mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
added status bar to GUI, populated it with useful status messages
This commit is contained in:
parent
6688ced698
commit
d1cd3c83ab
@ -107,6 +107,7 @@ class OnionShare(object):
|
||||
s.setproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9150)
|
||||
s.connect((self.onion_host, 80))
|
||||
ready = True
|
||||
|
||||
sys.stdout.write('{0}\n'.format(strings._('wait_for_hs_yup')))
|
||||
except TypeError as e:
|
||||
sys.stdout.write('{0}\n'.format(strings._('wait_for_hs_nope')))
|
||||
@ -184,6 +185,7 @@ def main():
|
||||
sys.exit(e.args[0])
|
||||
|
||||
# prepare files to share
|
||||
print strings._("preparing_files")
|
||||
web.set_file_info(filenames)
|
||||
app.cleanup_filenames.append(web.zip_filename)
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
"calculating_sha1": "Calculating SHA1 checksum.",
|
||||
"connecting_ctrlport": "Connecting to Tor control port to set up hidden service on port {0}.",
|
||||
"cant_connect_ctrlport": "Cannot connect to Tor control port on port {0}. Is Tor running?",
|
||||
"wait_for_hs": "Waiting for hidden service to be ready:",
|
||||
"preparing_files": "Preparing files to share.",
|
||||
"wait_for_hs": "Waiting for HS to be ready:",
|
||||
"wait_for_hs_trying": "Trying...",
|
||||
"wait_for_hs_nope": "Not ready yet.",
|
||||
"wait_for_hs_yup": "Ready!",
|
||||
@ -14,8 +15,6 @@
|
||||
"size": "Size",
|
||||
"sha1_checksum": "SHA1 checksum",
|
||||
"download_page_loaded": "Download page loaded",
|
||||
"download_started": "Download started",
|
||||
"download_finished": "Download finished",
|
||||
"other_page_loaded": "Other page has been loaded",
|
||||
"tails_requires_root": "You must run OnionShare as root in Tails",
|
||||
"close_on_finish": "Stop server automatically",
|
||||
@ -38,7 +37,8 @@
|
||||
"gui_stop_server": "Stop Server",
|
||||
"gui_copy_url": "Copy URL",
|
||||
"gui_downloads": "Downloads:",
|
||||
"gui_copied_url": "Copied URL to clipboard"
|
||||
"gui_copied_url": "Copied URL to clipboard",
|
||||
"gui_starting_server": "Please wait, starting server..."
|
||||
}, "no": {
|
||||
"calculating_sha1": "Kalkulerer SHA1 sjekksum.",
|
||||
"connecting_ctrlport": "Kobler til Tors kontroll-port for å sette opp en gjemt tjeneste på port {0}.",
|
||||
@ -50,8 +50,6 @@
|
||||
"sha1_checksum": "SHA1 sjekksum",
|
||||
"gui_copied_url": "Kopierte URL-en til utklippstavlen",
|
||||
"download_page_loaded": "Nedlastingsside lastet",
|
||||
"download_started": "Nedlasting startet",
|
||||
"download_finished": "Nedlasting fullført",
|
||||
"other_page_loaded": "En annen side har blitt lastet",
|
||||
"tails_requires_root": "OnionShare kan må kjøres som administrator i Tails",
|
||||
"close_on_finish": "Lukk automatisk",
|
||||
@ -67,8 +65,6 @@
|
||||
"sha1_checksum": "Suma de verificación SHA1",
|
||||
"gui_copied_url": "Copiar URL en el portapapeles",
|
||||
"download_page_loaded": "Descargar página cargada.",
|
||||
"download_started": "Descarga comenzó",
|
||||
"download_finished": "Descarga terminado",
|
||||
"other_page_loaded": "Otra página se ha cargado",
|
||||
"tails_requires_root": "Debe ejecutar OnionShare como root en Tails",
|
||||
"close_on_finish": "Cerrar automáticamente.",
|
||||
@ -93,8 +89,6 @@
|
||||
"sha1_checksum": "Firma SHA1",
|
||||
"gui_copied_url": "URL copiato negli appunti",
|
||||
"download_page_loaded": "Pagina di download caricata",
|
||||
"download_started": "Download iniziato",
|
||||
"download_finished": "Download finito",
|
||||
"other_page_loaded": "Un altra pagina é stata caricata",
|
||||
"tails_requires_root": "Con Tails devi avviare OnionShare come utente root",
|
||||
"close_on_finish": "Chiudi automaticamente",
|
||||
@ -110,8 +104,6 @@
|
||||
"sha1_checksum": "SHA1 controlecijfer",
|
||||
"gui_copied_url": "URL gekopieerd naar klembord",
|
||||
"download_page_loaded": "Download pagina geladen",
|
||||
"download_started": "Download gestart",
|
||||
"download_finished": "Download voltooid",
|
||||
"other_page_loaded": "Andere pagina is geladen",
|
||||
"tails_requires_root": "Je moet OnionShare als root draaien in Tails",
|
||||
"close_on_finish": "Sluit automatisch",
|
||||
@ -136,8 +128,6 @@
|
||||
"sha1_checksum": "Checksum SHA1",
|
||||
"gui_copied_url": "URL foi copiado para área de transferência",
|
||||
"download_page_loaded": "Página de download carregada",
|
||||
"download_started": "Começou o download",
|
||||
"download_finished": "Terminou o download",
|
||||
"other_page_loaded": "Outra página tem sido carregada",
|
||||
"tails_requires_root": "Tem que rodar o OnionShare como root no Tails",
|
||||
"close_on_finish": "Fechar automaticamente",
|
||||
@ -153,8 +143,6 @@
|
||||
"sha1_checksum": "SHA1 хешсумма",
|
||||
"gui_copied_url": "Ссылка скопирована в буфер обмена",
|
||||
"download_page_loaded": "Страница закачки загружена",
|
||||
"download_started": "Загрузка начата",
|
||||
"download_finished": "Загрузка закончена",
|
||||
"other_page_loaded": "Другая страница была загружена",
|
||||
"tails_requires_root": "Вы должны запустить OnionShare с правами root в Tails",
|
||||
"close_on_finish": "Закрыть автоматически",
|
||||
@ -171,8 +159,6 @@
|
||||
"sha1_checksum": "SHA1 Checksumme",
|
||||
"gui_copied_url": "URL in die Zwischenablage kopiert",
|
||||
"download_page_loaded": "Download-Seite geladen",
|
||||
"download_started": "Download gestartet",
|
||||
"download_finished": "Download abgeschlossen",
|
||||
"other_page_loaded": "Andere Seite wurde geladen",
|
||||
"tails_requires_root": "Du musst Onionshare in Tails als root ausführen",
|
||||
"close_on_finish": "Beende automatisch",
|
||||
@ -190,8 +176,6 @@
|
||||
"sha1_checksum": "SHA1 özeti",
|
||||
"gui_copied_url": "Panoya kopyalanan URL",
|
||||
"download_page_loaded": "İndirme sayfası yüklendi",
|
||||
"download_started": "İndirme başladı",
|
||||
"download_finished": "İndirme bitti",
|
||||
"other_page_loaded": "Diğer sayfa yüklendi",
|
||||
"tails_requires_root": "Tails'da OnionShare root olarak çalışır",
|
||||
"close_on_finish": "Kendiliğinden kapan",
|
||||
|
@ -48,9 +48,11 @@ class OnionShareGui(QtGui.QWidget):
|
||||
self.server_status.server_started.connect(self.start_server)
|
||||
self.server_status.server_stopped.connect(self.file_selection.server_stopped)
|
||||
self.server_status.server_stopped.connect(self.stop_server)
|
||||
self.start_server_finished.connect(self.clear_message)
|
||||
self.start_server_finished.connect(self.server_status.start_server_finished)
|
||||
self.stop_server_finished.connect(self.server_status.stop_server_finished)
|
||||
self.file_selection.file_list.files_updated.connect(self.server_status.update)
|
||||
self.server_status.url_copied.connect(self.copy_url)
|
||||
|
||||
# downloads
|
||||
self.downloads = Downloads()
|
||||
@ -58,12 +60,17 @@ class OnionShareGui(QtGui.QWidget):
|
||||
# options
|
||||
self.options = Options(web)
|
||||
|
||||
# status bar
|
||||
self.status_bar = QtGui.QStatusBar()
|
||||
self.status_bar.setSizeGripEnabled(False)
|
||||
|
||||
# main layout
|
||||
self.layout = QtGui.QVBoxLayout()
|
||||
self.layout.addLayout(self.file_selection)
|
||||
self.layout.addLayout(self.server_status)
|
||||
self.layout.addLayout(self.downloads)
|
||||
self.layout.addLayout(self.options)
|
||||
self.layout.addWidget(self.status_bar)
|
||||
self.setLayout(self.layout)
|
||||
self.show()
|
||||
|
||||
@ -74,15 +81,18 @@ class OnionShareGui(QtGui.QWidget):
|
||||
|
||||
def start_server(self):
|
||||
# start the hidden service
|
||||
self.status_bar.showMessage(strings._('gui_starting_server').format(self.app.port))
|
||||
try:
|
||||
self.app.start_hidden_service(gui=True)
|
||||
except onionshare.NoTor as e:
|
||||
alert(e.args[0], QtGui.QMessageBox.Warning)
|
||||
self.server_status.stop_server()
|
||||
self.status_bar.clearMessage()
|
||||
return
|
||||
except onionshare.TailsError as e:
|
||||
alert(e.args[0], QtGui.QMessageBox.Warning)
|
||||
self.server_status.stop_server()
|
||||
self.status_bar.clearMessage()
|
||||
return
|
||||
|
||||
# start onionshare service in new thread
|
||||
@ -128,12 +138,10 @@ class OnionShareGui(QtGui.QWidget):
|
||||
done = True
|
||||
|
||||
for event in events:
|
||||
#if event["path"] != '/favicon.ico':
|
||||
# pass
|
||||
#if event["type"] == web.REQUEST_LOAD:
|
||||
# pass
|
||||
if event["type"] == web.REQUEST_LOAD:
|
||||
self.status_bar.showMessage(strings._('download_page_loaded'), 2000)
|
||||
|
||||
if event["type"] == web.REQUEST_DOWNLOAD:
|
||||
elif event["type"] == web.REQUEST_DOWNLOAD:
|
||||
self.downloads.add_download(event["data"]["id"], web.zip_filesize)
|
||||
|
||||
elif event["type"] == web.REQUEST_PROGRESS:
|
||||
@ -144,6 +152,15 @@ class OnionShareGui(QtGui.QWidget):
|
||||
# close on finish?
|
||||
if not web.get_stay_open():
|
||||
self.server_status.stop_server()
|
||||
|
||||
elif event["path"] != '/favicon.ico':
|
||||
self.status_bar.showMessage('{0}: {1}'.format(strings._('other_page_loaded'), event["path"]), 2000)
|
||||
|
||||
def copy_url(self):
|
||||
self.status_bar.showMessage(strings._('gui_copied_url'), 2000)
|
||||
|
||||
def clear_message(self):
|
||||
self.status_bar.clearMessage()
|
||||
|
||||
def alert(msg, icon=QtGui.QMessageBox.NoIcon):
|
||||
dialog = QtGui.QMessageBox()
|
||||
|
@ -7,6 +7,7 @@ from onionshare import strings, helpers
|
||||
class ServerStatus(QtGui.QVBoxLayout):
|
||||
server_started = QtCore.pyqtSignal()
|
||||
server_stopped = QtCore.pyqtSignal()
|
||||
url_copied = QtCore.pyqtSignal()
|
||||
|
||||
STATUS_STOPPED = 0
|
||||
STATUS_WORKING = 1
|
||||
@ -22,9 +23,6 @@ class ServerStatus(QtGui.QVBoxLayout):
|
||||
self.web = web
|
||||
self.file_selection = file_selection
|
||||
|
||||
# system tray icon (for notifications)
|
||||
self.systray = QtGui.QSystemTrayIcon()
|
||||
|
||||
# server layout
|
||||
self.status_image_stopped = QtGui.QImage('{0}/server_stopped.png'.format(common.onionshare_gui_dir))
|
||||
self.status_image_working = QtGui.QImage('{0}/server_working.png'.format(common.onionshare_gui_dir))
|
||||
@ -128,6 +126,5 @@ class ServerStatus(QtGui.QVBoxLayout):
|
||||
clipboard = self.qtapp.clipboard()
|
||||
clipboard.setText(url)
|
||||
|
||||
# todo: make this systray popup work
|
||||
self.systray.showMessage(QtCore.QString("OnionShare"), QtCore.QString(strings._('gui_copied_url')))
|
||||
self.url_copied.emit()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user