本文整理汇总了Python中Legacy.Config.domains方法的典型用法代码示例。如果您正苦于以下问题:Python Config.domains方法的具体用法?Python Config.domains怎么用?Python Config.domains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Legacy.Config
的用法示例。
在下文中一共展示了Config.domains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from Legacy import Config [as 别名]
# 或者: from Legacy.Config import domains [as 别名]
def setUp (self):
Config.parse_directory (os.path.abspath('../ConfDir'))
Config.load_user ()
print 'CONFIGURATION'
print 50*'-'
for i in Config.domains ():
print i, Config.keys_in_domain (i)
print 'END', 50*'-'
self.db = Base.DataBase ('//localhost/Internal')
self.output = cStringIO.StringIO()
示例2: __init__
# 需要导入模块: from Legacy import Config [as 别名]
# 或者: from Legacy.Config import domains [as 别名]
def __init__ (self, parent = None):
Utils.GladeWindow.__init__ (self, parent, window = 'config1')
self.dialog = self.xml.get_widget ('config1')
content = self.xml.get_widget ('dialog-vbox1')
self.w = gtk.Notebook ()
content.pack_start (self.w)
tooltips = gtk.Tooltips ()
tooltips.enable ()
self.warning = 0
self.parent = parent
domains = Config.domains ()
domains = map (lambda x: string.capitalize (x), domains)
domains.sort ()
self.page = []
for dom in domains:
cw = {}
keys = Config.keys_in_domain (string.lower (dom))
keys.sort ()
table = gtk.VBox (spacing=6)
table.set_border_width (12)
for item in keys:
data = Config.get (item)
if data.type is None or not hasattr (data.type, 'w'):
continue
nice = string.capitalize (string.split (item, '/') [1])
label = gtk.Label()
label.set_use_markup(True)
label.set_markup('<b>%s</b>' % (nice))
label.set_alignment(xalign=0.5, yalign=0)
hbox = gtk.HBox (spacing = 12)
hbox.pack_start (label,False)
desc = data.description
desc = string.translate (desc, _map)
desc = string.strip (_cpt.sub (' ', desc))
table.pack_start (hbox, False)
# Create the edition widget...
edit = data.type.w (data.type, self, item, help_text=desc)
if edit.allow_help:
label = gtk.Label ()
label.set_line_wrap (True)
label.set_text(desc)
hbox.pack_start(label, False)
hbox = gtk.HBox (spacing = 6)
hbox.set_border_width (6)
cw [item] = edit
hbox.pack_start (edit.w, False)
## tooltips.set_tip (button, desc)
table.pack_start (hbox,
expand = edit.resize,
fill = edit.resize)
# items should not be spread vertically, however
if cw:
# Put the complete table in a scrolled window
scroll = gtk.ScrolledWindow ()
scroll.set_policy (gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scroll.add_with_viewport (table)
self.w.append_page (scroll, gtk.Label (dom))
self.page.append (cw)
self.show()
return