class LoginBuilder(object): """Constructs a login window.""" def setup(self, dialog): dialog.resize(320, 132) dialog.setModal(True) dialog.setWindowTitle("Please Login to Continue") self.form_layout = QFormLayout(dialog) self.form_layout.setObjectName("formLayout") self.login_label = QLabel("Server requesting authentication", dialog) self.login_label.setObjectName("login_label") self.form_layout.setWidget(0, QFormLayout.SpanningRole, self.login_label) self.username_label = QLabel(dialog) self.username_label.setObjectName("username_label") self.form_layout.setWidget(1, QFormLayout.LabelRole, self.username_label) self.username = QLineEdit(dialog) self.username.setObjectName("username") self.username.setStatusTip("Enter your username.") self.form_layout.setWidget(1, QFormLayout.FieldRole, self.username) self.password_label = QLabel(dialog) self.password_label.setObjectName("password_label") self.form_layout.setWidget(2, QFormLayout.LabelRole, self.password_label) self.password = QLineEdit(dialog) self.password.setObjectName("password") self.password.setStatusTip("Enter your password.") self.password.setEchoMode(QLineEdit.PasswordEchoOnEdit) self.form_layout.setWidget(2, QFormLayout.FieldRole, self.password) self.save_username = QCheckBox("&Save username", dialog) self.save_username.setObjectName("save_username") self.form_layout.setWidget(3, QFormLayout.FieldRole, self.save_username) self.button_box = QDialogButtonBox(dialog) self.button_box.setObjectName("button_box") self.button_box.setOrientation(Qt.Horizontal) self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.form_layout.setWidget(4, QFormLayout.SpanningRole, self.button_box) self.button_box.accepted.connect(dialog.accept) self.button_box.rejected.connect(dialog.close) QMetaObject.connectSlotsByName(dialog)
class UIBuilder(object): """Constructs the UI for a main application window""" def setup(self, main_window: QMainWindow) -> None: """ Initialize the UI. :param main_window: An instance of the `QMainWindow` class. :type main_window: :class:`QMainWindow` """ main_window.setObjectName("main_window") main_window.setWindowTitle("TeaseAI") main_window.resize(1137, 751) main_window.setSizePolicy(*EXP_EXP) main_window.setTabShape(QTabWidget.Rounded) self.menubar = QMenuBar(main_window) self.menubar.setObjectName("menubar") self.menubar.setGeometry(0, 0, 1137, 23) self.file_menu = QMenu("File", self.menubar) self.file_menu.setObjectName("file_men") self.server_menu = QMenu("Server", self.menubar) self.server_menu.setObjectName("server_men") self.options_menu = QMenu("Options", self.menubar) self.options_menu.setObjectName("options_men") self.media_menu = QMenu("Media", self.menubar) self.media_menu.setObjectName("media_men") main_window.setMenuBar(self.menubar) self.exit = QAction("Exit", main_window) self.exit.setObjectName("exit") self.start_server = QAction("Start Server", main_window) self.start_server.setObjectName("start_server") self.connect_server = QAction("Connect to Server", main_window) self.connect_server.setObjectName("connect_server") self.kill_server = QAction("Kill Server", main_window) self.kill_server.setObjectName("kill_server") self.options = QAction("Options", main_window) self.options.setObjectName("options") self.start_webcam = QAction("Start Webcam", main_window) self.start_webcam.setObjectName("start_webcam") self.start_webcam.setCheckable(False) self.centralwidget = QWidget(main_window) self.centralwidget.setObjectName("centralwidget") self.centralwidget.setContentsMargins(QMargins(0, 0, 0, 0)) self.centralwidget.setSizePolicy(*EXP_EXP) self.grid_layout = QGridLayout(self.centralwidget) self.media = QFrame(self.centralwidget) self.media.setObjectName("media") self.media.setSizePolicy(*EXP_EXP) self.media.setMinimumSize(200, 200) self.media.setStyleSheet("background: #000;") self.grid_layout.addWidget(self.media, 0, 0, 5, 1) self.users_label = QLabel(" Online users:", self.centralwidget) self.users_label.setObjectName("users_label") self.users_label.setMinimumSize(300, 15) self.users_label.setMaximumSize(300, 15) self.grid_layout.addWidget(self.users_label, 0, 1, 1, 2) self.online = QPlainTextEdit("", self.centralwidget) self.online.setObjectName("online") self.online.setSizePolicy(*FIX_FIX) self.online.setMinimumSize(300, 50) self.online.setMaximumSize(300, 50) self.online.setStyleSheet("margin-left: 3px;" + SUNKEN) self.online.setLineWidth(2) self.online.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.online.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.online.setSizeAdjustPolicy(QAbstractScrollArea.AdjustIgnored) self.online.setReadOnly(True) self.grid_layout.addWidget(self.online, 1, 1, 1, 2) self.chat = QPlainTextEdit("", self.centralwidget) self.chat.setObjectName("chat") self.chat.setSizePolicy(*FIX_EXP) self.chat.setMinimumSize(300, 0) self.chat.setMaximumSize(300, INFINITE) self.chat.setStyleSheet("margin-bottom: 3px; margin-top: 8px;" + SUNKEN) self.chat.setLineWidth(2) self.chat.setReadOnly(True) self.chat.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.grid_layout.addWidget(self.chat, 2, 1, 1, 2) self.input = QLineEdit(self.centralwidget) self.input.setObjectName("input") self.input.setSizePolicy(*FIX_FIX) self.input.setMinimumSize(224, 30) self.input.setMaximumSize(224, 30) self.input.setStyleSheet(SUNKEN) self.input.setEchoMode(QLineEdit.Normal) self.input.setClearButtonEnabled(True) self.grid_layout.addWidget(self.input, 3, 1, 1, 1) self.submit = QPushButton("Submit", self.centralwidget) self.submit.setObjectName("submit") self.submit.setSizePolicy(*FIX_FIX) self.submit.setMinimumSize(70, 30) self.submit.setMaximumSize(70, 30) self.grid_layout.addWidget(self.submit, 3, 2, 1, 1) self.tabs = QTabWidget(self.centralwidget) self.tabs.setObjectName("tabs") self.tabs.setSizePolicy(*FIX_FIX) self.tabs.setMinimumSize(300, 150) self.tabs.setMaximumSize(300, 150) self.tab = QWidget() self.tab.setObjectName("tab") self.tabs.addTab(self.tab, "Actions") self.tab2 = QWidget() self.tab2.setObjectName("tab2") self.tabs.addTab(self.tab2, "My Media") self.tab3 = QWidget() self.tab3.setObjectName("tab3") self.tab3.setSizePolicy(*FIX_FIX) self.grid_layout2 = QGridLayout(self.tab3) self.grid_layout2.setHorizontalSpacing(0) self.grid_layout2.setVerticalSpacing(3) self.grid_layout2.setContentsMargins(3, -1, 3, -1) self.server_folder = QLineEdit(self.tab3) self.server_folder.setObjectName("server_folder") self.grid_layout2.addWidget(self.server_folder, 0, 0, 1, 3) self.srv_browse = QPushButton("BROWSE", self.tab3) self.srv_browse.setObjectName("srv_browse") self.srv_browse.setStyleSheet("background: transparent;\n" " color: #4d4940;\n" " font-size: 8pt;\n" " font-weight: 450;\n" " padding: 6px;\n") self.grid_layout2.addWidget(self.srv_browse, 0, 3, 1, 1) self.back_button = QPushButton("", self.tab3) self.back_button.setObjectName("back_button") self.back_button.setSizePolicy(*FIX_FIX) self.back_button.setMaximumSize(SEVENTY_FIVE) self.back_button.setCursor(QCursor(Qt.PointingHandCursor)) self.back_button.setStyleSheet("border: 0;\n" "background: transparent;") icon = QIcon() icon.addFile(":/newPrefix/back_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.back_button.setIcon(icon) self.back_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.back_button, 1, 0, 1, 1) self.play_button = QPushButton("", self.tab3) self.play_button.setObjectName("play_button") self.play_button.setSizePolicy(*FIX_FIX) self.play_button.setMaximumSize(SEVENTY_FIVE) self.play_button.setCursor(QCursor(Qt.PointingHandCursor)) self.play_button.setStyleSheet("border: 0;\n" "background: transparent;") icon1 = QIcon() icon1.addFile(":/newPrefix/play_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.play_button.setIcon(icon1) self.play_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.play_button, 1, 1, 1, 1) self.stop_button = QPushButton("", self.tab3) self.stop_button.setObjectName("stop_button") self.stop_button.setSizePolicy(*FIX_FIX) self.stop_button.setMaximumSize(SEVENTY_FIVE) self.stop_button.setCursor(QCursor(Qt.PointingHandCursor)) self.stop_button.setStyleSheet("border: 0;\n" "background: transparent;") icon2 = QIcon() icon2.addFile(":/newPrefix/stop_button.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.stop_button.setIcon(icon2) self.stop_button.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.stop_button, 1, 2, 1, 1) self.fast_forward = QPushButton("", self.tab3) self.fast_forward.setObjectName("fast_forward") self.fast_forward.setSizePolicy(*FIX_FIX) self.fast_forward.setMaximumSize(SEVENTY_FIVE) self.fast_forward.setCursor(QCursor(Qt.PointingHandCursor)) self.fast_forward.setStyleSheet("border: 0;\n" "background: transparent;") icon3 = QIcon() icon3.addFile(":/newPrefix/fast_forward.png", SIXTY_FOUR, QIcon.Normal, QIcon.Off) self.fast_forward.setIcon(icon3) self.fast_forward.setIconSize(SIXTY_FOUR) self.grid_layout2.addWidget(self.fast_forward, 1, 3, 1, 1) self.tabs.addTab(self.tab3, "Server Media") self.grid_layout.addWidget(self.tabs, 4, 1, 1, 2) main_window.setCentralWidget(self.centralwidget) self.statusbar = QStatusBar(main_window) self.statusbar.setObjectName("statusbar") self.statusbar.setEnabled(True) self.statusbar.setStyleSheet("margin-bottom: 5px;") self.statusbar.setSizePolicy(*EXP_FIX) self.statusbar.setMinimumSize(INFINITE, 30) self.statusbar.setMaximumSize(INFINITE, 30) self.statusbar.setSizeGripEnabled(False) main_window.setStatusBar(self.statusbar) self.menubar.addAction(self.file_menu.menuAction()) self.menubar.addAction(self.server_menu.menuAction()) self.menubar.addAction(self.options_menu.menuAction()) self.menubar.addAction(self.media_menu.menuAction()) self.file_menu.addAction(self.exit) self.server_menu.addAction(self.start_server) self.server_menu.addAction(self.connect_server) self.server_menu.addAction(self.kill_server) self.options_menu.addAction(self.options) self.media_menu.addAction(self.start_webcam) self.exit.triggered.connect(main_window.close) self.tabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(main_window) self.exit.setStatusTip("Exit the program.") self.start_server.setStatusTip("Initialize a local server instance.") self.connect_server.setStatusTip("Connect to a remote server.") self.kill_server.setStatusTip("Shut down a running local server.") self.options.setStatusTip("Open the options menu.") self.start_webcam.setStatusTip("Start webcam feed.") self.tooltip = QLabel("", self.statusbar) tooltip_policy = QSizePolicy(*EXP_FIX) tooltip_policy.setHorizontalStretch(100) self.tooltip.setSizePolicy(tooltip_policy) self.tooltip.setMinimumSize(INFINITE, 26) self.tooltip.setMaximumSize(INFINITE, 26) self.server_status = QLabel("Server status:", self.statusbar) self.server_status.setSizePolicy(*FIX_FIX) self.server_status.setMinimumSize(300, 26) self.server_status.setMaximumSize(300, 26) self.client_status = QLabel("Client status:", self.statusbar) self.client_status.setSizePolicy(*FIX_FIX) self.client_status.setMinimumSize(302, 26) self.client_status.setMaximumSize(302, 26) self.statusbar.addPermanentWidget(self.tooltip) self.statusbar.addPermanentWidget(self.server_status) self.statusbar.addPermanentWidget(self.client_status) self.tooltip.setStyleSheet(SUNKEN + "margin-left: 4px;\ margin-right: 0px;") self.client_status.setStyleSheet(SUNKEN + "margin-right: 7px;") self.server_status.setStyleSheet(SUNKEN + "margin-right: 2px;\ margin-left: 2px;") self.statusbar.messageChanged.connect(main_window.status_tip)
class Ui_LoginFNSDialog(object): def setupUi(self, LoginFNSDialog): if not LoginFNSDialog.objectName(): LoginFNSDialog.setObjectName(u"LoginFNSDialog") LoginFNSDialog.resize(400, 500) self.verticalLayout_3 = QVBoxLayout(LoginFNSDialog) self.verticalLayout_3.setSpacing(6) self.verticalLayout_3.setObjectName(u"verticalLayout_3") self.verticalLayout_3.setContentsMargins(2, 2, 2, 2) self.LoginMethodTabs = QTabWidget(LoginFNSDialog) self.LoginMethodTabs.setObjectName(u"LoginMethodTabs") self.LoginSMSTab = QWidget() self.LoginSMSTab.setObjectName(u"LoginSMSTab") self.verticalLayout_7 = QVBoxLayout(self.LoginSMSTab) self.verticalLayout_7.setSpacing(2) self.verticalLayout_7.setObjectName(u"verticalLayout_7") self.verticalLayout_7.setContentsMargins(0, 0, 0, 0) self.PhoneNumberFrame = QFrame(self.LoginSMSTab) self.PhoneNumberFrame.setObjectName(u"PhoneNumberFrame") self.PhoneNumberFrame.setFrameShape(QFrame.NoFrame) self.PhoneNumberFrame.setFrameShadow(QFrame.Plain) self.formLayout_2 = QFormLayout(self.PhoneNumberFrame) self.formLayout_2.setObjectName(u"formLayout_2") self.formLayout_2.setContentsMargins(6, -1, 6, 0) self.PhoneLbl = QLabel(self.PhoneNumberFrame) self.PhoneLbl.setObjectName(u"PhoneLbl") self.formLayout_2.setWidget(0, QFormLayout.LabelRole, self.PhoneLbl) self.PhoneNumberEdit = QLineEdit(self.PhoneNumberFrame) self.PhoneNumberEdit.setObjectName(u"PhoneNumberEdit") self.PhoneNumberEdit.setInputMask(u"+7-999-999-99-99;_") self.formLayout_2.setWidget(0, QFormLayout.FieldRole, self.PhoneNumberEdit) self.verticalLayout_7.addWidget(self.PhoneNumberFrame) self.CodeButtonFrame = QFrame(self.LoginSMSTab) self.CodeButtonFrame.setObjectName(u"CodeButtonFrame") self.CodeButtonFrame.setFrameShape(QFrame.NoFrame) self.CodeButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_8 = QVBoxLayout(self.CodeButtonFrame) self.verticalLayout_8.setObjectName(u"verticalLayout_8") self.verticalLayout_8.setContentsMargins(0, 6, 0, 0) self.GetCodeBtn = QPushButton(self.CodeButtonFrame) self.GetCodeBtn.setObjectName(u"GetCodeBtn") sizePolicy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.GetCodeBtn.sizePolicy().hasHeightForWidth()) self.GetCodeBtn.setSizePolicy(sizePolicy) self.verticalLayout_8.addWidget(self.GetCodeBtn, 0, Qt.AlignHCenter) self.verticalLayout_7.addWidget(self.CodeButtonFrame) self.CodeFrame = QFrame(self.LoginSMSTab) self.CodeFrame.setObjectName(u"CodeFrame") self.CodeFrame.setFrameShape(QFrame.NoFrame) self.CodeFrame.setFrameShadow(QFrame.Plain) self.formLayout_3 = QFormLayout(self.CodeFrame) self.formLayout_3.setObjectName(u"formLayout_3") self.formLayout_3.setContentsMargins(6, -1, 6, 0) self.CodeLbl = QLabel(self.CodeFrame) self.CodeLbl.setObjectName(u"CodeLbl") self.formLayout_3.setWidget(0, QFormLayout.LabelRole, self.CodeLbl) self.CodeEdit = QLineEdit(self.CodeFrame) self.CodeEdit.setObjectName(u"CodeEdit") self.formLayout_3.setWidget(0, QFormLayout.FieldRole, self.CodeEdit) self.verticalLayout_7.addWidget(self.CodeFrame) self.SMSButtonFrame = QFrame(self.LoginSMSTab) self.SMSButtonFrame.setObjectName(u"SMSButtonFrame") sizePolicy1 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) sizePolicy1.setHorizontalStretch(0) sizePolicy1.setVerticalStretch(0) sizePolicy1.setHeightForWidth( self.SMSButtonFrame.sizePolicy().hasHeightForWidth()) self.SMSButtonFrame.setSizePolicy(sizePolicy1) self.SMSButtonFrame.setFrameShape(QFrame.NoFrame) self.SMSButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_10 = QVBoxLayout(self.SMSButtonFrame) self.verticalLayout_10.setObjectName(u"verticalLayout_10") self.verticalLayout_10.setContentsMargins(0, 0, 0, 6) self.frame = QFrame(self.SMSButtonFrame) self.frame.setObjectName(u"frame") sizePolicy1.setHeightForWidth( self.frame.sizePolicy().hasHeightForWidth()) self.frame.setSizePolicy(sizePolicy1) self.frame.setFrameShape(QFrame.NoFrame) self.frame.setFrameShadow(QFrame.Plain) self.verticalLayout_9 = QVBoxLayout(self.frame) self.verticalLayout_9.setObjectName(u"verticalLayout_9") self.SMSLoginBtn = QPushButton(self.frame) self.SMSLoginBtn.setObjectName(u"SMSLoginBtn") sizePolicy.setHeightForWidth( self.SMSLoginBtn.sizePolicy().hasHeightForWidth()) self.SMSLoginBtn.setSizePolicy(sizePolicy) self.verticalLayout_9.addWidget(self.SMSLoginBtn, 0, Qt.AlignHCenter | Qt.AlignTop) self.verticalLayout_10.addWidget(self.frame) self.line = QFrame(self.SMSButtonFrame) self.line.setObjectName(u"line") self.line.setFrameShape(QFrame.HLine) self.line.setFrameShadow(QFrame.Sunken) self.verticalLayout_10.addWidget(self.line) self.SMSCloseBtn = QPushButton(self.SMSButtonFrame) self.SMSCloseBtn.setObjectName(u"SMSCloseBtn") sizePolicy.setHeightForWidth( self.SMSCloseBtn.sizePolicy().hasHeightForWidth()) self.SMSCloseBtn.setSizePolicy(sizePolicy) self.verticalLayout_10.addWidget(self.SMSCloseBtn, 0, Qt.AlignHCenter) self.verticalLayout_7.addWidget(self.SMSButtonFrame) self.LoginMethodTabs.addTab(self.LoginSMSTab, "") self.LoginPasswordTab = QWidget() self.LoginPasswordTab.setObjectName(u"LoginPasswordTab") self.verticalLayout = QVBoxLayout(self.LoginPasswordTab) self.verticalLayout.setSpacing(2) self.verticalLayout.setObjectName(u"verticalLayout") self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.LoginDataFrame = QFrame(self.LoginPasswordTab) self.LoginDataFrame.setObjectName(u"LoginDataFrame") sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy2.setHorizontalStretch(0) sizePolicy2.setVerticalStretch(0) sizePolicy2.setHeightForWidth( self.LoginDataFrame.sizePolicy().hasHeightForWidth()) self.LoginDataFrame.setSizePolicy(sizePolicy2) self.LoginDataFrame.setFrameShape(QFrame.NoFrame) self.LoginDataFrame.setFrameShadow(QFrame.Plain) self.formLayout = QFormLayout(self.LoginDataFrame) self.formLayout.setObjectName(u"formLayout") self.formLayout.setHorizontalSpacing(6) self.formLayout.setContentsMargins(6, -1, 6, 0) self.InnLbl = QLabel(self.LoginDataFrame) self.InnLbl.setObjectName(u"InnLbl") self.formLayout.setWidget(0, QFormLayout.LabelRole, self.InnLbl) self.InnEdit = QLineEdit(self.LoginDataFrame) self.InnEdit.setObjectName(u"InnEdit") self.formLayout.setWidget(0, QFormLayout.FieldRole, self.InnEdit) self.PasswordLbl = QLabel(self.LoginDataFrame) self.PasswordLbl.setObjectName(u"PasswordLbl") self.formLayout.setWidget(1, QFormLayout.LabelRole, self.PasswordLbl) self.PasswordEdit = QLineEdit(self.LoginDataFrame) self.PasswordEdit.setObjectName(u"PasswordEdit") self.PasswordEdit.setEchoMode(QLineEdit.Password) self.formLayout.setWidget(1, QFormLayout.FieldRole, self.PasswordEdit) self.verticalLayout.addWidget(self.LoginDataFrame) self.FNSButtonFrame = QFrame(self.LoginPasswordTab) self.FNSButtonFrame.setObjectName(u"FNSButtonFrame") self.FNSButtonFrame.setFrameShape(QFrame.NoFrame) self.FNSButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_4 = QVBoxLayout(self.FNSButtonFrame) self.verticalLayout_4.setSpacing(6) self.verticalLayout_4.setObjectName(u"verticalLayout_4") self.verticalLayout_4.setContentsMargins(0, 0, 0, 6) self.FNSLoginFrame = QFrame(self.FNSButtonFrame) self.FNSLoginFrame.setObjectName(u"FNSLoginFrame") sizePolicy1.setHeightForWidth( self.FNSLoginFrame.sizePolicy().hasHeightForWidth()) self.FNSLoginFrame.setSizePolicy(sizePolicy1) self.FNSLoginFrame.setFrameShape(QFrame.NoFrame) self.FNSLoginFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_5 = QVBoxLayout(self.FNSLoginFrame) self.verticalLayout_5.setObjectName(u"verticalLayout_5") self.FNSLoginBtn = QPushButton(self.FNSLoginFrame) self.FNSLoginBtn.setObjectName(u"FNSLoginBtn") sizePolicy.setHeightForWidth( self.FNSLoginBtn.sizePolicy().hasHeightForWidth()) self.FNSLoginBtn.setSizePolicy(sizePolicy) self.verticalLayout_5.addWidget(self.FNSLoginBtn, 0, Qt.AlignHCenter | Qt.AlignTop) self.verticalLayout_4.addWidget(self.FNSLoginFrame) self.FNSSplitLine = QFrame(self.FNSButtonFrame) self.FNSSplitLine.setObjectName(u"FNSSplitLine") self.FNSSplitLine.setFrameShape(QFrame.HLine) self.FNSSplitLine.setFrameShadow(QFrame.Sunken) self.verticalLayout_4.addWidget(self.FNSSplitLine) self.FNSCloseBtn = QPushButton(self.FNSButtonFrame) self.FNSCloseBtn.setObjectName(u"FNSCloseBtn") sizePolicy.setHeightForWidth( self.FNSCloseBtn.sizePolicy().hasHeightForWidth()) self.FNSCloseBtn.setSizePolicy(sizePolicy) self.verticalLayout_4.addWidget(self.FNSCloseBtn, 0, Qt.AlignHCenter) self.verticalLayout.addWidget(self.FNSButtonFrame) self.LoginMethodTabs.addTab(self.LoginPasswordTab, "") self.ESIATab = QWidget() self.ESIATab.setObjectName(u"ESIATab") self.verticalLayout_2 = QVBoxLayout(self.ESIATab) self.verticalLayout_2.setSpacing(2) self.verticalLayout_2.setObjectName(u"verticalLayout_2") self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.ESIAWebView = QWebEngineView(self.ESIATab) self.ESIAWebView.setObjectName(u"ESIAWebView") sizePolicy1.setHeightForWidth( self.ESIAWebView.sizePolicy().hasHeightForWidth()) self.ESIAWebView.setSizePolicy(sizePolicy1) self.ESIAWebView.setUrl(QUrl(u"about:blank")) self.verticalLayout_2.addWidget(self.ESIAWebView) self.ESIAButtonFrame = QFrame(self.ESIATab) self.ESIAButtonFrame.setObjectName(u"ESIAButtonFrame") self.ESIAButtonFrame.setFrameShape(QFrame.NoFrame) self.ESIAButtonFrame.setFrameShadow(QFrame.Plain) self.verticalLayout_6 = QVBoxLayout(self.ESIAButtonFrame) self.verticalLayout_6.setObjectName(u"verticalLayout_6") self.verticalLayout_6.setContentsMargins(0, 0, 0, 6) self.ESIASplitLine = QFrame(self.ESIAButtonFrame) self.ESIASplitLine.setObjectName(u"ESIASplitLine") self.ESIASplitLine.setFrameShape(QFrame.HLine) self.ESIASplitLine.setFrameShadow(QFrame.Sunken) self.verticalLayout_6.addWidget(self.ESIASplitLine) self.ESIACloseBtn = QPushButton(self.ESIAButtonFrame) self.ESIACloseBtn.setObjectName(u"ESIACloseBtn") sizePolicy.setHeightForWidth( self.ESIACloseBtn.sizePolicy().hasHeightForWidth()) self.ESIACloseBtn.setSizePolicy(sizePolicy) self.verticalLayout_6.addWidget(self.ESIACloseBtn, 0, Qt.AlignHCenter) self.verticalLayout_2.addWidget(self.ESIAButtonFrame) self.LoginMethodTabs.addTab(self.ESIATab, "") self.verticalLayout_3.addWidget(self.LoginMethodTabs) self.retranslateUi(LoginFNSDialog) self.FNSCloseBtn.clicked.connect(LoginFNSDialog.close) self.ESIACloseBtn.clicked.connect(LoginFNSDialog.close) self.SMSCloseBtn.clicked.connect(LoginFNSDialog.close) self.LoginMethodTabs.setCurrentIndex(0) QMetaObject.connectSlotsByName(LoginFNSDialog) # setupUi def retranslateUi(self, LoginFNSDialog): LoginFNSDialog.setWindowTitle( QCoreApplication.translate("LoginFNSDialog", u"Authorization FNS", None)) self.PhoneLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"Phone number:", None)) self.GetCodeBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Send SMS with code", None)) self.CodeLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"Code from SMS:", None)) self.SMSLoginBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Login", None)) self.SMSCloseBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Close", None)) self.LoginMethodTabs.setTabText( self.LoginMethodTabs.indexOf(self.LoginSMSTab), QCoreApplication.translate("LoginFNSDialog", u"SMS Login", None)) self.InnLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"INN:", None)) self.PasswordLbl.setText( QCoreApplication.translate("LoginFNSDialog", u"Password:"******"LoginFNSDialog", u"Login", None)) self.FNSCloseBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Close", None)) self.LoginMethodTabs.setTabText( self.LoginMethodTabs.indexOf(self.LoginPasswordTab), QCoreApplication.translate("LoginFNSDialog", u"FNS Login", None)) self.ESIACloseBtn.setText( QCoreApplication.translate("LoginFNSDialog", u"Close", None)) self.LoginMethodTabs.setTabText( self.LoginMethodTabs.indexOf(self.ESIATab), QCoreApplication.translate("LoginFNSDialog", u"ESIA Login", None))
class LoginScreen(QDialog): Sg_login_success = Signal() Sg_login_failure = Signal() def __init__(self, model: NetworkModel, parent=None): super(LoginScreen, self).__init__(parent) # gestione modello self.model = model # inizializzazione layout self.layout = QVBoxLayout() # label e field self.login_title = QLabel(self) self.login_title.setText("Effettua l'accesso") self.login_title.setAccessibleName('LoginTitle') self.login_label = QLabel(self) self.login_label.setText('Username') self.login_label.setAccessibleName('LoginLabel') self.user_field = QLineEdit(self) self.psw_label = QLabel(self) self.psw_label.setText('Password') self.psw_label.setAccessibleName('LoginLabel') self.psw_field = QLineEdit(self) self.psw_field.setEchoMode(QLineEdit.Password) self.user_field.setText(self.model.get_username()) # pulsante invio form self.login_button = QPushButton(self) self.login_button.setText('Login') # gestione layout self.layout.setAlignment(Qt.AlignCenter) self.layout.addWidget(self.login_title) self.layout.addWidget(self.login_label) self.layout.addWidget(self.user_field) self.layout.addWidget(self.psw_label) self.layout.addWidget(self.psw_field) self.layout.addWidget(self.login_button) self.setLayout(self.layout) setQss("style.qss", self) @Slot() def Sl_model_changed(self): is_logged = self.model.is_logged() if is_logged: self.Sg_login_success.emit() def get_user(self) -> str: return self.user_field.text() def get_psw(self) -> str: return self.psw_field.text() @Slot() def Sl_login_fail(self): self.Sg_login_failure.emit()
class Ui_Dialog(object): def setupUi(self, Dialog): if not Dialog.objectName(): Dialog.setObjectName(u"Dialog") Dialog.resize(400, 150) self.verticalLayout = QVBoxLayout(Dialog) self.verticalLayout.setObjectName(u"verticalLayout") self.gridLayout = QGridLayout() self.gridLayout.setObjectName(u"gridLayout") self.label_3 = QLabel(Dialog) self.label_3.setObjectName(u"label_3") self.gridLayout.addWidget(self.label_3, 1, 0, 1, 1) self.label = QLabel(Dialog) self.label.setObjectName(u"label") self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.txtName = QLineEdit(Dialog) self.txtName.setObjectName(u"txtName") self.gridLayout.addWidget(self.txtName, 0, 1, 1, 1) self.txtPassword2 = QLineEdit(Dialog) self.txtPassword2.setObjectName(u"txtPassword2") self.txtPassword2.setEchoMode(QLineEdit.Password) self.gridLayout.addWidget(self.txtPassword2, 2, 1, 1, 1) self.btnFileChooser = QPushButton(Dialog) self.btnFileChooser.setObjectName(u"btnFileChooser") self.btnFileChooser.setMinimumSize(QSize(30, 0)) self.btnFileChooser.setMaximumSize(QSize(30, 16777215)) self.gridLayout.addWidget(self.btnFileChooser, 3, 2, 1, 1) self.label_4 = QLabel(Dialog) self.label_4.setObjectName(u"label_4") self.gridLayout.addWidget(self.label_4, 2, 0, 1, 1) self.txtPassword1 = QLineEdit(Dialog) self.txtPassword1.setObjectName(u"txtPassword1") self.txtPassword1.setEchoMode(QLineEdit.Password) self.gridLayout.addWidget(self.txtPassword1, 1, 1, 1, 1) self.label_2 = QLabel(Dialog) self.label_2.setObjectName(u"label_2") self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1) self.txtPath = QLineEdit(Dialog) self.txtPath.setObjectName(u"txtPath") self.gridLayout.addWidget(self.txtPath, 3, 1, 1, 1) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName(u"horizontalLayout") self.horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(self.horizontalSpacer) self.btnOk = QPushButton(Dialog) self.btnOk.setObjectName(u"btnOk") self.horizontalLayout.addWidget(self.btnOk) self.btnCancel = QPushButton(Dialog) self.btnCancel.setObjectName(u"btnCancel") self.horizontalLayout.addWidget(self.btnCancel) self.gridLayout.addLayout(self.horizontalLayout, 4, 0, 1, 3) self.verticalLayout.addLayout(self.gridLayout) QWidget.setTabOrder(self.txtName, self.txtPassword1) QWidget.setTabOrder(self.txtPassword1, self.txtPassword2) QWidget.setTabOrder(self.txtPassword2, self.txtPath) QWidget.setTabOrder(self.txtPath, self.btnFileChooser) QWidget.setTabOrder(self.btnFileChooser, self.btnOk) QWidget.setTabOrder(self.btnOk, self.btnCancel) self.retranslateUi(Dialog) QMetaObject.connectSlotsByName(Dialog) # setupUi def retranslateUi(self, Dialog): Dialog.setWindowTitle( QCoreApplication.translate("Dialog", u"Dialog", None)) self.label_3.setText( QCoreApplication.translate("Dialog", u"\u5bc6\u78011", None)) self.label.setText( QCoreApplication.translate("Dialog", u"\u540d\u79f0", None)) self.btnFileChooser.setText( QCoreApplication.translate("Dialog", u"...", None)) self.label_4.setText( QCoreApplication.translate("Dialog", u"\u5bc6\u78012", None)) self.label_2.setText( QCoreApplication.translate("Dialog", u"\u8def\u5f84", None)) self.btnOk.setText( QCoreApplication.translate("Dialog", u"\u4fdd\u5b58", None)) self.btnCancel.setText( QCoreApplication.translate("Dialog", u"\u53d6\u6d88", None))
class TextQueue_Ui(QWidget): def __init__(self, persepolis_setting): super().__init__() self.persepolis_setting = persepolis_setting icons = ':/' + \ str(self.persepolis_setting.value('settings/icons')) + '/' # add support for other languages locale = str(self.persepolis_setting.value('settings/locale')) QLocale.setDefault(QLocale(locale)) self.translator = QTranslator() if self.translator.load(':/translations/locales/ui_' + locale, 'ts'): QCoreApplication.installTranslator(self.translator) # set ui direction ui_direction = self.persepolis_setting.value('ui_direction') if ui_direction == 'rtl': self.setLayoutDirection(Qt.RightToLeft) elif ui_direction in 'ltr': self.setLayoutDirection(Qt.LeftToRight) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) window_verticalLayout = QVBoxLayout() self.setLayout(window_verticalLayout) # queue_tabWidget self.queue_tabWidget = QTabWidget(self) window_verticalLayout.addWidget(self.queue_tabWidget) # links_tab self.links_tab = QWidget() links_tab_verticalLayout = QVBoxLayout(self.links_tab) # link table self.links_table = QTableWidget(self.links_tab) links_tab_verticalLayout.addWidget(self.links_table) self.links_table.setSelectionBehavior(QAbstractItemView.SelectRows) self.links_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.links_table.verticalHeader().hide() self.links_table.setColumnCount(3) links_table_header_labels = [ 'File Name', 'Download Link', 'dictionary' ] self.links_table.setHorizontalHeaderLabels(links_table_header_labels) self.links_table.setColumnHidden(2, True) self.links_table.horizontalHeader().setSectionResizeMode( QHeaderView.ResizeMode.Stretch) self.links_table.horizontalHeader().setStretchLastSection(True) # add_queue add_queue_horizontalLayout = QHBoxLayout() self.select_all_pushButton = QPushButton(self.links_tab) add_queue_horizontalLayout.addWidget(self.select_all_pushButton) self.deselect_all_pushButton = QPushButton(self.links_tab) add_queue_horizontalLayout.addWidget(self.deselect_all_pushButton) add_queue_horizontalLayout.addStretch(1) self.add_queue_label = QLabel(self.links_tab) add_queue_horizontalLayout.addWidget(self.add_queue_label) self.add_queue_comboBox = QComboBox(self.links_tab) add_queue_horizontalLayout.addWidget(self.add_queue_comboBox) links_tab_verticalLayout.addLayout(add_queue_horizontalLayout) links_tab_verticalLayout.addStretch(1) self.queue_tabWidget.addTab(self.links_tab, "") # options_tab self.options_tab = QWidget() options_tab_verticalLayout = QVBoxLayout(self.options_tab) # proxy proxy_verticalLayout = QVBoxLayout() self.proxy_checkBox = QCheckBox(self.options_tab) proxy_verticalLayout.addWidget(self.proxy_checkBox) self.proxy_frame = QFrame(self.options_tab) self.proxy_frame.setFrameShape(QFrame.StyledPanel) self.proxy_frame.setFrameShadow(QFrame.Raised) proxy_gridLayout = QGridLayout(self.proxy_frame) self.ip_lineEdit = QLineEdit(self.proxy_frame) self.ip_lineEdit.setInputMethodHints(Qt.ImhNone) proxy_gridLayout.addWidget(self.ip_lineEdit, 0, 1, 1, 1) self.proxy_pass_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.proxy_pass_label, 2, 2, 1, 1) self.proxy_pass_lineEdit = QLineEdit(self.proxy_frame) self.proxy_pass_lineEdit.setEchoMode(QLineEdit.Password) proxy_gridLayout.addWidget(self.proxy_pass_lineEdit, 2, 3, 1, 1) self.ip_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.ip_label, 0, 0, 1, 1) self.proxy_user_lineEdit = QLineEdit(self.proxy_frame) proxy_gridLayout.addWidget(self.proxy_user_lineEdit, 0, 3, 1, 1) self.proxy_user_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.proxy_user_label, 0, 2, 1, 1) self.port_label = QLabel(self.proxy_frame) proxy_gridLayout.addWidget(self.port_label, 2, 0, 1, 1) self.port_spinBox = QSpinBox(self.proxy_frame) self.port_spinBox.setMaximum(9999) self.port_spinBox.setSingleStep(1) proxy_gridLayout.addWidget(self.port_spinBox, 2, 1, 1, 1) proxy_verticalLayout.addWidget(self.proxy_frame) options_tab_verticalLayout.addLayout(proxy_verticalLayout) # download Username & Password download_horizontalLayout = QHBoxLayout() download_horizontalLayout.setContentsMargins(-1, 10, -1, -1) download_verticalLayout = QVBoxLayout() self.download_checkBox = QCheckBox(self.options_tab) download_verticalLayout.addWidget(self.download_checkBox) self.download_frame = QFrame(self.options_tab) self.download_frame.setFrameShape(QFrame.StyledPanel) self.download_frame.setFrameShadow(QFrame.Raised) download_gridLayout = QGridLayout(self.download_frame) self.download_user_lineEdit = QLineEdit(self.download_frame) download_gridLayout.addWidget(self.download_user_lineEdit, 0, 1, 1, 1) self.download_user_label = QLabel(self.download_frame) download_gridLayout.addWidget(self.download_user_label, 0, 0, 1, 1) self.download_pass_label = QLabel(self.download_frame) download_gridLayout.addWidget(self.download_pass_label, 1, 0, 1, 1) self.download_pass_lineEdit = QLineEdit(self.download_frame) self.download_pass_lineEdit.setEchoMode(QLineEdit.Password) download_gridLayout.addWidget(self.download_pass_lineEdit, 1, 1, 1, 1) download_verticalLayout.addWidget(self.download_frame) download_horizontalLayout.addLayout(download_verticalLayout) # select folder self.folder_frame = QFrame(self.options_tab) self.folder_frame.setFrameShape(QFrame.StyledPanel) self.folder_frame.setFrameShadow(QFrame.Raised) folder_gridLayout = QGridLayout(self.folder_frame) self.download_folder_lineEdit = QLineEdit(self.folder_frame) folder_gridLayout.addWidget(self.download_folder_lineEdit, 2, 0, 1, 1) self.folder_pushButton = QPushButton(self.folder_frame) folder_gridLayout.addWidget(self.folder_pushButton, 3, 0, 1, 1) self.folder_pushButton.setIcon(QIcon(icons + 'folder')) self.folder_checkBox = QCheckBox(self.folder_frame) folder_gridLayout.addWidget(self.folder_checkBox) self.folder_label = QLabel(self.folder_frame) self.folder_label.setAlignment(Qt.AlignCenter) folder_gridLayout.addWidget(self.folder_label, 1, 0, 1, 1) download_horizontalLayout.addWidget(self.folder_frame) options_tab_verticalLayout.addLayout(download_horizontalLayout) self.queue_tabWidget.addTab(self.options_tab, '') # limit Speed limit_verticalLayout = QVBoxLayout() self.limit_checkBox = QCheckBox(self.options_tab) limit_verticalLayout.addWidget(self.limit_checkBox) self.limit_frame = QFrame(self.options_tab) self.limit_frame.setFrameShape(QFrame.StyledPanel) self.limit_frame.setFrameShadow(QFrame.Raised) limit_horizontalLayout = QHBoxLayout(self.limit_frame) self.limit_spinBox = QSpinBox(self.limit_frame) self.limit_spinBox.setMinimum(1) self.limit_spinBox.setMaximum(1023) limit_horizontalLayout.addWidget(self.limit_spinBox) self.limit_comboBox = QComboBox(self.limit_frame) self.limit_comboBox.addItem("KiB/S") self.limit_comboBox.addItem("MiB/S") limit_horizontalLayout.addWidget(self.limit_comboBox) limit_verticalLayout.addWidget(self.limit_frame) limit_connections_horizontalLayout = QHBoxLayout() limit_connections_horizontalLayout.addLayout(limit_verticalLayout) # number of connections connections_horizontalLayout = QHBoxLayout() connections_horizontalLayout.setContentsMargins(-1, 10, -1, -1) self.connections_frame = QFrame(self.options_tab) self.connections_frame.setFrameShape(QFrame.StyledPanel) self.connections_frame.setFrameShadow(QFrame.Raised) horizontalLayout_3 = QHBoxLayout(self.connections_frame) self.connections_label = QLabel(self.connections_frame) horizontalLayout_3.addWidget(self.connections_label) self.connections_spinBox = QSpinBox(self.connections_frame) self.connections_spinBox.setMinimum(1) self.connections_spinBox.setMaximum(16) self.connections_spinBox.setProperty("value", 16) horizontalLayout_3.addWidget(self.connections_spinBox) connections_horizontalLayout.addWidget(self.connections_frame) limit_connections_horizontalLayout.addLayout( connections_horizontalLayout) options_tab_verticalLayout.addLayout( limit_connections_horizontalLayout) options_tab_verticalLayout.addStretch(1) # buttons buttons_horizontalLayout = QHBoxLayout() buttons_horizontalLayout.addStretch(1) # ok_pushButton self.ok_pushButton = QPushButton(self) self.ok_pushButton.setIcon(QIcon(icons + 'ok')) buttons_horizontalLayout.addWidget(self.ok_pushButton) # cancel_pushButton self.cancel_pushButton = QPushButton(self) self.cancel_pushButton.setIcon(QIcon(icons + 'remove')) buttons_horizontalLayout.addWidget(self.cancel_pushButton) window_verticalLayout.addLayout(buttons_horizontalLayout) # labels self.setWindowTitle( QCoreApplication.translate("text_ui_tr", "Persepolis Download Manager")) self.queue_tabWidget.setTabText( self.queue_tabWidget.indexOf(self.links_tab), QCoreApplication.translate("text_ui_tr", 'Links')) self.queue_tabWidget.setTabText( self.queue_tabWidget.indexOf(self.options_tab), QCoreApplication.translate("text_ui_tr", 'Download Options')) self.select_all_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'Select All')) self.deselect_all_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'Deselect All')) self.add_queue_label.setText( QCoreApplication.translate("text_ui_tr", 'Add to queue: ')) self.proxy_checkBox.setText( QCoreApplication.translate("text_ui_tr", 'Proxy')) self.proxy_pass_label.setText( QCoreApplication.translate("text_ui_tr", "Proxy password: "******"text_ui_tr", "IP:")) self.proxy_user_label.setText( QCoreApplication.translate("text_ui_tr", "Proxy username: "******"text_ui_tr", "Port:")) self.download_checkBox.setText( QCoreApplication.translate("text_ui_tr", "Download username and password")) self.download_user_label.setText( QCoreApplication.translate("text_ui_tr", "Download username: "******"text_ui_tr", "Download password: "******"text_ui_tr", "Change Download Folder")) self.folder_checkBox.setText( QCoreApplication.translate("addlink_ui_tr", "Remember this path")) self.folder_label.setText( QCoreApplication.translate("text_ui_tr", "Download folder: ")) self.limit_checkBox.setText( QCoreApplication.translate("text_ui_tr", "Limit speed")) self.connections_label.setText( QCoreApplication.translate("text_ui_tr", "Number of connections:")) self.ok_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'OK')) self.cancel_pushButton.setText( QCoreApplication.translate("text_ui_tr", 'Cancel'))