本文整理汇总了Python中gtk.VBox.reparent方法的典型用法代码示例。如果您正苦于以下问题:Python VBox.reparent方法的具体用法?Python VBox.reparent怎么用?Python VBox.reparent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.VBox
的用法示例。
在下文中一共展示了VBox.reparent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SimpleTransactionEditor
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import reparent [as 别名]
class SimpleTransactionEditor(object):
def __init__(self, trans, transid, plugin, gui_parent,
change_register_function, book):
"""Sub classes should not override this __init__ but instead
implement simple_init_before_show() to hook in at the right time
"""
self.trans = trans
self.transid = transid
self.plugin = plugin
self.gui_parent = gui_parent
self.change_register_function = change_register_function
self.book = book
# An offscreen place for the transaction's GUI to hide while not in use.
self.hide_parent = Window()
self.hide_parent.hide()
self.mainvbox = VBox()
self.hide_parent.add(self.mainvbox)
self.simple_init_before_show()
self.mainvbox.show_all()
self.mainvbox.reparent(self.gui_parent)
def simple_init_before_show(self):
"""Create the GUI for this type of BoKeep transaction. Widgets can be
added to the "self.mainvbox" object."""
raise Exception("simple_init_before_show must be overrided by "
"sub classes of SimpleTransactionEditor")
def detach(self):
"""Detach the BoKeep transaction's GUI from the visible window and
attach it to a hidden window.
Sub classes overriding this are recommended to do their own work first, and
then delegate back up to this original detach so it may do the widget reparenting
work"""
self.mainvbox.reparent(self.hide_parent)
示例2: multipage_glade_editor
# 需要导入模块: from gtk import VBox [as 别名]
# 或者: from gtk.VBox import reparent [as 别名]
#.........这里部分代码省略.........
sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
sw.add( self.maincontainer)
self.mainvbox.pack_start(sw)
self.glade_pages = [
self.__setup_page(glade_file, top_glade_element)
for glade_file, top_glade_element in config.pages ]
self.glade_pages_by_ident_index = dict(
( (key, self.glade_pages[i])
for i, key in enumerate(config.pages)
) # end generator expression
) # end dict
self.__setup_auto_widgets()
self.current_page = 0
self.attach_current_page()
button_hbox = HBox()
self.mainvbox.pack_end(button_hbox, expand=False)
self.nav_buts = dict( (Button(), i)
for i in range(2) )
for but, i in self.nav_buts.iteritems():
but.set_property('use-stock', True)
but.set_label( STOCK_GO_BACK
if i == GLADE_BACK_NAV else STOCK_GO_FORWARD )
button_hbox.pack_start(but, expand=False)
but.connect("clicked", self.nav_but_clicked)
config.gui_initialization_hook(
self, self.trans, self.plugin, self.book)
self.mainvbox.show_all()
self.mainvbox.reparent(self.gui_parent)
def page_is_current(self, page):
# assumption is that config is fine and we're on a page
assert( hasattr(self, 'glade_pages_by_ident_index') and
True )
return \
self.glade_pages_by_ident_index[page] == self.current_widget_dict
def __setup_page(self, glade_file, top_glade_element):
widget_dict = {}
# this should come from the config, seeing how we're setting up
# our stuff manually
event_handlers_dict = {}
load_glade_file_get_widgets_and_connect_signals(
glade_file, top_glade_element,
widget_dict, event_handlers_dict )
widget_dict[top_glade_element].hide()
return widget_dict
def __setup_auto_widgets(self):
# go through each page
for key, widget_dict in self.glade_pages_by_ident_index.iteritems():
# go through each widget
for widget_name, widget in widget_dict.iteritems():
widget_key = (key, widget_name)
# determine if the current widget is one that we can take
# care of automatically saving, we do this with a linear
# search through a table of eligible types,
# where the first element of each entry is Widget class
#