Python PyQt4.QtGui 模块,QApplication() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt4.QtGui.QApplication()

项目:PyIntroduction    作者:tody411    | 项目源码 | 文件源码
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_())
项目:code    作者:ActiveState    | 项目源码 | 文件源码
def buttonClicked(self, char_ord):
        w = self.INPUT_WIDGET
        if char_ord in self.NO_ORD_KEY_LIST:
            keyPress = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, char_ord, QtCore.Qt.NoModifier, '')
        else:
            keyPress = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, char_ord, QtCore.Qt.NoModifier, chr(char_ord))

        # send keypress event to widget
        QtGui.QApplication.sendEvent(w, keyPress)

        # line edit returnPressed event is triggering twise for press and release both
        # that is why do not send release event for special key
        if char_ord not in self.NO_ORD_KEY_LIST:
            keyRelease = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, char_ord, QtCore.Qt.NoModifier, '')
            QtGui.QApplication.sendEvent(w, keyRelease)

        # hide on enter or esc button click
        if char_ord in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Escape):
            self.hide()
项目:TRA-Ticket-Booker    作者:gw19    | 项目源码 | 文件源码
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()
项目:PyIntroduction    作者:tody411    | 项目源码 | 文件源码
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?).
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def downloadWithoutProgress(self, imageUrl, filename):
        if self.cancel == True:
            self.textEdit.append(u"[Downloader] Cancelado!!")
            QtGui.QApplication.processEvents()
            return False
        else:
            self.imageRequest = urllib2.Request(self.imageUrl, headers={'User-agent' : 'BID/1.0'})
            self.imageResponse = urllib2.urlopen(self.imageRequest, context=self.context)
            with open(str(self.filename), 'wb') as self.file:
                while True:
                    self.imageData = self.imageResponse.read()
                    if not self.imageData:
                        break
                    self.file.write(self.imageData)
            return True

    # Método para resgatar a quantidade de posts no tópico escolhido.
    # ===============================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def downloadWithoutProgress(self, imageUrl, filename):
        if self.cancel == True:
            self.textEdit.append(u"[Downloader] Cancelado!!")
            QtGui.QApplication.processEvents()
            return False
        else:
            self.imageRequest = urllib2.Request(self.imageUrl, headers={'User-agent' : 'BID/1.0'})
            self.imageResponse = urllib2.urlopen(self.imageRequest, context=self.context)
            with open(str(self.filename), 'wb') as self.file:
                while True:
                    self.imageData = self.imageResponse.read()
                    if not self.imageData:
                        break
                    self.file.write(self.imageData)
            return True

    # Método para resgatar a quantidade de posts no tópico escolhido.
    # ===============================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def getPosts(self, getBoardValue, getThreadNumber):
        self.url = self.getJsonURL(self.getBoardValue, self.getThreadNumber)
        self.data = self.getJson(self.url)
        try:
            for self.archived in self.data['posts']:
                if 'archived' in self.archived:
                    return [self.data['posts'], True]
                else:
                    return [self.data['posts'], False]
        except Exception:
            self.textEdit.append(u"[Downloader] ERRO! Erro ao recuperar posts do tópico %s em /%s/!" % (self.getThreadNumber, self.getBoardValue))
            QtGui.QApplication.processEvents()
            return []

    # Método para resgatar as imagens dos posts e o hash MD5 das imagens.
    # Para Imageboards com suporte a múltiplas imagens por post ou apenas uma imagem por post.
    # Algumas imageboards não possuem informações de hash das imagens!
    # ========================================================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def downloadWithoutProgress(self, imageUrl, filename, fsizefile):
        if self.cancel == True:
            self.textEdit.append(u"[Downloader] Cancelado!!")
            QtGui.QApplication.processEvents()
            return False
        else:
            self.imageRequest = urllib2.Request(self.imageUrl, headers={'User-agent' : 'BID/1.0'})
            self.imageResponse = urllib2.urlopen(self.imageRequest, context=self.context)
            self.downloadedSoFar = 0
            with open(str(self.filename), 'wb') as self.file:
                while True:
                    self.imageData = self.imageResponse.read(4096)
                    self.downloadedSoFar += len(self.imageData)
                    if not self.imageData:
                        break
                    self.file.write(self.imageData)
                    self.setProgress(self.fsizefile, self.downloadedSoFar)
            return True

    # Método para resgatar a quantidade de posts no tópico escolhido.
    # ===============================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def getPosts(self, getBoardValue, getThreadNumber):
        self.url = self.getJsonURL(self.getBoardValue, self.getThreadNumber)
        self.data = self.getJson(self.url)
        try:
            for self.archived in self.data['posts']:
                if 'archived' in self.archived:
                    return [self.data['posts'], True]
                else:
                    return [self.data['posts'], False]
        except Exception:
            self.textEdit.append(u"[Downloader] ERRO! Erro ao recuperar posts do tópico %s em /%s/!" % (self.getThreadNumber, self.getBoardValue))
            QtGui.QApplication.processEvents()
            return []

    # Método para resgatar as imagens dos posts e o hash MD5 das imagens.
    # Para Imageboards com suporte a múltiplas imagens por post ou apenas uma imagem por post.
    # Algumas imageboards não possuem informações de hash das imagens!
    # ========================================================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def downloadWithoutProgress(self, imageUrl, filename):
        if self.cancel == True:
            self.textEdit.append(u"[Downloader] Cancelado!!")
            QtGui.QApplication.processEvents()
            return False
        else:
            self.imageRequest = urllib2.Request(self.imageUrl, headers={'User-agent' : 'BID/1.0'})
            self.imageResponse = urllib2.urlopen(self.imageRequest, context=self.context)
            with open(str(self.filename), 'wb') as self.file:
                while True:
                    self.imageData = self.imageResponse.read()
                    if not self.imageData:
                        break
                    self.file.write(self.imageData)
            return True

    # Método para resgatar a quantidade de posts no tópico escolhido.
    # ===============================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def getPosts(self, getBoardValue, getThreadNumber):
        self.url = self.getJsonURL(self.getBoardValue, self.getThreadNumber)
        self.data = self.getJson(self.url)
        try:
            for self.archived in self.data['posts']:
                if 'archived' in self.archived:
                    return [self.data['posts'], True]
                else:
                    return [self.data['posts'], False]
        except Exception:
            self.textEdit.append(u"[Downloader] ERRO! Erro ao recuperar posts do tópico %s em /%s/!" % (self.getThreadNumber, self.getBoardValue))
            QtGui.QApplication.processEvents()
            return []

    # Método para resgatar as imagens dos posts.
    # Para Imageboards com suporte a múltiplas imagens por post ou apenas uma imagem por post.
    # ========================================================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def downloadWithoutProgress(self, imageUrl, filename):
        if self.cancel == True:
            self.textEdit.append(u"[Downloader] Cancelado!!")
            QtGui.QApplication.processEvents()
            return False
        else:
            self.imageRequest = urllib2.Request(self.imageUrl, headers={'User-agent' : 'BID/1.0'})
            self.imageResponse = urllib2.urlopen(self.imageRequest, context=self.context)
            with open(str(self.filename), 'wb') as self.file:
                while True:
                    self.imageData = self.imageResponse.read()
                    if not self.imageData:
                        break
                    self.file.write(self.imageData)
            return True

    # Método para resgatar a quantidade de posts no tópico escolhido.
    # ===============================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def downloadWithoutProgress(self, imageUrl, filename):
        if self.cancel == True:
            self.textEdit.append(u"[Downloader] Cancelado!!")
            QtGui.QApplication.processEvents()
            return False
        else:
            self.imageRequest = urllib2.Request(self.imageUrl, headers={'User-agent' : 'BID/1.0'})
            self.imageResponse = urllib2.urlopen(self.imageRequest, context=self.context)
            with open(str(self.filename), 'wb') as self.file:
                while True:
                    self.imageData = self.imageResponse.read()
                    if not self.imageData:
                        break
                    self.file.write(self.imageData)
            return True

    # Método para resgatar a quantidade de posts no tópico escolhido.
    # ===============================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def downloadWithoutProgress(self, imageUrl, filename):
        if self.cancel == True:
            self.textEdit.append(u"[Downloader] Cancelado!!")
            QtGui.QApplication.processEvents()
            return False
        else:
            self.imageRequest = urllib2.Request(self.imageUrl, headers={'User-agent' : 'BID/1.0'})
            self.imageResponse = urllib2.urlopen(self.imageRequest, context=self.context)
            with open(str(self.filename), 'wb') as self.file:
                while True:
                    self.imageData = self.imageResponse.read()
                    if not self.imageData:
                        break
                    self.file.write(self.imageData)
            return True

    # Método para resgatar a quantidade de posts no tópico escolhido.
    # ===============================================================
项目:Boards-Image-Downloader    作者:Wolfterro    | 项目源码 | 文件源码
def getPosts(self, getBoardValue, getThreadNumber):
        self.url = self.getJsonURL(self.getBoardValue, self.getThreadNumber)
        self.data = self.getJson(self.url)
        try:
            for self.archived in self.data['posts']:
                if 'archived' in self.archived:
                    return [self.data['posts'], True]
                else:
                    return [self.data['posts'], False]
        except Exception:
            self.textEdit.append(u"[Downloader] ERRO! Erro ao recuperar posts do tópico %s em /%s/!" % (self.getThreadNumber, self.getBoardValue))
            QtGui.QApplication.processEvents()
            return []

    # Método para resgatar as imagens dos posts.
    # Para Imageboards com suporte a múltiplas imagens por post ou apenas uma imagem por post.
    # ========================================================================================
项目:adblockradio    作者:quasoft    | 项目源码 | 文件源码
def __init__(self, argv):
        QtGui.QApplication.__init__(self, argv)
        self.setQuitOnLastWindowClosed(False)

        self._widget = None
        self._icon = None
        self.show_tray_icon = True

        self._player = Player()

        dispatchers.app.exit_clicked += self.on_exit_click

        # Keep IDE from removing those ununsed imports
        StateStorage()
        BlacklistStorage()
        FavouritesStorage()
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def scrolled(self,value):
        global download,nextp,prevp,picn,chapterNo,pgn,series,downloadNext,pageNo,screen_height,view_mode


        if view_mode == 1 or view_mode == 2:
            if value >= self.scrollArea.verticalScrollBar().maximum() - 50:
                #if downloadNext == 1:
                if len(self.downloadWget) == 0:
                    pageNo = pageNo+1
                    ui.hello(pageNo)
                    r = self.list2.currentRow()
                    if r < self.list2.count() and r >=0:
                        self.list2.setCurrentRow(r+1)
                else:
                    #QtGui.QApplication.processEvents()
                    val = self.scrollArea.verticalScrollBar().maximum() - 60
                    ui.scrollArea.verticalScrollBar().setValue(val)
项目:ReadManga    作者:kanishka-linux    | 项目源码 | 文件源码
def scrolled(self,value):
        global download,nextp,prevp,picn,chapterNo,pgn,series,downloadNext,pageNo,screen_height,view_mode


        if view_mode == 1 or view_mode == 2:
            if value >= self.scrollArea.verticalScrollBar().maximum() - 50:
                #if downloadNext == 1:
                if len(self.downloadWget) == 0:
                    pageNo = pageNo+1
                    ui.hello(pageNo)
                    r = self.list2.currentRow()
                    if r < self.list2.count() and r >=0:
                        self.list2.setCurrentRow(r+1)
                else:
                    #QtGui.QApplication.processEvents()
                    val = self.scrollArea.verticalScrollBar().maximum() - 60
                    ui.scrollArea.verticalScrollBar().setValue(val)
项目:pslab-desktop-apps    作者:fossasia    | 项目源码 | 文件源码
def copyTable(self):
            selected = self.tbl.selectedRanges()
            s = '\t'+"\t".join([str(self.tbl.horizontalHeaderItem(i).text()) for i in xrange(selected[0].leftColumn(), selected[0].rightColumn()+1)])
            s = s + '\n'

            for r in xrange(selected[0].topRow(), selected[0].bottomRow()+1):
                #Add vertical headers
                try: s += self.tbl.verticalHeaderItem(r).text() + '\t'
                except: s += str(r)+'\t'

                for c in xrange(selected[0].leftColumn(), selected[0].rightColumn()+1):
                    try:
                        s += str(self.tbl.item(r,c).text()) + "\t"
                    except AttributeError:
                        s += "\t"
                s = s[:-1] + "\n" #eliminate last '\t'
            self.clip = QtGui.QApplication.clipboard()
            self.clip.setText(s)
项目:WebScraping    作者:liinnux    | 项目源码 | 文件源码
def main():
    app = QApplication([])
    webview = QWebView()
    loop = QEventLoop()
    webview.loadFinished.connect(loop.quit)
    webview.load(QUrl('http://example.webscraping.com/search'))
    loop.exec_()

    webview.show()
    frame = webview.page().mainFrame()
    frame.findFirstElement('#search_term').setAttribute('value', '.')
    frame.findFirstElement('#page_size option:checked').setPlainText('1000')
    frame.findFirstElement('#search').evaluateJavaScript('this.click()')

    elements = None
    while not elements:
        app.processEvents()
        elements = frame.findAllElements('#results a')
    countries = [e.toPlainText().strip() for e in elements]
    print countries
项目:PyFRAP    作者:alexblaessle    | 项目源码 | 文件源码
def main():

    #Creating application
    #font=QtGui.QFont()
    app = QtGui.QApplication(sys.argv)
    font=app.font()
    font.setPointSize(12)
    app.setFont(font)

    #Check if stout/sterr should be redirected
    try:
        print sys.argv[1]
        redirect=bool(int(sys.argv[1]))
        print redirect
    except:
        redirect=True

    mainWin = pyfrp(redirect=redirect)
    mainWin.show()

    sys.exit(app.exec_())
项目:Open-Browser    作者:EricsonWillians    | 项目源码 | 文件源码
def __init__(self):
        QtGui.QApplication.__init__(self, sys.argv)
        self.window = QtGui.QWidget()
        self.window.setGeometry(100, 100, 800, 600)
        self.window.setWindowTitle("Open Browser")
        self.grid = QtGui.QGridLayout()
        self.window.setLayout(self.grid)
        self.tab_stack = CQTabWidget()
        self.tab_stack.setTabShape(QtGui.QTabWidget.TabShape(QtGui.QTabWidget.Triangular))
        self.tab_stack.connect(self.tab_stack, QtCore.SIGNAL("currentChanged(int)"), self.add_tab)
        self.tab_stack.connect(self.tab_stack, QtCore.SIGNAL("RELOAD_PAGE"),
                               lambda: self.tabs[self.tab_stack.currentIndex()][2].reload())
        self.tabs = [[QtGui.QWidget(), QtGui.QGridLayout()], [QtGui.QWidget(), QtGui.QGridLayout()]]
        self.tab_stack.addTab(self.tabs[0][0], '')
        self.tab_stack.addTab(self.tabs[1][0], '+')
        self.current_links = []
        self.visited = []
        self.bookmarks = Bookmarks()
        QtWebKit.QWebSettings.globalSettings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)
        QtWebKit.QWebSettings.globalSettings().setAttribute(QtWebKit.QWebSettings.JavascriptEnabled, True)
        self.create_widgets()
        self.current_index = 0
        self.window.showMaximized()
        sys.exit(self.exec_())
项目:pyshell    作者:oglops    | 项目源码 | 文件源码
def main(global_vars=None):

    if str(QtGui.qApp.applicationName()).lower().startswith('maya'):
        global win
        try:
            win.close()
        except:
            pass
        win = MyInterpreter(None, global_vars)
        win.show()

    else:
        # _logger.info('start ...')
        app = QtGui.QApplication(sys.argv)
        win = MyInterpreter(None, global_vars)
        win.show()
        sys.exit(app.exec_())
项目:WxNeteaseMusic    作者:yaphone    | 项目源码 | 文件源码
def initUI(self):
            self.setStyleSheet("background:" + config.get_item(
                "osdlyrics_background"))
            if config.get_item("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_item("osdlyrics_on_top"):
                self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
                                    QtCore.Qt.WindowStaysOnTopHint |
                                    QtCore.Qt.X11BypassWindowManagerHint)
            else:
                self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            self.setMinimumSize(600, 50)
            self.resize(600, 60)
            scn = QtGui.QApplication.desktop().screenNumber(
                QtGui.QApplication.desktop().cursor().pos())
            br = QtGui.QApplication.desktop().screenGeometry(scn).bottomRight()
            frameGeo = self.frameGeometry()
            frameGeo.moveBottomRight(br)
            self.move(frameGeo.topLeft())
            self.text = "OSD Lyrics for Musicbox"
            self.setWindowTitle("Lyrics")
            self.show()
项目:FC    作者:JanusWind    | 项目源码 | 文件源码
def __init__( self, core, res_lo=False ) :

        # Inheret all attributes of the "QApplication" class.

        super( custom_Application, self ).__init__( [] )

        # Save the Janus "core" to be associated with this object.

        self.core = core

        # Save the indicator of reduced size for the application window.

        self.res_lo = ( True if ( res_lo ) else False )

        # Prepare to respond to signals received from the Wind/FC
        # spectrum.

        self.connect( self.core, SIGNAL('janus_busy_beg'),
                                                    self.resp_busy_beg )
        self.connect( self.core, SIGNAL('janus_busy_end'),
                                                    self.resp_busy_end )

    #-----------------------------------------------------------------------
    # DEFINE THE FUNCTION FOR RESPONDING TO THE "busy_beg" SIGNAL.
    #-----------------------------------------------------------------------
项目:DicomBrowser    作者:ericspod    | 项目源码 | 文件源码
def main(args=[],app=None):
    '''
    Default main program which starts Qt based on the command line arguments `args', sets the stylesheet if present, then
    creates the window object and shows it. The `args' list of command line arguments is also passed to the window object
    to pick up on specified directories. The `app' object would be the QApplication object if this was created elsewhere,
    otherwise it's created here. Returns the value of QApplication.exec_() if this object was created here otherwise 0.
    '''
    if not app:
        app = QtGui.QApplication(args)
        app.setAttribute(Qt.AA_DontUseNativeMenuBar) # in OSX, forces menubar to be in window
        app.setStyle('Plastique')

        # load the stylesheet included as a Qt resource
        with closing(QtCore.QFile(':/css/DefaultUIStyle.css')) as f:
            if f.open(QtCore.QFile.ReadOnly):
                app.setStyleSheet(bytes(f.readAll()).decode('UTF-8'))
            else:
                print('Failed to read %r'%f.fileName())

    browser=DicomBrowser(args)
    browser.show()

    return app.exec_() if app else 0
项目:email_text_format    作者:juna89    | 项目源码 | 文件源码
def __init__(self):
        super(fetch_mails_form, self).__init__()
        self.setupUi(self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.move(QtGui.QApplication.desktop().screen().rect().center() - self.rect().center())
        self.pushButton_select_location.clicked.connect(self.location_treeview)
        self.pushButton_select_date.clicked.connect(self.calender_date)
        self.cal_obj = calender_form()
        self.cal_obj.calendarWidget.clicked.connect(self.date_selected)
        self.pushButton.clicked.connect(self.close)
        self.pushButton_fetch_mails.clicked.connect(self.fetch_mails)
        self.email = ""
        self.password = ""
        self.mail_label = ""
        self.date_selected = ""
        self.folder_name = ""
项目:cityscapesScripts    作者:mcordts    | 项目源码 | 文件源码
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
项目:shoogle    作者:tokland    | 项目源码 | 文件源码
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
项目:mdimg    作者:zhiyue    | 项目源码 | 文件源码
def onClipChanged(self):
        if(QtGui.QApplication.clipboard().mimeData().hasImage()):

            image = QtGui.QApplication.clipboard().mimeData().imageData()
            if self.enableAction.isChecked():
                try:
                    img_name = time.strftime('%Y-%m-%d-%H-%M-%S',time.localtime(time.time())) + ".png"
                    img_path = os.path.join(self.img_dir,img_name)
                    try:
                        image.save(img_path)
                    except Exception as e:
                        image.toPyObject().save(img_path)

                    url = self.get_url(img_name)
                    if QtGui.QSystemTrayIcon.supportsMessages():
                        self.tray.showMessage('Now Upload ...', img_name)
                    self.upload(img_path)
                except Exception as e:
                    print(e)
项目:RasWxNeteaseMusic    作者:yaphone    | 项目源码 | 文件源码
def initUI(self):
            self.setStyleSheet("background:" + config.get_item(
                "osdlyrics_background"))
            if config.get_item("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_item("osdlyrics_on_top"):
                self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
                                    QtCore.Qt.WindowStaysOnTopHint |
                                    QtCore.Qt.X11BypassWindowManagerHint)
            else:
                self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            self.setMinimumSize(600, 50)
            self.resize(600, 60)
            scn = QtGui.QApplication.desktop().screenNumber(
                QtGui.QApplication.desktop().cursor().pos())
            br = QtGui.QApplication.desktop().screenGeometry(scn).bottomRight()
            frameGeo = self.frameGeometry()
            frameGeo.moveBottomRight(br)
            self.move(frameGeo.topLeft())
            self.text = "OSD Lyrics for Musicbox"
            self.setWindowTitle("Lyrics")
            self.show()
项目:certificate_generator    作者:juliarizza    | 项目源码 | 文件源码
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
项目:pymindwave    作者:frans-fuerst    | 项目源码 | 文件源码
def main():
    logging.basicConfig(level=logging.INFO)

    LOG.info(sys.executable)
    LOG.info('.'.join((str(e) for e in sys.version_info)))

    app = QtGui.QApplication(sys.argv)
    ex = mw_graphs()

#    for s in (signal.SIGABRT, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM):
#        signal.signal(s, lambda signal, frame: sigint_handler(signal, ex))

    # catch the interpreter every now and then to be able to catch signals
    timer = QtCore.QTimer()
    timer.start(200)
    timer.timeout.connect(lambda: None)

    sys.exit(app.exec_())
项目:rexploit    作者:DaniLabs    | 项目源码 | 文件源码
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_())
项目:pyDashboard    作者:jtsmith2    | 项目源码 | 文件源码
def main():
        global xscale, yscale        

        app = QtGui.QApplication(sys.argv)
        desktop = app.desktop()
        rec = desktop.screenGeometry()
        height = rec.height()
        width = rec.width()
        xscale = float(width)/1440.0
        yscale = float(height)/900.0

        dash = Dashboard()

        #dash.show()

        dash.showFullScreen()
        #dash.showMaximized()
        stimer = QtCore.QTimer()
        stimer.singleShot(1000, dash.syncCalAxis)


        sys.exit(app.exec_())
项目:spyking-circus    作者:spyking-circus    | 项目源码 | 文件源码
def main(params, nb_cpu, nb_gpu, use_gpu, extension):

    logger        = init_logging(params.logfile)
    logger        = logging.getLogger('circus.merging')
    file_out_suff = params.get('data', 'file_out_suff')
    extension_in  = extension
    extension_out = '-merged'

    if comm.rank == 0:
        if (extension != '') and (os.path.exists(file_out_suff + '.result%s.hdf5' %extension_out)):
            erase = query_yes_no("Export already made! Do you want to erase everything?", default=None)
            if erase:
                purge(file_out_suff, extension)
                extension_in = ''

    comm.Barrier()

    if comm.rank == 0:
        app = QApplication([])
        try:
            pylab.style.use('ggplot')
        except Exception:
            pass
    else:
        app = None

    if comm.rank == 0:
        print_and_log(['Launching the merging GUI...'], 'debug', logger)
    mygui = gui.MergeWindow(params, app, extension_in, extension_out)
    sys.exit(app.exec_())
项目:core-framework    作者:RedhawkSDR    | 项目源码 | 文件源码
def main():
    sdrroot = os.environ.get('SDRROOT', None)
    if not sdrroot:
        raise SystemExit('SDRROOT must be set')

    app = QtGui.QApplication(sys.argv)
    mainwindow = LauncherWindow(sdrroot)
    mainwindow.show()
    sys.exit(app.exec_())
项目:OpenCouture-Dev    作者:9-9-0    | 项目源码 | 文件源码
def main():
    import sys
    app = QtGui.QApplication(sys.argv)
    mainWindow = ProfileWindow()
    sys.exit(app.exec_())
项目:OpenCouture-Dev    作者:9-9-0    | 项目源码 | 文件源码
def runProg():
    app = QtGui.QApplication(sys.argv)
    GUI = appWindow()
    sys.exit(app.exec_())
项目:AntiRansom    作者:YJesus    | 项目源码 | 文件源码
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
项目:AntiRansom    作者:YJesus    | 项目源码 | 文件源码
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)
项目:AntiRansom    作者:YJesus    | 项目源码 | 文件源码
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
项目:AntiRansom    作者:YJesus    | 项目源码 | 文件源码
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def qWait(msec):
                start = time.time()
                QtGui.QApplication.processEvents()
                while time.time() < start + msec * 0.001:
                    QtGui.QApplication.processEvents()
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def qWait(msec):
                start = time.time()
                QtGui.QApplication.processEvents()
                while time.time() < start + msec * 0.001:
                    QtGui.QApplication.processEvents()
项目:typing-pattern-recognition    作者:abinashmeher999    | 项目源码 | 文件源码
def main():
    app = QtGui.QApplication(sys.argv)
    form = LoginScreen()
    form.show()
    app.exec_()
项目:iFruitFly    作者:AdnanMuhib    | 项目源码 | 文件源码
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
项目:iFruitFly    作者:AdnanMuhib    | 项目源码 | 文件源码
def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)
项目:linkchecker-gui    作者:linkcheck    | 项目源码 | 文件源码
def test_gui (self):
        from PyQt4 import QtCore, QtGui, QtTest
        from linkcheck_gui import LinkCheckerMain
        app = QtGui.QApplication(sys.argv)
        window = LinkCheckerMain()
        window.show()
        QtTest.QTest.mouseClick(window.controlButton, QtCore.Qt.LeftButton)
        window.close()
        del window
        del app
项目:SimpleSniffer    作者:HatBoy    | 项目源码 | 文件源码
def main():
    app = QtGui.QApplication(sys.argv)
    sniffer = SnifferUI()
    sniffer.show()
    sys.exit(app.exec_())