当前位置: 首页>>代码示例>>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;未经允许,请勿转载。