Ejemplo n.º 1
0
def setContext(context):
    # appDir = os.getcwd()
    # print(QDir.currentPath())
    appDir = 'file:///' + QDir.currentPath()
    # print(appDir)
    # # print('appDir:', appDir)
    # appDir = 'file:///h:/QtDocuments/AOI'
    # print(appDir)
    context.setContextProperty('appDir', appDir)

    # add controllers
    mainController = MainController()
    context.setContextProperty('PyConsole', mainController)
    context.setContextProperty('mainController', mainController)

    colorCorrectorController = ColorCorrectorController()
    context.setContextProperty('colorCorrectorController', colorCorrectorController)

    noiseGeneratorController = NoiseGeneratorController()
    context.setContextProperty('noiseGeneratorController', noiseGeneratorController)

    filtersController = FiltersController()
    context.setContextProperty('filtersController', filtersController)

    binarizeController = BinarizeController()
    context.setContextProperty('binarizeController', binarizeController)

    morphologyController = MorphologyController()
    context.setContextProperty('morphologyController', morphologyController)

    segmentationController = SegmentationController()
    context.setContextProperty('segmentationController', segmentationController)
Ejemplo n.º 2
0
def main():
    # Create main app
    myApp = QGuiApplication(sys.argv)
    # myApp.setWindowIcon(QIcon('./images/icon.png'))

    # Create a View and set its properties
    appView = QQuickView()
    appView.setMinimumHeight(640)
    appView.setMinimumWidth(1024)
    appView.setTitle('Authorize Kerberos')

    engine = appView.engine()
    engine.quit.connect(myApp.quit)
    context = engine.rootContext()

    # add paths
    appDir = 'file:///' + QDir.currentPath()
    context.setContextProperty('appDir', appDir)

    # add controllers
    mainController = MainController()
    context.setContextProperty('PyConsole', mainController)
    context.setContextProperty('mainController', mainController)

    # Show the View
    appView.setSource(QUrl('./qml/main.qml'))
    appView.showMaximized()

    # Execute the Application and Exit
    myApp.exec_()
    sys.exit()
Ejemplo n.º 3
0
    def __init__(self):
        #Init window params
        super().__init__()
        self.title = 'BCI Hamburg Software v1.0'
        self.setWindowTitle(self.title)

        #Create the main controller of this application(mostly switches modes)
        self.controller = MainController(parent=self)

        #Add all elements who will take up main window to stacked widget
        #in order to switch between views without having to recreate
        #them each time
        self.mainSpace = QStackedWidget()
        self.setCentralWidget(self.mainSpace)
        self.mainSpace.addWidget(self.controller.view)
        self.mainSpace.addWidget(self.controller.trainingController.view)
        self.mainSpace.addWidget(self.controller.testingController.view)
        self.mainSpace.addWidget(self.controller.liveController.view)
        self.mainSpace.addWidget(self.controller.mlController.view)
        self.mainSpace.setCurrentWidget(self.controller.view)
        self.adjustSize() #TODO: QStackedWidget sizes to biggest of its widgets, keep or change?

        #Menu belongs to main window
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&Mode')

        #Add menu options for changing between modes
        for mode in ["live_mode", "training_mode", "test_mode"]:
            modeAction = QAction('&' + mode.replace("_", " ").title(), self)
            modeAction.triggered.connect(partial(self.controller.change_view, mode))
            fileMenu.addAction(modeAction)

        self.show()
Ejemplo n.º 4
0
	def go(self, path = "main"):
	#O "path" escolhido pelo usuário é analisado para decidir qual função da rota será acionada, ex: main. 
		#obs: get_prefix(path) identifica o primeiro termo da rota que é a chave para acionar o controller correto
		if (self.get_prefix(path) == "home"):
			examples = ExampleRoutes()
			examples.go(path)
		elif (path == "exit"):
			app.exit_application()
		elif (self.get_prefix(path) == "settings"):
			settings_routes = SettingsRoutes()
			settings_routes.go(path)
		elif (self.get_prefix(path) == "tests"):
			tests_routes = TestsRoutes()
			tests_routes.go(path)
		else:
			controller = MainController()
			controller.initial()
			app.gps.update_main_section("main")
Ejemplo n.º 5
0
 def main(self):
     controller = MainController()
     path = controller.initial()
     self.go(path)
Ejemplo n.º 6
0
from controllers.mainController import MainController


# Main program
if __name__ == "__main__":
    print("Algoritmo genetico robot...")
    # Start controller
    main_controller = MainController()
    main_controller.run()
Ejemplo n.º 7
0
def main():
    config = Config(DATA)
    controller = MainController(config)
    controller.run()
Ejemplo n.º 8
0
Archivo: main.py Proyecto: drewdru/AOI
    engine = appView.engine()
    engine.quit.connect(myApp.quit)
    context = engine.rootContext()

    # add paths
    # appDir = os.getcwd()
    # print(QDir.currentPath())
    appDir = 'file:///' + QDir.currentPath()
    # print(appDir)
    # # print('appDir:', appDir)
    # appDir = 'file:///h:/QtDocuments/AOI'
    # print(appDir)
    context.setContextProperty('appDir', appDir)

    # add controllers
    mainController = MainController()
    context.setContextProperty('PyConsole', mainController)
    context.setContextProperty('mainController', mainController)

    colorCorrectorController = ColorCorrectorController()
    context.setContextProperty('colorCorrectorController',
                               colorCorrectorController)

    noiseGeneratorController = NoiseGeneratorController()
    context.setContextProperty('noiseGeneratorController',
                               noiseGeneratorController)

    filtersController = FiltersController()
    context.setContextProperty('filtersController', filtersController)

    binarizeController = BinarizeController()