def main(): pyqtRemoveInputHook() QDir(QDir.homePath()).mkdir(".ricodebug") app = QApplication(sys.argv) app.setApplicationName("ricodebug") Icons() # We use all kinds of loggers here: # * a CriticalLogHandler that will abort the program whenever a critical error is received # * a FileHandler writing to a log in the home directory (all messages, for debugging) # * a LogViewHandler to have the log available in the GUI # * a ErrorLabelHandler that visually notifies the user of an error or a warning logger = logging.getLogger() formatter = logging.Formatter('[%(levelname)-8s] : %(filename)15s:%(lineno)4d/%(funcName)-20s : %(message)s') filehandler = logging.FileHandler(filename='%s/.ricodebug/ricodebug.log' % str(QDir.homePath())) filehandler.setFormatter(formatter) logger.addHandler(filehandler) logger.setLevel(logging.DEBUG) logger.addHandler(criticalloghandler.CriticalLogHandler()) window = MainWindow() logger.addHandler(window.logviewhandler) logger.addHandler(window.notificationFrameHandler) if (len(sys.argv) > 1): window.debugController.openExecutable(sys.argv[1]) window.show() logging.shutdown() sys.exit(app.exec_())
def main(): L = Loader('models/schemas/') decryptor = L.load_schema('decryptor') matrix = L.load_schema('storage_matrix') multiplexer = L.load_schema('multiplexer') and1 = L.load_schema('and') and2 = L.load_schema('and') decryptor.connector.add( matrix, { 'Y0': 'Y0', 'Y1': 'Y1', 'Y2': 'Y2', 'Y3': 'Y3', 'Y4': 'Y4', 'Y5': 'Y5', 'Y6': 'Y6', 'Y7': 'Y7' }) matrix.connector.add( multiplexer, { 'X0': 'X0', 'X1': 'X1', 'X2': 'X2', 'X3': 'X3', 'X4': 'X4', 'X5': 'X5', 'X6': 'X6', 'X7': 'X7' }) multiplexer.connector.add(and2, {'Y': 'X1'}) and1.connector.add(and2, {'Y': 'X2'}) cm = CollectManager(decryptor) cm.add(matrix) cm.add(multiplexer) cm.add(and1) cm.add(and2) mw = MainWindow(cm) mw.canvas.schema(decryptor, [50, 50]).draw() mw.canvas.matrix(matrix, [200, 50]).draw() mw.canvas.schema(multiplexer, [360, 250]).draw() mw.canvas.schema(and1, [360, 460]).draw() mw.canvas.schema(and2, [520, 420]).draw() connections = mw.canvas.connections() for connection in connections: connection.draw() mw.execute()
def __init__(self): self.app = QApplication(sys.argv) self.mw = MainWindow() self.project = ProjectModel()
from PyQt5 import QtWidgets from views.mainwindow import MainWindow if __name__ == '__main__': import sys app = QtWidgets.QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())
def main(): """Start the app.""" app = QApplication(sys.argv) app.mainwindow = MainWindow(SETTINGS) app.mainwindow.show() app.exit(app.exec_())