def main(): global app global mainWindow app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
class PyQtGuiController(GuiControllerBase): def __init__(self): super(PyQtGuiController, self).__init__() self.app = QtGui.QApplication(sys.argv) self.win = MainWindow(self) def getDirName(self, title, dir, filter): temp = QtGui.QFileDialog.getExistingDirectory(self.win, title, dir) return str(temp) def getFileNames(self, title, dir, filter): temp = QtGui.QFileDialog.getOpenFileNames(self.win, title, dir, filter) fileNames = map(str, temp) return fileNames def getSaveName(self, title, dir, filter): temp = QtGui.QFileDialog.getSaveFileName(self.win, title, dir, filter) fileName = str(temp) return fileName def getInputName(self, window): name, ok = QtGui.QInputDialog.getText(self.win, "Enter the name", "Name:", QtGui.QLineEdit.Normal, window.getName()) return name, ok def getInputPara(self, window, title, initial = 0.0): data, ok = QtGui.QInputDialog.getDouble(self.win, "Enter the " + title.lower(), title.capitalize() + ":", initial) return data, ok def showMessageOnStatusBar(self, text): return self.win.showMessageOnStatusBar(text) def getMessageOnStatusBar(self): return self.win.getMessageOnStatusBar() def addNewDataView(self, data): return self.win.addNewDataView(data) def startApplication(self): self.win.show() sys.exit(self.app.exec_())
def on_promisCheckBox_stateChanged(self, p0): MainWindow.on_promisCheckBox_stateChanged(self, p0) # print "check int:%d"%p0 if(self.promisCheckBox.isChecked()): self.capturer.set_promisc(True) else: self.capturer.set_promisc(False)
class PyQtGuiController(GuiControllerBase): def __init__(self): super(PyQtGuiController, self).__init__() self.app = QtGui.QApplication(sys.argv) self.win = MainWindow(self) def getDirName(self, title, dir, filter): temp = QtGui.QFileDialog.getExistingDirectory(self.win, title, dir) return str(temp) def getFileNames(self, title, dir, filter): temp = QtGui.QFileDialog.getOpenFileNames(self.win, title, dir, filter) fileNames = map(str, temp) return fileNames def getSaveName(self, title, dir, filter): temp = QtGui.QFileDialog.getSaveFileName(self.win, title, dir, filter) fileName = str(temp) return fileName def getReloadDataIndex(self): if self.dataModel.getCount() == 0: self.showErrorMessage('Error', 'There\'re no enough data!') return names = self.dataModel.getNameDict() return self.getDataIndex(names, "Select the data to be reloaded") def getDataIndex(self, names, word): items = names.keys() item, ok = QtGui.QInputDialog.getItem(self.win, word, "Data:", items, 0, False) if ok and item: item = str(item) index = int(names[item]) del names[item] return index def getRegisterDataIndex(self): if self.dataModel.getCount() < 2: self.showErrorMessage('Error', 'There\'re no enough data!') return names = self.dataModel.getNameDict() fixedIndex = self.getDataIndex(names, "Select the fixed image") if fixedIndex is not None: movingIndex = self.getDataIndex(names, "Select the moving image") if movingIndex is not None: return (fixedIndex, movingIndex) def getInputName(self, window): name, ok = QtGui.QInputDialog.getText(self.win, "Enter the name", "Name:", QtGui.QLineEdit.Normal, window.getName()) return name, ok def getInputPara(self, window, title, initial = 0.0): data, ok = QtGui.QInputDialog.getDouble(self.win, "Enter the " + title.lower(), title.capitalize() + ":", initial) return data, ok def showErrorMessage(self, title, message): QtGui.QMessageBox.information(self.win, title, message) def showMessageOnStatusBar(self, text): return self.win.showMessageOnStatusBar(text) def getMessageOnStatusBar(self): return self.win.getMessageOnStatusBar() def addNewDataView(self, data): return self.win.addNewDataView(data) def startApplication(self): self.win.show() sys.exit(self.app.exec_())
class controller(): def __init__(self): self.initUI() def initUI(self): self.mw=MainWindow(self) self.mw.show() self.add_Filtermethods() #self.need_Param() def need_Param(self,a="HP",b="Chebychev 1",c="man"): if a=="HP" and b=="Chebychev 1": b="cheby1" return self.filter.get(b).needHP() else: return "noch nicht implementiert" def add_Filtermethods(self): self.filter={} fobj=open("init.txt","r") for line in fobj: line=line.strip() #a= eval(line) a=getattr(sys.modules[__name__], line)() self.filter.update({line:a}) fobj.close
def _Run(argv): from CDUtilsPack.MetaUtils import UserException from PackUtils.CoreBaseException import CoreBaseException from SectionFactory import CreateSectionsByCfg from MainWindow import MainWindow try: appLoop = QtGui.QApplication(argv) # for Qt widgets using imgs = _ImageLoader(dir = 'Images') sett = _CmdLineParser(argv) absFileName = os.path.join(os.getcwd(), sett['cfg']) del sett['cfg'] sectionDict = CreateSectionsByCfg(absFileName, imgs) app = MainWindow(sectionDict, imgs) app.show() appLoop.exec() except UserException as e: print ("Aborted!\nStart-up error:", e) except CoreBaseException as e: print("Aborted!\n{0}: {1}".format(type(e).__name__, e))
def on_stopButton_clicked(self): MainWindow.on_stopButton_clicked(self) if self.cap_thread != None and self.cap_thread.is_alive(): self.capturer.stop_capture() self.cap_thread.join() if self.ana_thread != None and self.ana_thread.is_alive(): self.analyzer.stop_analize() self.ana_thread.join()
def run(): # PySide fix: Check if QApplication already exists. Create QApplication if it doesn't exist app = QtGui.QApplication.instance() if not app: app = QtGui.QApplication(sys.argv) window = MainWindow() window.show() app.exec_()
def main(argv): app = QApplication(sys.argv) # Constructing gui... mainWindow = MainWindow() mainWindow.show() # Start event processing... app.exec_()
def main(): import sys app = QApplication(sys.argv) screen = MainWindow() screen.show() sys.exit(app.exec_())
class App(QApplication): def __init__(self, argv): super(App, self).__init__(argv) self.mainwindow = MainWindow() def exec_(self, *args, **kwargs): self.mainwindow.show() super(App, self).exec_()
class PVDataTools(QtGui.QApplication): def __init__(self, sys_argv): super().__init__(sys_argv) self.model = Model() self.main_window = MainWindow(self.model) self.main_window.show() self.main_window.new_dataviewer()
def main(): config = ConfigParser.SafeConfigParser(allow_no_value=True) internalConfig = ConfigParser.SafeConfigParser(allow_no_value=True) config.read("config.ini") internalConfig.read("internal-config.ini") w = MainWindow(config, internalConfig) w.show() return app.exec_()
def main(): app = QtGui.QApplication(sys.argv) guiDelegate = delegate.GuiDelegate() window = MainWindow(guiDelegate=guiDelegate) guiDelegate.set_main_window(window) window.show() excode = app.exec_() guiDelegate.exit() sys.exit(excode)
def on_startButton_clicked(self): MainWindow.on_startButton_clicked(self) if self.capturer.adhandle == None: curindex = self.devComboBox.currentIndex() if not self.capturer.open_dev(curindex): # TODO: handle open error return self.cap_thread = threading.Thread(target=self.capturer.start_capture) self.cap_thread.start() self.ana_thread = threading.Thread(target=self.analyzer.start_analize) self.ana_thread.start()
def main(args): mainApp=QtGui.QApplication(args) fenetre=QWidget() label1 = QLabel("Bienvenue") MainWindow2=MainWindow() MainWindow2.show() r=mainApp.exec_() return r
class Application: def __init__(self): global gwin #self.settingsContainer = SettingsContainer() #self.settingsController = SettingsController(self.settingsContainer) #self.settingsController.loadSettings() self.mainWindow = MainWindow() self.mainWindow.setupWindow() gwin = self.mainWindow self.journal = Journal() self.wordsHint = WordsHint()
def exit(self): self.cleanUp() self.painter = None for widget in self.parent.pack_slaves(): widget.pack_forget() from MainWindow import MainWindow mw = MainWindow(self.parent) mw.pack() self.destroy()
class Application: def __init__(self): self.name = "Стержни от Димыча" self.nameDelim = " — " self.version = "1.0" self.timestamp = "Октябрь 2015" self.construction = None self.logic = Logic(self) # Окна self.mainWindow = MainWindow(self) self.windows = set() self.windows.add(self.mainWindow) def createDetailWindow(self, barNumber = 0): self.windows.add(DetailWindow(self, barNumber = barNumber)) def createMatricesWindow(self, barNumber = None): self.windows.add(MatricesWindow(self, barNumber = barNumber)) def createComponentsDumpWindow(self, barNumber = None): self.windows.add(ComponentsDumpWindow(self, barNumber = barNumber)) def createEditConstructionWindow(self, barNumber = None): self.windows.add(EditConstructionWindow(self, barNumber = barNumber)) def onWindowDestroy(self, window): self.windows.discard(window) def onConstructionChanged(self): for w in self.windows: w.onConstructionChanged() def run(self): self.mainWindow.mainloop() def about(self): return "Версия: %s, %s\n\n" \ "Куковинец Дмитрий Валерьевич\[email protected]\n\n" \ "ФГБОУ ВО \"МГТУ \"СТАНКИН\"\nКафедра УИТС" \ % (self.version, self.timestamp)
def on_pktTableWidget_cellClicked(self, row, column): MainWindow.on_pktTableWidget_cellClicked(self, row, column) tree = self.pktTreeWidget tree.clear() pktItem = self.analyzer.itemlist[row] pktdata = pktItem.rawpkt[1] pTree = ProtocolTree(tree, pktdata) tree.insertTopLevelItems(0, pTree.parseProtocol()) p0xb = self.pkt0xBrowser p0xb.setText(QtCore.QString(PktContent.pkt0xContent(pktdata))) pasciib = self.pktAsciiBrowser pasciib.setText(QtCore.QString(PktContent.pktAsciiContent(pktdata)))
class LheidoEdit(QApplication): """ LheidoEdit app class extend QApplication """ def __init__ (self, argv): QApplication.__init__(self, argv) self.__mainWin = MainWindow() with open("dev-theme/dev_theme.css") as t: dev_theme = t.read() self.setStyleSheet(dev_theme) def run(self): self.__mainWin.show() self.exec_()
def __init__(self): MainWindow.__init__(self) self.pktList = PktList() self.capturer = Capturer(self.pktList) self.cap_thread = None self.analyzer = Analyer(self.pktList, self.pktTableWidget, self) self.ana_thread = None MainWindow.set_devlist(self, self.capturer.devlist, WIN32) # self.testWidget() self.show()
def main(): app = QApplication(sys.argv) w = MainWindow() w.setWindowTitle("Task Visualizer") w.resize(1000, 500) w.move(10, 10) w.show() app.exec_()
def main(): random.seed() # change working dir if not cmdLineArgs.options.debug: dirname = 'data_'+time.strftime('%y%m%d_%H%M%S') os.makedirs(dirname) os.chdir(dirname) print "Current working directory:", os.getcwd() app = QtGui.QApplication(sys.argv) app.setPalette(QtGui.QPalette(QtGui.QColor(204,230,255), QtGui.QColor(204,230,255))) window = MainWindow() window.show() sys.exit(app.exec_())
def __getMainWindow(self): """Returns the main windows controlled by this controller. Implements lazy initialization""" if self.__mainWindow is None: self.__mainWindow = MainWindow(self.__root,self) self.__mainWindow.init() return self.__mainWindow
def svc(self): if GUITask.app_flag == False: GUITask.app_flag = True guard = OpenRTM_aist.ScopedLock(self.m_ec._workerthread._mutex) app = QtGui.QApplication([""]) mainWin = MainWindow(self.m_ec) mainWin.show() del guard app.exec_() else: pass return 0
def __init__(self, file_paths, platform): """ ActionHandler constructor. Create the main window, setup the message handler, import the preferences, and connect all of the action handlers. Finally, enter the gtk main loop and block. @param file_paths a list of flow graph file passed from command line @param platform platform module """ self.clipboard = None for action in Actions.get_all_actions(): action.connect('activate', self._handle_action) #setup the main window self.main_window = MainWindow(platform) self.main_window.connect('delete-event', self._quit) self.main_window.connect('key-press-event', self._handle_key_press) self.get_page = self.main_window.get_page self.get_flow_graph = self.main_window.get_flow_graph self.get_focus_flag = self.main_window.get_focus_flag #setup the messages Messages.register_messenger(self.main_window.add_report_line) Messages.send_init(platform) #initialize self.init_file_paths = file_paths Actions.APPLICATION_INITIALIZE() #enter the mainloop gtk.main()
def __init__(self): self.clipboard = QtGui.QApplication.clipboard() self.mainwindow = MainWindow() self.mainwindow.show() self.widget = LinWidget() self.clipboard.selectionChanged.connect(self.display_widget) QtCore.QTextCodec.setCodecForTr(QtCore.QTextCodec.codecForName("utf8"))
def __init__(self, sys_argv): super().__init__(sys_argv) self.model = Model() self.main_window = MainWindow(self.model) self.main_window.show() self.main_window.new_dataviewer()
def main(): app = QApplication(sys.argv) try: auto_update() except: pass app.setOrganizationName("Deca Technologies") app.setOrganizationDomain("decatechnologies.com") app.setApplicationName("Pyrite") # create app environment window = MainWindow() window.show() # run main application loop sys.exit(app.exec_())
def __init__(self): super().__init__() self.hm_page = HomePage() self.mn_window = MainWindow() self.widget_layout = QStackedLayout() self.buildLayout() self.connections()
def window(): app = QApplication(sys.argv) automark = False if args.a: automark = True window = MainWindow(args.g, args.t, automark) window.setGeometry(400, 400, args.g * args.t, args.g * args.t) window.setWindowTitle("Numeropeli") window.show() sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) textCodec = QTextCodec.codecForName('utf-8') QTextCodec.setCodecForCStrings(textCodec) QTextCodec.setCodecForLocale(textCodec) QTextCodec.setCodecForTr(textCodec) mainWindow = MainWindow() #mainWindow.show() app.exec_()
def main(): app = QApplication(sys.argv) print(app) main_window = MainWindow() # main_window.show() qtmodern.styles.dark(app) mw = qtmodern.windows.ModernWindow(main_window) mw.show() sys.exit(app.exec_())
def __init__(self): self.__gateway = JavaGateway(start_callback_server=True) app = QtGui.QApplication(sys.argv) app.setApplicationName("Droid Navi") app.setApplicationVersion("0.1") app.setQuitOnLastWindowClosed(False) mainWindow = MainWindow(self.__gateway) mainWindow.destroyed.connect(lambda: app.quit()) sys.exit(app.exec_())
def show_main_window(self): self.main_window = MainWindow(self.parse_window.savegame_list,\ self.parse_window.formable_nations_dict, self.parse_window.playertags) self.main_window.main.switch_table_window.connect( self.show_table_window) self.main_window.main.switch_province_table_window.connect( self.show_province_table_window) self.main_window.main.back_to_parse_window.connect( self.back_to_parse_window) self.main_window.main.switch_overview_window.connect( self.show_overview_window) self.main_window.main.switch_monarch_table_window.connect( self.show_monarch_table_window) self.main_window.main.switch_error_window.connect( self.show_error_window) self.main_window.main.switch_nation_profile.connect( self.show_nation_profile) self.main_window.show() self.parse_window.close()
class FlixApplication(Gtk.Application): """Acts a program manager""" initWindow = None mainWindow = None db = None def __init__(self): Gtk.Application.__init__(self, application_id=FLIX_APP_ID) self.connect("activate", self.activate_cb) self.connect("shutdown", lambda app: app.quit()) def windowCheck(self): """Checks if a window is already in use""" if self.initWindow is None and self.mainWindow is None: self.initWindow = InitWindow( ) # create the initial window to get a location self.initWindow.connect('cancel', lambda win: self.quit()) self.initWindow.connect("credentials-set", self.createMainWin) self.add_window(self.initWindow) # self.appWindow.connect("delete-event", Gtk.main_quit) # when delete-event signal is received, calls Gtk.main_quit def activate_cb(self, app): """Starts the program""" self.windowCheck() self.initWindow.show_all() # display the window and all widgets def createMainWin(self, win, cred_dict): """Creates the main window""" # Database.location = location self.db = Database( cred_dict) # create the database of the given location self.mainWindow = MainWindow( self.db ) # create the main window now that we have an initial location self.remove_window(self.initWindow) self.initWindow.destroy() self.add_window(self.mainWindow) self.mainWindow.show_all()
class PCAPtoPDMLController: def __init__(self): self.pcap = PCAP.PCAP('', '') self.dissector = Dissector.Dissector('', '') self.pdml = PDML.PDML() def setPCAP(self, path): self.pcap.setAttributes(path) def callConversion(self, workspace): #namePDML = self.dissector.convert(self.pcap, workspace.path) workspace.setPCAP(self.pcap) #self.pdml.setName(namePDML) #self.pdml.parse(workspace.path) from MainWindow import MainWindow self.window = MainWindow(workspace) #window.connect("destroy", Gtk.main_quit) self.window.maximize() self.window.show_all()
class Form(QtWidgets.QDialog): def __init__(self): super().__init__() uic.loadUi('connectForm.ui', self) # QtWidgets.QDialog.__init__(self, parent) # self.ui = uic.loadUi("ConnectForm.ui") # self.ui.show() self.connectListDict = {} self.initConnectionList() # self.mainWindow = MainWidow() # exit_action = QtGui.QAction('Exit', self) self.connectButton.clicked.connect(self.slotConnectButton) # 파일에 저장되어있는 연결 위치와 아이피값을 받아와 딕셔너리로 저장 후 # 첫 페이지의 연결 리스트 선택 항목으로 띄워줌 def initConnectionList(self): with open('ConnectionList.csv', 'r', encoding='utf-8') as f: rdr = csv.reader(f) connList = [] for row in rdr: connList.append(row) # print(connList) self.connectListBox.addItem(row[0]) self.connectListDict = dict(connList) # print(self.connectListDict) @pyqtSlot() def slotConnectButton(self): connectLocation = self.connectListBox.currentText() self.ipLabel.setText(self.connectListDict[connectLocation]) self.mainWindow = MainWindow() self.mainWindow.connect(self.connectListDict[connectLocation]) self.mainWindow.show()
class UserLoginDialog(QDialog, ui_UserLoginDialog.Ui_L): def __init__(self, parent=None): super(UserLoginDialog, self).__init__(parent) self.setupUi(self) self.LoginOKButton.setEnabled(False) self.LoginCancelButton.setFocusPolicy(Qt.NoFocus) self.registerButton.setFocusPolicy(Qt.NoFocus) self.setWindowTitle('Login') self.updateUi() def on_userNameLogin_textEdited(self): self.updateUi() def on_userPasswordLogin_textEdited(self): self.updateUi() def on_LoginOKButton_clicked(self): name = self.userNameLogin.text() passwd = self.userPasswordLogin.text() self.sql_handle = sql_handle.SqlHandle(name, key = passwd) self.mainWindow = MainWindow(table_name = name, password = passwd, sql = self.sql_handle) self.mainWindow.show() # self.accept() self.close() def updateUi(self): """判断是否输入为空 :return: """ enable = (not self.userNameLogin.text() == '') and (not self.userPasswordLogin.text() == '') self.LoginOKButton.setEnabled(enable) def ChargeLogin(self): #TODO 进行登陆判断 return True def on_registerButton_clicked(self): from RegisterDialog import RegisterDialog self.register = RegisterDialog() self.register.show() self.accept()
def OnInit(self): # # Parse command line arguments parser = argparse.ArgumentParser( description='Wuggy - A Multilingual Pseudoword Generator') parser.add_argument('--data', help='specify a non-default data directory') parser.add_argument('--plugin', help='specify a non-default plugin directory') try: clargs = parser.parse_args() config.cl_plugin_path = vars(clargs)['plugin'] config.cl_data_path = vars(clargs)['data'] except: "Exception parsing command line arguments" # Initialize the application wx.InitAllImageHandlers() mainwindow = MainWindow(None, -1, "") self.SetTopWindow(mainwindow) mainwindow.Show() return 1
def __init__(self): QObject.__init__(self) # Initialize visual elements self.mainWindow = MainWindow() self.mainContent = MainContent() # Add Main Content ot Main Window layout = QVBoxLayout() layout.insertWidget(0, self.mainContent) self.mainWindow.ui.centralwidget.setLayout(layout) # Initialize the menu actions self.__initializeMenuActions() # Initialize the button and their signals self.__initializeButtons() # Initialize the table widget self.__initializeTableWidget()
def main(): """ """ from MainWindow import MainWindow translator = QTranslator() #Build the translator translator.load(":/locales/df_%s" % QLocale.system().name()) qttranslator = QTranslator() #A translator for Qt standard strings qttranslator.load("qt_%s" % (QLocale.system().name())) App = QApplication(sys.argv) #Creating the app App.setOrganizationName(ORGNAME) #Setting organization and application's App.setApplicationName(NAME) #name. It's only useful for QSettings App.setApplicationVersion(VERSION) App.setOrganizationDomain(URL) App.installTranslator( translator) #Install translators into the application. App.installTranslator(qttranslator) mw = MainWindow(App) #Now it's time to instantiate the main window mw.show() #And show it sys.exit(App.exec_()) #When the app finishes, exit.
def start_ryven(): # import windows from MainConsole import init_main_console from startup_dialog.StartupDialog import StartupDialog from MainWindow import MainWindow # init application from qtpy.QtWidgets import QApplication app = QApplication(sys.argv) # register fonts from qtpy.QtGui import QFontDatabase db = QFontDatabase() db.addApplicationFont('../resources/fonts/poppins/Poppins-Medium.ttf') db.addApplicationFont('../resources/fonts/source_code_pro/SourceCodePro-Regular.ttf') db.addApplicationFont('../resources/fonts/asap/Asap-Regular.ttf') # StartupDialog sw = StartupDialog() sw.exec_() # exit if dialog couldn't initialize if sw.editor_startup_configuration == {}: sys.exit() window_theme = sw.window_theme # init main console console_stdout_redirect, \ console_errout_redirect = init_main_console(window_theme) # init main window mw = MainWindow(sw.editor_startup_configuration, window_theme) mw.show() if REDIRECT_CONSOLE_OUTPUT: # redirect console output from contextlib import redirect_stdout, redirect_stderr with redirect_stdout(console_stdout_redirect), \ redirect_stderr(console_errout_redirect): # run mw.print_info() sys.exit(app.exec_()) else: # run mw.print_info() sys.exit(app.exec_())
def submit_selection(self): try: width, height, pad, number = self.division1.parse() stiffness, time_step, speedup, dampening = self.division2.parse() pos = [ Vector(width * (i / (number - 1)), 0) for i in range(number - 1) ] g_x = self.g_x_input.parse() g_y = self.g_y_input.parse() left_dyna = self.left_dyna_selector.get_dynamics(0, 0) right_dyna = self.right_dyna_selector.get_dynamics(width, 0) color_hot = '#' + self.color_hot_input.parse() color_cold = '#' + self.color_cold_input.parse() do_blur = self.blur_check.isChecked() stress_mode = self.stress_check.isChecked() chain = StringChain(pos, Vector(g_x, -g_y), stiffness, dampening=dampening, left_dyna=left_dyna, right_dyna=right_dyna) self.display = MainWindow(width, pad, height, chain, time_step=time_step, speedup=speedup * 2, do_blur=do_blur, stress_mode=stress_mode, color_hot=color_hot, color_cold=color_cold) self.display.show() except: pass
class GUI_Manager(): # open and create userdb and foodlogdb (databases) # and users and Food_Entries tables def __init__(self): # asks user for the root account password in terminal for mysql server self.__password = input('root account password: ') self.user_database = userDatabase(self.__password) self.user_database.close() self.food_database = foodDatabase(self.__password) self.food_database.close() def open_login(self): self.login = LoginForm(self.__password) self.login.switch_window.connect(self.open_main) self.login.show() def open_main(self, user): self.main = MainWindow(user, self.__password) self.login.close() self.main.show()
def launch(self): while(True): self.drawButtons() for event in pygame.event.get(): # if event is QUIT leave game if(event.type == QUIT): pygame.quit() # if a key is pressed if event.type == KEYDOWN: if event.key == K_UP: self.selected = (self.selected-1)%3 if event.key == K_DOWN: self.selected = (self.selected+1)%3 if event.key == K_RETURN: if(self.selected == 0): gameWin = MainWindow() gameWin.launch() elif(self.selected == 1): landWin = LanderWindow() else: pygame.quit()
def main(): app = QApplication(sys.argv) main_window = MainWindow() main_window.show() r = app.exec_() main_window.cleanup() sys.exit(r)
class FaceWindow(QMainWindow, form_face): loginwindow = None def __init__(self, window): super().__init__() self.setupUi(self) self.setWindowTitle("ANNA") self.loginwindow = window self.initUI() @pyqtSlot(QImage) def setImage(self, image): self.label.setPixmap(QPixmap.fromImage(image)) def initUI(self): self.label = QLabel(self) self.label.move(30, 30) self.label.resize(390, 360) th = Thread(self) th.changePixmap.connect(self.setImage) th.facewindow = self th.start() def th_open(self): global t_stop t_stop = False #자동로그인 될때까지 계속 대기 def openmain(self): while not IsSuccess: #성공하면 끝나는 무한루프 continue self.loginwindow.hide() self.newWindow = MainWindow(USERID) self.newWindow.show() self.hide() def closeWindow(self): global t_stop t_stop = True self.close()
def main(): print("init") sys._excepthook = sys.excepthook sys.excepthook = my_exception_hook app = QApplication(sys.argv) win = MainWindow() # noinspection PyBroadException try: sys.exit(app.exec_()) except: print("Exiting")
def create_data_set(self): if len(self.name.text()) > 0 and len(self.path.text()): path = self.path.text() + "/" + self.name.text() dis = path + ".myo" os.makedirs(path) sets = [] for set in self.sets: if set.checkState() == 2: sets.append(set.text()) os.makedirs(path + "/" + set.text()) for i in range(self.gestures_list.model().rowCount()): os.makedirs(path + "/" + set.text() + "/" + self.gestures_list.model().index(i).data()) gestures = [] for i in range(self.gestures_list.model().rowCount()): gestures.append(self.gestures_list.model().index(i).data()) project = { "name": self.name.text(), "location": path, "sets": sets, "duration": self.dur.value(), "emg_freq": self.emg_freq.value(), "imu_freq": self.imu_freq.value(), "imu_check": max(0, self.imu_check.checkState() - 1), "gestures": gestures, "last": 0 } with open(dis, 'w') as outfile: json.dump(project, outfile) self.close() w = MainWindow(self.parent(), dis) w.show()
def main(): # Load the configuration file preferences = Preferences.Preferences(args=sys.argv) # Create application app = QtGui.QApplication(sys.argv) # Load the Main Widget mainWindow = MainWindow(preferences) # Start the application sys.exit(app.exec_())
def main(): #Pil da problemi con alcune versioni di python, con la 3.4 va bene # il percorso ai risultati va specificato se si vuole continuare il lavoro va specificata, altrimenti no #se metti una cartella gia esistente ma vuota da errore, la cartella se esiste DEVE essere piena # per comodità imporre: # nome_file_dei_risultati = nome_cartella_giornata #TASTO DX ESCLUDE TUTTA LA RIGA #TASTO SX 1 CLICK ESCLUDE SINGOLA FOTO #TASTO SX 2 CLICK MODIFICA LA LUMINOSITA #PREMERE LA ROTELLA APRE L IMMAGINE -per poterla vedere meglio- #ABILITARE LA SPUNTA DELLA CASELLA METTE A 1 IL VALORE DELLA 3 COLONNA DEL CSV (potrebbe servire per segnare il progresso) #USARE LE SPUNTE QUANDO SONO PRESENTI PIU PERSONE PER RIGA pathToImages = "C:/Users/Daniele/Downloads/UnivPm/Magistrale/1 anno/Computer Vision & Deep Learning/Progetto/dataset/gennaio/2020-01-21_clean" pathToResults = "C:/Users/Daniele/Desktop/label/21-01.csv" numOfFolder = 200 min_images = 0 start_time = 0 image_path = pathToImages result = pathToResults n = numOfFolder last_id = -1 if os.path.exists(result): with open(result, 'r') as f: lines = f.read().splitlines() last_line = lines[0] last_id = int(last_line) print(os.path.dirname(__file__)) images_folders = [k for k in sorted(os.listdir(os.path.join(os.path.dirname(__file__), image_path)), key=int) if len(os.listdir(os.path.join(os.path.dirname(__file__), image_path, k)))/2 >= min_images and int(sorted(os.listdir(os.path.join(os.path.dirname(__file__), image_path, k)), key=lambda s: datetime.strptime(s[:12], '%H-%M-%S-%f'))[0].split('-')[0]) >= start_time and int(k) > last_id] images_folders = images_folders[:min(n, len(images_folders))] if not images_folders: print("no image folder") else: root = tk.Tk() root.title("pyMultipleImgAnnot") MainWindow(root, result, image_path, images_folders, n) root.mainloop()
def main(): app = QApplication([]) LitLimeWindow = MainWindow() LitLimeWindow.show() app.exec_() LitLimeWindow.stop_all_threads()
def main(): app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.move(app.screens()[0].geometry().topLeft()) mainWindow.showMaximized() mainWindow.dataWindow.move(app.screens()[-1].geometry().topLeft()) mainWindow.dataWindow.showMaximized() sys.exit(app.exec())
def __init__(self, root): # Variables self.database_interface = DatabaseInterface() self.root = root # Time format self.time_format = '%Y-%m-%d %H:%M:%S' # Get variables to create the main window last_action = self.database_interface.get_last_action() if last_action is None: last_action = { "time": "N/A N/A", "project_name": "N/A", "action_type": "N/A" } project_names = self.database_interface.get_project_names() # Create the main window self.main_window = MainWindow(self.root, project_names, last_action) # Start and stop buttons self.main_window.set_start_button_command(self.add_work_time) self.main_window.set_stop_button_command(self.end_work_time) # Add and delete project buttons self.main_window.set_add_project_button_command( self.create_add_project_window) self.main_window.set_modify_project_button_command( self.create_modify_project_window) # self.main_window.set_delete_project_button_command(self.create_delete_project_window) # Summary button self.main_window.set_summary_button_command(self.create_summary_window) # Calendar button self.main_window.set_calendar_button_command( self.create_calendar_window)
def start_gui(): app = QtGui.QApplication( sys.argv ) app.setStyleSheet( """ QGroupBox { border: 1px solid #bbb; border-radius: 4px; margin: 0.5em 0 0.5em 0; } QGroupBox::title { subcontrol-origin: margin; left: 5px; padding: 0 3px 0 3px; color: #666; } QGraphicsView { background: #bbb; } """ ) window = MainWindow( app ) window.show() sys.exit( app.exec_() )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) __builtins__.__dict__['app'] = self executablePath = Path(sys.argv[0]) self.name = app.name = executablePath.stem self.version = '0.0' self.dir = executablePath.parent.resolve() sys.path.append(os.path.dirname(sys.argv[0])) self.loadCmdlineArgs() self.loadConfigs() self.loadTranslations() self.win = MainWindow(parent=None, title=app.name) __builtins__.__dict__['win'] = self.win self.win.initUI() self.loadPlugins() self.openStdin() #self.openStdout(sys.stdout, 'stdout') #self.openStdout(sys.stderr, 'stderr') win.openDocuments(self.cmdargs.files) if not win.documents: win.newDocument() win.Show(True) self.SetTopWindow(win) self.MainLoop()
def OnInit(self): # # Parse command line arguments parser = argparse.ArgumentParser(description='Wuggy - A Multilingual Pseudoword Generator') parser.add_argument('--data', help='specify a non-default data directory') parser.add_argument('--plugin', help='specify a non-default plugin directory') try: clargs = parser.parse_args() config.cl_plugin_path=vars(clargs)['plugin'] config.cl_data_path=vars(clargs)['data'] except: "Exception parsing command line arguments" # Check for Updates BASEURL = "http://crr.ugent.be" self.InitUpdates(updatesURL=BASEURL+"/Wuggy/downloads/", changelogURL=BASEURL+"/Wuggy/changelog.txt") self.SetAppDisplayName('Wuggy') # Initialize the application # wx.InitAllImageHandlers() mainwindow = MainWindow(None, -1, "") self.SetTopWindow(mainwindow) mainwindow.Show() self.CheckForUpdate() return 1
def login_button_clicked(self): host = self.Host_line.text() port = self.Port_line.text() login = self.Login_line.text() password = self.Password_line.text() try: imap = Imap(host, port, login, password) imap.login() self.set_disabled(True) main_window = MainWindow(imap, self) self.Main_window = main_window except Exception as e: self.message_box = QtWidgets.QMessageBox() self.message_box.setText(str(e)) self.message_box.show()