1
0
Fork 0
mirror of synced 2024-07-02 21:20:54 +12:00
Rare/rare/ui/components/dialogs/login/browser_login.py
loathingKernel 8e1a3c8c73
LoginDialog: Calculate a fixed height for the login stack based on width
* Properly find row to insert sid_edit into
* Use lazy evaluation for logging
* Clean the login forms by using separate layouts for the interactive fields
2023-12-12 01:23:17 +02:00

98 lines
5.1 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(320, 243)
BrowserLogin.setWindowTitle("BrowserLogin")
self.main_layout = QtWidgets.QVBoxLayout(BrowserLogin)
self.main_layout.setObjectName("main_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.main_layout.addWidget(self.title_label)
self.form_layout = QtWidgets.QFormLayout()
self.form_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
self.form_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.form_layout.setLabelAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.form_layout.setFormAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.form_layout.setObjectName("form_layout")
self.open_button = QtWidgets.QPushButton(BrowserLogin)
self.open_button.setObjectName("open_button")
self.form_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.open_button)
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.link_layout.setStretch(0, 1)
self.form_layout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.link_layout)
self.sid_label = QtWidgets.QLabel(BrowserLogin)
self.sid_label.setText("authorizationCode")
self.sid_label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
self.sid_label.setObjectName("sid_label")
self.form_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.sid_label)
self.status_label = QtWidgets.QLabel(BrowserLogin)
font = QtGui.QFont()
font.setItalic(True)
self.status_label.setFont(font)
self.status_label.setText("")
self.status_label.setObjectName("status_label")
self.form_layout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.status_label)
self.main_layout.addLayout(self.form_layout)
spacerItem = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.main_layout.addItem(spacerItem)
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)
self.info_label.setWordWrap(True)
self.info_label.setObjectName("info_label")
self.main_layout.addWidget(self.info_label)
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.info_label.setText(_translate("BrowserLogin", "<i>Click the <strong>Open Browser</strong> button to open the login page in your web browser or copy the link and paste it in any web browser. After logging in using the browser, copy the text in the quotes after </i><code><b>authorizationCode</b></code><i> in the same line into the empty input above.<br><br><strong>DO NOT SHARE THE INFORMATION IN THE BROWSER PAGE WITH ANYONE IN ANY FORM (TEXT OR SCREENSHOT)!</strong></i>"))
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_())