mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Create a "primary action" layout, and only show it when there are files in the file list
This commit is contained in:
parent
8dd9b045cc
commit
cf1ff97ce9
@ -78,6 +78,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
self.start_server_finished.connect(self.server_status.start_server_finished)
|
self.start_server_finished.connect(self.server_status.start_server_finished)
|
||||||
self.stop_server_finished.connect(self.server_status.stop_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.file_selection.file_list.files_updated.connect(self.server_status.update)
|
||||||
|
self.file_selection.file_list.files_updated.connect(self.update_primary_action)
|
||||||
self.server_status.url_copied.connect(self.copy_url)
|
self.server_status.url_copied.connect(self.copy_url)
|
||||||
self.server_status.hidservauth_copied.connect(self.copy_hidservauth)
|
self.server_status.hidservauth_copied.connect(self.copy_hidservauth)
|
||||||
self.starting_server_step2.connect(self.start_server_step2)
|
self.starting_server_step2.connect(self.start_server_step2)
|
||||||
@ -124,13 +125,20 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
self.persistent_url_label.setStyleSheet('padding: 10px 0; font-weight: bold; color: #333333;')
|
self.persistent_url_label.setStyleSheet('padding: 10px 0; font-weight: bold; color: #333333;')
|
||||||
self.persistent_url_label.hide()
|
self.persistent_url_label.hide()
|
||||||
|
|
||||||
|
# Primary action layout
|
||||||
|
primary_action_layout = QtWidgets.QVBoxLayout()
|
||||||
|
primary_action_layout.addLayout(self.server_status)
|
||||||
|
primary_action_layout.addWidget(self.filesize_warning)
|
||||||
|
primary_action_layout.addWidget(self.persistent_url_label)
|
||||||
|
primary_action_layout.addWidget(self.downloads_container)
|
||||||
|
self.primary_action = QtWidgets.QWidget()
|
||||||
|
self.primary_action.setLayout(primary_action_layout)
|
||||||
|
self.primary_action.hide()
|
||||||
|
|
||||||
# Main layout
|
# Main layout
|
||||||
self.layout = QtWidgets.QVBoxLayout()
|
self.layout = QtWidgets.QVBoxLayout()
|
||||||
self.layout.addLayout(self.file_selection)
|
self.layout.addLayout(self.file_selection)
|
||||||
self.layout.addLayout(self.server_status)
|
self.layout.addWidget(self.primary_action)
|
||||||
self.layout.addWidget(self.filesize_warning)
|
|
||||||
self.layout.addWidget(self.persistent_url_label)
|
|
||||||
self.layout.addWidget(self.downloads_container)
|
|
||||||
central_widget = QtWidgets.QWidget()
|
central_widget = QtWidgets.QWidget()
|
||||||
central_widget.setLayout(self.layout)
|
central_widget.setLayout(self.layout)
|
||||||
self.setCentralWidget(central_widget)
|
self.setCentralWidget(central_widget)
|
||||||
@ -158,6 +166,12 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||||||
# After connecting to Tor, check for updates
|
# After connecting to Tor, check for updates
|
||||||
self.check_for_updates()
|
self.check_for_updates()
|
||||||
|
|
||||||
|
def update_primary_action(self):
|
||||||
|
if self.file_selection.file_list.count() > 0:
|
||||||
|
self.primary_action.show()
|
||||||
|
else:
|
||||||
|
self.primary_action.hide()
|
||||||
|
|
||||||
def _initSystemTray(self):
|
def _initSystemTray(self):
|
||||||
system = common.get_platform()
|
system = common.get_platform()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user