当前位置: 首页>>代码示例>>Python>>正文


Python QCoreApplication.processEvents方法代码示例

本文整理汇总了Python中PyQt4.Qt.QCoreApplication.processEvents方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.processEvents方法的具体用法?Python QCoreApplication.processEvents怎么用?Python QCoreApplication.processEvents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.Qt.QCoreApplication的用法示例。


在下文中一共展示了QCoreApplication.processEvents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_cache

# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import processEvents [as 别名]
    def update_cache(self, parent=None, timeout=10, force=False,
            suppress_progress=False):
        if self.lock.acquire(False):
            try:
                update_thread = CacheUpdateThread(self.config, self.seralize_books, timeout)
                if not suppress_progress:
                    progress = CacheProgressDialog(parent)
                    progress.set_message(_('Updating MobileRead book cache...'))

                    update_thread.total_changed.connect(progress.set_total)
                    update_thread.update_progress.connect(progress.set_progress)
                    update_thread.update_details.connect(progress.set_details)
                    progress.rejected.connect(update_thread.abort)

                    progress.open()
                    update_thread.start()
                    while update_thread.is_alive() and not progress.canceled:
                        QCoreApplication.processEvents()

                    if progress.isVisible():
                        progress.accept()
                    return not progress.canceled
                else:
                    update_thread.start()
            finally:
                self.lock.release()
开发者ID:Eksmo,项目名称:calibre,代码行数:28,代码来源:mobileread_plugin.py

示例2: message

# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import processEvents [as 别名]
 def message(self, msg, ms=2000, sub=False):
     if sub:
         if self._prev_msg:
             msg = ": ".join((self._prev_msg, msg))
     else:
         self._prev_msg = msg
     self.statusBar().showMessage(msg, ms)
     QCoreApplication.processEvents(QEventLoop.ExcludeUserInputEvents)
开发者ID:kernsuite-debian,项目名称:purr,代码行数:10,代码来源:MainWindow.py

示例3: check_library

# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import processEvents [as 别名]
    def check_library(self):
        from calibre.gui2.dialogs.check_library import CheckLibraryDialog, DBCheck, DBCheckNew

        self.gui.library_view.save_state()
        m = self.gui.library_view.model()
        m.stop_metadata_backup()
        db = m.db
        db.prefs.disable_setting = True

        if hasattr(db, "new_api"):
            d = DBCheckNew(self.gui, db)
        else:
            d = DBCheck(self.gui, db)
        d.start()
        try:
            d.conn.close()
        except:
            pass
        d.break_cycles()
        self.gui.library_moved(db.library_path, call_close=not d.closed_orig_conn)
        if d.rejected:
            return
        if d.error is None:
            if not question_dialog(
                self.gui,
                _("Success"),
                _(
                    "Found no errors in your calibre library database."
                    " Do you want calibre to check if the files in your "
                    " library match the information in the database?"
                ),
            ):
                return
        else:
            return error_dialog(
                self.gui,
                _("Failed"),
                _("Database integrity check failed, click Show details" " for details."),
                show=True,
                det_msg=d.error[1],
            )

        self.gui.status_bar.show_message(_("Starting library scan, this may take a while"))
        try:
            QCoreApplication.processEvents()
            d = CheckLibraryDialog(self.gui, m.db)

            if not d.do_exec():
                info_dialog(
                    self.gui,
                    _("No problems found"),
                    _("The files in your library match the information " "in the database."),
                    show=True,
                )
        finally:
            self.gui.status_bar.clear_message()
开发者ID:jackpinto,项目名称:calibre,代码行数:58,代码来源:choose_library.py

示例4: updateGraph

# 需要导入模块: from PyQt4.Qt import QCoreApplication [as 别名]
# 或者: from PyQt4.Qt.QCoreApplication import processEvents [as 别名]
    def updateGraph(self):
#         try:
#             self.graph.clear()
#             print 'yes'
#         except AttributeError:
#             print "error"
#         else:
#             pass
#         QtGui.QWidget.__init__(self)
#         self.canvas = MplCanvas()
#         #We instantiate the Matplotlib canvas object.
#         self.vbl = QtGui.QVBoxLayout()
#         #Here, we create a layout manager (in this case a vertical box).
#         self.vbl.addWidget(self.canvas)
#         # We add the Matplotlib canvas to the layout manager.
#         self.graph.setLayout(self.vbl)
#         # a figure instance to plot on
        self.figure = plt.figure()
        # this is the Canvas Widget that displays the `figure`
        # it takes the `figure` instance as a parameter to __init__
        self.canvas = FigureCanvas(self.figure)

#         self.canvas.clf()
        # this is the Navigation widget
        # it takes the Canvas widget and a parent
        self.toolbar = NavigationToolbar(self.canvas, self)
        
#         self.layout.reLayout()
        if self.hasLayOUT==True:
            self.clearLayout()
        if self.hasLayOUT==False:
            self.layout = QtGui.QVBoxLayout()
        self.hasLayOUT=True
        self.layout.addWidget(self.toolbar)
        self.layout.addWidget(self.canvas)
#         self.graph.layout().deleteLater()
        self.graph.setLayout(self.layout)
        self.ControlButton.setVisible(False)
        pos={}
        for nm,ob in self.provisionals.iteritems():
            x=ob.x
            y=ob.y
            pos[nm]=  (x,y)         
        for nm,ob in self.control.iteritems():
            x=ob.x
            y=ob.y
            pos[nm]=  (x,y)
        nx.draw_networkx_nodes(self.N,pos,
                           node_color='y',
                           node_size=800,
                           alpha=1)
        nx.draw_networkx_nodes(self.N,pos,
                       nodelist=self.control,
                       node_color='r',
                       node_size=800,
                       alpha=1)
        
#         ellipse = mpl.patches.Ellipse(xy=(58305,49663), width=1000, height=1000)
#         fig,ax = plt.subplots()
# #         self.figure.add_artist(ellipse) 
#         nx.draw_networkx_nodes(ellipse, xy=(self.control['SUR09'].x,self.control['SUR09'].y))
        edges={}
        for v,u,d in self.N.edges(data=True):
            if d.has_key("distance") and d.has_key('direction'):
                edges[v,u]='b'
#         fig = figure()
#         ax = fig.add_subplot(111, aspect='equal')
#         e=(Ellipse((self.control['SUR09'].x,self.control['SUR09'].y), width=100, height=5, angle=45))    
#         ax.add_artist(e)
#         plt.plot(self.control['SUR09'].x,self.control['SUR09'].y,'g.', markersize=100.0)                  #([e], [e], 'g.', markersize=20.0) 
          
        nx.draw(self.N,pos)
        nx.draw_networkx_edges(self.N,pos,
                       edgelist=edges,
                       width=8,alpha=0.5,edge_color='b')
#         nx.draw(Ellipse((self.control['SUR09'].x,self.control['SUR09'].y), width=100, height=5, angle=45,edgecolor=('green')))
        
        plt.axis('scaled')
#         nx.set_aspect('auto')
        
#         forceAspect(nx,aspect=1)
#         plt.show()
#         nx.draw(ellipse)
#         nx.add_artist(ellipse)
    #     matplotlib.pyplot.ion()
    #     plt.draw()
#         self.canvas.addAction(ellipse)
        QCoreApplication.processEvents()
        self.canvas.draw()
开发者ID:CraigNielsen,项目名称:LeastSquaresGui,代码行数:91,代码来源:main1.py


注:本文中的PyQt4.Qt.QCoreApplication.processEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。