mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Refactor how Mode layouts work, so the downstream Mode has more control over the UI
This commit is contained in:
parent
2ffcdbb108
commit
fc1902c1ee
@ -72,24 +72,17 @@ class Mode(QtWidgets.QWidget):
|
||||
self.starting_server_step3.connect(self.start_server_step3)
|
||||
self.starting_server_error.connect(self.start_server_error)
|
||||
|
||||
# Primary action layout
|
||||
# Primary action
|
||||
# Note: It's up to the downstream Mode to add this to its layout
|
||||
self.primary_action_layout = QtWidgets.QVBoxLayout()
|
||||
self.primary_action_layout.addWidget(self.server_status)
|
||||
self.primary_action = QtWidgets.QWidget()
|
||||
self.primary_action.setLayout(self.primary_action_layout)
|
||||
|
||||
# Layout
|
||||
self.layout = QtWidgets.QVBoxLayout()
|
||||
self.layout.addWidget(self.primary_action)
|
||||
# Hack to allow a minimum width on self.layout
|
||||
min_width_widget = QtWidgets.QWidget()
|
||||
min_width_widget.setMinimumWidth(450)
|
||||
self.layout.addWidget(min_width_widget)
|
||||
|
||||
self.horizontal_layout_wrapper = QtWidgets.QHBoxLayout()
|
||||
self.horizontal_layout_wrapper.addLayout(self.layout)
|
||||
|
||||
self.setLayout(self.horizontal_layout_wrapper)
|
||||
# Hack to allow a minimum width on the main layout
|
||||
# Note: It's up to the downstream Mode to add this to its layout
|
||||
self.min_width_widget = QtWidgets.QWidget()
|
||||
self.min_width_widget.setMinimumWidth(450)
|
||||
|
||||
def init(self):
|
||||
"""
|
||||
|
@ -76,11 +76,19 @@ class ReceiveMode(Mode):
|
||||
self.receive_info.setMinimumHeight(80)
|
||||
self.receive_info.setWordWrap(True)
|
||||
|
||||
# Main layout
|
||||
self.main_layout = QtWidgets.QVBoxLayout()
|
||||
self.main_layout.addWidget(self.info_widget)
|
||||
self.main_layout.addWidget(self.receive_info)
|
||||
self.main_layout.addWidget(self.primary_action)
|
||||
self.main_layout.addStretch()
|
||||
self.main_layout.addWidget(self.min_width_widget)
|
||||
|
||||
# Layout
|
||||
self.layout.insertWidget(0, self.receive_info)
|
||||
self.layout.insertWidget(0, self.info_widget)
|
||||
self.layout.addStretch()
|
||||
self.horizontal_layout_wrapper.addWidget(self.uploads)
|
||||
self.layout = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(self.main_layout)
|
||||
self.layout.addWidget(self.uploads)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
def get_stop_server_shutdown_timeout_text(self):
|
||||
"""
|
||||
|
@ -106,10 +106,18 @@ class ShareMode(Mode):
|
||||
# Status bar, zip progress bar
|
||||
self._zip_progress_bar = None
|
||||
|
||||
# Main layout
|
||||
self.main_layout = QtWidgets.QVBoxLayout()
|
||||
self.main_layout.addWidget(self.info_widget)
|
||||
self.main_layout.addLayout(self.file_selection)
|
||||
self.main_layout.addWidget(self.primary_action)
|
||||
self.main_layout.addWidget(self.min_width_widget)
|
||||
|
||||
# Layout
|
||||
self.layout.insertLayout(0, self.file_selection)
|
||||
self.layout.insertWidget(0, self.info_widget)
|
||||
self.horizontal_layout_wrapper.addWidget(self.downloads)
|
||||
self.layout = QtWidgets.QHBoxLayout()
|
||||
self.layout.addLayout(self.main_layout)
|
||||
self.layout.addWidget(self.downloads)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
# Always start with focus on file selection
|
||||
self.file_selection.setFocus()
|
||||
|
Loading…
Reference in New Issue
Block a user