mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-16 09:47:27 -05:00
Merge branch 'fixzipthreadproblem' of https://github.com/b3sigma/onionshare into b3sigma-fixzipthreadproblem
This commit is contained in:
commit
b03e888304
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
from __future__ import division
|
from __future__ import division
|
||||||
import os, sys, subprocess, inspect, platform, argparse, threading, time, math, inspect, platform
|
import os, sys, subprocess, inspect, platform, argparse, threading, time, math, inspect, platform
|
||||||
from PyQt5 import QtCore, QtWidgets, QtGui
|
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||||
|
from PyQt5.QtCore import pyqtSlot
|
||||||
|
|
||||||
import onionshare
|
import onionshare
|
||||||
from onionshare import strings, helpers, web
|
from onionshare import strings, helpers, web
|
||||||
@ -199,7 +200,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
def finish_starting_server(self):
|
def finish_starting_server(self):
|
||||||
# prepare files to share
|
# prepare files to share
|
||||||
def _set_processed_size(x):
|
def _set_processed_size(x):
|
||||||
self._zip_progress_bar.processed_size = x
|
if self._zip_progress_bar != None:
|
||||||
|
self._zip_progress_bar.update_processed_size_signal.emit(x)
|
||||||
web.set_file_info(self.file_selection.file_list.filenames, processed_size_callback=_set_processed_size)
|
web.set_file_info(self.file_selection.file_list.filenames, processed_size_callback=_set_processed_size)
|
||||||
self.app.cleanup_filenames.append(web.zip_filename)
|
self.app.cleanup_filenames.append(web.zip_filename)
|
||||||
self.starting_server_step3.emit()
|
self.starting_server_step3.emit()
|
||||||
@ -351,6 +353,8 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
|
|
||||||
class ZipProgressBar(QtWidgets.QProgressBar):
|
class ZipProgressBar(QtWidgets.QProgressBar):
|
||||||
|
update_processed_size_signal = QtCore.pyqtSignal(int)
|
||||||
|
|
||||||
def __init__(self, total_files_size):
|
def __init__(self, total_files_size):
|
||||||
super(ZipProgressBar, self).__init__()
|
super(ZipProgressBar, self).__init__()
|
||||||
self.setMaximumHeight(15)
|
self.setMaximumHeight(15)
|
||||||
@ -364,6 +368,8 @@ class ZipProgressBar(QtWidgets.QProgressBar):
|
|||||||
self._total_files_size = total_files_size
|
self._total_files_size = total_files_size
|
||||||
self._processed_size = 0
|
self._processed_size = 0
|
||||||
|
|
||||||
|
self.update_processed_size_signal.connect(self.update_processed_size)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def total_files_size(self):
|
def total_files_size(self):
|
||||||
return self._total_files_size
|
return self._total_files_size
|
||||||
@ -378,6 +384,9 @@ class ZipProgressBar(QtWidgets.QProgressBar):
|
|||||||
|
|
||||||
@processed_size.setter
|
@processed_size.setter
|
||||||
def processed_size(self, val):
|
def processed_size(self, val):
|
||||||
|
self.update_processed_size(val)
|
||||||
|
|
||||||
|
def update_processed_size(self, val):
|
||||||
self._processed_size = val
|
self._processed_size = val
|
||||||
if self.processed_size < self.total_files_size:
|
if self.processed_size < self.total_files_size:
|
||||||
self.setValue(int((self.processed_size * 100) / self.total_files_size))
|
self.setValue(int((self.processed_size * 100) / self.total_files_size))
|
||||||
|
Loading…
Reference in New Issue
Block a user