本文整理汇总了Python中gi.repository.Gdk.threads_enter方法的典型用法代码示例。如果您正苦于以下问题:Python Gdk.threads_enter方法的具体用法?Python Gdk.threads_enter怎么用?Python Gdk.threads_enter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.Gdk
的用法示例。
在下文中一共展示了Gdk.threads_enter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_key
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def set_key(self, key, modifiers: list=None):
if modifiers is None:
modifiers = []
Gdk.threads_enter()
if key in self.KEY_MAP:
key = self.KEY_MAP[key]
self._setKeyLabel(key)
self.key = key
self.controlButton.set_active(Key.CONTROL in modifiers)
self.altButton.set_active(Key.ALT in modifiers)
self.shiftButton.set_active(Key.SHIFT in modifiers)
self.superButton.set_active(Key.SUPER in modifiers)
self.hyperButton.set_active(Key.HYPER in modifiers)
self.metaButton.set_active(Key.META in modifiers)
self.setButton.set_sensitive(True)
Gdk.threads_leave()
示例2: get_selection
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def get_selection(self):
"""
Read text from the X selection
Usage: C{clipboard.get_selection()}
@return: text contents of the mouse selection
@rtype: C{str}
@raise Exception: if no text was found in the selection
"""
Gdk.threads_enter()
text = self.selection.wait_for_text()
Gdk.threads_leave()
if text is not None:
return text
else:
raise Exception("No text found in X selection")
示例3: flush_events
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def flush_events(self):
Gdk.threads_enter()
while Gtk.events_pending():
Gtk.main_iteration(True)
Gdk.flush()
Gdk.threads_leave()
示例4: flush_events
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def flush_events(self):
# docstring inherited
Gdk.threads_enter()
while Gtk.events_pending():
Gtk.main_iteration()
Gdk.flush()
Gdk.threads_leave()
示例5: main
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def main():
if not check_root_access():
sys.exit("\nOnly root can run this script :(\n")
win = AppWindow()
win.show_all()
Gdk.threads_enter()
GObject.threads_init()
Gtk.main()
Gdk.threads_leave()
示例6: _on_finished
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
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")
示例7: post_ui
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def post_ui(func):
def func_wrapper(*args, **kwargs):
Gdk.threads_enter()
func(*args, **kwargs)
Gdk.threads_leave()
return func_wrapper
示例8: show_notify
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def show_notify(self, message, iconName):
Gdk.threads_enter()
n = Notify.Notification.new("AutoKey", message, iconName)
n.set_urgency(Notify.Urgency.LOW)
n.show()
Gdk.threads_leave()
示例9: config_modified
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def config_modified(self):
if not self.__warnedOfChanges:
Gdk.threads_enter()
msg = _("Changes made in other programs will not be displayed until you\
close and reopen the AutoKey window.\nThis message is only shown once per session.")
dlg = Gtk.MessageDialog(self.ui, type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.OK,
message_format= _("Configuration has been changed on disk."))
dlg.format_secondary_text(msg)
dlg.run()
dlg.destroy()
Gdk.threads_leave()
self.__warnedOfChanges = True
示例10: cancel_grab
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def cancel_grab(self):
Gdk.threads_enter()
self.setButton.set_sensitive(True)
self._setKeyLabel(self.key)
Gdk.threads_leave()
示例11: receive_window_info
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def receive_window_info(self, info):
Gdk.threads_enter()
dlg = DetectDialog(self.ui)
dlg.populate(info)
response = dlg.run()
if response == Gtk.ResponseType.OK:
self.triggerRegexEntry.set_text(dlg.get_choice())
self.detectButton.set_sensitive(True)
Gdk.threads_leave()
示例12: remove_from_desktop
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def remove_from_desktop(self):
Gdk.threads_enter()
self.popdown()
Gdk.threads_leave()
示例13: text
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def text(self):
Gdk.threads_enter()
text = self._clipboard.wait_for_text()
Gdk.threads_leave()
return text
示例14: selection
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def selection(self):
Gdk.threads_enter()
text = self._selection.wait_for_text()
Gdk.threads_leave()
return text
示例15: show_configure_async
# 需要导入模块: from gi.repository import Gdk [as 别名]
# 或者: from gi.repository.Gdk import threads_enter [as 别名]
def show_configure_async(self):
Gdk.threads_enter()
self.show_configure()
Gdk.threads_leave()