本文整理汇总了Python中zim.gui.widgets.Dialog.show_all方法的典型用法代码示例。如果您正苦于以下问题:Python Dialog.show_all方法的具体用法?Python Dialog.show_all怎么用?Python Dialog.show_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zim.gui.widgets.Dialog
的用法示例。
在下文中一共展示了Dialog.show_all方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_all
# 需要导入模块: from zim.gui.widgets import Dialog [as 别名]
# 或者: from zim.gui.widgets.Dialog import show_all [as 别名]
def show_all(self):
# We focus on the treeview so that the user can start typing the
# notebook name directly when the dialog opens.
Dialog.show_all(self)
self.treeview.grab_focus()
示例2: InstantsearchMainWindowExtension
# 需要导入模块: from zim.gui.widgets import Dialog [as 别名]
# 或者: from zim.gui.widgets.Dialog import show_all [as 别名]
class InstantsearchMainWindowExtension(WindowExtension):
uimanager_xml = '''
<ui>
<menubar name='menubar'>
<menu action='tools_menu'>
<placeholder name='plugin_items'>
<menuitem action='instantsearch'/>
</placeholder>
</menu>
</menubar>
</ui>
'''
gui = "";
@action(_('_Instantsearch'), accelerator='<ctrl>e') # T: menu item
def instantsearch(self):
#init
self.cached_titles = []
#self.menu = defaultdict(_MenuItem)
self.lastQuery = "" # previous user input
self.queryO = None
self.caret = {'pos':0, 'altPos':0, 'text':""} # cursor position
self.originalPage = self.window.ui.page.name # we return here after escape
self.selection = None
if not self.plugin.preferences['isCached']:
# reset last search results
State.reset()
self.menuPage = None
self.isClosed = False
self.lastPage = None
# preferences
self.title_match_char = self.plugin.preferences['title_match_char']
self.start_search_length = self.plugin.preferences['start_search_length']
self.keystroke_delay = self.plugin.preferences['keystroke_delay']
self.open_when_unique = self.plugin.preferences['open_when_unique']
# building quick title cache
def build(start = ""):
if hasattr(self.window.ui.notebook, 'pages'):
o = self.window.ui.notebook.pages
else: # for Zim 0.66-
o = self.window.ui.notebook.index
for s in o.list_pages(Path(start or ":")):
start2 = (start + ":" if start else "") + s.basename
self.cached_titles.append((start2, start2.lower()))
build(start2)
build()
# Gtk
self.gui = Dialog(self.window.ui, _('Search'), buttons=None, defaultwindowsize=(300, -1))
self.gui.resize(300, 100) # reset size
self.inputEntry = InputEntry()
self.inputEntry.connect('key_press_event', self.move)
self.inputEntry.connect('changed', self.change) # self.change is needed by GObject or something
self.gui.vbox.pack_start(self.inputEntry, False)
self.labelObject = gtk.Label((''))
self.labelObject.set_usize(300, -1)
self.gui.vbox.pack_start(self.labelObject, False)
#gui geometry
px, py = self.window.get_position()
pw, ph = self.window.get_size()
x, y = self.gui.get_position()
if self.plugin.preferences['position'] == InstantsearchPlugin.POSITION_RIGHT:
self.gui.move((pw-300), 0)
elif self.plugin.preferences['position'] == InstantsearchPlugin.POSITION_CENTER:
self.gui.resize(300, 100)
self.gui.move(px + (pw / 2) - 150, py + (ph / 2) - 250)
else:
raise AttributeError("Instant search: Wrong position preference.")
self.gui.show_all()
self.labelVar = ""
self.timeout = ""
self.timeoutOpenPage = None
#lastPage = ""
#pageTitleOnly = False
menu = []
#queryTime = 0
def change(self, _): #widget, event,text
if self.timeout:
gobject.source_remove(self.timeout)
q = self.inputEntry.get_text()
#print("Change. {} {}".format(input, self.lastQuery))
if q == self.lastQuery: return
if q == self.title_match_char: return
if q and q[-1] == "∀": # easter egg: debug option for zim --standalone
q = q[:-1]
import ipdb; ipdb.set_trace()
#.........这里部分代码省略.........