class Main(QtGui.QMainWindow): def __init__(self, parent=None): super(Main, self).__init__(parent) self.ui = MainWindow() self.ui.setupUi(self) (name, ok) = QtGui.QInputDialog.getText(self, "Register", "Enter your username:"******"Register", "Enter your username:") QtSender(name, 'config.cfg') self.sender = QtSender.GetInstance() # set up messaging listeners here self.receiver = QtReceiver('config.cfg') self.receiverThread = QtCore.QThread() self.receiverThread.started.connect(self.receiver.StartListening) self.receiver.moveToThread(self.receiverThread) self.receiverThread.start() def closeEvent(self, event): #JOURNAL need to kill thread while it's still running # unavoidable because accept runs until # interrupted, which we can't do in QThread/Python self.receiver.StopListening() self.receiverThread.quit() self.sender.Unregister() self.receiverThread.wait(1500) event.accept() pass
def __init__(self, parent=None): super(Main, self).__init__(parent) self.ui = MainWindow() self.ui.setupUi(self) (name, ok) = QtGui.QInputDialog.getText(self, "Register", "Enter your username:"******"Register", "Enter your username:") QtSender(name, 'config.cfg') self.sender = QtSender.GetInstance() # set up messaging listeners here self.receiver = QtReceiver('config.cfg') self.receiverThread = QtCore.QThread() self.receiverThread.started.connect(self.receiver.StartListening) self.receiver.moveToThread(self.receiverThread) self.receiverThread.start()
def __init__(self, argv): ''' Constructor ''' super().__init__(argv) #initalize sysout logging QtCore.qInstallMessageHandler(MainApplication.qt_message_handler) #set log level logging.basicConfig(level=logging.DEBUG) #set the skin self.loadSkin() #Create the MainController self.mainController = MainController() # Create the Main Window self.mainWindow = MainWindow()
def main(): #TODO: create standalone exe and liberate it configFilePath = '..\\persistence\\config\\' configFileName = 'config.json' defaultLaserJobsFilePath = '..\\persistence\\data\\' defaultLaserJobsFileName = 'defaultLaserJobsFile.xlsx' lc = LogicController(configFilePath, configFileName, defaultLaserJobsFilePath, defaultLaserJobsFileName) gc = GuiController() # ('#0','jobID',10) #0 es el id de la columna, 'jobID' es el texto del encabezado de dicha columna, # 10 es el procentaje de ancho de la columna (del total de MainWindow) mw = MainWindow(0.9, 0.7) mw.setGuiController(gc) mw.populate(LaserJob.keys) gc.setActualWindow(mw) lc.setGuiController(gc) lc.start()
import sys from App.ProfileLogger import ProfileLogger from Gui.MainWindow import MainWindow from Gui.Dialogs.DatabaseExceptionDialog import DatabaseExceptionDialog from sqlalchemy.exc import * if '__main__' == __name__: try: app = ProfileLogger(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_()) except DisconnectionError, e: dlg = DatabaseExceptionDialog(app.activeWindow(), e) dlg.exec_() except InternalError, e: dlg = DatabaseExceptionDialog(app.activeWindow(), e) dlg.exec_()
## Application main entry point. from Gui.MainWindow import MainWindow mw = MainWindow() mw.mainloop()
# coding=utf-8 import sys sys.path.append("/usr/lib/python2.6/dist-packages/PyQt4") from Gui.MainWindow import MainWindow from PyQt4.QtGui import QApplication app = QApplication(sys.argv) janela = MainWindow() janela.show() app.exec_()