From 6dac6293e1a6a72fa65ae5366096dd99c6c92cf1 Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Wed, 29 Dec 2021 14:09:14 +0100 Subject: [PATCH] Add resize policy for mainwindow --- mtkclient/gui/main_gui.py | 216 +++++++------ mtkclient/gui/main_gui.ui | 625 ++++++++++++++++++-------------------- 2 files changed, 403 insertions(+), 438 deletions(-) diff --git a/mtkclient/gui/main_gui.py b/mtkclient/gui/main_gui.py index 4ac8ab2..9596001 100644 --- a/mtkclient/gui/main_gui.py +++ b/mtkclient/gui/main_gui.py @@ -18,14 +18,13 @@ class Ui_MainWindow(object): if not MainWindow.objectName(): MainWindow.setObjectName(u"MainWindow") MainWindow.setWindowModality(Qt.NonModal) - MainWindow.resize(746, 600) - sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding) + MainWindow.resize(746, 574) + sizePolicy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QSize(746, 400)) - MainWindow.setMaximumSize(QSize(746, 600)) MainWindow.setAcceptDrops(False) MainWindow.setAutoFillBackground(False) self.actionRead_partition_s = QAction(MainWindow) @@ -54,106 +53,22 @@ class Ui_MainWindow(object): self.actionGenerate_RPMB_keys.setObjectName(u"actionGenerate_RPMB_keys") self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") - self.line = QFrame(self.centralwidget) - self.line.setObjectName(u"line") - self.line.setGeometry(QRect(12, 160, 722, 16)) - self.line.setFrameShape(QFrame.HLine) - self.line.setFrameShadow(QFrame.Sunken) - self.logBox = QPlainTextEdit(self.centralwidget) - self.logBox.setObjectName(u"logBox") - self.logBox.setGeometry(QRect(12, 401, 722, 186)) - self.logBox.setMinimumSize(QSize(722, 0)) - self.logBox.setMaximumSize(QSize(722, 186)) - self.logBox.setStyleSheet(u"") - self.logBox.setReadOnly(True) - self.logBox.setProperty("hidden", False) - self.layoutWidget2 = QWidget(self.centralwidget) - self.layoutWidget2.setObjectName(u"layoutWidget2") - self.layoutWidget2.setGeometry(QRect(12, 184, 721, 141)) - self.horizontalLayout_2 = QHBoxLayout(self.layoutWidget2) - self.horizontalLayout_2.setSpacing(10) - self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") - self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) - self.logoPic = QLabel(self.layoutWidget2) - self.logoPic.setObjectName(u"logoPic") - sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) - sizePolicy1.setHorizontalStretch(0) - sizePolicy1.setVerticalStretch(0) - sizePolicy1.setHeightForWidth(self.logoPic.sizePolicy().hasHeightForWidth()) - self.logoPic.setSizePolicy(sizePolicy1) - self.logoPic.setMinimumSize(QSize(128, 128)) - self.logoPic.setMaximumSize(QSize(128, 128)) - self.logoPic.setPixmap(QPixmap(u"images/logo_256.png")) - self.logoPic.setScaledContents(True) - self.logoPic.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) - - self.horizontalLayout_2.addWidget(self.logoPic) - - self.copyrightInfo = QLabel(self.layoutWidget2) - self.copyrightInfo.setObjectName(u"copyrightInfo") - sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) - sizePolicy2.setHorizontalStretch(0) - sizePolicy2.setVerticalStretch(0) - sizePolicy2.setHeightForWidth(self.copyrightInfo.sizePolicy().hasHeightForWidth()) - self.copyrightInfo.setSizePolicy(sizePolicy2) - - self.horizontalLayout_2.addWidget(self.copyrightInfo) - - self.layoutWidget = QWidget(self.centralwidget) - self.layoutWidget.setObjectName(u"layoutWidget") - self.layoutWidget.setGeometry(QRect(12, 359, 721, 32)) - self.horizontalLayout_4 = QHBoxLayout(self.layoutWidget) - self.horizontalLayout_4.setSpacing(0) - self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") - self.horizontalLayout_4.setSizeConstraint(QLayout.SetNoConstraint) - self.horizontalLayout_4.setContentsMargins(0, 0, 0, 0) - self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) - - self.horizontalLayout_4.addItem(self.horizontalSpacer) - - self.debugBtn = QPushButton(self.layoutWidget) - self.debugBtn.setObjectName(u"debugBtn") - sizePolicy1.setHeightForWidth(self.debugBtn.sizePolicy().hasHeightForWidth()) - self.debugBtn.setSizePolicy(sizePolicy1) - self.debugBtn.setMinimumSize(QSize(110, 0)) - self.debugBtn.setAutoDefault(False) - self.debugBtn.setFlat(False) - - self.horizontalLayout_4.addWidget(self.debugBtn) - - self.pic = QLabel(self.centralwidget) - self.pic.setObjectName(u"pic") - self.pic.setGeometry(QRect(644, 10, 87, 128)) - sizePolicy1.setHeightForWidth(self.pic.sizePolicy().hasHeightForWidth()) - self.pic.setSizePolicy(sizePolicy1) - self.pic.setMinimumSize(QSize(60, 128)) - self.pic.setMaximumSize(QSize(87, 128)) - self.pic.setPixmap(QPixmap(u"images/phone_notfound.png")) - self.pic.setScaledContents(True) - self.pic.setAlignment(Qt.AlignCenter) - self.pic.setWordWrap(False) - self.phoneInfoTextbox = QLabel(self.centralwidget) - self.phoneInfoTextbox.setObjectName(u"phoneInfoTextbox") - self.phoneInfoTextbox.setGeometry(QRect(433, 10, 201, 91)) - sizePolicy3 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) - sizePolicy3.setHorizontalStretch(0) - sizePolicy3.setVerticalStretch(0) - sizePolicy3.setHeightForWidth(self.phoneInfoTextbox.sizePolicy().hasHeightForWidth()) - self.phoneInfoTextbox.setSizePolicy(sizePolicy3) - self.phoneInfoTextbox.setAlignment(Qt.AlignRight|Qt.AlignTop|Qt.AlignTrailing) - self.phoneInfoTextbox.setWordWrap(True) self.spinner_pic = QLabel(self.centralwidget) self.spinner_pic.setObjectName(u"spinner_pic") self.spinner_pic.setGeometry(QRect(655, 42, 64, 64)) + sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth(self.spinner_pic.sizePolicy().hasHeightForWidth()) self.spinner_pic.setSizePolicy(sizePolicy1) self.spinner_pic.setPixmap(QPixmap(u"images/phone_loading.png")) self.spinner_pic.setScaledContents(False) self.spinner_pic.setAlignment(Qt.AlignCenter) + self.gridLayout = QGridLayout(self.centralwidget) + self.gridLayout.setObjectName(u"gridLayout") self.title = QLabel(self.centralwidget) self.title.setObjectName(u"title") self.title.setEnabled(True) - self.title.setGeometry(QRect(14, 10, 231, 24)) sizePolicy1.setHeightForWidth(self.title.sizePolicy().hasHeightForWidth()) self.title.setSizePolicy(sizePolicy1) self.title.setMinimumSize(QSize(0, 24)) @@ -168,20 +83,119 @@ class Ui_MainWindow(object): self.title.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) self.title.setWordWrap(False) self.title.setIndent(0) + + self.gridLayout.addWidget(self.title, 0, 0, 1, 1) + + self.pic = QLabel(self.centralwidget) + self.pic.setObjectName(u"pic") + sizePolicy1.setHeightForWidth(self.pic.sizePolicy().hasHeightForWidth()) + self.pic.setSizePolicy(sizePolicy1) + self.pic.setMinimumSize(QSize(60, 128)) + self.pic.setMaximumSize(QSize(87, 128)) + self.pic.setPixmap(QPixmap(u"images/phone_notfound.png")) + self.pic.setScaledContents(True) + self.pic.setAlignment(Qt.AlignCenter) + self.pic.setWordWrap(False) + + self.gridLayout.addWidget(self.pic, 0, 3, 2, 1) + + self.phoneInfoTextbox = QLabel(self.centralwidget) + self.phoneInfoTextbox.setObjectName(u"phoneInfoTextbox") + sizePolicy2 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + sizePolicy2.setHorizontalStretch(0) + sizePolicy2.setVerticalStretch(0) + sizePolicy2.setHeightForWidth(self.phoneInfoTextbox.sizePolicy().hasHeightForWidth()) + self.phoneInfoTextbox.setSizePolicy(sizePolicy2) + self.phoneInfoTextbox.setAlignment(Qt.AlignRight|Qt.AlignTop|Qt.AlignTrailing) + self.phoneInfoTextbox.setWordWrap(True) + + self.gridLayout.addWidget(self.phoneInfoTextbox, 0, 2, 1, 1) + + self.line = QFrame(self.centralwidget) + self.line.setObjectName(u"line") + self.line.setFrameShape(QFrame.HLine) + self.line.setFrameShadow(QFrame.Sunken) + + self.gridLayout.addWidget(self.line, 2, 0, 1, 4) + + self.horizontalLayout_2 = QHBoxLayout() + self.horizontalLayout_2.setSpacing(10) + self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") + self.logoPic = QLabel(self.centralwidget) + self.logoPic.setObjectName(u"logoPic") + sizePolicy1.setHeightForWidth(self.logoPic.sizePolicy().hasHeightForWidth()) + self.logoPic.setSizePolicy(sizePolicy1) + self.logoPic.setMinimumSize(QSize(128, 128)) + self.logoPic.setMaximumSize(QSize(128, 128)) + self.logoPic.setPixmap(QPixmap(u"images/logo_256.png")) + self.logoPic.setScaledContents(True) + self.logoPic.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) + + self.horizontalLayout_2.addWidget(self.logoPic) + + self.copyrightInfo = QLabel(self.centralwidget) + self.copyrightInfo.setObjectName(u"copyrightInfo") + sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed) + sizePolicy3.setHorizontalStretch(0) + sizePolicy3.setVerticalStretch(0) + sizePolicy3.setHeightForWidth(self.copyrightInfo.sizePolicy().hasHeightForWidth()) + self.copyrightInfo.setSizePolicy(sizePolicy3) + + self.horizontalLayout_2.addWidget(self.copyrightInfo) + + + self.gridLayout.addLayout(self.horizontalLayout_2, 3, 0, 1, 4) + self.status = QLabel(self.centralwidget) self.status.setObjectName(u"status") - self.status.setGeometry(QRect(14, 40, 451, 111)) - sizePolicy3.setHeightForWidth(self.status.sizePolicy().hasHeightForWidth()) - self.status.setSizePolicy(sizePolicy3) + sizePolicy2.setHeightForWidth(self.status.sizePolicy().hasHeightForWidth()) + self.status.setSizePolicy(sizePolicy2) self.status.setMinimumSize(QSize(400, 0)) self.status.setTextFormat(Qt.AutoText) self.status.setScaledContents(False) self.status.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop) self.status.setWordWrap(False) + + self.gridLayout.addWidget(self.status, 1, 0, 1, 3) + + self.logBox = QPlainTextEdit(self.centralwidget) + self.logBox.setObjectName(u"logBox") + self.logBox.setMinimumSize(QSize(722, 0)) + self.logBox.setStyleSheet(u"") + self.logBox.setReadOnly(True) + self.logBox.setProperty("hidden", False) + + self.gridLayout.addWidget(self.logBox, 5, 0, 1, 4) + + self.horizontalLayout_4 = QHBoxLayout() + self.horizontalLayout_4.setSpacing(0) + self.horizontalLayout_4.setObjectName(u"horizontalLayout_4") + self.horizontalLayout_4.setSizeConstraint(QLayout.SetNoConstraint) + self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.horizontalLayout_4.addItem(self.horizontalSpacer) + + self.debugBtn = QPushButton(self.centralwidget) + self.debugBtn.setObjectName(u"debugBtn") + sizePolicy1.setHeightForWidth(self.debugBtn.sizePolicy().hasHeightForWidth()) + self.debugBtn.setSizePolicy(sizePolicy1) + self.debugBtn.setMinimumSize(QSize(110, 0)) + self.debugBtn.setAutoDefault(False) + self.debugBtn.setFlat(False) + + self.horizontalLayout_4.addWidget(self.debugBtn) + + + self.gridLayout.addLayout(self.horizontalLayout_4, 4, 0, 1, 4) + + self.horizontalSpacer_2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + + self.gridLayout.addItem(self.horizontalSpacer_2, 0, 1, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(MainWindow) self.menubar.setObjectName(u"menubar") - self.menubar.setGeometry(QRect(0, 0, 746, 24)) + self.menubar.setGeometry(QRect(0, 0, 746, 22)) self.readFlashMenu = QMenu(self.menubar) self.readFlashMenu.setObjectName(u"readFlashMenu") self.writeFlashMenu = QMenu(self.menubar) @@ -231,14 +245,14 @@ class Ui_MainWindow(object): self.actionWrite_RPMB.setText(QCoreApplication.translate("MainWindow", u"Write RPMB", None)) self.actionRead_preloader.setText(QCoreApplication.translate("MainWindow", u"Read preloader", None)) self.actionGenerate_RPMB_keys.setText(QCoreApplication.translate("MainWindow", u"Generate RPMB keys", None)) - self.logoPic.setText("") - self.copyrightInfo.setText(QCoreApplication.translate("MainWindow", u"Made by: Bjoern Kerler
Gui by: Geert-Jan Kreileman

Credits:
kamakiri [xyzz]
linecode exploit [chimera]
Chaosmaster
and all contributers

", None)) - self.debugBtn.setText(QCoreApplication.translate("MainWindow", u"Show debug log", None)) - self.pic.setText("") - self.phoneInfoTextbox.setText(QCoreApplication.translate("MainWindow", u"No phone detected.", None)) self.spinner_pic.setText("") self.title.setText(QCoreApplication.translate("MainWindow", u"MTKClient v2.0", None)) + self.pic.setText("") + self.phoneInfoTextbox.setText(QCoreApplication.translate("MainWindow", u"No phone detected.", None)) + self.logoPic.setText("") + self.copyrightInfo.setText(QCoreApplication.translate("MainWindow", u"Made by: Bjoern Kerler
Gui by: Geert-Jan Kreileman

Credits:
kamakiri [xyzz]
linecode exploit [chimera]
Chaosmaster
and all contributers

", None)) self.status.setText(QCoreApplication.translate("MainWindow", u"

Please connect a Mediatek phone to continue.

Hint: Power off the phone before connecting.
For brom mode:
Press and hold vol up, vol dwn, or all hw buttons and connect usb.
For preloader mode:
Don't press any hw button and connect usb.

", None)) + self.debugBtn.setText(QCoreApplication.translate("MainWindow", u"Show debug log", None)) self.readFlashMenu.setTitle(QCoreApplication.translate("MainWindow", u"&Read Flash", None)) self.writeFlashMenu.setTitle(QCoreApplication.translate("MainWindow", u"&Write Flash", None)) self.eraseFlashMenu.setTitle(QCoreApplication.translate("MainWindow", u"&Erase Flash", None)) diff --git a/mtkclient/gui/main_gui.ui b/mtkclient/gui/main_gui.ui index 8e99775..52f4b1e 100755 --- a/mtkclient/gui/main_gui.ui +++ b/mtkclient/gui/main_gui.ui @@ -10,11 +10,11 @@ 0 0 746 - 600 + 574 - + 0 0 @@ -25,12 +25,6 @@ 400 - - - 746 - 600 - - false @@ -41,239 +35,291 @@ false - - - - 12 - 160 - 722 - 16 - - - - Qt::Horizontal - - - - - - 12 - 401 - 722 - 186 - - - - - 722 - 0 - - - - - 722 - 186 - - - - - - - true - - - false - - - - - - 12 - 184 - 721 - 141 - - - - - 10 - - - - - - 0 - 0 - - - - - 128 - 128 - - - - - 128 - 128 - - - - - - - images/logo_256.png - - - true - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 0 - - - - <b>Made by:</b> Bjoern Kerler<br/><b>Gui by:</b> Geert-Jan Kreileman<br/><br/><b>Credits:</b><br/>kamakiri [xyzz]<br/>linecode exploit [chimera]<br/>Chaosmaster<br/>and all contributers</p> - - - - - - - - - 12 - 359 - 721 - 32 - - - - - 0 - - - QLayout::SetNoConstraint - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 110 - 0 - - - - Show debug log - - - false - - - false - - - false - - - - - - - - - 644 - 10 - 87 - 128 - - - - - 0 - 0 - - - - - 60 - 128 - - - - - 87 - 128 - - - - - - - images/phone_notfound.png - - - true - - - Qt::AlignCenter - - - false - - - - - - 433 - 10 - 201 - 91 - - - - - 0 - 0 - - - - No phone detected. - - - Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing - - - true - - + + + + + true + + + + 0 + 0 + + + + + 0 + 24 + + + + + 16777215 + 20 + + + + + Arial + 18 + + + + 0 + + + MTKClient v2.0 + + + Qt::AutoText + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + false + + + 0 + + + + + + + + 0 + 0 + + + + + 60 + 128 + + + + + 87 + 128 + + + + + + + images/phone_notfound.png + + + true + + + Qt::AlignCenter + + + false + + + + + + + + 0 + 0 + + + + No phone detected. + + + Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing + + + true + + + + + + + Qt::Horizontal + + + + + + + 10 + + + + + + 0 + 0 + + + + + 128 + 128 + + + + + 128 + 128 + + + + + + + images/logo_256.png + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + <b>Made by:</b> Bjoern Kerler<br/><b>Gui by:</b> Geert-Jan Kreileman<br/><br/><b>Credits:</b><br/>kamakiri [xyzz]<br/>linecode exploit [chimera]<br/>Chaosmaster<br/>and all contributers</p> + + + + + + + + + + 0 + 0 + + + + + 400 + 0 + + + + <html><head/><body><p>Please connect a Mediatek phone to continue.<br/><br/><span style=" font-weight:600;">Hint:</span> Power off the phone before connecting.<br/><span style=" font-style:italic; color:#393939;">For brom mode:</span><span style=" color:#393939;"><br/>Press and hold vol up, vol dwn, or all hw buttons and connect usb.<br/></span><span style=" font-style:italic; color:#393939;">For preloader mode:</span><span style=" color:#393939;"><br/>Don't press any hw button and connect usb.</span></p></body></html> + + + Qt::AutoText + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + false + + + + + + + + 722 + 0 + + + + + + + true + + + false + + + + + + + 0 + + + QLayout::SetNoConstraint + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + Show debug log + + + false + + + false + + + false + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -302,101 +348,6 @@ Qt::AlignCenter - - - true - - - - 14 - 10 - 231 - 24 - - - - - 0 - 0 - - - - - 0 - 24 - - - - - 16777215 - 20 - - - - - Arial - 18 - - - - 0 - - - MTKClient v2.0 - - - Qt::AutoText - - - false - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - false - - - 0 - - - - - - 14 - 40 - 451 - 111 - - - - - 0 - 0 - - - - - 400 - 0 - - - - <html><head/><body><p>Please connect a Mediatek phone to continue.<br/><br/><span style=" font-weight:600;">Hint:</span> Power off the phone before connecting.<br/><span style=" font-style:italic; color:#393939;">For brom mode:</span><span style=" color:#393939;"><br/>Press and hold vol up, vol dwn, or all hw buttons and connect usb.<br/></span><span style=" font-style:italic; color:#393939;">For preloader mode:</span><span style=" color:#393939;"><br/>Don't press any hw button and connect usb.</span></p></body></html> - - - Qt::AutoText - - - false - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - false - - @@ -404,7 +355,7 @@ 0 0 746 - 24 + 22