本文整理汇总了Python中gtk.Label.get_alignment方法的典型用法代码示例。如果您正苦于以下问题:Python Label.get_alignment方法的具体用法?Python Label.get_alignment怎么用?Python Label.get_alignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.Label
的用法示例。
在下文中一共展示了Label.get_alignment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: multipage_glade_editor
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import get_alignment [as 别名]
class multipage_glade_editor(object):
def __init__(self,
trans, transid, plugin, gui_parent, change_register_function,
book, display_mode=TRANSACTION_ALL_EDIT_FIRST_TIME,
transaction_edit_finished_function=null_function):
self.trans = trans
self.transid = transid
self.plugin = plugin
self.gui_parent = gui_parent
self.change_register_function = change_register_function
self.book = book
self.display_mode = display_mode
self.transaction_edit_finished_function = (
null_function if display_mode not in HEADLESS_MODES
else transaction_edit_finished_function )
self.hide_parent = Window()
self.hide_parent.hide()
self.mainvbox = VBox()
self.hide_parent.add(self.mainvbox)
config = self.trans.get_configuration_and_provide_on_load_hook()
config_module_name = self.plugin.config_module_name
if not config_valid(config):
# even in the case of a broken config, we should still
# display all of the data we have available...
self.mainvbox.pack_start(Label("no configuration"))
elif not self.trans.can_safely_proceed_with_config_module(config):
# should display all data that's available instead of just
# this label
#
# and should give
# user an overide option where they either pick an old config
# for one time use or just blow out the memory of having used
# a different config...
#
# should also print the checksum itself so they know
# what they need...
#
# perhaps eventually we even put in place some archival support
# for saving old glade and config files and then code into the
# the transaction -- hey, code you need to be editable is
# over here..
#
# now hopefully there is no marking of this transaction dirty
# in this mode and the extra safegaurds we put into
# MultipageGladeTransaction don't get activated
self.mainvbox.pack_start(
Label("out of date configuration. data is read only here for "
"the safety of your old information, last adler "
"CRC was %s" % self.trans.config_crc_cache ))
else:
# if the safety cache was relied on before we need to tell the
# backend that the transaction is actually dirty,
# and now that we know that we have a workable config,
# there's a chance that we'll actually be able to avoid
# relying on the cache this time
if self.trans.get_safety_cache_was_used():
self.change_register_function()
self.page_label = Label("")
(x_align, y_align) = self.page_label.get_alignment()
self.page_label.set_alignment(0.0, y_align)
self.mainvbox.pack_start(self.page_label, expand=False)
# establish maincontainer, which is where the actual glade
# pages are put by attach_current_page
#
# The order of placement here is important, we place this
# after page_label has already been added to main
# and we also need to do this prior to attach_current_page
# being called, as it depends on self.maincontainer being
# there
#
# when we're in headless mode the maincontainer can just be
# the mainvbox itself
#
# but, outside headless mode we save screen real-estate and
# place a scrolled window (which becomes the maincontainer)
# inside the mainvbox and the glade by glade pages end up
# in there instead (again, in attach_current_page)
if display_mode in HEADLESS_MODES:
self.maincontainer = self.mainvbox
else:
self.maincontainer = Viewport()
sw = ScrolledWindow()
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()
#.........这里部分代码省略.........