From c207bd42e906da9216c7b1291af8d0abc1bf80f8 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 20 Apr 2019 15:25:08 -0400 Subject: [PATCH] Implement scrolling to fix window sizing issues --- CHANGELOG.rst | 4 + dottorrentGUI/gui.py | 9 - dottorrentGUI/mainwindow.ui | 689 +++++++++++++++++---------------- dottorrentGUI/ui_mainwindow.py | 94 +++-- dottorrentGUI/version.py | 2 +- 5 files changed, 430 insertions(+), 368 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b8543bf..398ffbc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,10 @@ Changelog ========= +1.3.11 +------ +* [ENHANCEMENT/FIX] Main window area now scrolls to prevent overflow issues on lower-resolution screens + 1.3.10 ------ * [FIX] Add missing humanfriendly dependency diff --git a/dottorrentGUI/gui.py b/dottorrentGUI/gui.py index 9ea4938..ef12e86 100755 --- a/dottorrentGUI/gui.py +++ b/dottorrentGUI/gui.py @@ -557,15 +557,6 @@ def main(): ui = DottorrentGUI() ui.setupUi(MainWindow) - MainWindow.resize(500, 0) - MainWindow.setGeometry( - QtWidgets.QStyle.alignedRect( - QtCore.Qt.LeftToRight, - QtCore.Qt.AlignCenter, - MainWindow.size(), - app.desktop().availableGeometry() - ) - ) MainWindow.setWindowTitle(PROGRAM_NAME_VERSION) ui.loadSettings() diff --git a/dottorrentGUI/mainwindow.ui b/dottorrentGUI/mainwindow.ui index 48fb97c..f9ac170 100644 --- a/dottorrentGUI/mainwindow.ui +++ b/dottorrentGUI/mainwindow.ui @@ -40,332 +40,373 @@ - - - - 0 - 0 - + + + QAbstractScrollArea::AdjustToContents - - Input path + + true - - - - - - 0 - 0 - - - - File - - - - - - - <html><head/><body><p>If enabled, a torrent will be created for each directory and file one level below the input directory. The piece size for each torrent will be determined automatically.</p></body></html> - - - Batch mode - - - - - - - - 0 - 0 - - - - Directory - - - - - - - - 0 - 0 - - - - Filename exclusion patterns (one per line) - - - - - - - true - - - - 0 - 0 - - - - - 0 - 90 - - - - - 16777215 - 16777215 - - - - QAbstractScrollArea::AdjustToContents - - - - - - - - 0 - 0 - - - - Browse... - - - - - - - - - - true - - - true - - - - - - - - 0 - 0 - - - - Paste from clipboard - - - - - - - - - - - 0 - 0 - - - - Seeding - - - - - - - 0 - 0 - - - - Tracker URLs (one per line) - - - - - - - - 0 - 0 - - - - - 0 - 90 - - - - - 16777215 - 16777215 - - - - QAbstractScrollArea::AdjustToContents - - - - - - - - 0 - 0 - - - - HTTP/FTP seeds (one per line) - - - - - - - - 0 - 0 - - - - - 0 - 90 - - - - - 16777215 - 16777215 - - - - QAbstractScrollArea::AdjustToContents - - - - - - - - - - - 0 - 0 - - - - Torrent options - - - - - - - 0 - 0 - - - - # pieces - - - - - - - - 100 - 16777215 - - - - - - - - <html><head/><body><p>This is not used by BitTorrent at all, but it is included by some programs for greater compatibility.</p></body></html> - - - Compute MD5 hashes - - - - - - - - 0 - 0 - - - - Piece size - - - - - - - <html><head/><body><p>If enabled, clients will not use DHT or Peer Exchange to discover peers or transfer data. Make sure to enable this option for private trackers.</p></body></html> - - - Private torrent - - - - - - - - 0 - 0 - - - - Comment - - - - - - - - - - - 0 - 0 - - - - Source - - - - - - - <html><head/><body><p>An optional source string that wil be added to the info dictionary. Useful for creating torrents with unique info hashes for private trackers.</p></body></html> - - - - + + + + 0 + 0 + 465 + 904 + + + + + 12 + + + 12 + + + 12 + + + 12 + + + + + + 0 + 1 + + + + Input path + + + + + + + 0 + 0 + + + + File + + + + + + + <html><head/><body><p>If enabled, a torrent will be created for each directory and file one level below the input directory. The piece size for each torrent will be determined automatically.</p></body></html> + + + Batch mode + + + + + + + + 0 + 0 + + + + Filename exclusion patterns (one per line) + + + + + + + true + + + + 0 + 0 + + + + + 0 + 90 + + + + + 16777215 + 16777215 + + + + QAbstractScrollArea::AdjustToContents + + + + + + + + + + true + + + true + + + + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + Browse... + + + + + + + + 0 + 0 + + + + Paste from clipboard + + + + + + + + + + 0 + 0 + + + + Directory + + + + + + + + + + + 0 + 2 + + + + Seeding + + + + + + + 0 + 0 + + + + Tracker URLs (one per line) + + + + + + + + 0 + 1 + + + + + 0 + 90 + + + + + 16777215 + 16777215 + + + + QAbstractScrollArea::AdjustToContents + + + + + + + + 0 + 0 + + + + HTTP/FTP seeds (one per line) + + + + + + + + 0 + 1 + + + + + 0 + 90 + + + + + 16777215 + 16777215 + + + + QAbstractScrollArea::AdjustToContents + + + + + + + + + + + 0 + 0 + + + + Torrent options + + + + + + + 0 + 0 + + + + # pieces + + + + + + + + 100 + 16777215 + + + + + + + + <html><head/><body><p>This is not used by BitTorrent at all, but it is included by some programs for greater compatibility.</p></body></html> + + + Compute MD5 hashes + + + + + + + + 0 + 0 + + + + Piece size + + + + + + + <html><head/><body><p>If enabled, clients will not use DHT or Peer Exchange to discover peers or transfer data. Make sure to enable this option for private trackers.</p></body></html> + + + Private torrent + + + + + + + + 0 + 0 + + + + Comment + + + + + + + + + + + 0 + 0 + + + + Source + + + + + + + <html><head/><body><p>An optional source string that wil be added to the info dictionary. Useful for creating torrents with unique info hashes for private trackers.</p></body></html> + + + + + + + + diff --git a/dottorrentGUI/ui_mainwindow.py b/dottorrentGUI/ui_mainwindow.py index 59e5a0e..3222f01 100644 --- a/dottorrentGUI/ui_mainwindow.py +++ b/dottorrentGUI/ui_mainwindow.py @@ -28,10 +28,20 @@ def setupUi(self, MainWindow): self.centralwidget.setObjectName("centralwidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName("verticalLayout") - self.inputGroupBox = QtWidgets.QGroupBox(self.centralwidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + self.scrollArea = QtWidgets.QScrollArea(self.centralwidget) + self.scrollArea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents = QtWidgets.QWidget() + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 465, 904)) + self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") + self.verticalLayoutMain = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents) + self.verticalLayoutMain.setContentsMargins(12, 12, 12, 12) + self.verticalLayoutMain.setObjectName("verticalLayoutMain") + self.inputGroupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) + sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.inputGroupBox.sizePolicy().hasHeightForWidth()) self.inputGroupBox.setSizePolicy(sizePolicy) self.inputGroupBox.setObjectName("inputGroupBox") @@ -47,15 +57,7 @@ def setupUi(self, MainWindow): self.gridLayout.addWidget(self.fileRadioButton, 0, 0, 1, 1) self.batchModeCheckBox = QtWidgets.QCheckBox(self.inputGroupBox) self.batchModeCheckBox.setObjectName("batchModeCheckBox") - self.gridLayout.addWidget(self.batchModeCheckBox, 3, 0, 1, 1) - self.directoryRadioButton = QtWidgets.QRadioButton(self.inputGroupBox) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.directoryRadioButton.sizePolicy().hasHeightForWidth()) - self.directoryRadioButton.setSizePolicy(sizePolicy) - self.directoryRadioButton.setObjectName("directoryRadioButton") - self.gridLayout.addWidget(self.directoryRadioButton, 0, 1, 1, 1) + self.gridLayout.addWidget(self.batchModeCheckBox, 4, 0, 1, 1) self.excludeLabel = QtWidgets.QLabel(self.inputGroupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -63,10 +65,10 @@ def setupUi(self, MainWindow): sizePolicy.setHeightForWidth(self.excludeLabel.sizePolicy().hasHeightForWidth()) self.excludeLabel.setSizePolicy(sizePolicy) self.excludeLabel.setObjectName("excludeLabel") - self.gridLayout.addWidget(self.excludeLabel, 4, 0, 1, 4) + self.gridLayout.addWidget(self.excludeLabel, 5, 0, 1, 4) self.excludeEdit = QtWidgets.QPlainTextEdit(self.inputGroupBox) self.excludeEdit.setEnabled(True) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.excludeEdit.sizePolicy().hasHeightForWidth()) @@ -75,7 +77,16 @@ def setupUi(self, MainWindow): self.excludeEdit.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.excludeEdit.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) self.excludeEdit.setObjectName("excludeEdit") - self.gridLayout.addWidget(self.excludeEdit, 5, 0, 1, 4) + self.gridLayout.addWidget(self.excludeEdit, 6, 0, 1, 4) + self.inputEdit = QtWidgets.QLineEdit(self.inputGroupBox) + self.inputEdit.setText("") + self.inputEdit.setDragEnabled(True) + self.inputEdit.setReadOnly(True) + self.inputEdit.setObjectName("inputEdit") + self.gridLayout.addWidget(self.inputEdit, 1, 0, 1, 4) + self.horizontalLayout_inputButtons = QtWidgets.QHBoxLayout() + self.horizontalLayout_inputButtons.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint) + self.horizontalLayout_inputButtons.setObjectName("horizontalLayout_inputButtons") self.browseButton = QtWidgets.QPushButton(self.inputGroupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -83,13 +94,7 @@ def setupUi(self, MainWindow): sizePolicy.setHeightForWidth(self.browseButton.sizePolicy().hasHeightForWidth()) self.browseButton.setSizePolicy(sizePolicy) self.browseButton.setObjectName("browseButton") - self.gridLayout.addWidget(self.browseButton, 2, 0, 1, 1) - self.inputEdit = QtWidgets.QLineEdit(self.inputGroupBox) - self.inputEdit.setText("") - self.inputEdit.setDragEnabled(True) - self.inputEdit.setReadOnly(True) - self.inputEdit.setObjectName("inputEdit") - self.gridLayout.addWidget(self.inputEdit, 1, 0, 1, 4) + self.horizontalLayout_inputButtons.addWidget(self.browseButton) self.pasteButton = QtWidgets.QPushButton(self.inputGroupBox) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -97,12 +102,21 @@ def setupUi(self, MainWindow): sizePolicy.setHeightForWidth(self.pasteButton.sizePolicy().hasHeightForWidth()) self.pasteButton.setSizePolicy(sizePolicy) self.pasteButton.setObjectName("pasteButton") - self.gridLayout.addWidget(self.pasteButton, 2, 1, 1, 1) - self.verticalLayout.addWidget(self.inputGroupBox) - self.seedingGroupBox = QtWidgets.QGroupBox(self.centralwidget) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + self.horizontalLayout_inputButtons.addWidget(self.pasteButton) + self.gridLayout.addLayout(self.horizontalLayout_inputButtons, 2, 0, 1, 4) + self.directoryRadioButton = QtWidgets.QRadioButton(self.inputGroupBox) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.directoryRadioButton.sizePolicy().hasHeightForWidth()) + self.directoryRadioButton.setSizePolicy(sizePolicy) + self.directoryRadioButton.setObjectName("directoryRadioButton") + self.gridLayout.addWidget(self.directoryRadioButton, 0, 2, 1, 1) + self.verticalLayoutMain.addWidget(self.inputGroupBox) + self.seedingGroupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(2) sizePolicy.setHeightForWidth(self.seedingGroupBox.sizePolicy().hasHeightForWidth()) self.seedingGroupBox.setSizePolicy(sizePolicy) self.seedingGroupBox.setObjectName("seedingGroupBox") @@ -117,9 +131,9 @@ def setupUi(self, MainWindow): self.trackerLabel.setObjectName("trackerLabel") self.verticalLayout_2.addWidget(self.trackerLabel) self.trackerEdit = QtWidgets.QPlainTextEdit(self.seedingGroupBox) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) + sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.trackerEdit.sizePolicy().hasHeightForWidth()) self.trackerEdit.setSizePolicy(sizePolicy) self.trackerEdit.setMinimumSize(QtCore.QSize(0, 90)) @@ -136,9 +150,9 @@ def setupUi(self, MainWindow): self.webSeedLabel.setObjectName("webSeedLabel") self.verticalLayout_2.addWidget(self.webSeedLabel) self.webSeedEdit = QtWidgets.QPlainTextEdit(self.seedingGroupBox) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) + sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(self.webSeedEdit.sizePolicy().hasHeightForWidth()) self.webSeedEdit.setSizePolicy(sizePolicy) self.webSeedEdit.setMinimumSize(QtCore.QSize(0, 90)) @@ -146,8 +160,8 @@ def setupUi(self, MainWindow): self.webSeedEdit.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) self.webSeedEdit.setObjectName("webSeedEdit") self.verticalLayout_2.addWidget(self.webSeedEdit) - self.verticalLayout.addWidget(self.seedingGroupBox) - self.optionGroupBox = QtWidgets.QGroupBox(self.centralwidget) + self.verticalLayoutMain.addWidget(self.seedingGroupBox) + self.optionGroupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -204,7 +218,9 @@ def setupUi(self, MainWindow): self.sourceEdit = QtWidgets.QLineEdit(self.optionGroupBox) self.sourceEdit.setObjectName("sourceEdit") self.gridLayout_2.addWidget(self.sourceEdit, 7, 0, 1, 2) - self.verticalLayout.addWidget(self.optionGroupBox) + self.verticalLayoutMain.addWidget(self.optionGroupBox) + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + self.verticalLayout.addWidget(self.scrollArea) self.progressBar = QtWidgets.QProgressBar(self.centralwidget) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") @@ -259,10 +275,10 @@ def retranslateUi(self, MainWindow): self.fileRadioButton.setText(_translate("MainWindow", "File")) self.batchModeCheckBox.setToolTip(_translate("MainWindow", "

If enabled, a torrent will be created for each directory and file one level below the input directory. The piece size for each torrent will be determined automatically.

")) self.batchModeCheckBox.setText(_translate("MainWindow", "Batch mode")) - self.directoryRadioButton.setText(_translate("MainWindow", "Directory")) self.excludeLabel.setText(_translate("MainWindow", "Filename exclusion patterns (one per line)")) self.browseButton.setText(_translate("MainWindow", "Browse...")) self.pasteButton.setText(_translate("MainWindow", "Paste from clipboard")) + self.directoryRadioButton.setText(_translate("MainWindow", "Directory")) self.seedingGroupBox.setTitle(_translate("MainWindow", "Seeding")) self.trackerLabel.setText(_translate("MainWindow", "Tracker URLs (one per line)")) self.webSeedLabel.setText(_translate("MainWindow", "HTTP/FTP seeds (one per line)")) @@ -290,3 +306,13 @@ def retranslateUi(self, MainWindow): self.actionQuit.setText(_translate("MainWindow", "Quit")) self.actionQuit.setShortcut(_translate("MainWindow", "Ctrl+Q")) + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + MainWindow = QtWidgets.QMainWindow() + ui = Ui_MainWindow() + ui.setupUi(MainWindow) + MainWindow.show() + sys.exit(app.exec_()) + diff --git a/dottorrentGUI/version.py b/dottorrentGUI/version.py index f1a3fb0..6c6a2be 100644 --- a/dottorrentGUI/version.py +++ b/dottorrentGUI/version.py @@ -1 +1 @@ -__version__ = '1.3.10' +__version__ = '1.3.11'