def __init__(self, app): super(MainController, self).__init__(app) # Fire main window window = QResizableMainWindow() self.mainWindow = MainWindow(window) window.resized.connect(self.resize) window.show() # Setup filemanager # Setup simulation self.setupSimulation() # Setup plotters self.mainWindow.setupGraphicsView() self.long_plotter = PipeDrawing(self.mainWindow.long_GraphicsView) self.long_plotter.updateView() self.cut_plotter = CutDrawing(self.mainWindow.cut_GraphicsView) self.cut_plotter.updateView() # Setup window self.mainWindow.updateDrawings.connect(self.redrawGeometry) self.mainWindow.setup() self.mainWindow.startSimulation.connect(self.startSimulation) self.mainWindow.stopSimulation.connect(self.forceQuit) self.mainWindow.displayField_comboBox.currentTextChanged.connect( self.fillCells) # Launch application sys.exit(app.exec_())
def initUI(self, masternode_list, imgDir): # Set title and geometry self.setWindowTitle(self.title) self.resize(self.cache.get("window_width"), self.cache.get("window_height")) # Set Icons self.spmtIcon = QIcon(os.path.join(imgDir, 'spmtLogo_shield.png')) self.pivx_icon = QIcon(os.path.join(imgDir, 'icon_pivx.png')) self.script_icon = QIcon(os.path.join(imgDir, 'icon_script.png')) self.setWindowIcon(self.spmtIcon) # Add RPC server menu mainMenu = self.menuBar() confMenu = mainMenu.addMenu('Setup') self.rpcConfMenu = QAction(self.pivx_icon, 'Local RPC Server...', self) self.rpcConfMenu.triggered.connect(self.onEditRPCServer) confMenu.addAction(self.rpcConfMenu) self.loadMNConfAction = QAction(self.script_icon, 'Import "masternode.conf" file', self) self.loadMNConfAction.triggered.connect(self.loadMNConf) confMenu.addAction(self.loadMNConfAction) # Sort masternode list (by alias if no previous order set) if self.cache.get('mnList_order') != {}: masternode_list.sort(key=self.extract_order) else: masternode_list.sort(key=self.extract_name) # Create main window self.mainWindow = MainWindow(self, masternode_list, imgDir) self.setCentralWidget(self.mainWindow) # Show self.show() self.activateWindow()
def init(configModule=None): from nodeEditor.nodeEditor import NodeEditor coralApp.init() CoralUiData.app = QtCore.QCoreApplication.instance() if CoralUiData.app is None: CoralUiData.app = QtGui.QApplication(sys.argv) else: coralApp.logInfo("using existing QApplication") MainWindow._init() NodeEditor._init() import builtinUis loadPluginUiModule(builtinUis) import builtinDrawNodes coralApp.loadPluginModule(builtinDrawNodes) if configModule: configModule.apply() else: MainWindow.globalInstance().show() if os.environ.has_key("CORAL_STARTUP_SCRIPT"): startupScriptFile = os.environ["CORAL_STARTUP_SCRIPT"] if startupScriptFile: utils.runtimeImport(startupScriptFile)
def main(): parser = OptionParser() parser = OptionParser(usage='usage: %prog [options]', version=baseclasses.version) parser.add_option('--verbose', action='store_true', dest='VERBOSE', default=False, help='Be more verbose') (options, args) = parser.parse_args(sys.argv) app = QtGui.QApplication(sys.argv) ui = MainWindow() #check for dependencies for dependency in ['faac', 'sox', 'soxi', 'mp4chaps', 'mp4tags', 'mp4art']: if which(dependency) == None: msgBox = QtGui.QMessageBox() msgBox.setIcon(QtGui.QMessageBox.Critical) msgBox.setText( 'Missing dependency: ' + dependency + ' is not properly installed. \nPlease read INSTALL.txt \nExiting.' ) msgBox.exec_() sys.exit(2) ui.show() baseclasses.VERBOSE = options.VERBOSE sys.exit(app.exec_())
def main(): app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() sys.exit(app.exec_())
class Trough(Gtk.Application): """ Beginning of the application: init -> run() -> startup signal -> activate signal """ def __init__(self): super().__init__(application_id='org.glu10.trough', flags=Gio.ApplicationFlags.FLAGS_NONE) self.main_window = None self.preferences = None self.cache = None self.connect('activate', self.do_activate) def do_startup(self) -> None: Gtk.Application.do_startup(self) self.preferences = Preferences(load_from_file=True) self.cache = Cache(load_from_file=True) def do_activate(self, *args) -> None: if not self.main_window and self.preferences and self.cache: self.main_window = MainWindow( self.preferences, self.cache, application=self, title='Trough') self.main_window.connect('delete_event', self.on_quit) self.add_window(self.main_window) self.main_window.present() def on_quit(self, widget: Gtk.Widget, event: Gdk.Event) -> None: self.cache.write_cache() self.quit()
def gui(plugin): """Launches the Qt GUI""" app = QApplication([]) win = MainWindow(plugin) win.show() return "Succesfully stopped lightning-qt" if not app.exec_( ) else "An error occured"
def __LaunchProcess(self, arg_parse_result): ''' after the arguments have been parsed, launch the UI in a forked process ''' # Initialize concurrency limit as early as possible so that it is # respected by subsequent imports. from pxr import Work Work.SetConcurrencyLimitArgument(arg_parse_result.numThreads) from mainWindow import MainWindow if arg_parse_result.clearSettings: MainWindow.clearSettings() # find the resource directory resourceDir = os.path.dirname(os.path.realpath(__file__)) + "/" # Create the Qt application app = QApplication(sys.argv) # apply the style sheet to it sheet = open(os.path.join(resourceDir, 'usdviewstyle.qss'), 'r') sheetString = sheet.read().replace('RESOURCE_DIR', resourceDir) app.setStyleSheet(sheetString) mainWindow = MainWindow(None, arg_parse_result) if arg_parse_result.quitAfterStartup: # Before we quit, process events one more time to make sure the # UI is fully populated (and to capture all the timing information # we'd want). app.processEvents() sys.exit(0) app.exec_()
def init(configModule = None): from nodeEditor.nodeEditor import NodeEditor coralApp.init() CoralUiData.app = QtCore.QCoreApplication.instance() if CoralUiData.app is None: CoralUiData.app = QtGui.QApplication(sys.argv) else: coralApp.logInfo("using existing QApplication") MainWindow._init() NodeEditor._init() import builtinUis loadPluginUiModule(builtinUis) import builtinDrawNodes coralApp.loadPluginModule(builtinDrawNodes) if configModule: configModule.apply() if os.environ.has_key("CORAL_STARTUP_SCRIPT"): startupScriptFile = os.environ["CORAL_STARTUP_SCRIPT"] if startupScriptFile: utils.runtimeImport(startupScriptFile)
class Application: def __init__(self): self.app = QApplication(sys.argv) self.mainWindow = MainWindow() def run(self): self.mainWindow.show() sys.exit(self.app.exec_())
def main(): app = QApplication(sys.argv) app.setAttribute(Qt.AA_EnableHighDpiScaling) app.setStyle("fusion") loginWindow = MainWindow() loginWindow.show() sys.exit(app.exec_())
def bangumi(): app = QApplication(sys.argv) mainWindow = MainWindow(app) bangumiInfoEditorWindow = BangumiInfoEditorWindow(mainWindow) mainWindow.show() app.setQuitOnLastWindowClosed(False) sys.exit(app.exec_())
def main(): from PyQt4.QtGui import QApplication from sys import exit, argv as args from mainWindow import MainWindow app = QApplication( args ) win = MainWindow() win.show() exit(app.exec_())
def do_activate(self, *args) -> None: if not self.main_window and self.preferences and self.cache: self.main_window = MainWindow( self.preferences, self.cache, application=self, title='Trough') self.main_window.connect('delete_event', self.on_quit) self.add_window(self.main_window) self.main_window.present()
def setupMainWindow(self): ''' create the main window with title''' self.widthMain = 1280 self.heightMain = 720 self.root = tk.Tk() self.root.title("Encube Discovery Wall Configurator") # self.root.minsize(width=self.widthMain,height=self.heightMain) self.mainWindow = MainWindow(self, self.root) # create listener event, delete window to call closeEvent self.root.protocol("WM_DELETE_WINDOW", self.closeEvent)
def connect(self): email = self.email_display.text() mdp = self.mdp_display.text() serverSMTP = "" serverPORT = "" a = email.find("@") b = email.rfind(".") server_name = email[a + 1:b] if a < 1 or b - a < 2: self.warning('Entrer un email valide SVP !') elif len(mdp) < 6: self.warning('Entrer un mot de passe valide SVP !') else: if server_name == "outlook": serverPORT = "587" serverSMTP = 'smtp-mail.outlook.com' elif server_name == "gmail": serverSMTP = 'smtp.gmail.fr' serverPORT = "587" elif server_name == "ensea": serverSMTP = 'smtp2.ensea.fr' serverPORT = "587" else: serverSMTP = QInputDialog.getText(self, self.title, "Serveur :")[0] serverPORT = QInputDialog.getText(self, self.title, "Port :")[0] if len(serverSMTP) > 0 and len(serverPORT) > 0: serverPORT = int(serverPORT) try: server = smtplib.SMTP(serverSMTP, serverPORT) server.starttls() server.login(email, mdp) except smtplib.SMTPServerDisconnected: self.warning( 'La combinaison email/mot de passe est incorrecte.') except smtplib.SMTPAuthenticationError: self.warning('Entrer un mot de passe valide SVP !') else: self.mainWindow = MainWindow(self.title, email, mdp, serverSMTP, serverPORT) self.mainWindow.show() self.hide()
def initUI(self, imgDir): # Set title and geometry self.setWindowTitle(self.title) self.resize(self.cache.get("window_width"), self.cache.get("window_height")) # Set Icons self.spmtIcon = QIcon(os.path.join(imgDir, 'spmtLogo_shield.png')) self.pivx_icon = QIcon(os.path.join(imgDir, 'icon_pivx.png')) self.script_icon = QIcon(os.path.join(imgDir, 'icon_script.png')) self.setWindowIcon(self.spmtIcon) # Create main window self.mainWindow = MainWindow(self, imgDir) self.setCentralWidget(self.mainWindow) # Add RPC server menu mainMenu = self.menuBar() confMenu = mainMenu.addMenu('Setup') self.rpcConfMenu = QAction(self.pivx_icon, 'RPC Servers config...', self) self.rpcConfMenu.triggered.connect(self.onEditRPCServer) confMenu.addAction(self.rpcConfMenu) toolsMenu = mainMenu.addMenu('Tools') self.signVerifyAction = QAction('Sign/Verify message', self) self.signVerifyAction.triggered.connect(self.onSignVerifyMessage) toolsMenu.addAction(self.signVerifyAction) # Show self.show() self.activateWindow()
def __init__(self, app): super(MasterWindow, self).__init__() self.setWindowTitle("Distortion Tester") self.mainWindow = MainWindow() self.processingThread = QThread() self.processingThread.start() self.settingsSaver = SettingsSaver() self.testRunner = TestRunner(self.settingsSaver) self.testRunner.moveToThread(self.processingThread) self.testRunner.startImageLoop.emit() app.aboutToQuit.connect(self.onClose) self.showMainWindow()
def main(): #you can change databasename at models.__init__ #status = False #if SqlHandler.usesLite(): status = True #os.path.exists(getDBName()) app = QtGui.QApplication(sys.argv) #try: if not SqlHandler.initialize(): print(g_error_msg_dict['database_init']) return if LoginDialog().exec_() == QtGui.QDialog.Accepted: vet_app = MainWindow() Tabmanager.openTab(tabCreator=MainMenuTab) vet_app.showMaximized() sys.exit(app.exec_())
def main(): app = QtGui.QApplication(sys.argv) scriptPath = os.path.dirname(os.path.realpath(sys.argv[0])) QtGui.qApp.pixmapsPath=scriptPath+"/../pixmaps" QtGui.qApp.resourcesPath=scriptPath+"/../resources" app.setWindowIcon(QtGui.QIcon(QtGui.qApp.pixmapsPath+"/icon.png")) app.setOrganizationName("pimp"); app.setApplicationName("Pimp"); app.styleSheet = QtCore.QFile(QtGui.qApp.resourcesPath+"/stylesheet.qss") app.styleSheet.open(QtCore.QIODevice.ReadOnly) app.setStyleSheet( str(app.styleSheet.readAll()) ) app.styleSheet.close() window = MainWindow() window.setWindowTitle("Pimp") window.show() sys.exit(app.exec_())
def main(): parser = OptionParser() parser = OptionParser(usage= 'usage: %prog [options]', version = baseclasses.version) parser.add_option('--verbose', action='store_true', dest='VERBOSE', default=False, help= 'Be more verbose') (options, args) = parser.parse_args(sys.argv) app = QtGui.QApplication(sys.argv) ui = MainWindow() #check for dependencies for dependency in ['faac', 'sox', 'soxi', 'mp4chaps', 'mp4tags', 'mp4art']: if which(dependency) == None: msgBox = QtGui.QMessageBox() msgBox.setIcon(QtGui.QMessageBox.Critical) msgBox.setText('Missing dependency: '+dependency+ ' is not properly installed. \nPlease read INSTALL.txt \nExiting.') msgBox.exec_() sys.exit(2) ui.show() baseclasses.VERBOSE = options.VERBOSE sys.exit(app.exec_())
def __LaunchProcess(self, arg_parse_result): ''' after the arguments have been parsed, launch the UI in a forked process ''' # Initialize concurrency limit as early as possible so that it is # respected by subsequent imports. from pxr import Work Work.SetConcurrencyLimitArgument(arg_parse_result.numThreads) from mainWindow import MainWindow if arg_parse_result.clearSettings: MainWindow.clearSettings() # Find the resource directory resourceDir = os.path.dirname(os.path.realpath(__file__)) + "/" # Create the Qt application app = QApplication(sys.argv) # Apply the style sheet to it sheet = open(os.path.join(resourceDir, 'usdviewstyle.qss'), 'r') # Qt style sheet accepts only forward slashes as path separators sheetString = sheet.read().replace('RESOURCE_DIR', resourceDir.replace("\\", "/")) app.setStyleSheet(sheetString) mainWindow = MainWindow(None, arg_parse_result) if arg_parse_result.quitAfterStartup: # Before we quit, process events one more time to make sure the # UI is fully populated (and to capture all the timing information # we'd want). app.processEvents() sys.exit(0) app.exec_()
def main(): urls = [] if len(sys.argv) > 1: if sys.argv[1] == "-h" or sys.argv[1] == "--help": print_help() return (0) app = QApplication(sys.argv) app.setWindowIcon(Icons().get_icon("application-icon")) win = MainWindow() sys.exit(app.exec_())
class Trough(Gtk.Application): """ Beginning of the application: init -> run() -> startup signal -> activate signal """ def __init__(self): super().__init__(application_id='org.glu10.trough', flags=Gio.ApplicationFlags.FLAGS_NONE) self.main_window = None self.preferences = None self.cache = None self.connect('activate', self.do_activate) def do_startup(self): Gtk.Application.do_startup(self) self.preferences = Preferences(load_from_file=True) self.cache = Cache(load_from_file=True) def do_activate(self, *args): if not self.main_window and self.preferences and self.cache: self.main_window = MainWindow(self.preferences, self.cache, application=self, title='Trough') self.main_window.connect('delete_event', self.on_quit) self.add_window(self.main_window) self.main_window.present() def on_quit(self, action, param): self.cache.write_cache() self.quit()
def initUI(self, imgDir): # Set title and geometry self.setWindowTitle(self.title) self.resize(starting_width, starting_height) # Set Icon spmtIcon_file = os.path.join(imgDir, 'spmtLogo_shield.png') self.spmtIcon = QIcon(spmtIcon_file) self.setWindowIcon(self.spmtIcon) # Add RPC server menu mainMenu = self.menuBar() confMenu = mainMenu.addMenu('Setup') self.rpcConfMenu = QAction(self.spmtIcon, 'Local RPC Server...', self) self.rpcConfMenu.triggered.connect(self.onEditRPCServer) confMenu.addAction(self.rpcConfMenu) # Create main window self.mainWindow = MainWindow(self, imgDir) self.setCentralWidget(self.mainWindow) # Show self.show() self.activateWindow()
def main(args): rospy.init_node('projected_gui_example', anonymous=True, log_level=rospy.DEBUG) signal.signal(signal.SIGINT, sigint_handler) app = QtGui.QApplication(sys.argv) gui = MyGui(0, 0, 1.00, 0.60, 2000, 1234) gui.debug_view() gui.mainWindow = MainWindow(gui.scene) timer = QtCore.QTimer() timer.start(500) timer.timeout.connect(lambda: None) # Let the interpreter run each 500 ms. sys.exit(app.exec_())
def main(): #checking projects integrity if not os.path.isdir("games"): print("There's no game directory") os.makedirs("games") #create game file gf = open("games/games.xml", "w") gf.write('<?xml version="1.0"?>\n<all>\n</all>\n') gf.close() #creating windows mainwin = MainWindow() mainwin.connect("delete-event", Gtk.main_quit) mainwin.show_all() Gtk.main()
def AnaPencereWidget(self): # TODO : Derse Kayıtlı Öğrenci Yoksa AnaWidget ı açmasın model_name = self.ui.cmb_Model.currentText() distance_metric = self.ui.cmb_Metrik.currentText() genelkod = self.ui.cmb_Dersler.currentText() countTakenStudents = list(self.Lesson.getLessonTakenStudents(genelkod)) if None in countTakenStudents: QMessageBox.warning( self, "Uyarı", "Derse Kayıtlı Öğrenci Yok Önce Derse Öğrenci Ekleyiniz None") elif len(countTakenStudents[0].split(",")) < 1: QMessageBox.warning( self, "Uyarı", "Derse Kayıtlı Öğrenci Yok Önce Derse Öğrenci Ekleyiniz") else: try: from mainWindow import MainWindow self.AnaWidget = MainWindow(self.id, self.kadi, self.sifre, genelkod, model_name, distance_metric) except: QMessageBox.warning(self, "Uyarı", "Ana Pencere Açılamadı")
#! /usr/bin/env python2 #! PY_PYTHON=3 import sys from PyQt5.QtWidgets import QApplication from mainWindow import MainWindow if __name__ == "__main__": app = QApplication(sys.argv) mw = MainWindow() sys.exit(app.exec_())
try: log.init(fbs.get_resource()) except Exception as e: QtWidgets.QMessageBox.critical( None, 'Log Create Error', f'Log file is not created successfully. Error is {e}') exit(-1) exit_code = 1 try: from widgets.toast import Toast from mainWindow import MainWindow Toast.settings['iconsPath'] = fbs.get_resource( os.path.join('icons', 'toast')) mainWindow = MainWindow() mainWindowQss = fbs.qss('mainWindow.qss') if mainWindowQss is not None: mainWindow.setStyleSheet(mainWindowQss) else: log.warning(f'Main window qss is not loaded successfully') Toast.setWidget(mainWindow) mainWindow.show() exit_code = fbs.app.exec_() # 2. Invoke appctxt.app.exec_() sys.exit(exit_code) except Exception as e: traceback.print_exc() log.critical("Unexpected Error, " + str(e)) QtWidgets.QMessageBox.critical(None, "Unexpected Error", str(e))
def data(self): MainWindow.globalInstance().emit(QtCore.SIGNAL("coralDataDropped")) return self._data
def mainWindow(): return MainWindow.globalInstance()
from PyQt5 import QtWidgets import sys from mainWindow import MainWindow if __name__ == "__main__": app = QtWidgets.QApplication([]) windown = MainWindow() windown.show() sys.exit(app.exec_())
QMessageBox.information(self, "Warning", str(e)) def maximizeWindow(self): try: window.showMaximized() except BaseException as e: QMessageBox.information(self, "Warning", str(e)) if __name__ == "__main__": app = QApplication(sys.argv) if platform.system() == 'Windows': app.setStyle(QStyleFactory.create('WindowsVista')) # for retina if platform.system() == 'Darwin': app.setAttribute(Qt.AA_EnableHighDpiScaling, True) myLocale = QLocale() trans = QTranslator() g = genlist_api.Genlist() i18nQm = g.resource_path(os.path.join('i18n', 'checklister_' + myLocale.name() + '.qm')) trans.load(i18nQm) app.installTranslator(trans) window = MainWindow() window.show() # window zoom/min/max window.actionMinimize.triggered.connect(minimizeWindow) window.actionZoom.triggered.connect(normalWindow) window.actionMaximize.triggered.connect(maximizeWindow) sys.exit(app.exec_())
#!/usr/bin/env python3 from mainWindow import MainWindow from PyQt5.QtWidgets import QApplication app=QApplication([]) mainWindow=MainWindow() mainWindow.show() app.exec_()
def _restoreSettings(self): mainWin = MainWindow.globalInstance() settings = mainWin.settings() self._scriptTextEdit.setPlainText(settings.value("scriptEditorText").toString())
# -*- coding: utf-8 -*- from PyQt4.QtGui import QApplication import os import sys from mainWindow import MainWindow from datamodel import DataModel from moses import Moses if __name__ == "__main__": app = QApplication(sys.argv) workdir = os.path.join(os.path.join(os.path.expanduser('~'), 'mosesgui')) if not os.path.exists(workdir): os.makedirs(workdir) dm = DataModel(filename=os.path.join(workdir, "models.sqlite")) moses = Moses() if not moses.detect(): sys.exit(1) MainWindow = MainWindow(dm=dm, moses=moses, workdir=workdir) MainWindow.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())
def do_activate(self, *args): if not self.main_window and self.preferences and self.cache: self.main_window = MainWindow(self.preferences, self.cache, application=self, title='Trough') self.main_window.connect('delete_event', self.on_quit) self.add_window(self.main_window) self.main_window.present()
from PyQt5.QtWidgets import QApplication#, QSystemTrayIcon from PyQt5.QtGui import QIcon import sys from mainWindow import MainWindow if __name__ == "__main__": app = QApplication(sys.argv) # tray = QSystemTrayIcon() # tray.setIcon(QIcon("icons/h8code.png")) # tray.show() main = MainWindow() main.show() sys.exit(app.exec_())
def closeEvent(self, event): mainWin = MainWindow.globalInstance() settings = mainWin.settings() settings.setValue("scriptEditorText", self._scriptTextEdit.toPlainText())
from qt import * from mainWindow import MainWindow app = QApplication([]) app.setApplicationName("Circuit Editor") window = MainWindow(app) window.show() app.exec_()
# 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_())