[Pkg-anonymity-tools] [onionshare] 109/140: warns about sending large files in GUI (#123)
Ulrike Uhlig
u-guest at moszumanska.debian.org
Mon Sep 29 20:33:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch master
in repository onionshare.
commit 4f6cff65034afd32aa03a7b6323c8a251fd129c2
Author: Micah Lee <micah at micahflee.com>
Date: Thu Sep 18 01:35:30 2014 +0000
warns about sending large files in GUI (#123)
---
onionshare/onionshare.py | 4 ++--
onionshare/strings.json | 2 +-
onionshare_gui/downloads.py | 1 -
onionshare_gui/onionshare_gui.py | 16 ++++++++++++++++
onionshare_gui/options.py | 1 -
onionshare_gui/server_status.py | 1 -
6 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py
index be08910..5c0acde 100644
--- a/onionshare/onionshare.py
+++ b/onionshare/onionshare.py
@@ -239,9 +239,9 @@ def main():
app.cleanup_filenames.append(web.zip_filename)
# warn about sending large files over Tor
- if web.zip_filesize >= 209715200: # 200mb
+ if web.zip_filesize >= 157286400: # 150mb
print ''
- print strings._("large_filesize").format(helpers.human_readable_filesize(web.zip_filesize))
+ print strings._("large_filesize")
print ''
# start onionshare service in new thread
diff --git a/onionshare/strings.json b/onionshare/strings.json
index b21adb5..6523639 100644
--- a/onionshare/strings.json
+++ b/onionshare/strings.json
@@ -18,7 +18,7 @@
"close_on_finish": "Stop server automatically",
"choose_file": "Choose a file to share",
"closing_automatically": "Closing automatically because download finished",
- "large_filesize": "You are sending a total of {0}. Transferring large files using OnionShare might take hours.",
+ "large_filesize": "Warning: Sending large files could take hours",
"error_tails_invalid_port": "Invalid value, port must be an integer",
"error_tails_unknown_root": "Unknown error with Tails root process",
"help_tails_port": "Tails only: port for opening firewall, starting hidden service",
diff --git a/onionshare_gui/downloads.py b/onionshare_gui/downloads.py
index 18b9415..7f8b7c1 100644
--- a/onionshare_gui/downloads.py
+++ b/onionshare_gui/downloads.py
@@ -25,7 +25,6 @@ from onionshare import strings, helpers
class Downloads(QtGui.QVBoxLayout):
def __init__(self):
super(Downloads, self).__init__()
- self.addSpacing(10)
self.progress_bars = {}
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 33a40b3..17c4daa 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -45,6 +45,7 @@ class Application(QtGui.QApplication):
class OnionShareGui(QtGui.QWidget):
start_server_finished = QtCore.pyqtSignal()
stop_server_finished = QtCore.pyqtSignal()
+ server_starting = QtCore.pyqtSignal()
def __init__(self, qtapp, app):
super(OnionShareGui, self).__init__()
@@ -73,6 +74,12 @@ class OnionShareGui(QtGui.QWidget):
self.file_selection.file_list.files_updated.connect(self.server_status.update)
self.server_status.url_copied.connect(self.copy_url)
+ # filesize warning
+ self.filesize_warning = QtGui.QLabel()
+ self.filesize_warning.setStyleSheet('padding: 10px 0; font-weight: bold; color: #333333;')
+ self.filesize_warning.hide()
+ self.server_starting.connect(self.server_start_update)
+
# downloads
self.downloads = Downloads()
@@ -87,6 +94,7 @@ class OnionShareGui(QtGui.QWidget):
self.layout = QtGui.QVBoxLayout()
self.layout.addLayout(self.file_selection)
self.layout.addLayout(self.server_status)
+ self.layout.addWidget(self.filesize_warning)
self.layout.addLayout(self.downloads)
self.layout.addLayout(self.options)
self.layout.addWidget(self.status_bar)
@@ -98,6 +106,12 @@ class OnionShareGui(QtGui.QWidget):
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.check_for_requests)
self.timer.start(500)
+ def server_start_update(self):
+ # warn about sending large files over Tor
+ if web.zip_filesize >= 157286400: # 150mb
+ self.filesize_warning.setText(strings._("large_filesize", True))
+ self.filesize_warning.show()
+
def start_server(self):
# start the hidden service
self.status_bar.showMessage(strings._('gui_starting_server', True).format(self.app.port))
@@ -126,6 +140,7 @@ class OnionShareGui(QtGui.QWidget):
# prepare files to share
web.set_file_info(self.file_selection.file_list.filenames)
self.app.cleanup_filenames.append(web.zip_filename)
+ self.server_starting.emit()
# wait for hs
self.app.wait_for_hs()
@@ -141,6 +156,7 @@ class OnionShareGui(QtGui.QWidget):
if self.server_status.status == self.server_status.STATUS_STARTED:
web.stop(self.app.port)
self.app.cleanup()
+ self.filesize_warning.hide()
self.stop_server_finished.emit()
def check_for_requests(self):
diff --git a/onionshare_gui/options.py b/onionshare_gui/options.py
index 7aefca4..24d5992 100644
--- a/onionshare_gui/options.py
+++ b/onionshare_gui/options.py
@@ -25,7 +25,6 @@ from onionshare import strings, helpers
class Options(QtGui.QHBoxLayout):
def __init__(self, web):
super(Options, self).__init__()
- self.addSpacing(10)
self.web = web
diff --git a/onionshare_gui/server_status.py b/onionshare_gui/server_status.py
index 6cd386f..2909c31 100644
--- a/onionshare_gui/server_status.py
+++ b/onionshare_gui/server_status.py
@@ -35,7 +35,6 @@ class ServerStatus(QtGui.QVBoxLayout):
def __init__(self, qtapp, app, web, file_selection):
super(ServerStatus, self).__init__()
self.status = self.STATUS_STOPPED
- self.addSpacing(10)
self.qtapp = qtapp
self.app = app
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/onionshare.git
More information about the Pkg-anonymity-tools
mailing list