1
0
Fork 0
mirror of synced 2024-08-18 03:31:31 +12:00
Rare/rare/ui/components/dialogs/login/browser_login.py
loathingKernel 0ec80e5678
LoginDialog: Set minimum size in a way that avoids resizing on changing widgets
The forms were updated to be more informative and easier to read.

NOTE: The reason the form is bigger than the contents is because the
QLabels have word-wrapping enabled and as such they substitute width
for height (`hasHeightforWidth`)
2023-12-12 01:23:16 +02:00

101 lines
5.4 KiB
Python

# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'rare/ui/components/dialogs/login/browser_login.ui'
#
# Created by: PyQt5 UI code generator 5.15.10
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_BrowserLogin(object):
def setupUi(self, BrowserLogin):
BrowserLogin.setObjectName("BrowserLogin")
BrowserLogin.resize(480, 184)
BrowserLogin.setMinimumSize(QtCore.QSize(480, 180))
BrowserLogin.setWindowTitle("BrowserLogin")
self.browser_layout = QtWidgets.QFormLayout(BrowserLogin)
self.browser_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.browser_layout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.browser_layout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.browser_layout.setObjectName("browser_layout")
self.title_label = QtWidgets.QLabel(BrowserLogin)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.title_label.sizePolicy().hasHeightForWidth())
self.title_label.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.title_label.setFont(font)
self.title_label.setObjectName("title_label")
self.browser_layout.setWidget(0, QtWidgets.QFormLayout.SpanningRole, self.title_label)
self.open_button = QtWidgets.QPushButton(BrowserLogin)
self.open_button.setObjectName("open_button")
self.browser_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.open_button)
self.sid_label = QtWidgets.QLabel(BrowserLogin)
self.sid_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.sid_label.setObjectName("sid_label")
self.browser_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.sid_label)
self.link_layout = QtWidgets.QHBoxLayout()
self.link_layout.setObjectName("link_layout")
self.link_text = QtWidgets.QLineEdit(BrowserLogin)
self.link_text.setText("")
self.link_text.setReadOnly(True)
self.link_text.setPlaceholderText("")
self.link_text.setObjectName("link_text")
self.link_layout.addWidget(self.link_text)
self.copy_button = QtWidgets.QPushButton(BrowserLogin)
self.copy_button.setText("")
self.copy_button.setObjectName("copy_button")
self.link_layout.addWidget(self.copy_button)
self.browser_layout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.link_layout)
self.status_label = QtWidgets.QLabel(BrowserLogin)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.status_label.sizePolicy().hasHeightForWidth())
self.status_label.setSizePolicy(sizePolicy)
font = QtGui.QFont()
self.status_label.setFont(font)
self.status_label.setText("")
self.status_label.setWordWrap(True)
self.status_label.setObjectName("status_label")
self.browser_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.status_label)
self.info_label = QtWidgets.QLabel(BrowserLogin)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.info_label.sizePolicy().hasHeightForWidth())
self.info_label.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setItalic(True)
self.info_label.setFont(font)
self.info_label.setWordWrap(True)
self.info_label.setObjectName("info_label")
self.browser_layout.setWidget(5, QtWidgets.QFormLayout.SpanningRole, self.info_label)
spacerItem = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.browser_layout.setItem(4, QtWidgets.QFormLayout.SpanningRole, spacerItem)
self.retranslateUi(BrowserLogin)
def retranslateUi(self, BrowserLogin):
_translate = QtCore.QCoreApplication.translate
self.title_label.setText(_translate("BrowserLogin", "Login through browser"))
self.open_button.setText(_translate("BrowserLogin", "Open Browser"))
self.sid_label.setText(_translate("BrowserLogin", "Code"))
self.info_label.setText(_translate("BrowserLogin", "Click the <b>Open Browser</b> button to open the login page in a browser or copy the link and paste it in a browser. After logging in using the browser, copy the <b><code>authorizationCode</code></b> contents into the empty input above. <b>DO NOT SHARE THE INFORMATION IN THE BROWSER PAGE WITH ANYONE IN ANY FORM (TEXT OR SCREENSHOT)!</b>"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
BrowserLogin = QtWidgets.QWidget()
ui = Ui_BrowserLogin()
ui.setupUi(BrowserLogin)
BrowserLogin.show()
sys.exit(app.exec_())