Increase minimum window with to 460, and store it in a variable to stop repeating myself

This commit is contained in:
Micah Lee 2018-09-29 15:12:05 -07:00
parent 8ca34fadd9
commit 39dd0862d4
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
4 changed files with 7 additions and 5 deletions

View File

@ -50,7 +50,7 @@ class Mode(QtWidgets.QWidget):
self.filenames = filenames
self.setMinimumWidth(450)
self.setMinimumWidth(self.common.min_window_width)
# The web object gets created in init()
self.web = None
@ -83,7 +83,7 @@ class Mode(QtWidgets.QWidget):
# 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)
self.min_width_widget.setMinimumWidth(self.common.min_window_width)
def init(self):
"""

View File

@ -45,6 +45,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.common = common
self.common.log('OnionShareGui', '__init__')
self.common.min_window_width = 460
self.onion = onion
self.qtapp = qtapp
@ -169,7 +170,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.show()
# Adjust window size, to start with a minimum window width
self.adjust_size(450)
self.adjust_size(self.common.min_window_width)
# The server isn't active yet
self.set_server_active(False)
@ -474,6 +475,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
# Adjust sizes of each mode
for mode in [self.share_mode, self.receive_mode]:
self.qtapp.processEvents()
adjust_size_widget(mode)
# Adjust window size

View File

@ -194,7 +194,7 @@ class ReceiveMode(Mode):
self.resize_window()
def resize_window(self):
min_width = 450
min_width = self.common.min_window_width
if self.uploads.isVisible():
min_width += 300
self.adjust_size.emit(min_width)

View File

@ -317,7 +317,7 @@ class ShareMode(Mode):
self.downloads.reset()
def resize_window(self):
min_width = 450
min_width = self.common.min_window_width
if self.downloads.isVisible():
min_width += 300
self.adjust_size.emit(min_width)