本文整理匯總了Python中bus.Bus.get_name方法的典型用法代碼示例。如果您正苦於以下問題:Python Bus.get_name方法的具體用法?Python Bus.get_name怎麽用?Python Bus.get_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類bus.Bus
的用法示例。
在下文中一共展示了Bus.get_name方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestWindow
# 需要導入模塊: from bus import Bus [as 別名]
# 或者: from bus.Bus import get_name [as 別名]
class TestWindow(gtk.Window):
def __init__(self):
super(TestWindow,self).__init__()
self.__bus = Bus()
print self.__bus.get_name()
self.__bus.connect("disconnected", gtk.main_quit)
context_path = self.__bus.create_input_context("Test")
print context_path
self.__context = InputContext(self.__bus, context_path)
self.__context.set_capabilities (9)
self.__context.connect("commit-text", self.__commit_text_cb)
self.__context.connect("update-preedit-text", self.__update_preedit_text_cb)
self.__context.connect("show-preedit-text", self.__show_preedit_text_cb)
self.__context.connect("update-auxiliary-text", self.__update_auxiliary_text_cb)
self.__context.connect("update-lookup-table", self.__update_lookup_table_cb)
self.set_events(gtk.gdk.KEY_PRESS_MASK | gtk.gdk.KEY_RELEASE_MASK | gtk.gdk.FOCUS_CHANGE_MASK)
self.connect("key-press-event", self.__key_press_event_cb)
self.connect("key-release-event", self.__key_release_event_cb)
self.connect("delete-event", gtk.main_quit)
self.connect("focus-in-event", lambda *args: self.__context.focus_in())
self.connect("focus-out-event", lambda *args: self.__context.focus_out())
self.show_all()
def __commit_text_cb(self, context, text):
print "commit-text:", text.text
def __update_preedit_text_cb(self, context, text, cursor_pos, visible):
print "preedit-text:", text.text, cursor_pos, visible
def __show_preedit_text_cb(self, context):
print "show-preedit-text"
def __hide_preedit_text_cb(self, context):
print "hide-preedit-text"
def __update_auxiliary_text_cb(self, context, text, visible):
print "auxiliary-text:", text.text, visible
def __update_lookup_table_cb(self, context, table, visible):
print "update-lookup-table:", visible
def __key_press_event_cb(self, widget, event):
self.__context.process_key_event(event.keyval, event.state)
def __key_release_event_cb(self, widget, event):
self.__context.process_key_event(event.keyval, event.state | modifier.RELEASE_MASK)