mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-15 01:07:21 -05:00
Make different strings for start server button for different modes
This commit is contained in:
parent
2fc4330ee4
commit
996f1d3a81
@ -39,7 +39,7 @@ class ServerStatus(QtWidgets.QWidget):
|
|||||||
STATUS_WORKING = 1
|
STATUS_WORKING = 1
|
||||||
STATUS_STARTED = 2
|
STATUS_STARTED = 2
|
||||||
|
|
||||||
def __init__(self, common, qtapp, app, web, file_selection=None):
|
def __init__(self, common, qtapp, app, web, share_mode, file_selection=None):
|
||||||
super(ServerStatus, self).__init__()
|
super(ServerStatus, self).__init__()
|
||||||
|
|
||||||
self.common = common
|
self.common = common
|
||||||
@ -51,6 +51,8 @@ class ServerStatus(QtWidgets.QWidget):
|
|||||||
self.web = web
|
self.web = web
|
||||||
|
|
||||||
# Only used in share mode
|
# Only used in share mode
|
||||||
|
self.share_mode = share_mode
|
||||||
|
if self.share_mode:
|
||||||
self.file_selection = file_selection
|
self.file_selection = file_selection
|
||||||
|
|
||||||
# Shutdown timeout layout
|
# Shutdown timeout layout
|
||||||
@ -73,7 +75,6 @@ class ServerStatus(QtWidgets.QWidget):
|
|||||||
self.shutdown_timeout_container.setLayout(shutdown_timeout_container_layout)
|
self.shutdown_timeout_container.setLayout(shutdown_timeout_container_layout)
|
||||||
self.shutdown_timeout_container.hide()
|
self.shutdown_timeout_container.hide()
|
||||||
|
|
||||||
|
|
||||||
# Server layout
|
# Server layout
|
||||||
self.server_button = QtWidgets.QPushButton()
|
self.server_button = QtWidgets.QPushButton()
|
||||||
self.server_button.clicked.connect(self.server_button_clicked)
|
self.server_button.clicked.connect(self.server_button_clicked)
|
||||||
@ -175,7 +176,7 @@ class ServerStatus(QtWidgets.QWidget):
|
|||||||
button_working_style = 'QPushButton { background-color: #4c8211; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; font-style: italic; }'
|
button_working_style = 'QPushButton { background-color: #4c8211; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; font-style: italic; }'
|
||||||
button_started_style = 'QPushButton { background-color: #d0011b; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; }'
|
button_started_style = 'QPushButton { background-color: #d0011b; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; }'
|
||||||
|
|
||||||
if self.file_selection and self.file_selection.get_num_files() == 0:
|
if self.share_mode and self.file_selection.get_num_files() == 0:
|
||||||
self.server_button.hide()
|
self.server_button.hide()
|
||||||
else:
|
else:
|
||||||
self.server_button.show()
|
self.server_button.show()
|
||||||
@ -183,17 +184,27 @@ class ServerStatus(QtWidgets.QWidget):
|
|||||||
if self.status == self.STATUS_STOPPED:
|
if self.status == self.STATUS_STOPPED:
|
||||||
self.server_button.setStyleSheet(button_stopped_style)
|
self.server_button.setStyleSheet(button_stopped_style)
|
||||||
self.server_button.setEnabled(True)
|
self.server_button.setEnabled(True)
|
||||||
self.server_button.setText(strings._('gui_start_server', True))
|
if self.share_mode:
|
||||||
|
self.server_button.setText(strings._('gui_share_start_server', True))
|
||||||
|
else:
|
||||||
|
self.server_button.setText(strings._('gui_receive_start_server', True))
|
||||||
self.server_button.setToolTip('')
|
self.server_button.setToolTip('')
|
||||||
if self.common.settings.get('shutdown_timeout'):
|
if self.common.settings.get('shutdown_timeout'):
|
||||||
self.shutdown_timeout_container.show()
|
self.shutdown_timeout_container.show()
|
||||||
elif self.status == self.STATUS_STARTED:
|
elif self.status == self.STATUS_STARTED:
|
||||||
self.server_button.setStyleSheet(button_started_style)
|
self.server_button.setStyleSheet(button_started_style)
|
||||||
self.server_button.setEnabled(True)
|
self.server_button.setEnabled(True)
|
||||||
self.server_button.setText(strings._('gui_stop_server', True))
|
if self.share_mode:
|
||||||
|
self.server_button.setText(strings._('gui_share_stop_server', True))
|
||||||
|
else:
|
||||||
|
self.server_button.setText(strings._('gui_share_stop_server', True))
|
||||||
if self.common.settings.get('shutdown_timeout'):
|
if self.common.settings.get('shutdown_timeout'):
|
||||||
self.shutdown_timeout_container.hide()
|
self.shutdown_timeout_container.hide()
|
||||||
self.server_button.setToolTip(strings._('gui_stop_server_shutdown_timeout_tooltip', True).format(self.timeout))
|
if self.share_mode:
|
||||||
|
self.server_button.setToolTip(strings._('gui_share_stop_server_shutdown_timeout_tooltip', True).format(self.timeout))
|
||||||
|
else:
|
||||||
|
self.server_button.setToolTip(strings._('gui_receive_stop_server_shutdown_timeout_tooltip', True).format(self.timeout))
|
||||||
|
|
||||||
elif self.status == self.STATUS_WORKING:
|
elif self.status == self.STATUS_WORKING:
|
||||||
self.server_button.setStyleSheet(button_working_style)
|
self.server_button.setStyleSheet(button_working_style)
|
||||||
self.server_button.setEnabled(True)
|
self.server_button.setEnabled(True)
|
||||||
|
@ -158,7 +158,7 @@ class ShareMode(QtWidgets.QWidget):
|
|||||||
if self.timeout > 0:
|
if self.timeout > 0:
|
||||||
now = QtCore.QDateTime.currentDateTime()
|
now = QtCore.QDateTime.currentDateTime()
|
||||||
seconds_remaining = now.secsTo(self.server_status.timeout)
|
seconds_remaining = now.secsTo(self.server_status.timeout)
|
||||||
self.server_status.server_button.setText(strings._('gui_stop_server_shutdown_timeout', True).format(seconds_remaining))
|
self.server_status.server_button.setText(strings._('gui_share_stop_server_shutdown_timeout', True).format(seconds_remaining))
|
||||||
if not self.app.shutdown_timer.is_alive():
|
if not self.app.shutdown_timer.is_alive():
|
||||||
# If there were no attempts to download the share, or all downloads are done, we can stop
|
# If there were no attempts to download the share, or all downloads are done, we can stop
|
||||||
if self.web.download_count == 0 or self.web.done:
|
if self.web.download_count == 0 or self.web.done:
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
"gui_add": "Přidat",
|
"gui_add": "Přidat",
|
||||||
"gui_delete": "Smazat",
|
"gui_delete": "Smazat",
|
||||||
"gui_choose_items": "Vybrat",
|
"gui_choose_items": "Vybrat",
|
||||||
"gui_start_server": "Spustit sdílení",
|
"gui_share_start_server": "Spustit sdílení",
|
||||||
"gui_stop_server": "Zastavit sdílení",
|
"gui_share_stop_server": "Zastavit sdílení",
|
||||||
"gui_copy_url": "Kopírovat URL",
|
"gui_copy_url": "Kopírovat URL",
|
||||||
"gui_copy_hidservauth": "Kopírovat HidServAuth",
|
"gui_copy_hidservauth": "Kopírovat HidServAuth",
|
||||||
"gui_downloads": "Stahování:",
|
"gui_downloads": "Stahování:",
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
"gui_add": "Tilføj",
|
"gui_add": "Tilføj",
|
||||||
"gui_delete": "Slet",
|
"gui_delete": "Slet",
|
||||||
"gui_choose_items": "Vælg",
|
"gui_choose_items": "Vælg",
|
||||||
"gui_start_server": "Start deling",
|
"gui_share_start_server": "Start deling",
|
||||||
"gui_stop_server": "Stop deling",
|
"gui_share_stop_server": "Stop deling",
|
||||||
"gui_copy_url": "Kopiér URL",
|
"gui_copy_url": "Kopiér URL",
|
||||||
"gui_copy_hidservauth": "Kopiér HidServAuth",
|
"gui_copy_hidservauth": "Kopiér HidServAuth",
|
||||||
"gui_downloads": "Downloads:",
|
"gui_downloads": "Downloads:",
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
"gui_add": "Hinzufügen",
|
"gui_add": "Hinzufügen",
|
||||||
"gui_delete": "Löschen",
|
"gui_delete": "Löschen",
|
||||||
"gui_choose_items": "Auswählen",
|
"gui_choose_items": "Auswählen",
|
||||||
"gui_start_server": "Server starten",
|
"gui_share_start_server": "Server starten",
|
||||||
"gui_stop_server": "Server anhalten",
|
"gui_share_stop_server": "Server anhalten",
|
||||||
"gui_copy_url": "URL kopieren",
|
"gui_copy_url": "URL kopieren",
|
||||||
"gui_downloads": "Downloads:",
|
"gui_downloads": "Downloads:",
|
||||||
"gui_copied_url": "URL wurde in die Zwischenablage kopiert",
|
"gui_copied_url": "URL wurde in die Zwischenablage kopiert",
|
||||||
|
@ -41,10 +41,14 @@
|
|||||||
"gui_add": "Add",
|
"gui_add": "Add",
|
||||||
"gui_delete": "Delete",
|
"gui_delete": "Delete",
|
||||||
"gui_choose_items": "Choose",
|
"gui_choose_items": "Choose",
|
||||||
"gui_start_server": "Start Sharing",
|
"gui_share_start_server": "Start Sharing",
|
||||||
"gui_stop_server": "Stop Sharing",
|
"gui_share_stop_server": "Stop Sharing",
|
||||||
"gui_stop_server_shutdown_timeout": "Stop Sharing ({}s remaining)",
|
"gui_share_stop_server_shutdown_timeout": "Stop Sharing ({}s remaining)",
|
||||||
"gui_stop_server_shutdown_timeout_tooltip": "Share will expire automatically at {}",
|
"gui_share_stop_server_shutdown_timeout_tooltip": "Share will expire automatically at {}",
|
||||||
|
"gui_receive_start_server": "Start Receive Mode",
|
||||||
|
"gui_receive_stop_server": "Stop Receive Mode",
|
||||||
|
"gui_receive_stop_server_shutdown_timeout": "Stop Receive Mode ({}s remaining)",
|
||||||
|
"gui_receive_stop_server_shutdown_timeout_tooltip": "Receive mode will expire automatically at {}",
|
||||||
"gui_copy_url": "Copy Address",
|
"gui_copy_url": "Copy Address",
|
||||||
"gui_copy_hidservauth": "Copy HidServAuth",
|
"gui_copy_hidservauth": "Copy HidServAuth",
|
||||||
"gui_downloads": "Download History",
|
"gui_downloads": "Download History",
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
"gui_add": "Aldoni",
|
"gui_add": "Aldoni",
|
||||||
"gui_delete": "Forviŝi",
|
"gui_delete": "Forviŝi",
|
||||||
"gui_choose_items": "Elekti",
|
"gui_choose_items": "Elekti",
|
||||||
"gui_start_server": "Komenci kundividon",
|
"gui_share_start_server": "Komenci kundividon",
|
||||||
"gui_stop_server": "Ĉesigi kundividon",
|
"gui_share_stop_server": "Ĉesigi kundividon",
|
||||||
"gui_copy_url": "Kopii URL",
|
"gui_copy_url": "Kopii URL",
|
||||||
"gui_copy_hidservauth": "Kopii HidServAuth",
|
"gui_copy_hidservauth": "Kopii HidServAuth",
|
||||||
"gui_downloads": "Elŝutoj:",
|
"gui_downloads": "Elŝutoj:",
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
"gui_add": "Añadir",
|
"gui_add": "Añadir",
|
||||||
"gui_delete": "Eliminar",
|
"gui_delete": "Eliminar",
|
||||||
"gui_choose_items": "Elegir",
|
"gui_choose_items": "Elegir",
|
||||||
"gui_start_server": "Encender el Servidor",
|
"gui_share_start_server": "Encender el Servidor",
|
||||||
"gui_stop_server": "Detener el Servidor",
|
"gui_share_stop_server": "Detener el Servidor",
|
||||||
"gui_copy_url": "Copiar URL",
|
"gui_copy_url": "Copiar URL",
|
||||||
"gui_downloads": "Descargas:",
|
"gui_downloads": "Descargas:",
|
||||||
"gui_copied_url": "Se copió la URL en el portapapeles"
|
"gui_copied_url": "Se copió la URL en el portapapeles"
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
"gui_add": "Lisää",
|
"gui_add": "Lisää",
|
||||||
"gui_delete": "Poista",
|
"gui_delete": "Poista",
|
||||||
"gui_choose_items": "Valitse",
|
"gui_choose_items": "Valitse",
|
||||||
"gui_start_server": "Käynnistä palvelin",
|
"gui_share_start_server": "Käynnistä palvelin",
|
||||||
"gui_stop_server": "Pysäytä palvelin",
|
"gui_share_stop_server": "Pysäytä palvelin",
|
||||||
"gui_copy_url": "Kopioi URL-osoite",
|
"gui_copy_url": "Kopioi URL-osoite",
|
||||||
"gui_downloads": "Lataukset:",
|
"gui_downloads": "Lataukset:",
|
||||||
"gui_canceled": "Peruutettu",
|
"gui_canceled": "Peruutettu",
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
"gui_add": "Ajouter",
|
"gui_add": "Ajouter",
|
||||||
"gui_delete": "Supprimer",
|
"gui_delete": "Supprimer",
|
||||||
"gui_choose_items": "Sélectionnez",
|
"gui_choose_items": "Sélectionnez",
|
||||||
"gui_start_server": "Démarrer le serveur",
|
"gui_share_start_server": "Démarrer le serveur",
|
||||||
"gui_stop_server": "Arrêter le serveur",
|
"gui_share_stop_server": "Arrêter le serveur",
|
||||||
"gui_copy_url": "Copier URL",
|
"gui_copy_url": "Copier URL",
|
||||||
"gui_copy_hidservauth": "Copier HidServAuth",
|
"gui_copy_hidservauth": "Copier HidServAuth",
|
||||||
"gui_downloads": "Téléchargements :",
|
"gui_downloads": "Téléchargements :",
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
"gui_add": "Aggiungi",
|
"gui_add": "Aggiungi",
|
||||||
"gui_delete": "Cancella",
|
"gui_delete": "Cancella",
|
||||||
"gui_choose_items": "Scegli",
|
"gui_choose_items": "Scegli",
|
||||||
"gui_start_server": "Inizia la condivisione",
|
"gui_share_start_server": "Inizia la condivisione",
|
||||||
"gui_stop_server": "Ferma la condivisione",
|
"gui_share_stop_server": "Ferma la condivisione",
|
||||||
"gui_copy_url": "Copia lo URL",
|
"gui_copy_url": "Copia lo URL",
|
||||||
"gui_downloads": "Downloads:",
|
"gui_downloads": "Downloads:",
|
||||||
"gui_canceled": "Cancellati",
|
"gui_canceled": "Cancellati",
|
||||||
|
@ -38,8 +38,6 @@
|
|||||||
"gui_add": "Toevoegen",
|
"gui_add": "Toevoegen",
|
||||||
"gui_delete": "Verwijder",
|
"gui_delete": "Verwijder",
|
||||||
"gui_choose_items": "Kies",
|
"gui_choose_items": "Kies",
|
||||||
"gui_start_server": "Start server",
|
|
||||||
"gui_stop_server": "Stop server",
|
|
||||||
"gui_copy_url": "Kopieer URL",
|
"gui_copy_url": "Kopieer URL",
|
||||||
"gui_copy_hidservauth": "Kopieer HidServAuth",
|
"gui_copy_hidservauth": "Kopieer HidServAuth",
|
||||||
"gui_downloads": "Downloads:",
|
"gui_downloads": "Downloads:",
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
"gui_add": "Ekle",
|
"gui_add": "Ekle",
|
||||||
"gui_delete": "Sil",
|
"gui_delete": "Sil",
|
||||||
"gui_choose_items": "Seç",
|
"gui_choose_items": "Seç",
|
||||||
"gui_start_server": "Paylaşımı Başlat",
|
"gui_share_start_server": "Paylaşımı Başlat",
|
||||||
"gui_stop_server": "Paylaşımı Durdur",
|
"gui_share_stop_server": "Paylaşımı Durdur",
|
||||||
"gui_copy_url": "URL Kopyala",
|
"gui_copy_url": "URL Kopyala",
|
||||||
"gui_downloads": "İndirilenler:",
|
"gui_downloads": "İndirilenler:",
|
||||||
"gui_canceled": "İptal edilen",
|
"gui_canceled": "İptal edilen",
|
||||||
|
Loading…
Reference in New Issue
Block a user