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


Python GObject.timeout_add方法代码示例

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


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

示例1: run

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def run(self, ttl=None):
        if self.DISABLE_SSDP_LISTENER:
            return

        self.allow_reuse_address = True
        SocketServer.UDPServer.__init__(
            self, (self.host or '', self.SSDP_PORT), SSDPHandler)
        self.socket.setsockopt(
            socket.IPPROTO_IP,
            socket.IP_ADD_MEMBERSHIP,
            self._multicast_struct(self.SSDP_ADDRESS))
        self.socket.setsockopt(
            socket.IPPROTO_IP,
            socket.IP_MULTICAST_TTL,
            self.SSDP_TTL)

        if ttl:
            GObject.timeout_add(ttl * 1000, self.shutdown)

        setproctitle.setproctitle('ssdp_listener')
        self.serve_forever(self)
        logger.info('SSDPListener.run()') 
开发者ID:masmu,项目名称:pulseaudio-dlna,代码行数:24,代码来源:listener.py

示例2: on_tn_entry_changed

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def on_tn_entry_changed(self, widget):
        """ Callback: checks tag name validity and start value changes
        monitoring to decide when to update a tag's name."""
        self.tn_entry_last_recorded_value = self.get_tn_text()
        # check validity
        if self.tn_entry_last_recorded_value == "":
            self.tn_entry.set_icon_from_icon_name(
                Gtk.EntryIconPosition.SECONDARY, Gtk.STOCK_DIALOG_ERROR)
        else:
            self.tn_entry.set_icon_from_icon_name(
                Gtk.EntryIconPosition.SECONDARY, None)
        # filter out change requests to reduce commit overhead
        if self.tn_entry_watch_id is None:
            # There is no watchers for the text entry. Register one.
            # Also, wait 1 second before commiting the change in order to
            # reduce rename requests
            tn_entry_changes = self.watch_tn_entry_changes
            self.tn_entry_watch_id = GObject.timeout_add(1000, tn_entry_changes) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:20,代码来源:tag_editor.py

示例3: nudge_progress_bar

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def nudge_progress_bar (self):

        """Can be called by anything.

        Called by self.run() during the download operation.

        Also called by code in other files, just after that code adds a new
        media data object to our download list.

        Updates the main window's progress bar.
        """

        if DEBUG_FUNC_FLAG:
            utils.debug_time('dld 616 nudge_progress_bar')

        if self.current_item_obj:

            GObject.timeout_add(
                0,
                self.app_obj.main_win_obj.update_progress_bar,
                self.current_item_obj.media_data_obj.name,
                self.job_count,
                    len(self.download_list_obj.download_item_list),
            ) 
开发者ID:axcore,项目名称:tartube,代码行数:26,代码来源:downloads.py

示例4: on_query_changed

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def on_query_changed(self, editor):
        if editor is None:
            self.lbl_query.set_text('')
            return
        query = editor.get_active_query()
        if query is None or query.failed:
            self.lbl_query.set_text('')
        elif query.finished:
            self.lbl_query.set_text(query.get_result_summary())
        elif query.pending:
            self.lbl_query.set_text('Pending...')
            GObject.timeout_add(10, self.on_query_changed, self._editor)
        else:
            duration = time.time() - query.start_time
            self.lbl_query.set_text('Running for {} seconds'.format(
                locale.format('%.3f', duration, grouping=True)))
            GObject.timeout_add(10, self.on_query_changed, self._editor) 
开发者ID:andialbrecht,项目名称:runsqlrun,代码行数:19,代码来源:ui.py

示例5: load_book_data

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def load_book_data(self, filename):
        """
        Loads book to Viwer and moves to correct chapter and scroll position
        :param filename:
        """
        self.spinner.start()
        self.viewer.hide()
        self.right_box.add(self.spinner)
        self.filename = filename
        if not filename.upper().endswith(tuple(constants.NATIVE)):
            convert_thread = threading.Thread(target=self.__bg_import_book, args=(filename,))
            self.job_running = True
            convert_thread.start()
            GObject.timeout_add(100, self.__check_on_work)
        else:
            self.__continiue_book_loading(filename) 
开发者ID:michaldaniel,项目名称:ebook-viewer,代码行数:18,代码来源:main_window.py

示例6: on_size_allocate

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def on_size_allocate(self, allocation):
		# remove timer if any
		if self._render_timeout:
			GObject.source_remove(self._render_timeout)
			self._render_timeout = None

		size = (allocation.width, allocation.height)
		if size == self._render_size or not self._pixbuf:
			pass # no update of rendering needed
		else:
			def render_on_timeout(size):
				self._render_size = size
				try:
					self._render()
				except:
					logger.exception('Exception while rendering image')

				return False

			self._render_timeout = GObject.timeout_add(100, render_on_timeout, size) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:22,代码来源:widgets.py

示例7: __init__

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def __init__(self):
            super().__init__()
            self._browser = None
            self._win32_handle = None
            self._initial_html = ""

            sys.excepthook = cef.ExceptHook  # To shutdown CEF processes on error.
            cef.Initialize(settings={"context_menu": {"enabled": False}})

            GObject.threads_init()
            GObject.timeout_add(10, self.on_timer)

            self.connect("configure-event", self.on_configure)
            self.connect("size-allocate", self.on_size_allocate)
            self.connect("focus-in-event", self.on_focus_in)
            self.connect("realize", self.on_realize) 
开发者ID:jendrikseipp,项目名称:rednotebook,代码行数:18,代码来源:browser_cef.py

示例8: __init__

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def __init__(self, path, encoder, recorder, queue, *args, **kwargs):
        threading.Thread.__init__(self, *args, **kwargs)
        self.path = path
        self.encoder = encoder
        self.recorder = recorder
        self.recorder_process = None
        self.encoder_process = None
        self.queue = queue

        self.reinitialize_count = 0
        self.stop_event = threading.Event()

        GObject.timeout_add(
            10000, self._on_regenerate_reinitialize_count) 
开发者ID:masmu,项目名称:pulseaudio-dlna,代码行数:16,代码来源:streamserver.py

示例9: unregister

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def unregister(self, stream):
        logger.info('Unregistered stream "{}" ({}) ...'.format(
            stream.path, stream.id))
        del self.streams[stream.path][stream.id]

        if stream.path in self.timeouts:
            GObject.source_remove(self.timeouts[stream.path])
        self.timeouts[stream.path] = GObject.timeout_add(
            2000, self._on_disconnect, stream) 
开发者ID:masmu,项目名称:pulseaudio-dlna,代码行数:11,代码来源:streamserver.py

示例10: _block_device_handling

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def _block_device_handling(self, object_path):
        self.blocked_devices.append(object_path)
        GObject.timeout_add(1000, self._unblock_device_handling, object_path) 
开发者ID:masmu,项目名称:pulseaudio-dlna,代码行数:5,代码来源:pulseaudio.py

示例11: _delayed_handle_sink_update

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def _delayed_handle_sink_update(self, sink_path):
        if self.signal_timers.get(sink_path, None):
            GObject.source_remove(self.signal_timers[sink_path])
        self.signal_timers[sink_path] = GObject.timeout_add(
            1000, self._handle_sink_update, sink_path) 
开发者ID:masmu,项目名称:pulseaudio-dlna,代码行数:7,代码来源:pulseaudio.py

示例12: on_name_owner_changed

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def on_name_owner_changed(self, name, new_owner, old_owner):
        if not self.is_checking:
            if self.check_id:
                GObject.source_remove(self.check_id)
            self.check_id = GObject.timeout_add(
                3000, self._check_processes) 
开发者ID:masmu,项目名称:pulseaudio-dlna,代码行数:8,代码来源:daemon.py

示例13: __init__

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def __init__(self, pulse=True, rate=0.01):

        Gtk.ProgressBar.__init__(self)
        self.activity_mode = pulse
        self.still_working = True
        self.progress_rate = rate

        if self.activity_mode:
            self.pulse()
        else:
            self.set_fraction(0.0)

        GObject.timeout_add(50, self.on_timeout, None) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:15,代码来源:kano_progress.py

示例14: _timer_start

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def _timer_start(self):
        # Need to stop it, otherwise we potentially leak a timer id that will
        # never be stopped.
        self._timer_stop()
        self._timer = GObject.timeout_add(self._interval, self._on_timer) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:backend_gtk3.py

示例15: _on_timer

# 需要导入模块: from gi.repository import GObject [as 别名]
# 或者: from gi.repository.GObject import timeout_add [as 别名]
def _on_timer(self):
        TimerBase._on_timer(self)

        # Gtk timeout_add() requires that the callback returns True if it
        # is to be called again.
        if len(self.callbacks) > 0 and not self._single:
            return True
        else:
            self._timer = None
            return False 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:12,代码来源:backend_gtk3.py


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