Change MinimumWidthWidget to MinimumSizeWidget, and use it for height in chat mode

This commit is contained in:
Micah Lee 2021-05-25 17:18:31 -07:00
parent 40919dca6f
commit b181028931
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
5 changed files with 15 additions and 13 deletions

View File

@ -24,7 +24,7 @@ from onionshare_cli.web import Web
from .. import Mode from .. import Mode
from .... import strings from .... import strings
from ....widgets import MinimumWidthWidget from ....widgets import MinimumSizeWidget
from ....gui_common import GuiCommon from ....gui_common import GuiCommon
@ -82,7 +82,8 @@ class ChatMode(Mode):
# Top bar # Top bar
top_bar_layout = QtWidgets.QHBoxLayout() top_bar_layout = QtWidgets.QHBoxLayout()
top_bar_layout.addStretch() # Add space at the top, same height as the toggle history bar in other modes
top_bar_layout.addWidget(MinimumSizeWidget(0, 30))
# Main layout # Main layout
self.main_layout = QtWidgets.QVBoxLayout() self.main_layout = QtWidgets.QVBoxLayout()
@ -90,7 +91,7 @@ class ChatMode(Mode):
self.main_layout.addWidget(header_label) self.main_layout.addWidget(header_label)
self.main_layout.addWidget(self.primary_action, stretch=1) self.main_layout.addWidget(self.primary_action, stretch=1)
self.main_layout.addWidget(self.server_status) self.main_layout.addWidget(self.server_status)
self.main_layout.addWidget(MinimumWidthWidget(700)) self.main_layout.addWidget(MinimumSizeWidget(700, 0))
# Column layout # Column layout
self.column_layout = QtWidgets.QHBoxLayout() self.column_layout = QtWidgets.QHBoxLayout()

View File

@ -26,7 +26,7 @@ from onionshare_cli.web import Web
from ..history import History, ToggleHistory, ReceiveHistoryItem from ..history import History, ToggleHistory, ReceiveHistoryItem
from .. import Mode from .. import Mode
from .... import strings from .... import strings
from ....widgets import MinimumWidthWidget, Alert from ....widgets import MinimumSizeWidget, Alert
from ....gui_common import GuiCommon from ....gui_common import GuiCommon
@ -183,7 +183,7 @@ class ReceiveMode(Mode):
self.main_layout.addWidget(header_label) self.main_layout.addWidget(header_label)
self.main_layout.addWidget(receive_warning) self.main_layout.addWidget(receive_warning)
self.main_layout.addWidget(self.primary_action, stretch=1) self.main_layout.addWidget(self.primary_action, stretch=1)
self.main_layout.addWidget(MinimumWidthWidget(525)) self.main_layout.addWidget(MinimumSizeWidget(525, 0))
# Row layout # Row layout
content_row = QtWidgets.QHBoxLayout() content_row = QtWidgets.QHBoxLayout()

View File

@ -29,7 +29,7 @@ from .. import Mode
from ..file_selection import FileSelection from ..file_selection import FileSelection
from ..history import History, ToggleHistory, ShareHistoryItem from ..history import History, ToggleHistory, ShareHistoryItem
from .... import strings from .... import strings
from ....widgets import MinimumWidthWidget from ....widgets import MinimumSizeWidget
from ....gui_common import GuiCommon from ....gui_common import GuiCommon
@ -162,7 +162,7 @@ class ShareMode(Mode):
self.main_layout.addLayout(self.file_selection) self.main_layout.addLayout(self.file_selection)
self.main_layout.addWidget(self.primary_action, stretch=1) self.main_layout.addWidget(self.primary_action, stretch=1)
self.main_layout.addWidget(self.server_status) self.main_layout.addWidget(self.server_status)
self.main_layout.addWidget(MinimumWidthWidget(700)) self.main_layout.addWidget(MinimumSizeWidget(700, 0))
# Column layout # Column layout
self.column_layout = QtWidgets.QHBoxLayout() self.column_layout = QtWidgets.QHBoxLayout()

View File

@ -29,7 +29,7 @@ from .. import Mode
from ..file_selection import FileSelection from ..file_selection import FileSelection
from ..history import History, ToggleHistory from ..history import History, ToggleHistory
from .... import strings from .... import strings
from ....widgets import MinimumWidthWidget from ....widgets import MinimumSizeWidget
from ....gui_common import GuiCommon from ....gui_common import GuiCommon
@ -160,7 +160,7 @@ class WebsiteMode(Mode):
self.main_layout.addLayout(self.file_selection) self.main_layout.addLayout(self.file_selection)
self.main_layout.addWidget(self.primary_action, stretch=1) self.main_layout.addWidget(self.primary_action, stretch=1)
self.main_layout.addWidget(self.server_status) self.main_layout.addWidget(self.server_status)
self.main_layout.addWidget(MinimumWidthWidget(700)) self.main_layout.addWidget(MinimumSizeWidget(700, 0))
# Column layout # Column layout
self.column_layout = QtWidgets.QHBoxLayout() self.column_layout = QtWidgets.QHBoxLayout()

View File

@ -84,14 +84,15 @@ class AddFileDialog(QtWidgets.QFileDialog):
QtWidgets.QDialog.accept(self) QtWidgets.QDialog.accept(self)
class MinimumWidthWidget(QtWidgets.QWidget): class MinimumSizeWidget(QtWidgets.QWidget):
""" """
An empty widget with a minimum width, just to force layouts to behave An empty widget with a minimum width and height, just to force layouts to behave
""" """
def __init__(self, width): def __init__(self, width, height):
super(MinimumWidthWidget, self).__init__() super(MinimumSizeWidget, self).__init__()
self.setMinimumWidth(width) self.setMinimumWidth(width)
self.setMinimumHeight(height)
class Image(qrcode.image.base.BaseImage): class Image(qrcode.image.base.BaseImage):