Python PyQt4.QtGui.QApplication() Examples

The following are 30 code examples of PyQt4.QtGui.QApplication(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt4.QtGui , or try the search function .
Example #1
Source File: interidentify.py    From specidentify with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def InterIdentify(xarr, specarr, slines, sfluxes, ws, mdiff=20, wdiff=20, rstep=1, filename=None,
                  function='poly', order=3, sigma=3, smooth=0, niter=5, res=2, dres=0.1, dc=20, ndstep=20,
                  istart=None, method='Zeropoint', scale='zscale', cmap='gray', contrast=1.0,
                  subback=0, textcolor='green', log=None, verbose=True):

    # Create GUI
    App = QtGui.QApplication(sys.argv)
    aw = InterIdentifyWindow(xarr, specarr, slines, sfluxes, ws, rstep=rstep, mdiff=mdiff, wdiff=wdiff, sigma=sigma, niter=niter,
                             res=res, dres=dres, dc=dc, ndstep=ndstep, istart=istart, method=method, smooth=smooth,subback=subback,
                             cmap=cmap, scale=scale, contrast=contrast, filename=filename, textcolor=textcolor, log=log)
    aw.show()
    # Start application event loop
    exit = App.exec_()
    imsol = aw.main.ImageSolution.copy()

    # Check if GUI was executed succesfully
    if exit != 0:
        raise SpecError(
            'InterIdentify GUI has unexpected exit status ' +
            str(exit))
    del aw
    return imsol 
Example #2
Source File: PyFlashAero.py    From PyFlashAero with GNU Affero General Public License v3.0 6 votes vote down vote up
def ImageView(args):
    print("imageView")
    
    try:
        import PyQt4.QtGui as QtGui
    except ImportError:
        sys.exit("Using --imageViewer requires PyQt4, which is not installed.")
    
    from FlashAir import ImageViewer
    
    app = QtGui.QApplication(sys.argv)
    port=args.card_uri.port    
    if(port == None):
        port = 80
    imageViewer = ImageViewer.ImageViewer(socket.gethostbyname(args.card_uri.hostname), port, args.timeout, args.folder_local, args.folder_remote, args.instant, args.recursive, args.debug_image)
    imageViewer.show()
    sys.exit(app.exec_()) 
Example #3
Source File: program.py    From nupic.studio with GNU General Public License v2.0 6 votes vote down vote up
def main():
  Global.app = QtGui.QApplication(sys.argv)
  Global.app.setStyleSheet("QGroupBox { border: 1px solid gray; } QGroupBox::title { padding: 0 5px; }")

  Global.appPath = os.path.abspath(os.path.join(__file__, '..'))
  Global.loadConfig()

  Global.project = Project()
  Global.simulationForm = SimulationForm()
  Global.architectureForm = ArchitectureForm()
  Global.nodeInformationForm = NodeInformationForm()
  Global.outputForm = OutputForm()
  Global.mainForm = MainForm()

  # Create and display the splash screen
  start = time.time()
  splash_pix = QtGui.QPixmap(Global.appPath + '/images/splash.png')
  splash = QtGui.QSplashScreen(splash_pix, QtCore.Qt.WindowStaysOnTopHint)
  splash.setMask(splash_pix.mask())
  splash.show()
  while time.time() - start < 3:
    time.sleep(0.001)
    Global.app.processEvents()
  splash.close()

  # Show start form
  startForm = StartForm()
  startForm.show()

  deploymentBuild = os.getenv("NUPIC_STUDIO_DEPLOYMENT_BUILD", False)
  if deploymentBuild:
    sys.exit(0)
  else:
    sys.exit(Global.app.exec_()) 
Example #4
Source File: cityscapesLabelTool.py    From LightNet with MIT License 6 votes vote down vote up
def keyReleaseEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.restoreOverrideCursor()
        # check for zero to release temporary zero
        # somehow, for the numpad key in some machines, a check on Insert is needed aswell
        elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert:
            self.transpTempZero = False
            self.update()

    #############################
    ## Little helper methods
    #############################

    # Helper method that sets tooltip and statustip
    # Provide an QAction and the tip text
    # This text is appended with a hotkeys and then assigned 
Example #5
Source File: app.py    From certificate_generator with GNU General Public License v3.0 6 votes vote down vote up
def run():
    """
        Main function that executes the app.
    """

    app = QtGui.QApplication(sys.argv)

    # Initialize the database
    createDB()

    # Start the app
    GUI = Window()
    GUI.show()
    sys.exit(app.exec_())

# Run the app 
Example #6
Source File: gui.py    From sparta with GNU General Public License v3.0 6 votes vote down vote up
def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Sparta v0.0001", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_5), QtGui.QApplication.translate("MainWindow", "Services", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_6), QtGui.QApplication.translate("MainWindow", "Information", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_3.setTabText(self.tabWidget_3.indexOf(self.tab_7), QtGui.QApplication.translate("MainWindow", "Notes", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_3), QtGui.QApplication.translate("MainWindow", "Hosts", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_4), QtGui.QApplication.translate("MainWindow", "Services", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("MainWindow", "Scan", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QtGui.QApplication.translate("MainWindow", "Brute", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_8), QtGui.QApplication.translate("MainWindow", "Log", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_9), QtGui.QApplication.translate("MainWindow", "Terminal", None, QtGui.QApplication.UnicodeUTF8))
        self.tabWidget_4.setTabText(self.tabWidget_4.indexOf(self.tab_10), QtGui.QApplication.translate("MainWindow", "Python", None, QtGui.QApplication.UnicodeUTF8))
        self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", "File", None, QtGui.QApplication.UnicodeUTF8))
        self.menuEdit.setTitle(QtGui.QApplication.translate("MainWindow", "Edit", None, QtGui.QApplication.UnicodeUTF8))
        self.menuSettings.setTitle(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
        self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNew_Project.setText(QtGui.QApplication.translate("MainWindow", "New", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNew_Project.setToolTip(QtGui.QApplication.translate("MainWindow", "Create a new project file", None, QtGui.QApplication.UnicodeUTF8))
        self.actionNew_Project.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+N", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setText(QtGui.QApplication.translate("MainWindow", "Exit", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setToolTip(QtGui.QApplication.translate("MainWindow", "Exit the application", None, QtGui.QApplication.UnicodeUTF8))
        self.actionExit.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+Q", None, QtGui.QApplication.UnicodeUTF8))
        self.actionOpen.setText(QtGui.QApplication.translate("MainWindow", "Open", None, QtGui.QApplication.UnicodeUTF8))
        self.actionOpen.setToolTip(QtGui.QApplication.translate("MainWindow", "Open an existing project file", None, QtGui.QApplication.UnicodeUTF8))
        self.actionOpen.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) 
Example #7
Source File: recipe-578634.py    From code with MIT License 6 votes vote down vote up
def post_to(cls, receiver, func, *args, **kwargs):
        """
        Post a callable to be delivered to a specific
        receiver as a CallbackEvent. 

        It is the responsibility of this receiver to 
        handle the event and choose to call the callback.
        """
        # We can create a weak proxy reference to the
        # callback so that if the object associated with
        # a bound method is deleted, it won't call a dead method
        if not isinstance(func, proxy):
            reference = proxy(func, quiet=True)
        else:
            reference = func

        event = cls(reference, *args, **kwargs)

        # post the event to the given receiver
        QtGui.QApplication.postEvent(receiver, event) 
Example #8
Source File: TraTicketBooker.py    From TRA-Ticket-Booker with GNU General Public License v3.0 6 votes vote down vote up
def main():
    # This is a very important solution 
    # for the problem in the IPython console.
    app_main = 0
    # ---------------------------------------------------------------------- #
    app_main = QtGui.QApplication(
        sys.argv, 
        QtCore.Qt.WindowStaysOnTopHint
    )
    app_main.processEvents()
    
    # Show Main Window
    tra_ticket_booker = TraTicketBooker()
    tra_ticket_booker.show()
    
    sys.exit(app_main.exec_())
    tra_ticket_booker.driver.quit() 
Example #9
Source File: browser.py    From shoogle with GNU General Public License v3.0 6 votes vote down vote up
def get_code(url, size=(640, 480), title="Google authentication"):
    """Open a QT webkit window and return the access code."""
    app = QtGui.QApplication([])
    dialog = QtGui.QDialog()
    dialog.setWindowTitle(title)
    dialog.resize(*size)
    webview = QtWebKit.QWebView()
    webpage = QtWebKit.QWebPage()
    webview.setPage(webpage)           
    webpage.loadFinished.connect(lambda: _on_qt_page_load_finished(dialog, webview))
    webview.setUrl(QtCore.QUrl.fromEncoded(url))
    layout = QtGui.QGridLayout()
    layout.addWidget(webview)
    dialog.setLayout(layout)
    dialog.authorization_code = None
    dialog.show()
    app.exec_()
    return dialog.authorization_code 
Example #10
Source File: cityscapesLabelTool.py    From TFSegmentation with Apache License 2.0 6 votes vote down vote up
def keyReleaseEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.restoreOverrideCursor()
        # check for zero to release temporary zero
        # somehow, for the numpad key in some machines, a check on Insert is needed aswell
        elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert:
            self.transpTempZero = False
            self.update()

    #############################
    ## Little helper methods
    #############################

    # Helper method that sets tooltip and statustip
    # Provide an QAction and the tip text
    # This text is appended with a hotkeys and then assigned 
Example #11
Source File: main.py    From rexploit with GNU General Public License v3.0 6 votes vote down vote up
def main():
    try:
        from PyQt4.Qt import PYQT_VERSION_STR
        from nmap import __version__
        from fpdf import __version__
        from requests import __version__
    except ImportError as e:
        from PyQt4.Qt import PYQT_VERSION_STR
        from nmap import __version__
        from fpdf import __version__
        from requests import __version__
        print e
        exit(-1)

    from PyQt4.QtGui import QApplication
    from rexploit.controllers.maincontroller import MainController
    app = QApplication(argv)
    mainController = MainController()
    mainController.start()
    exit(app.exec_()) 
Example #12
Source File: cityscapesLabelTool.py    From fcn8s_tensorflow with GNU General Public License v3.0 6 votes vote down vote up
def keyReleaseEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.restoreOverrideCursor()
        # check for zero to release temporary zero
        # somehow, for the numpad key in some machines, a check on Insert is needed aswell
        elif e.key() == QtCore.Qt.Key_0 or e.key() == QtCore.Qt.Key_Insert:
            self.transpTempZero = False
            self.update()

    #############################
    ## Little helper methods
    #############################

    # Helper method that sets tooltip and statustip
    # Provide an QAction and the tip text
    # This text is appended with a hotkeys and then assigned 
Example #13
Source File: web_browser.py    From PyIntroduction with MIT License 6 votes vote down vote up
def mainPyQt4Simple():
    # 必要なモジュールのimport
    from PyQt4.QtCore import QUrl
    from PyQt4.QtGui import QApplication
    from PyQt4.QtWebKit import QWebView

    url = 'https://github.com/tody411/PyIntroduction'

    app = QApplication(sys.argv)

    # QWebViewによるWebページ表示
    browser = QWebView()
    browser.load(QUrl(url))
    browser.show()

    sys.exit(app.exec_())

## PyQt4でのWebブラウザー作成(Youtube用). 
Example #14
Source File: splash.py    From AntiRansom with GNU General Public License v2.0 5 votes vote down vote up
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig) 
Example #15
Source File: pg.py    From IFIscripts with MIT License 5 votes vote down vote up
def main():

    app = QtGui.QApplication(sys.argv)  # A new instance of QApplication
    form = ExampleApp()  # We set the form to be our ExampleApp (design)
    form.show()  # Show the form
    app.exec_()  # and execute the app
    
    return ifi_identifiersDict 
Example #16
Source File: cityscapesLabelTool.py    From TFSegmentation with Apache License 2.0 5 votes vote down vote up
def keyPressEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        # Backspace deletes last point from polygon
        elif e.key() == QtCore.Qt.Key_Backspace:
            if not self.drawPolyClosed:
                del self.drawPoly[-1]
                self.update()
        # set alpha to temporary zero
        elif e.key() == QtCore.Qt.Key_0:
            self.transpTempZero = True
            self.update()
        elif e.key() == QtCore.Qt.Key_E:
            self.select_next_correction()
        elif e.key() == QtCore.Qt.Key_R:
            self.select_previous_correction()
        elif e.key() == QtCore.Qt.Key_1:
            self.modify_correction_type(CorrectionBox.types.TO_CORRECT)
        elif e.key() == QtCore.Qt.Key_2:
            self.modify_correction_type(CorrectionBox.types.TO_REVIEW)
        elif e.key() == QtCore.Qt.Key_3:
            self.modify_correction_type(CorrectionBox.types.RESOLVED)
        elif e.key() == QtCore.Qt.Key_4:
            self.modify_correction_type(CorrectionBox.types.QUESTION)
        elif e.key() == QtCore.Qt.Key_D and self.config.correctionMode:
            self.delete_selected_annotation()
        elif e.key() == QtCore.Qt.Key_M and self.config.correctionMode:
            self.modify_correction_description()

    # Key released 
Example #17
Source File: cityscapesViewer.py    From TFSegmentation with Apache License 2.0 5 votes vote down vote up
def main():

    app = QtGui.QApplication(sys.argv)
    tool = CityscapesViewer()
    sys.exit(app.exec_()) 
Example #18
Source File: cityscapesViewer.py    From LightNet with MIT License 5 votes vote down vote up
def main():

    app = QtGui.QApplication(sys.argv)
    tool = CityscapesViewer()
    sys.exit(app.exec_()) 
Example #19
Source File: cityscapesLabelTool.py    From LightNet with MIT License 5 votes vote down vote up
def main():

    app = QtGui.QApplication(sys.argv)

    tool = CityscapesLabelTool()

    sys.exit(app.exec_()) 
Example #20
Source File: cityscapesLabelTool.py    From TFSegmentation with Apache License 2.0 5 votes vote down vote up
def main():

    app = QtGui.QApplication(sys.argv)

    tool = CityscapesLabelTool()

    sys.exit(app.exec_()) 
Example #21
Source File: robot_gui.py    From Learning-Robotics-using-Python-Second-Edition with MIT License 5 votes vote down vote up
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig) 
Example #22
Source File: cityscapesLabelTool.py    From LightNet with MIT License 5 votes vote down vote up
def keyPressEvent(self,e):
        # Ctrl key changes mouse cursor
        if e.key() == QtCore.Qt.Key_Control:
            QtGui.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        # Backspace deletes last point from polygon
        elif e.key() == QtCore.Qt.Key_Backspace:
            if not self.drawPolyClosed:
                del self.drawPoly[-1]
                self.update()
        # set alpha to temporary zero
        elif e.key() == QtCore.Qt.Key_0:
            self.transpTempZero = True
            self.update()
        elif e.key() == QtCore.Qt.Key_E:
            self.select_next_correction()
        elif e.key() == QtCore.Qt.Key_R:
            self.select_previous_correction()
        elif e.key() == QtCore.Qt.Key_1:
            self.modify_correction_type(CorrectionBox.types.TO_CORRECT)
        elif e.key() == QtCore.Qt.Key_2:
            self.modify_correction_type(CorrectionBox.types.TO_REVIEW)
        elif e.key() == QtCore.Qt.Key_3:
            self.modify_correction_type(CorrectionBox.types.RESOLVED)
        elif e.key() == QtCore.Qt.Key_4:
            self.modify_correction_type(CorrectionBox.types.QUESTION)
        elif e.key() == QtCore.Qt.Key_D and self.config.correctionMode:
            self.delete_selected_annotation()
        elif e.key() == QtCore.Qt.Key_M and self.config.correctionMode:
            self.modify_correction_description()

    # Key released 
Example #23
Source File: guinness.py    From GUINNESS with GNU General Public License v2.0 5 votes vote down vote up
def main():
    app = QtGui.QApplication(sys.argv)
    ex = Layout()
    sys.exit(app.exec_()) 
Example #24
Source File: mainWindow.py    From Multiple-Uyghur-Script-Converter with Apache License 2.0 5 votes vote down vote up
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig) 
Example #25
Source File: mainWindow.py    From Multiple-Uyghur-Script-Converter with Apache License 2.0 5 votes vote down vote up
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding) 
Example #26
Source File: osdlyrics.py    From musicbox with MIT License 5 votes vote down vote up
def show_lyrics():

        app = QtGui.QApplication(sys.argv)
        lyrics = Lyrics()
        QtDBus.QDBusConnection.sessionBus().registerService("org.musicbox.Bus")
        QtDBus.QDBusConnection.sessionBus().registerObject("/", lyrics)
        sys.exit(app.exec_()) 
Example #27
Source File: osdlyrics.py    From musicbox with MIT License 5 votes vote down vote up
def initUI(self):
            self.setStyleSheet("background:" + config.get("osdlyrics_background"))
            if config.get("osdlyrics_transparent"):
                self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
            self.setAttribute(QtCore.Qt.WA_ShowWithoutActivating)
            self.setAttribute(QtCore.Qt.WA_X11DoNotAcceptFocus)
            self.setFocusPolicy(QtCore.Qt.NoFocus)
            if config.get("osdlyrics_on_top"):
                self.setWindowFlags(
                    QtCore.Qt.FramelessWindowHint
                    | QtCore.Qt.WindowStaysOnTopHint
                    | QtCore.Qt.X11BypassWindowManagerHint
                )
            else:
                self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            self.setMinimumSize(600, 50)
            osdlyrics_size = config.get("osdlyrics_size")
            self.resize(osdlyrics_size[0], osdlyrics_size[1])
            scn = QtGui.QApplication.desktop().screenNumber(
                QtGui.QApplication.desktop().cursor().pos()
            )
            bl = QtGui.QApplication.desktop().screenGeometry(scn).bottomLeft()
            br = QtGui.QApplication.desktop().screenGeometry(scn).bottomRight()
            bc = (bl + br) / 2
            frameGeo = self.frameGeometry()
            frameGeo.moveCenter(bc)
            frameGeo.moveBottom(bc.y())
            self.move(frameGeo.topLeft())
            self.text = "OSD Lyrics for Musicbox"
            self.setWindowTitle("Lyrics")
            self.show() 
Example #28
Source File: tray.py    From nsaway with GNU General Public License v3.0 5 votes vote down vote up
def tray():
  app = QtGui.QApplication(['NSAway'])
  style = app.style()
  ico = QtGui.QIcon(get_icon_path("good.ico"))
  w = QtGui.QWidget()

  trayIcon = SystemTrayIcon(ico, w)
  trayIcon.show()

  sys.exit(app.exec_()) 
Example #29
Source File: web_browser.py    From PyIntroduction with MIT License 5 votes vote down vote up
def mainPyQt5():
    # 必要なモジュールのimport
    from PyQt5.QtWidgets import QApplication
    from PyQt5.QtCore import QUrl
    from PyQt5.QtWebEngineWidgets import QWebEngineView

    url = 'https://github.com/tody411/PyIntroduction'

    app = QApplication(sys.argv)

    # QWebEngineViewによるWebページ表示
    browser = QWebEngineView()
    browser.load(QUrl(url))
    browser.show()

    sys.exit(app.exec_()) 
Example #30
Source File: web_browser.py    From PyIntroduction with MIT License 5 votes vote down vote up
def mainPyQt4Youtube():
    # 必要なモジュールのimport
    from PyQt4.QtCore import QUrl
    from PyQt4.QtGui import QApplication
    from PyQt4.QtWebKit import QWebView, QWebSettings
    from PyQt4.QtNetwork import QNetworkProxyFactory

    url = 'https://www.youtube.com/?hl=ja&gl=JP'

    app = QApplication(sys.argv)

    # Youtube動画を読み込むための設定
    QNetworkProxyFactory.setUseSystemConfiguration(True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.DnsPrefetchEnabled, True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.JavascriptEnabled, True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.OfflineStorageDatabaseEnabled, True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.AutoLoadImages, True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.LocalStorageEnabled, True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.PrivateBrowsingEnabled, True)
    QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)

    # QWebViewによるWebページ表示
    browser = QWebView()
    browser.load(QUrl(url))
    browser.setEnabled(True)
    browser.show()
    sys.exit(app.exec_())


## PyQt5でのWebブラウザー作成.