本文整理匯總了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
#