def startGui(): settings = Settings() try: settings.load() except JSONSettings.SettingsError as e: print(e) quit() app = QGuiApplication([]) app.setOrganizationName('Schweinesystem') app.setOrganizationDomain('schweinesystem.eu') app.setApplicationName('PasswdAdmin') signal.signal(signal.SIGINT, signit_handler) timer = QTimer() timer.start(500) # You may change this if you wish. timer.timeout.connect(lambda: None) # Let the interpreter run each 500 ms. engine = QQmlApplicationEngine() usermodel = UserModel(settings) context = engine.rootContext() context.setContextProperty('userModel', usermodel) thisFile = os.path.realpath(__file__) thisDir = os.path.dirname(thisFile) engine.load(thisDir + '/qml/MainWidget.qml') if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
def run(): """Start Virtual Warehouse application.""" QGuiApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) app = QGuiApplication(sys.argv) app.setOrganizationName("Bretislav Hajek") app.setOrganizationDomain("bretahajek.com") app.setApplicationName("Virtual Warehouse") app.setApplicationVersion(__version__) engine = QQmlApplicationEngine() controller = ViewController() engine.rootContext().setContextProperty("ViewController", controller) engine.rootContext().setContextProperty("versionNumber", __version__) app.setWindowIcon(QIcon(":/images/icon.png")) engine.load(QtCore.QUrl("qrc:/qml/main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
def main(): argv = sys.argv # Trick to set the style / not found how to do it in pythonic way argv.extend(["-style", "universal"]) app = QGuiApplication(argv) # why needed now? app.setOrganizationName("Some Company") app.setOrganizationDomain("somecompany.com") app.setApplicationName("Amazing Application") qmlRegisterType(FigureCanvasQTAggToolbar, "Backend", 1, 0, "FigureToolbar") imgProvider = MatplotlibIconProvider() # !! You must specified the QApplication as parent of QQmlApplicationEngine # otherwise a segmentation fault is raised when exiting the app engine = QQmlApplicationEngine(parent=app) engine.addImageProvider("mplIcons", imgProvider) context = engine.rootContext() data_model = DataSeriesModel() context.setContextProperty("dataModel", data_model) mainApp = Form(data=data_model) context.setContextProperty("draw_mpl", mainApp) engine.load(QUrl('main.qml')) win = engine.rootObjects()[0] mainApp.figure = win.findChild(QObject, "figure").getFigure() rc = app.exec_() # There is some trouble arising when deleting all the objects here # but I have not figure out how to solve the error message. # It looks like 'app' is destroyed before some QObject sys.exit(rc)
# This Python file uses the following encoding: utf-8 import sys import os from PySide2.QtGui import QGuiApplication, QIcon from PySide2.QtQml import QQmlApplicationEngine from mainWindow import MainWindow if __name__ == "__main__": app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() # Get Context main = MainWindow() engine.rootContext().setContextProperty("backend", main) # Set App Extra Info app.setOrganizationName("Wanderson M. Pimenta") app.setOrganizationDomain("N/A") # Set Icon app.setWindowIcon(QIcon("app.ico")) # Load Initial Window engine.load(os.path.join(os.path.dirname(__file__), "qml/splashScreen.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
def shutdown(): '''Delete engine and qml object before python garbage collection''' del globals()["engine"] if __name__ == "__main__": #QGuiApplication.setAttribute(Qt.AA_EnableHighDpiScaling) #bug on linux scaling if activated sys.argv += ['--style', 'material'] app = QGuiApplication(sys.argv) app.aboutToQuit.connect(shutdown) # set variables for settings app.setApplicationName("DipSim") app.setOrganizationName("IPR") app.setOrganizationDomain("IPR.com") hypervisor = SimHypervisor() # python compute hypervisor engine = QQmlApplicationEngine() # UI engine # add necesaary object linking UI and python data engine.rootContext().setContextProperty("hypervisor", hypervisor) engine.rootContext().setContextProperty("primCell", hypervisor.primCell) engine.rootContext().setContextProperty("dipModel", hypervisor.dipModel) engine.rootContext().setContextProperty("dipModelMinEnergy", hypervisor.dipModelMinEnergy) engine.rootContext().setContextProperty("dipModelMinEnergyMC", hypervisor.dipModelMinEnergyMC) engine.load(os.path.join(os.path.dirname(__file__), "main.qml"))
#Here try to implement -> the bigger the difference the smaller the percentage #the smaller the distance the bigger the percentage if result_loc < 1000: percen = 100 else: percen = 100 - (result_loc / 100) if percen < 0: percen = 0 print(loc_info) file.close() if __name__ == "__main__": app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() # Get Context main = MainWindow() engine.rootContext().setContextProperty("backend", main) # Set App Extra Info app.setOrganizationName("Image Verifier with Location") app.setOrganizationDomain("N/A") # Load QML File engine.load(os.path.join(os.path.dirname(__file__), "qml/nimi.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
from bean.ProcessBean import ProcessBean from bean.SettingsBean import SettingsBean from controller.SettingsController import SettingsController from controller.ProcessController import ProcessController from core.Logger import Logger import resources if __name__ == "__main__": # Set up the application window app = QGuiApplication(sys.argv) version = "1.0.2" app.setOrganizationName("DV") app.setApplicationName("CSV-Synchronizer") app.setApplicationVersion(version) Logger().info("Start applicazione CSV-Synchronizer") Logger().info("Versione: " + version) # qmlFile = QFile(":/ui/main.qml") # qmlFile.open(QFile.ReadOnly | QFile.Text) # Load the QML file # qmlFile = os.path.join(os.path.dirname(__file__), "./ui/main.qml") qmlRegisterType(SettingsController, "SettingsController", 1, 0, "QMLSettingsController") qmlRegisterType(ProcessController, "ProcessController", 1, 0, "QMLProcessController") qmlRegisterType(ProcessBean, "ProcessBean", 1, 0, "QMLProcessBean") qmlRegisterType(SettingsBean, "SettingsBean", 1, 0, "QMLSettingsBean")
default=None, help="List of stocks in JSON format") if sys.version_info[0] != 3: print("Error: This script requires Python 3") exit(1) # arguments for QApplication parser.add_option("--style", help="Passed to the constructor of QApplication") (options, args) = parser.parse_args() if len(args) != 0: parser.error("Wrong number of arguments. Use %s --help" % sys.argv[0]) # Company name: this avoids an error message QGuiApplication.setOrganizationName("MyCompany") QGuiApplication.setOrganizationDomain("mycompany.com") # View model stockListModel = JsonListModel() # Python objects tradingClient = TradingClient(stockListModel) tradingClient.resetStocks() # Main if __name__ == '__main__': # Setup the application window, by default use google material style if '--style' not in sys.argv: sys.argv += ['--style', 'material']
# qml de oluşturulan fonk ile bağdaştırıp anlık zaman bilgisini label yazma def setTime(self): now = datetime.datetime.now() formatDate = now.strftime("Now is %H:%M:%S %p of %Y/%m/%d") print(formatDate) self.printTime.emit(formatDate) # Signal slot ile qml de texte müdahale edebilmek ve yazıyı pythonda düzenlemek için gerekli kısım @Slot(str) def welcomeText(self, name): self.setName.emit("Welcome, " + name) if __name__ == "__main__": app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() # Get Context main = MainWindow() engine.rootContext().setContextProperty("backend", main) # arayüzün detaylandırılması app.setOrganizationName("TUBİTAK2209A") app.setOrganizationDomain("N/A") # Ana tasarımlarının yapıldığı mail.qml dosyası engine.load(os.path.join(os.path.dirname(__file__), "qml/main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
abspath(__file__))) def shutdown(): del globals()["engine"] if __name__ == '__main__': main_context = MainContext() error_service = ErrorService() app = QGuiApplication(sys.argv) app.aboutToQuit.connect(shutdown) app.setWindowIcon(QIcon("icons/app.ico")) app.setOrganizationName("xavier CLEMENCE") app.setOrganizationDomain("xavier CLEMENCE") QQuickStyle.setStyle("Material") engine = QQmlApplicationEngine() context = engine.rootContext() context.setContextProperty("context", main_context) context.setContextProperty("error", error_service) qmlFile = join(application_path, "views/MainView.qml") engine.load(QUrl.fromLocalFile(qmlFile)) if not engine.rootObjects(): sys.exit(-1)
from PySide2.QtGui import QGuiApplication from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType from PySide2.QtCore import QUrl, Property, Signal, QObject, Slot import eye import videoio_uvc #import calibration_hmd import debugger as calibration_hmd import cv2 import time import numpy as np import multiprocessing as mp if __name__ == '__main__': #mp.set_start_method('spawn') app = QGuiApplication(sys.argv) app.setOrganizationName('Cadu') app.setOrganizationDomain('Nowhere') engine = QQmlApplicationEngine() videoio = videoio_uvc.VideoIO_UVC() calib_hmd = calibration_hmd.HMDCalibrator(3, 3, 21, 3) le_cam = eye.EyeCamera('left') re_cam = eye.EyeCamera('right') videoio.set_active_cameras(le_cam, re_cam) calib_hmd.set_sources(le_cam, re_cam) engine.rootContext().setContextProperty("camManager", videoio) engine.rootContext().setContextProperty("leftEyeCam", le_cam) engine.rootContext().setContextProperty("rightEyeCam", re_cam) engine.rootContext().setContextProperty("calibHMD", calib_hmd)
#ДЛЯ ОСТАНОВКИ ЦИКЛА if self.running == False: break #МЕНЯЕМ replaceok = self.openfile(file_path2).replace(chtomenaem,lst_zamena.pop(0)) if replaceok.endswith('\n') == False: replaceok +='\n' #ЗАПИСЫВАЕМ В ФАЙЛ ГОТОВО self.writefile(file_path3,'a',replaceok) now_progbar +=1 self.nowProgbar.emit(now_progbar) #ПРОГРЕССБАР НА 0 self.nowProgbar.emit(0) self.allOk.emit("OK") if __name__ == "__main__": app = QGuiApplication(sys.argv) app.setWindowIcon(QIcon("img/icon.png")) app.setOrganizationName("null") app.setOrganizationDomain("null") standart = Standart() engine = QQmlApplicationEngine() engine.rootContext().setContextProperty("standart", standart) engine.load(os.fspath(Path(__file__).resolve().parent / "main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
@Slot() def stop_bot(self): """Stops the bot and terminates the Process. @Slot() Returns: None """ if(self._bot_process != None): print("\n[STATUS] Stopping the bot and terminating the Thread.") self._bot_process.terminate() return None if __name__ == "__main__": app = QGuiApplication(sys.argv) app.setOrganizationName("somename") app.setOrganizationDomain("somename") engine = QQmlApplicationEngine() # Get the Context. main = MainWindow() engine.rootContext().setContextProperty("backend", main) # Load the QML File. engine.load(os.path.join(os.path.dirname(__file__), "gui/qml/main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())
#==================main=============== if __name__ == "__main__": sys.argv += ['--style', 'Imagine'] app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() # Get Context main = MainWindow() engine.rootContext().setContextProperty("backend", main) # Set App Extra Info app.setOrganizationName("Informacao") app.setOrganizationDomain("N/A") # Load QML File engine.load(os.path.join(os.path.dirname(__file__), "qml/main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())