def login(self): username = self.user_field.text() password = self.pass_field.text() login_endpoint = self.api_endpoint + "/Login" login_request = requests.post(login_endpoint, data={ 'username': username, 'password': password }) login_response = json.loads(login_request.text) if login_response: login_status = login_response["status"] login_message = login_response["message"] if login_status == 200: self.close() self.main_window = MainWindow() self.main_window.show() elif login_status == 100: self.error_label.setText('Incorrect username or password') self.error_label.show() else: self.error_label.show() else: self.error_label.setText('Please try again.') self.error_label.show()
def main(): app = QtGui.QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() return app.exec_()
def main(): app = QtGui.QApplication(sys.argv) ex = MainWindow() ex.show() sys.exit(app.exec_()) return
def __init__(self, parent=None): super(StartWindow, self).__init__() self.ui = startWnd.Ui_StartForm() self.ui.setupUi(self) self.mw = MainWindow() self.mw.set_start_wnd(self) self.ui.pbStart.clicked.connect(self.on_start) self.ui.pbExit.clicked.connect(self.on_close_clicked)
def build(self): from main import MainWindow from core.plugin_wrapper import PluginWrapper plugin_wrapper = PluginWrapper('plugins.processing.hotkey') hotkey=Hotkey() app = MainWindow() window = app.build() app.plugins['hotkey']={ 'type':'processing','disabled':False,'instance':hotkey,'wrapper':plugin_wrapper} return window
def build(self): '''Testing by take this middleware as a plugin of main program''' from main import MainWindow from core.plugin_wrapper import PluginWrapper plugin_wrapper = PluginWrapper('plugins.processing.widget_handler') app = MainWindow() window = app.build() widget_handler = WidgetHandler() app.plugins['widget_handler'] = { 'type': 'processing', 'disabled': False, 'wrapper': plugin_wrapper, 'instance': widget_handler } return window
def __init__(self): """ Create the windows and set some variables. """ self.app = MyApp(False) self.frame = MainWindow(None, "Region-Fixer-GUI") # NOTE: It's very important that the MainWindow is parent of all others windows self.backups = BackupsWindow(self.frame, "Backups") self.about = AboutWindow(self.frame, "About") self.frame.backups = self.backups self.frame.about = self.about self.frame.help = HelpWindow(self.frame, "Help") # self.frame.error = ErrorWindow(self.frame, "Error") self.app.main_window = self.frame
def main(): ''':return:''' app = QApplication(sys.argv) mainWindow = MainWindow() mainWnd = FramelessWindow() mainWnd.setWindowTitle('欢迎窗口login') mainWnd.setWindowIcon(QIcon('Qt.ico')) mainWnd.setFixedSize( QSize(500, 400) ) #因为这里固定了大小,所以窗口的大小没有办法任意调整,想要使resizeWidget函数生效的话要把这里去掉,自己调节布局和窗口大小 mainWnd.setWidget(loginWnd(mainWindow, mainWnd)) # 把自己的窗口添加进来 mainWnd.show() app.exec()
def on_pushButton_login_clicked(self): """ Slot documentation goes here. """ username = unicode(self.lineEdit_user.text()) password = unicode(self.lineEdit_password.text()) # 创建SQL客户端。保证全局可用。 global sql_client sql_client = globalvar._init(username, password) if sql_client.check_user(): print "登陆成功" from main import MainWindow self.main_window = MainWindow() self.main_window.show() else: print "用户名或密码错误!"
def login(self, args): username = self.usernameInput.text() password = self.passwordInput.text() if username == '' or password == '': Tools.showMsgDialog(u'用户名或密码不能为空', self) return self.loginButton.setVisible(False) self.progressBar.setVisible(True) httpAPI = HttpAPI() apiRes = httpAPI.login(username, password) if not apiRes[0]: Tools.showMsgDialog(apiRes[1], self) self.loginButton.setVisible(True) self.progressBar.setVisible(False) return self.close() self.mainWindow = MainWindow(apiRes[1]) self.mainWindow.showMaximized()
def test_connecting_disconnecting_from_gui(qtbot): mainWin = MainWindow() mainWin.show() qtbot.addWidget(mainWin) qtbot.wait(2000) if_select = mainWin.interfaceSelection qtbot.mouseClick(if_select, Qt.LeftButton) qtbot.wait(100) # check if we see the simulator running and can potentially connect to it assert (if_select.findText("cb_sim", Qt.MatchContains) != -1) num_connections = 10 while num_connections > 0: if_select.setCurrentIndex( if_select.findText("cb_sim", Qt.MatchContains)) qtbot.wait(500) assert (mainWin.nodeIdLineEdit.text() == "cb_sim") if_select.setCurrentIndex(if_select.findText("None", Qt.MatchContains)) qtbot.wait(1000) assert (if_select.findText("cb_sim", Qt.MatchContains) != -1) num_connections -= 1
#!/usr/bin/env python3 # # run.py # Runs a skeleton program that contains a main window and customized menu bar. # Using Python 3.6 and PySide2 v.5.12 # # Copyright (C) 2019 Robert Parker # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. import sys from PySide2.QtWidgets import QApplication from main import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) ex = MainWindow() ex.show() sys.exit(app.exec_())
def __init__(self): self.path = "data/0200nm/" self.mainGui = MainWindow()
import sys from PyQt5.QtWidgets import QApplication from main import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) win = MainWindow(app) win.show() sys.exit(app.exec_())
# -*- coding: utf-8 -*- import sys import atexit from PyQt4 import QtGui from PyQt4.QtSql import QSqlDatabase from main import MainWindow @atexit.register def appExit(): pass def createConnection(): db = QSqlDatabase.addDatabase("QSQLITE") db.setDatabaseName("sqlite.db3") return db.open() createConnection() app = QtGui.QApplication(sys.argv) app.addLibraryPath("qt4_plugins") main_window = MainWindow() main_window.showMaximized() main_window.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) app.setStyle(QStyleFactory.create('Fusion')) mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
#!/usr/bin/python import sys from PySide import QtGui from main import MainWindow if __name__ == "__main__": app = QtGui.QApplication(sys.argv) myapp = MainWindow() myapp.show() sys.exit(app.exec_())
from PySide2.QtWidgets import QApplication from main import MainWindow if __name__ == '__main__': import sys app = QApplication(sys.argv) win = MainWindow() win.show() app.exec_()
GT(u'Configuration key "{}" = "{}", type: {}'.format( key, GS(value), type(value)))) # FIXME: ConfCode values are integers & could cause problems with config values if conf_values[V] in ( ConfCode.FILE_NOT_FOUND, ConfCode.KEY_NOT_DEFINED, ConfCode.KEY_NO_EXIST, ): first_run = LaunchFirstRun(debreate_app) if not first_run == ConfCode.SUCCESS: sys.exit(first_run) break Debreate = MainWindow(conf_values[u'position'], conf_values[u'size']) debreate_app.SetMainWindow(Debreate) Debreate.InitWizard() if conf_values[u'maximize']: Debreate.Maximize() elif conf_values[u'center']: from system.display import CenterOnPrimaryDisplay # NOTE: May be a few pixels off CenterOnPrimaryDisplay(Debreate) working_dir = conf_values[u'workingdir'] if parsed_path:
def setUp(self): self.form = MainWindow()
def main(argv): path = None first_arg = None second_arg = None config = None apath = None print("QT VERSION %s" % QT_VERSION_STR) try: first_arg = argv[1] second_arg = argv[2] except IndexError: pass if first_arg is not None: if first_arg == "-c": config = True if second_arg is not None: path = second_arg else: path = first_arg try: #app = QApplication(argv) app = MyApp(argv) QCoreApplication.setOrganizationDomain('www.trickplay.com') QCoreApplication.setOrganizationName('Trickplay') QCoreApplication.setApplicationName('Trickplay Debugger') QCoreApplication.setApplicationVersion('0.0.1') s = QProcessEnvironment.systemEnvironment().toStringList() for item in s: k, v = str(item).split("=", 1) if k == 'PWD': apath = v apath = os.path.join(apath, os.path.dirname(str(argv[0]))) main = MainWindow(app, apath) main.config = config main.show() main.raise_() wizard = Wizard() app.main = main path = wizard.start(path) if path: settings = QSettings() settings.setValue('path', path) app.setActiveWindow(main) main.start(path, wizard.filesToOpen()) main.show() sys.exit(app.exec_()) # TODO, better way of doing this for 'clean' exit... except KeyboardInterrupt: exit("Exited")
def setUp(self): self.run = MainWindow(app=appctxt)
def __init__(self): self.path = "data/firstData/" self.mainGui = MainWindow()
import sys from PyQt5.QtWidgets import QApplication from main import MainWindow if __name__ == '__main__': app = QApplication(sys.argv) mv = MainWindow() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication from main import MainWindow app = QApplication(sys.argv) Rocpy = MainWindow() Rocpy.show() sys.exit(app.exec_())
def openMainWindow(self): self.mainUIWindow = MainWindow() self.hide() print('A new window is opened!')
def setUp(self): self.mainGui = MainWindow()
self.messageLabel.setGeometry(QRect(70, 15, 360, 50)) self.messageLabel.setWordWrap(True) self.messageLabel.setScaledContents(True) self.messageLabel.setStyleSheet( 'QLabel{background-color:rgb(255,0,79);color:white;font:9pt;padding-left:5px;padding-right:5px;}' ) # border-radius:5px # height = self.messageLabel.fontMetrics().boundingRect(self.messageLabel.text()).height() self.messageLabel.hide() def initSpinner(self): self.spinner = QtWaitingSpinner(self, centerOnParent=True, disableParentWhenSpinning=True) self.spinner.setNumberOfLines(15) # self.spinner.setColor(QColor(81, 4, 71)) self.spinner.setInnerRadius(20) # 设置内圆大小 self.spinner.setLineLength(15) # 设置线长 self.spinner.setLineWidth(5) # 设置线宽 self.spinner.setTrailFadePercentage(80) if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) loginDialog = LoginDialog() if loginDialog.exec_() == QDialog.Accepted: mainWindow = MainWindow() mainWindow.setWindowTitle('{},欢迎您进入余票查询'.format(loginDialog.userName)) mainWindow.show() sys.exit(app.exec_())
def setUp(self): self.gui = MainWindow() self.gui.load_video('video.mp4')
def on_pushButton_clicked(self): self.panel = MainWindow() self.panel.show() self.close() return