def run(): global appMainForm, appImagesForm app = QtGui.QApplication(sys.argv) appMainForm = MainWindow() appImagesForm = ImagesSelectionForm() appMainForm.show() sys.exit(app.exec_())
class App: def __init__(self): self.validate() self.serial = acquisition.FakeSerial() self.gui = MainWindow() self.transform = DataScaling() self.serial.source.connect(self.transform.process) self.transform.source.connect(self.gui.plots.new_data) self.gui.start.connect(self.serial.start) self.gui.stop.connect(self.serial.stop) self.exporters = [] for name, params in settings.export.items(): exporter = export.FORMATS[params['format']](name, params) if params['stage'] == 'acquisition': self.serial.source.connect(exporter.update) elif params['stage'] == 'transform': self.transform.source.connect(exporter.update) self.exporters.append(exporter) for e in self.exporters: self.gui.start.connect(e.start) self.gui.stop.connect(e.stop) def start(self): self.gui.show() def validate(self): assert settings.NUMBER_OF_SENSORS > 0 if settings.transform['default'] and not hasattr(settings.transform['default'], '__call__'): print("default transformation must be callable or None") settings.transform['default'] = None for i in range(settings.NUMBER_OF_SENSORS): # reverse-update plot parameters with defaults s = settings.plots['default'].copy() if i in settings.plots: s.update(settings.plots[i]) settings.plots[i] = s # check transforms if i not in settings.transform or not hasattr(settings.transform[i], '__call__'): settings.transform[i] = settings.transform['default'] for name, params in settings.export.items(): if params['format'] not in export.FORMATS: print("Invalid export format: {}", params['format'])
def __init__(self): self.validate() self.serial = acquisition.FakeSerial() self.gui = MainWindow() self.transform = DataScaling() self.serial.source.connect(self.transform.process) self.transform.source.connect(self.gui.plots.new_data) self.gui.start.connect(self.serial.start) self.gui.stop.connect(self.serial.stop) self.exporters = [] for name, params in settings.export.items(): exporter = export.FORMATS[params['format']](name, params) if params['stage'] == 'acquisition': self.serial.source.connect(exporter.update) elif params['stage'] == 'transform': self.transform.source.connect(exporter.update) self.exporters.append(exporter) for e in self.exporters: self.gui.start.connect(e.start) self.gui.stop.connect(e.stop)
def main(): try: qApp = QtWidgets.QApplication(sys.argv) aw = MainWindow() sys.exit(qApp.exec_()) except Exception as err: Error_handel().write(err, region='gui') sys.exit()
""" Entry point for application. You may run this without a GUI by passing in the absolute path to the Template document and the Variables workbook as command line arguments. """ import sys from PyQt5.QtWidgets import QApplication from gui.gui import MainWindow from automation.automate import Automate if __name__ == '__main__': if sys.argv[1:]: if len(sys.argv[1:]) != 2: print('To run this without a GUI, please supply the absolute paths to the Template and Variables files ' 'enclosed in quotes. For example: ') print(r'python main.py "C:\path\to\template.docx" "C:\path\to\variables.xls"') else: template_file, vars_file = sys.argv[1], sys.argv[2] automation = Automate(in_gui=False) automation.run(template_file, vars_file) else: app = QApplication(sys.argv) main = MainWindow() main.show() sys.exit(app.exec_())
import signal signal.signal(signal.SIGINT, signal.SIG_DFL) if __name__ == '__main__': cfg = config.load(sys.argv[1]) try: img_path=sys.argv[2] except IndexError: img_path=None #starting comm jdrc= comm.init(cfg, 'ColorTuner') cameraCli = jdrc.getCameraClient("ColorTuner.Camera") camera = CameraFilter(cameraCli) app = QApplication(sys.argv) frame = MainWindow(img_path) frame.setCamera(camera) frame.show() app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) t2 = ThreadGUI(frame) t2.daemon=True t2.start() sys.exit(app.exec_())
''' Created on Jan 13, 2014 @author: Eugene Syriani @version: 0.2.5 This is the main BiBler module. Execute this module from the command line to start the application. @note: It assumes that the L{app} package has a L{statechart.BiBler_Statechart} class and a L{UserInterface.UserInterface} class that implements L{gui.app_interface.IApplication}. G{packagetree app, gui, utils} ''' import wx from gui.gui import MainWindow from gui.controller import Controller from app.statechart import BiBler_Statechart from app.UserInterface import UserInterface if __name__ == '__main__': app = wx.App(False) controller = Controller() controller.bindGUI(MainWindow(controller)) controller.bindSC(BiBler_Statechart()) controller.bindApp(UserInterface()) controller.start() app.MainLoop()
nn = NeuralNetwork() nn.train_model() elif start_argument == 'test': nn = NeuralNetwork(load_existing_data=True) # nn.test_accuracy() nn.test_accuracy_custom() elif start_argument == 'predict': nn = NeuralNetwork(load_existing_data=True) print('Ввод текстов активен (CTRL + C для выхода)') try: while True: text = input('> ') prediction = nn.predict(text) print(f'{prediction[0]} [{prediction[1]}]') except (KeyboardInterrupt, SystemExit): print('До свидания!') else: raise InvalidStartParameter exit(0) app = QtWidgets.QApplication(argv) main_window = MainWindow() main_window.show() exit(app.exec_())
from PyQt5 import QtGui import qdarkstyle import signal signal.signal(signal.SIGINT, signal.SIG_DFL) if __name__ == '__main__': cfg = config.load(sys.argv[1]) try: img_path=sys.argv[2] except IndexError: img_path=None jdrc= comm.init(cfg, 'ColorTuner') cameraCli = jdrc.getCameraClient("ColorTuner.Camera") camera = CameraFilter(cameraCli) app = QApplication(sys.argv) frame = MainWindow(img_path) frame.setCamera(camera) frame.show() app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) t2 = ThreadGUI(frame) t2.daemon=True t2.start() sys.exit(app.exec_())
#!/usr/bin/python3 import sys from gui.gui import MainWindow from PyQt5.QtWidgets import QApplication if __name__ == "__main__": app = QApplication(sys.argv) frame = MainWindow() frame.show() sys.exit(app.exec_())
import sys from gui.gui import MainWindow, Run if __name__ == "__main__": mainWindow = MainWindow() sys.exit(Run(sys.argv, mainWindow))
from sensors.cameraFilter import CameraFilter from gui.gui import MainWindow from PyQt5.QtWidgets import QApplication from PyQt5 import QtGui import qdarkstyle import signal signal.signal(signal.SIGINT, signal.SIG_DFL) if __name__ == '__main__': cfg = config.load(sys.argv[1]) #starting comm jdrc = comm.init(cfg, 'ColorTuner') cameraCli = jdrc.getCameraClient("ColorTuner.Camera") camera = CameraFilter(cameraCli) app = QApplication(sys.argv) frame = MainWindow() frame.setCamera(camera) frame.show() app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) t2 = ThreadGUI(frame) t2.daemon = True t2.start() sys.exit(app.exec_())
def main(): import sys app = QApplication(sys.argv) w = MainWindow() sys.exit(app.exec_())
__author__ = 'Галлям' from PyQt5 import QtWidgets import sys from gui.gui import MainWindow if __name__ == '__main__': app = QtWidgets.QApplication([]) mw = MainWindow() mw.show() sys.exit(app.exec_())