python类source_remove()的实例源码

gtk2reactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def doIteration(self, delay):
        # flush some pending events, return if there was something to do
        # don't use the usual "while self.context.pending(): self.context.iteration()"
        # idiom because lots of IO (in particular test_tcp's
        # ProperlyCloseFilesTestCase) can keep us from ever exiting.
        log.msg(channel='system', event='iteration', reactor=self)
        if self.__pending():
            self.__iteration(0)
            return
        # nothing to do, must delay
        if delay == 0:
            return # shouldn't delay, so just return
        self.doIterationTimer = gobject.timeout_add(int(delay * 1000),
                                                self.doIterationTimeout)
        # This will either wake up from IO or from a timeout.
        self.__iteration(1) # block
        # note: with the .simulate timer below, delays > 0.1 will always be
        # woken up by the .simulate timer
        if self.doIterationTimer:
            # if woken by IO, need to cancel the timer
            gobject.source_remove(self.doIterationTimer)
            self.doIterationTimer = None
gmythstreamer.py 文件源码 项目:barbieri-playground 作者: barbieri 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def close(self):
        PlayerSource.close(self)

        if self.io_watcher_id is not None:
            gobject.source_remove(self.io_watcher_id)
            self.io_watcher_id = None

        if self.data:
            self.data.close()
            self.data = None

        if self.control:
            self.control.close()
            self.control = None

        if self.fifo:
            self.fifo.close()
            self.fifo = None

        self.fifo_name = None

        return True
    # close()
# PlayerSourceGMythStreamer
gtk2reactor.py 文件源码 项目:sslstrip-hsts-openwrt 作者: adde88 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def doIteration(self, delay):
        # flush some pending events, return if there was something to do
        # don't use the usual "while self.context.pending(): self.context.iteration()"
        # idiom because lots of IO (in particular test_tcp's
        # ProperlyCloseFilesTestCase) can keep us from ever exiting.
        log.msg(channel='system', event='iteration', reactor=self)
        if self.__pending():
            self.__iteration(0)
            return
        # nothing to do, must delay
        if delay == 0:
            return # shouldn't delay, so just return
        self.doIterationTimer = gobject.timeout_add(int(delay * 1000),
                                                self.doIterationTimeout)
        # This will either wake up from IO or from a timeout.
        self.__iteration(1) # block
        # note: with the .simulate timer below, delays > 0.1 will always be
        # woken up by the .simulate timer
        if self.doIterationTimer:
            # if woken by IO, need to cancel the timer
            gobject.source_remove(self.doIterationTimer)
            self.doIterationTimer = None
win_main.py 文件源码 项目:wahcade 作者: sairuk 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def start_timer(self, timer_type):
        """start given timer"""
        #screen saver
        if timer_type == 'scrsave' and self.scrsave_delay > 0:
            if self.scrsave_timer:
                gobject.source_remove(self.scrsave_timer)
            self.scrsave_timer = gobject.timeout_add(2500, self.on_scrsave_timer)
        #video
        elif timer_type == 'video' and self.video_enabled:
            #stop any playing vids first
            self.stop_video()
            #restart timer
            self.video_timer = gobject.timeout_add(
                self.delaymovieprev * 1000,
                self.on_video_timer)
        #joystick
        elif timer_type == 'joystick' and self.joy:
            self.joystick_timer = gobject.timeout_add(50, self.joy.poll, self.on_winMain_key_press)
recipe-551774.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, mapping=None, **kwargs):
        # socket -> (source_id, mask) map, for io_add_watch and source_remove
        self._watch_map = dict()
        # fd -> socket map, for the interface
        self._fd_map = dict()
        if mapping is not None:
            self.update(mapping)
        if kwargs:
            self.update(kwargs)
recipe-551774.py 文件源码 项目:code 作者: ActiveState 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _remove_watch(self, obj):
        gobject.source_remove(self._watch_map.pop(obj)[0])
gtk2reactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def removeReader(self, reader):
        if hasReader(reader):
            gobject.source_remove(reads[reader])
            del reads[reader]
gtk2reactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def removeWriter(self, writer):
        if hasWriter(writer):
            gobject.source_remove(writes[writer])
            del writes[writer]
gtk2reactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def simulate(self):
        """Run simulation loops and reschedule callbacks.
        """
        global _simtag
        if _simtag is not None:
            gobject.source_remove(_simtag)
        self.runUntilCurrent()
        timeout = min(self.timeout(), 0.1)
        if timeout is None:
            timeout = 0.1
        # grumble
        _simtag = gobject.timeout_add(int(timeout * 1010), self.simulate)
gtk2reactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def simulate(self):
        """Run simulation loops and reschedule callbacks.
        """
        global _simtag
        if _simtag is not None:
            gobject.source_remove(_simtag)
        self.iterate()
        timeout = min(self.timeout(), 0.1)
        if timeout is None:
            timeout = 0.1
        # grumble
        _simtag = gobject.timeout_add(int(timeout * 1010), self.simulate)
core.py 文件源码 项目:ns3-rdma 作者: bobzhuyb 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _start_update_timer(self):
        if self._update_timeout_id is not None:
            gobject.source_remove(self._update_timeout_id)
        #print "start_update_timer"
        self._update_timeout_id = gobject.timeout_add(int(SAMPLE_PERIOD/min(self.speed, 1)*1e3),
                                                      self.update_view_timeout,
                                                      priority=PRIORITY_UPDATE_VIEW)
core.py 文件源码 项目:ns3-rdma 作者: bobzhuyb 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _on_play_button_toggled(self, button):
        if button.get_active():
            self._start_update_timer()
        else:
            if self._update_timeout_id is not None:
                gobject.source_remove(self._update_timeout_id)
core.py 文件源码 项目:ns3-rdma 作者: bobzhuyb 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _quit(self, *dummy_args):
        if self._update_timeout_id is not None:
            gobject.source_remove(self._update_timeout_id)
            self._update_timeout_id = None
        self.simulation.quit = True
        self.simulation.go.set()
        self.simulation.join()
        gtk.main_quit()
dbus_mqtt.py 文件源码 项目:dbus-mqtt 作者: victronenergy 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _refresh_keep_alive(self):
        if self._keep_alive_interval is None:
            return
        restart = False
        if self._keep_alive_timer is None:
            logging.info('[KeepAlive] Received request, publishing restarted')
            restart = True
        else:
            gobject.source_remove(self._keep_alive_timer)
        self._keep_alive_timer = gobject.timeout_add_seconds(
            self._keep_alive_interval, exit_on_error, self._on_keep_alive_timeout)
        if restart:
            # Do this after self._keep_alive_timer is set, because self._publish used it check if it should
            # publish
            self._publish_all()
mqtt_gobject_bridge.py 文件源码 项目:dbus-mqtt 作者: victronenergy 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _init_socket_handlers(self):
        if self._socket_watch is not None:
            gobject.source_remove(self._socket_watch)
        self._socket_watch = gobject.io_add_watch(self._client.socket().fileno(), gobject.IO_IN,
            self._on_socket_in)
        if self._socket_timer is None:
            self._socket_timer = gobject.timeout_add_seconds(1, exit_on_error, self._on_socket_timer)
mqtt_gobject_bridge.py 文件源码 项目:dbus-mqtt 作者: victronenergy 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def _on_disconnect(self, client, userdata, rc):
        logging.error('[Disconnected] Lost connection to broker')
        if self._socket_watch is not None:
            gobject.source_remove(self._socket_watch)
            self._socket_watch = None
        logging.info('[Disconnected] Set timer')
        gobject.timeout_add(5000, exit_on_error, self._reconnect)
benchmark.py 文件源码 项目:epoptes 作者: Epoptes 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def cancel_benchmark(self):
        self.stop_benchmark()
        gobject.source_remove(self.countdown_event)
        self.get('hbox_status').set_visible(False)
        self.get('seconds_spinbox').set_sensitive(True)
        self.get('hbox_buttons').set_visible(True)
mplayer.py 文件源码 项目:barbieri-playground 作者: barbieri 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _unregister_state_timeout(self):
        if self.state_timeout is not None:
            gobject.source_remove(self.state_timeout)
            self.state_timeout = None
    # _unregister_state_timeout()
xdot.py 文件源码 项目:autoinjection 作者: ChengWiLL 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def stop(self):
        self.dot_widget.animation = NoAnimation(self.dot_widget)
        if self.timeout_id is not None:
            gobject.source_remove(self.timeout_id)
            self.timeout_id = None
common.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def destroy(self, w):

        if MPI_ENABLED:

            if mpi.rank == 0:
                if self.thread is None:
                    wake_nodes(1)
                    mpi.bcast(None)
                else:
                    wake_nodes(3)

        gobject.source_remove(self.pbar_timer)

        gtk.main_quit()
gtk2reactor.py 文件源码 项目:sslstrip-hsts-openwrt 作者: adde88 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def removeReader(self, reader):
        if hasReader(reader):
            gobject.source_remove(reads[reader])
            del reads[reader]
gtk2reactor.py 文件源码 项目:sslstrip-hsts-openwrt 作者: adde88 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def removeWriter(self, writer):
        if hasWriter(writer):
            gobject.source_remove(writes[writer])
            del writes[writer]
gtk2reactor.py 文件源码 项目:sslstrip-hsts-openwrt 作者: adde88 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def simulate(self):
        """Run simulation loops and reschedule callbacks.
        """
        global _simtag
        if _simtag is not None:
            gobject.source_remove(_simtag)
        self.runUntilCurrent()
        timeout = min(self.timeout(), 0.1)
        if timeout is None:
            timeout = 0.1
        # grumble
        _simtag = gobject.timeout_add(int(timeout * 1010), self.simulate)
gtk2reactor.py 文件源码 项目:sslstrip-hsts-openwrt 作者: adde88 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def simulate(self):
        """Run simulation loops and reschedule callbacks.
        """
        global _simtag
        if _simtag is not None:
            gobject.source_remove(_simtag)
        self.iterate()
        timeout = min(self.timeout(), 0.1)
        if timeout is None:
            timeout = 0.1
        # grumble
        _simtag = gobject.timeout_add(int(timeout * 1010), self.simulate)
xdot.py 文件源码 项目:Eagle 作者: magerx 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def stop(self):
        self.dot_widget.animation = NoAnimation(self.dot_widget)
        if self.timeout_id is not None:
            gobject.source_remove(self.timeout_id)
            self.timeout_id = None
xdot.py 文件源码 项目:landport 作者: land-pack 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def stop(self):
        self.dot_widget.animation = NoAnimation(self.dot_widget)
        if self.timeout_id is not None:
            gobject.source_remove(self.timeout_id)
            self.timeout_id = None
xdot.py 文件源码 项目:Helix 作者: 3lackrush 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def stop(self):
        self.dot_widget.animation = NoAnimation(self.dot_widget)
        if self.timeout_id is not None:
            gobject.source_remove(self.timeout_id)
            self.timeout_id = None
xdot.py 文件源码 项目:autoscan 作者: b01u 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def stop(self):
        self.dot_widget.animation = NoAnimation(self.dot_widget)
        if self.timeout_id is not None:
            gobject.source_remove(self.timeout_id)
            self.timeout_id = None
ofono.py 文件源码 项目:phony 作者: littlecraft 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _reset(self):
    if self._find_child_hfp_modem:
      try:
        gobject.source_remove(self._poll_for_child_hfp_modem_id)
      except:
        pass

      self._poll_for_child_hfp_modem_id = None
win_scrsaver.py 文件源码 项目:wahcade 作者: sairuk 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def stop_scrsaver(self):
        """stop screen saver"""
        if self.scr_timer_id:
            gobject.source_remove(self.scr_timer_id)
        if self.video_playing:
            self.movie_type = ''
            self.video_playing = False
            self.video_player.stop()
            self.drwVideo.set_property('visible', False)
        self.running = False
        self.WinMain.hide_window('scrsaver')


问题


面经


文章

微信
公众号

扫码关注公众号