當前位置: 首頁>>代碼示例>>Python>>正文


Python gobject.idle_add方法代碼示例

本文整理匯總了Python中gobject.idle_add方法的典型用法代碼示例。如果您正苦於以下問題:Python gobject.idle_add方法的具體用法?Python gobject.idle_add怎麽用?Python gobject.idle_add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gobject的用法示例。


在下文中一共展示了gobject.idle_add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: do_redistribute

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def do_redistribute(self, recurse_up=False, recurse_down=False):
        """Evenly divide available space between sibling panes"""
        #1 Find highest ancestor of the same type => ha
        highest_ancestor = self
        while type(highest_ancestor.get_parent()) == type(highest_ancestor):
            highest_ancestor = highest_ancestor.get_parent()
        
        # (1b) If Super modifier, redistribute higher sections too
        if recurse_up:
            grandfather=highest_ancestor.get_parent()
            if grandfather != self.get_toplevel():
                grandfather.do_redistribute(recurse_up, recurse_down)
        
        gobject.idle_add(highest_ancestor._do_redistribute, recurse_up, recurse_down)
        while gtk.events_pending():
            gtk.main_iteration_do(False)
        gobject.idle_add(highest_ancestor._do_redistribute, recurse_up, recurse_down) 
開發者ID:OWASP,項目名稱:NINJA-PingU,代碼行數:19,代碼來源:paned.py

示例2: idlethread

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def idlethread(func):
    '''
    A decorator which causes the function to be called by the gtk
    main iteration loop rather than synchronously...

    NOTE: This makes the call async handled by the gtk main
    loop code.  you can NOT return anything.
    '''
    def dowork(arginfo):
        args,kwargs = arginfo
        return func(*args, **kwargs)

    def idleadd(*args, **kwargs):
        if currentThread().getName() == 'GtkThread':
            return func(*args, **kwargs)
        gtk.gdk.threads_enter()
        gobject.idle_add(dowork, (args,kwargs))
        gtk.gdk.threads_leave()

    return idleadd 
開發者ID:joxeankoret,項目名稱:nightmare,代碼行數:22,代碼來源:main.py

示例3: __init__

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def __init__(self, n, front, back, trunk, trunk_stroke, grains,
               steps_itt, step):

    Render.__init__(self, n, front, back, trunk, trunk_stroke, grains)

    window = gtk.Window()
    window.resize(self.n, self.n)

    self.steps_itt = steps_itt
    self.step = step

    window.connect("destroy", self.__destroy)
    darea = gtk.DrawingArea()
    darea.connect("expose-event", self.expose)
    window.add(darea)
    window.show_all()

    self.darea = darea

    self.steps = 0
    gobject.idle_add(self.step_wrap) 
開發者ID:inconvergent,項目名稱:tree,代碼行數:23,代碼來源:render.py

示例4: set_status

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def set_status(self, status=None, badge=None, _now=False):
        # FIXME: Can we support badges?
        if status is None:
            return

        if _now:
            do = lambda o, a: o(a)
        else:
            do = gobject.idle_add
        images = self.config.get('images')
        if images:
            icon = images.get(status)
            if not icon:
                icon = images.get('normal')
            if icon:
                self._indicator_set_icon(icon, do=do)
        self._indicator_set_status(status, do=do) 
開發者ID:mailpile,項目名稱:gui-o-matic,代碼行數:19,代碼來源:gtkbase.py

示例5: run

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def run(self):
        self._font_setup()
        self._menu_setup()
        if self.config.get('indicator') and self._HAVE_INDICATOR:
            self._indicator_setup()
        if self.config.get('main_window'):
            self._main_window_setup()

        def ready(s):
            s.ready = True
        gobject.idle_add(ready, self)

        try:
            gtk.main()
        except:
            traceback.print_exc() 
開發者ID:mailpile,項目名稱:gui-o-matic,代碼行數:18,代碼來源:gtkbase.py

示例6: deferred_set_rough_geometry_hints

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def deferred_set_rough_geometry_hints(self):
        # no parameters are used in set_rough_geometry_hints, so we can
        # use the set_rough_geometry_hints
        if self.pending_set_rough_geometry_hint == True:
            return
        self.pending_set_rough_geometry_hint = True
        gobject.idle_add(self.do_deferred_set_rough_geometry_hints) 
開發者ID:OWASP,項目名稱:NINJA-PingU,代碼行數:9,代碼來源:window.py

示例7: deferred_on_vte_size_allocate

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def deferred_on_vte_size_allocate(self, widget, allocation):
        # widget & allocation are not used in on_vte_size_allocate, so we
        # can use the on_vte_size_allocate instead of duplicating the code
        if self.pending_on_vte_size_allocate == True:
            return
        self.pending_on_vte_size_allocate = True
        gobject.idle_add(self.do_deferred_on_vte_size_allocate, widget, allocation) 
開發者ID:OWASP,項目名稱:NINJA-PingU,代碼行數:9,代碼來源:terminal.py

示例8: asynchronous_gtk_message

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def asynchronous_gtk_message(fun):

    def worker((function, args, kwargs)):
        apply(function, args, kwargs)

    def fun2(*args, **kwargs):
        gobject.idle_add(worker, (fun, args, kwargs))

    return fun2 
開發者ID:KanoComputing,項目名稱:kano-toolset,代碼行數:11,代碼來源:webapp.py

示例9: idleadd

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def idleadd(*args, **kwargs):
        if currentThread().getName() == 'GtkThread':
            return func(*args, **kwargs)
        gtk.gdk.threads_enter()
        gobject.idle_add(dowork, (args,kwargs))
        gtk.gdk.threads_leave()
        return q.get() 
開發者ID:joxeankoret,項目名稱:nightmare,代碼行數:9,代碼來源:main.py

示例10: run

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def run(self):
        while not self.quit:
            #print "sim: Wait for go"
            self.go.wait() # wait until the main (view) thread gives us the go signal
            self.go.clear()
            if self.quit:
                break
            #self.go.clear()
            #print "sim: Acquire lock"
            self.lock.acquire()
            try:
                if 0:
                    if ns3.core.Simulator.IsFinished():
                        self.viz.play_button.set_sensitive(False)
                        break
                #print "sim: Current time is %f; Run until: %f" % (ns3.Simulator.Now ().GetSeconds (), self.target_time)
                #if ns3.Simulator.Now ().GetSeconds () > self.target_time:
                #    print "skipping, model is ahead of view!"
                self.sim_helper.SimulatorRunUntil(ns.core.Seconds(self.target_time))
                #print "sim: Run until ended at current time: ", ns3.Simulator.Now ().GetSeconds ()
                self.pause_messages.extend(self.sim_helper.GetPauseMessages())
                gobject.idle_add(self.viz.update_model, priority=PRIORITY_UPDATE_MODEL)
                #print "sim: Run until: ", self.target_time, ": finished."
            finally:
                self.lock.release()
            #print "sim: Release lock, loop."

# enumeration 
開發者ID:ntu-dsi-dcn,項目名稱:ntu-dsi-dcn,代碼行數:30,代碼來源:core.py

示例11: start

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def start():
    assert Visualizer.INSTANCE is None
    if _import_error is not None:
        import sys
        print >> sys.stderr, "No visualization support (%s)." % (str(_import_error),)
        ns.core.Simulator.Run()
        return
    load_plugins()
    viz = Visualizer()
    for hook, args in initialization_hooks:
        gobject.idle_add(hook, viz, *args)
    ns.network.Packet.EnablePrinting()
    viz.start() 
開發者ID:ntu-dsi-dcn,項目名稱:ntu-dsi-dcn,代碼行數:15,代碼來源:core.py

示例12: write

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def write(self, text, editable=False):
    gobject.idle_add(self._write, text, editable) 
開發者ID:imec-idlab,項目名稱:IEEE-802.11ah-ns-3,代碼行數:4,代碼來源:ipython_view.py

示例13: showPrompt

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def showPrompt(self, prompt):
    gobject.idle_add(self._showPrompt, prompt) 
開發者ID:imec-idlab,項目名稱:IEEE-802.11ah-ns-3,代碼行數:4,代碼來源:ipython_view.py

示例14: changeLine

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def changeLine(self, text):
    gobject.idle_add(self._changeLine, text) 
開發者ID:imec-idlab,項目名稱:IEEE-802.11ah-ns-3,代碼行數:4,代碼來源:ipython_view.py

示例15: __init__

# 需要導入模塊: import gobject [as 別名]
# 或者: from gobject import idle_add [as 別名]
def __init__(self, figure):
        if _debug: print('FigureCanvasGTK.%s' % fn_name())
        FigureCanvasBase.__init__(self, figure)
        gtk.DrawingArea.__init__(self)

        self._idle_draw_id  = 0
        self._need_redraw   = True
        self._pixmap_width  = -1
        self._pixmap_height = -1
        self._lastCursor    = None

        self.connect('scroll_event',         self.scroll_event)
        self.connect('button_press_event',   self.button_press_event)
        self.connect('button_release_event', self.button_release_event)
        self.connect('configure_event',      self.configure_event)
        self.connect('expose_event',         self.expose_event)
        self.connect('key_press_event',      self.key_press_event)
        self.connect('key_release_event',    self.key_release_event)
        self.connect('motion_notify_event',  self.motion_notify_event)
        self.connect('leave_notify_event',   self.leave_notify_event)
        self.connect('enter_notify_event',   self.enter_notify_event)

        self.set_events(self.__class__.event_mask)

        self.set_double_buffered(False)
        self.set_flags(gtk.CAN_FOCUS)
        self._renderer_init()

        self._idle_event_id = gobject.idle_add(self.idle_event)

        self.last_downclick = {} 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:33,代碼來源:backend_gtk.py


注:本文中的gobject.idle_add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。