class UI(): def __init__(self): self.app = QApplication(sys.argv) self.main_window = None if "username" in config.user and "password" in config.user: self.finished_auto = False self.autoLogin() else: self.createLogin() def autoLogin(self): self.client_socket = network.ClientSocket("localhost", 6667) self.client_socket.authenticateUser(config.user["username"], config.user["password"]) self.client_socket.authenticate_success.connect(self.createMain) self.client_socket.authenticate_failure.connect(self.createLogin) def autoLoginSuccess(self): self.finished_auto = True self.auto_success = True def autoLoginFailure(self): self.finished_auto = True self.auto_success = False def createLogin(self): self.login_window = LoginWindow() self.login_window.loggedIn.connect(self.finishLogin) self.login_window.exit.connect(self.closeApplication) def finishLogin(self): self.login_window.close() self.client_socket = self.login_window.client_socket self.createMain() def createMain(self): self.main_window = MainWindow(self.client_socket, self.app.processEvents) def closeApplication(self): self.app.quit() def searchUser(self, query): self.client_socket.searchUser(query) def exec(self): return self.app.exec_() def disconnect(self): if not self.main_window == None: self.main_window.disconnect()
def main(): """This is the main function of this class Args: none """ db = DBService() app = QApplication(sys.argv) UI = MainWindow(db, lang) sys.exit(app.exec_())
def run(self): print("Starting thread " + self.name) # instantiate QApplication for PyQt framework app = QApplication(sys.argv) # instantiate main window window = MainWindow(self.port) # show the main window window.show() # bring the main window to the front window.raise_() # execute the application - start watching for events etc. app.exec_() print("Exiting thread " + self.name)
from UI.MainWindow import MainWindow # 21. ИБ ИЗ1 ПЗ1 Д10З1 Д10О3 Д2П1 Д2Б3 ОР2 ОД3 # ИЗ1 — пуассоновский для бесконечных, # ПЗ1 — экспоненциальный; # Д1ОЗ1 — по кольцу; # Д1ОО3 — самая старая в буфере; # Д2П1 — приоритет по номеру прибора; # Д2Б3 — по кольцу # ОР2 — графики по значениям параметров; # ОД3 — временные диаграммы, текущее состояние. if __name__ == '__main__': MainWindow().start_ui()
def _scan_device(device_id): raw_result = pqs.batch_scan(google.get_apps_by_device_web_id(device_id)) result = [] if raw_result: for reputation in raw_result: result.append(reputation.get_rating_name() + " [" + reputation.get_app().get_name() + "]") return result if __name__ == '__main__': ############ init first ############ app = QApplication(sys.argv) loginWindow = LoginWindow() loginWindow.connect_to_accept(_handle_login) loginWindow.set_account(DEFAULT_ACCOUNT) loginWindow.set_password(DEFAULT_PW) mainWindow = MainWindow() mainWindow.connect_to_change_device(_handle_device_selection) devices = [] ############ end of init ############ loginWindow.show() app.exec_()
def main(): import sys app = QApplication(sys.argv) wnd = MainWindow() # ---------------------- Init Mainwindow ------------------------------ qr = wnd.frameGeometry() cp = QDesktopWidget().availableGeometry().center() qr.moveCenter(cp) wnd.move(qr.topLeft()) wnd.listLib.setSortingEnabled(True) wnd.initFaceCompare() wnd.initCamera() # -------------------------------------------------------------------------------- wnd.show() sys.exit(app.exec_())
import sys from PyQt5.QtWidgets import QApplication from UI.MainWindow import MainWindow q_app = QApplication(sys.argv) window = MainWindow() window.show() window.setFixedSize(window.size()) q_app.exec_()
from UI.SetupWiizard import ConfigWizard from UI.MainWindow import MainWindow try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) if __name__ == "__main__": if hasattr(sys, 'frozen'): currentPath = os.path.abspath(sys.argv[0]) else: currentPath = os.path.abspath(os.path.realpath(__file__)) utils.setProgramPath(currentPath) import sys app = QtGui.QApplication(sys.argv) if not transferPC.init_config(): wizard = ConfigWizard() wizard.show() else: mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
import sys from PyQt4 import QtGui from UI.MainWindow import MainWindow import os #defines _DEBUG = True _WORKING_DIR = os.path.dirname(__file__) # Debug calls for launch if _DEBUG: pass # Creating App app = QtGui.QApplication(sys.argv) # Initializing UI RootWindow = MainWindow() RootWindow.show() # Waiting for exit sys.exit(app.exec_())
def createMain(self): self.main_window = MainWindow(self.client_socket, self.app.processEvents)
#!/usr/bin/python3 # -*- coding: UTF-8 -*- from UI.MainWindow import MainWindow import logging logging.basicConfig(filename='./LOG/'+'skydataTool'+'.log', format='[%(asctime)s; %(filename)s]:%(levelname)s:%(message)s', level = logging.ERROR, filemode='a', datefmt='%Y-%m-%d %I:%M:%S %p') if __name__ == '__main__': mainWindow = MainWindow() mainWindow.windowInit()
import sys from PyQt5.QtWidgets import QApplication from UI.MainWindow import MainWindow from MessageHandler.ChatMessageReceiver import ChatMessageReceiver import time if __name__ == "__main__": # 开启图形界面循环 app = QApplication(sys.argv) main = MainWindow() main.show() chat_message_receiver = ChatMessageReceiver() # 消息接收器的信号 chat_message_receiver.receive_text_signal.connect(main.receive_text) chat_message_receiver.send_successfully_signal.connect( main.ChatRecordInterface.add_msg) chat_message_receiver.start_itchat_signal.connect( main.FriendControllInterface.read_all_friend_with_record) chat_message_receiver.set_closest_msg_after_success_signal.connect( main.FriendControllInterface.set_closest_msg) # 界面控件的信号 main.exit_proc_signal.connect(chat_message_receiver.end) main.ChatRecordInterface.send_msg_signal.connect( chat_message_receiver.send_msg) chat_message_receiver.start() status = app.exec_() # 界面关闭,等待微信监控程序关闭,等待5秒 timer = 0.0 while chat_message_receiver.isRunning():
import sys import os sys.path.append(os.path.abspath(os.path.dirname(__file__))) sys.path.append(os.path.abspath(os.path.dirname(__file__)) + '\\source') sys.path.append( os.path.abspath(os.path.dirname(__file__)) + '\\source\\PhonemeModule') from UI.MainWindow import MainWindow from PyQt5 import uic from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * import sys app = QApplication(sys.argv) window = MainWindow() window.show() app.exec_()
# -*- coding:utf-8 -*- """ @author: SiriYang @file: LunchMainWindow.py @createTime: 2021-01-22 16:05:58 @updateTime: 2021-01-22 16:10:36 @codeLines: 6 """ import sys sys.path.append('.') # 将项目根目录加入模块搜索路径,这样其他模块才能成功导包 from UI.MainWindow import MainWindow if __name__ == '__main__': mainWindow = MainWindow("./data/") mainWindow.launch()