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


Python GLib.source_remove方法代碼示例

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


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

示例1: do_server_disconnected

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def do_server_disconnected(self):
		"""
		Clean up the connections to the server and disconnect. This logs out of
		the RPC, closes the server event socket, and stops the SSH forwarder.
		"""
		if self.rpc is not None:
			if self.server_events is not None:
				self.server_events.reconnect = False
			GLib.source_remove(self._rpc_ping_event)
			try:
				self.rpc.async_call('logout')
			except advancedhttpserver.RPCError as error:
				self.logger.warning('failed to logout, rpc error: ' + error.message)
			else:
				if self.server_events is not None:
					self.server_events.shutdown()
					self.server_events = None
			self.rpc.shutdown()
			self.rpc = None

		if self._ssh_forwarder:
			self._ssh_forwarder.stop()
			self._ssh_forwarder = None
		return 
開發者ID:rsmusllp,項目名稱:king-phisher,代碼行數:26,代碼來源:application.py

示例2: _gtk_configure

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def _gtk_configure(self, widget, event):
        def resize(*args):
            self._resize_timer_id = None
            width, height = self._window.get_size()
            columns = width // self._cell_pixel_width
            rows = height // self._cell_pixel_height
            if self._screen.columns == columns and self._screen.rows == rows:
                return
            self._bridge.resize(columns, rows)

        if not self._screen:
            return
        if event.width == self._pixel_width and \
           event.height == self._pixel_height:
            return
        if self._resize_timer_id is not None:
            GLib.source_remove(self._resize_timer_id)
        self._resize_timer_id = GLib.timeout_add(250, resize) 
開發者ID:neovim,項目名稱:python-gui,代碼行數:20,代碼來源:gtk_ui.py

示例3: connect

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def connect(self):
        """Handle btn_action clicked when it's in the Connect state."""
        self.host = self.ent_host.get_text().strip()
        pid = os.getpid()

        share_terminal = self.cmb_method.get_active() != 0
        if share_terminal:
            cmd = ['xterm', '-e', os.path.dirname(__file__) +
                   '/share-terminal', self.host]
            subprocess.Popen(cmd)
            self.on_btn_close_clicked(None)
            return

        cmd = ['x11vnc', '-q', '-nopw', '-connect_or_exit', self.host,
               '-afteraccept', 'kill -USR1 {}'.format(pid)]
        self.proc = subprocess.Popen(cmd)

        # Set the status as "Connecting"
        if self.retry_timeout_id:
            GLib.source_remove(self.retry_timeout_id)
            self.retry_timeout_id = None
        self.set_state('connecting')

        # Start polling the process every 1 second to see if it's still alive
        GLib.timeout_add(1000, self.poll_process) 
開發者ID:epoptes,項目名稱:epoptes,代碼行數:27,代碼來源:remote_assistance.py

示例4: show_family_name

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def show_family_name(self, handle, event):
        """
        Popup menu for node (family).
        """
        if handle:
            family = self.dbstate.db.get_family_from_handle(handle)
        else:
            return False

        if family:
            if not self.timeout:
                self.save_tooltip = handle
                self.scrolledwindow.set_property("has-tooltip", True)
                tooltip = self.get_family_name(handle)
                self.scrolledwindow.set_tooltip_text(tooltip)
                self.timeout = GLib.timeout_add(3*1000, self.remove_tooltip)
            elif handle != self.save_tooltip:
                self.save_tooltip = handle
                GLib.source_remove(self.timeout)
                tooltip = self.get_family_name(handle)
                self.scrolledwindow.set_tooltip_text(tooltip)
                self.timeout = GLib.timeout_add(3*1000, self.remove_tooltip) 
開發者ID:gramps-project,項目名稱:addons-source,代碼行數:24,代碼來源:QuiltView.py

示例5: on_touch

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def on_touch(self, widget, event):
        """Clear mouse connection when touching screen.

        This stops calling the ButtonX bindings when using the touch screen.
        Reasoning: We do not want to e.g. move to the next image when trying to
            zoom in.
        """
        try:
            self._app["window"].disconnect_by_func(self.on_click)
        # Was already disconnected
        except TypeError:
            pass
        if self._timer_id_touch:
            GLib.source_remove(self._timer_id_touch)
        self._timer_id_touch = GLib.timeout_add(5, self._reconnect_click)
        return True 
開發者ID:karlch,項目名稱:vimiv,代碼行數:18,代碼來源:eventhandler.py

示例6: num_append

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def num_append(self, num, remove_by_timeout=True):
        """Add a new char to num_str.

        Args:
            num: The number to append to the string.
            remove_by_timeout: If True, add a timeout to clear the num_str.
        """
        # Remove old timers if we have new numbers
        if self._timer_id:
            GLib.source_remove(self._timer_id)
        self._timer_id = GLib.timeout_add_seconds(1, self.num_clear)
        self._num_str += num
        self._convert_trailing_zeros()
        # Write number to log file in debug mode
        if self._app.debug:
            self._app["log"].write_message("number", num + "->" + self._num_str)
        self._app["statusbar"].update_info() 
開發者ID:karlch,項目名稱:vimiv,代碼行數:19,代碼來源:eventhandler.py

示例7: __callback__

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def __callback__(self, handle, status):
        try:
            pid = self._handles.pop(handle)
            source, callback, args, handle = self._sources.pop(pid)
        except KeyError:
            return

        self._close_process_handle(handle)
        GLib.source_remove(source)

        if hasattr(os, "WIFSIGNALED") and os.WIFSIGNALED(status):
            returncode = -os.WTERMSIG(status)
        elif hasattr(os, "WIFEXITED") and os.WIFEXITED(status):
            returncode = os.WEXITSTATUS(status)

            # FIXME: Hack for adjusting invalid status returned by GLIB
            #    Looks like there is a bug in glib or in pygobject
            if returncode > 128:
                returncode = 128 - returncode
        else:
            returncode = status

        callback(pid, returncode, *args) 
開發者ID:pychess,項目名稱:pychess,代碼行數:25,代碼來源:glib_events.py

示例8: timer

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def timer(self, name, delay, callback, *data, **kwdata):
		"""
		Runs callback after specified number of seconds. Uses
		GLib.timeout_add_seconds with small wrapping to allow named
		timers to be canceled by reset() call
		"""
		method = GLib.timeout_add_seconds
		if delay < 1 and delay > 0:
			method = GLib.timeout_add
			delay = delay * 1000.0
		if name is None:
			# No wrapping is needed, call GLib directly
			method(delay, callback, *data, **kwdata)
		else:
			if name in self._timers:
				# Cancel old timer
				GLib.source_remove(self._timers[name])
			# Create new one
			self._timers[name] = method(delay, self._callback, name, callback, *data, **kwdata) 
開發者ID:kozec,項目名稱:syncthing-gtk,代碼行數:21,代碼來源:timermanager.py

示例9: state_loop

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def state_loop(self, scroll_scale=None, delay=16):  # 16ms ~ 60hz
        # Remove any pending callbacks
        if self.timeout_id:
            GLib.source_remove(self.timeout_id)
            self.timeout_id = None

        # Set scroll scale if specified, and the state is not dirty
        if not self.state_discard_read and scroll_scale not in (None, self.scroll_scale):
            self.scroll_scale = scroll_scale
            if self.scroll_scale != -1:
                self.emit("scroll-scale-changed", self.scroll_scale)
        self.state_discard_read = False

        # Handle the current state
        if not self.state_loaded or self.state_load_failed or self.state_waiting:
            return
        elif self.state_dirty or delay == 0:
            self.sync_scroll_scale(self.scroll_scale, self.state_dirty)
            self.state_dirty = False
        else:
            self.timeout_id = GLib.timeout_add(delay, self.state_loop, None, 0) 
開發者ID:ApostropheEditor,項目名稱:Apostrophe,代碼行數:23,代碼來源:preview_web_view.py

示例10: stop

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def stop(self):
        GLib.source_remove(self.watcher)
        if is_unix_socket(self.server_socket):
            unix_socket_path = self.server_socket.getsockname()
        else:
            unix_socket_path = None

        self.server_socket.shutdown(socket.SHUT_RDWR)
        self.server_socket.close()

        # clean up the socket file
        if unix_socket_path is not None:
            os.unlink(unix_socket_path) 
開發者ID:mopidy,項目名稱:mopidy-mpd,代碼行數:15,代碼來源:network.py

示例11: disable_timeout

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def disable_timeout(self):
        """Deactivate timeout mechanism."""
        if self.timeout_id is None:
            return
        GLib.source_remove(self.timeout_id)
        self.timeout_id = None 
開發者ID:mopidy,項目名稱:mopidy-mpd,代碼行數:8,代碼來源:network.py

示例12: disable_recv

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def disable_recv(self):
        if self.recv_id is None:
            return
        GLib.source_remove(self.recv_id)
        self.recv_id = None 
開發者ID:mopidy,項目名稱:mopidy-mpd,代碼行數:7,代碼來源:network.py

示例13: disable_send

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def disable_send(self):
        if self.send_id is None:
            return

        GLib.source_remove(self.send_id)
        self.send_id = None 
開發者ID:mopidy,項目名稱:mopidy-mpd,代碼行數:8,代碼來源:network.py

示例14: _start_blinking

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def _start_blinking(self):
        def blink(*args):
            self._blink = not self._blink
            self._screen_invalid()
            self._blink_timer_id = GLib.timeout_add(500, blink)
        if self._blink_timer_id:
            GLib.source_remove(self._blink_timer_id)
        self._blink = False
        blink() 
開發者ID:neovim,項目名稱:python-gui,代碼行數:11,代碼來源:gtk_ui.py

示例15: disconnect

# 需要導入模塊: from gi.repository import GLib [as 別名]
# 或者: from gi.repository.GLib import source_remove [as 別名]
def disconnect(self):
        """Handle btn_action clicked when it's in the Disconnect state."""
        self.manually_stopped = True
        if self.retry_timeout_id is not None:
            self.set_state('disconnected')
            GLib.source_remove(self.retry_timeout_id)
            self.retry_timeout_id = None
        if self.proc:
            self.proc.kill()
        self.btn_action.set_label(Gtk.STOCK_CONNECT) 
開發者ID:epoptes,項目名稱:epoptes,代碼行數:12,代碼來源:remote_assistance.py


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