mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-27 16:29:41 -05:00
combined Start Server and Stop Server buttons into a single button
This commit is contained in:
parent
c159ef671d
commit
5b9176c9d4
@ -37,7 +37,8 @@
|
||||
"gui_copy_url": "Copy URL",
|
||||
"gui_downloads": "Downloads:",
|
||||
"gui_copied_url": "Copied URL to clipboard",
|
||||
"gui_starting_server": "Please wait, starting server..."
|
||||
"gui_starting_server": "Please wait, starting server...",
|
||||
"gui_please_wait": "Please wait..."
|
||||
}, "no": {
|
||||
"connecting_ctrlport": "Kobler til Tors kontroll-port for å sette opp en gjemt tjeneste på port {0}.",
|
||||
"cant_connect_ctrlport": "Klarte ikke å koble til Tors kontroll-porter {0}. Sjekk at Tor kjører.",
|
||||
|
@ -162,7 +162,6 @@ class FileSelection(QtGui.QVBoxLayout):
|
||||
# add the widgets
|
||||
self.addWidget(self.file_list)
|
||||
self.addLayout(button_layout)
|
||||
self.addWidget(self.filesize_warning)
|
||||
|
||||
self.update()
|
||||
|
||||
|
@ -48,14 +48,11 @@ class ServerStatus(QtGui.QVBoxLayout):
|
||||
self.status_image_started = QtGui.QImage(common.get_image_path('server_started.png'))
|
||||
self.status_image_label = QtGui.QLabel()
|
||||
self.status_image_label.setFixedWidth(30)
|
||||
self.start_server_button = QtGui.QPushButton(strings._('gui_start_server', True))
|
||||
self.start_server_button.clicked.connect(self.start_server)
|
||||
self.stop_server_button = QtGui.QPushButton(strings._('gui_stop_server', True))
|
||||
self.stop_server_button.clicked.connect(self.stop_server)
|
||||
self.server_button = QtGui.QPushButton()
|
||||
self.server_button.clicked.connect(self.server_button_clicked)
|
||||
server_layout = QtGui.QHBoxLayout()
|
||||
server_layout.addWidget(self.status_image_label)
|
||||
server_layout.addWidget(self.start_server_button)
|
||||
server_layout.addWidget(self.stop_server_button)
|
||||
server_layout.addWidget(self.server_button)
|
||||
|
||||
# url layout
|
||||
url_font = QtGui.QFont()
|
||||
@ -94,20 +91,26 @@ class ServerStatus(QtGui.QVBoxLayout):
|
||||
self.url_label.hide()
|
||||
self.copy_url_button.hide()
|
||||
|
||||
# buttons enabled
|
||||
# button
|
||||
if self.file_selection.get_num_files() == 0:
|
||||
self.start_server_button.setEnabled(False)
|
||||
self.stop_server_button.setEnabled(False)
|
||||
self.server_button.setEnabled(False)
|
||||
self.server_button.setText(strings._('gui_start_server', True))
|
||||
else:
|
||||
if self.status == self.STATUS_STOPPED:
|
||||
self.start_server_button.setEnabled(True)
|
||||
self.stop_server_button.setEnabled(False)
|
||||
self.server_button.setEnabled(True)
|
||||
self.server_button.setText(strings._('gui_start_server', True))
|
||||
elif self.status == self.STATUS_STARTED:
|
||||
self.start_server_button.setEnabled(False)
|
||||
self.stop_server_button.setEnabled(True)
|
||||
self.server_button.setEnabled(True)
|
||||
self.server_button.setText(strings._('gui_stop_server', True))
|
||||
else:
|
||||
self.start_server_button.setEnabled(False)
|
||||
self.stop_server_button.setEnabled(False)
|
||||
self.server_button.setEnabled(False)
|
||||
self.server_button.setText(strings._('gui_please_wait'))
|
||||
|
||||
def server_button_clicked(self):
|
||||
if self.status == self.STATUS_STOPPED:
|
||||
self.start_server()
|
||||
elif self.status == self.STATUS_STARTED:
|
||||
self.stop_server()
|
||||
|
||||
def start_server(self):
|
||||
self.status = self.STATUS_WORKING
|
||||
|
Loading…
Reference in New Issue
Block a user