我们从Python开源项目中,提取了以下13个代码示例,用于说明如何使用gi.repository.Gdk.threads_leave()。
def play_list_move(self): Gdk.threads_enter() path, column = self.play_view.get_cursor() Gdk.threads_leave() if None == path: return None store = self.play_store Gdk.threads_enter() it = store.get_iter(path) Gdk.threads_leave() logging.debug("Selected row: " % (store[it][0:])) Gdk.threads_enter() sid = store[it][2] Gdk.threads_leave() retval = self.req.play_list_move(sid) logging.debug(retval) if 'Success' == retval: self.play_list_update()
def play_list_remove(self): Gdk.threads_enter() path, column = self.play_view.get_cursor() Gdk.threads_leave() if None == path: return None store = self.play_store Gdk.threads_enter() it = store.get_iter(path) Gdk.threads_leave() logging.debug("Selected row: " % (store[it][0:])) Gdk.threads_enter() sid = store[it][2] Gdk.threads_leave() retval = self.req.play_list_remove(sid) logging.debug(retval) if 'Success' == retval: self.play_list_update()
def on_quit(self, action, param): Gdk.threads_leave() Gtk.main_quit() self.quit()
def _on_finished(self, transaction, status, close, show_error): if close: self.hide() if status == EXIT_FAILED and show_error: Gdk.threads_enter() err_dia = AptErrorDialog(self._transaction.error, self) err_dia.run() err_dia.hide() Gdk.threads_leave() self.emit("finished")
def post_ui(func): def func_wrapper(*args, **kwargs): Gdk.threads_enter() func(*args, **kwargs) Gdk.threads_leave() return func_wrapper
def set_text(self, text, fraction): Gdk.threads_enter() self.progressbar.set_text(text) if fraction is None: self.pulse = True else: self.pulse = False self.fraction = fraction self.show_all() Gdk.threads_leave()
def terminate(self): self._running = False Gdk.threads_enter() self._prompt.destroy() Gdk.threads_leave() Gtk.main_quit();
def question(self, message, text): self.hide() Gdk.threads_enter() dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, message) dialog.format_secondary_text(text) response = dialog.run() dialog.destroy() Gdk.threads_leave() if response == Gtk.ResponseType.YES: return True else: return False
def hide(self): Gdk.threads_enter() self._prompt.hide() Gdk.threads_leave()
def play_list_first_row_id(self): store = self.play_store Gdk.threads_enter() it = store.get_iter_first() Gdk.threads_leave() if None == it: return None return store[it][2]
def __3list_insert_row__(self, store, data): Gdk.threads_enter() if None != data: store.clear() for idx, meta in enumerate(data): store.append([idx + 1, meta[1], meta[0]]) Gdk.threads_leave()
def on_sync_message(self, bus, message): print("sync: %s" % bus, message) if message is None or message.structure is None: return message_name = message.structure.get_name() if message_name == "prepare-xwindow-id": imagesink = message.src imagesink.set_property("force-aspect-ratio", True) Gdk.threads_enter() # FIXME: this is the way to do it, *but* get_xid() is not # exported in the GIR xid = self.player.movie_window.get_window().get_xid() imagesink.set_xwindow_id(xid) Gdk.threads_leave()