本文整理匯總了Python中radialnet.bestwidgets.expanders.BWExpander.set_expanded方法的典型用法代碼示例。如果您正苦於以下問題:Python BWExpander.set_expanded方法的具體用法?Python BWExpander.set_expanded怎麽用?Python BWExpander.set_expanded使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類radialnet.bestwidgets.expanders.BWExpander
的用法示例。
在下文中一共展示了BWExpander.set_expanded方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: SystemPage
# 需要導入模塊: from radialnet.bestwidgets.expanders import BWExpander [as 別名]
# 或者: from radialnet.bestwidgets.expanders.BWExpander import set_expanded [as 別名]
class SystemPage(BWScrolledWindow):
"""
"""
def __init__(self, node):
"""
"""
BWScrolledWindow.__init__(self)
self.__node = node
self.__font = pango.FontDescription('Monospace')
self.__create_widgets()
def __create_widgets(self):
"""
"""
self.__vbox = BWVBox()
self.__vbox.set_border_width(6)
self.__cell = gtk.CellRendererText()
self.__general_frame = BWExpander(_('General information'))
self.__sequences_frame = BWExpander(_('Sequences'))
self.__os_frame = BWExpander(_('Operating System'))
self.__sequences_frame.bw_add(gtk.Label(_('No sequence information.')))
self.__os_frame.bw_add(gtk.Label(_('No OS information.')))
# general information widgets
self.__general = BWTable(3, 2)
self.__address_label = BWSectionLabel(_('Address:'))
self.__address_list = gtk.combo_box_entry_new_text()
self.__address_list.child.set_editable(False)
for address in self.__node.get_info('addresses'):
params = address['type'], address['addr']
address_text = SYSTEM_ADDRESS_TEXT % params
if address['vendor'] is not None and address['vendor'] != '':
address_text += " (%s)" % address['vendor']
self.__address_list.append_text(address_text)
self.__address_list.set_active(0)
self.__general.bw_attach_next(self.__address_label,
yoptions=gtk.FILL,
xoptions=gtk.FILL)
self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)
if self.__node.get_info('hostnames') is not None:
self.__hostname_label = BWSectionLabel(_('Hostname:'))
self.__hostname_list = gtk.combo_box_entry_new_text()
self.__hostname_list.child.set_editable(False)
for hostname in self.__node.get_info('hostnames'):
params = hostname['type'], hostname['name']
self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)
self.__hostname_list.set_active(0)
self.__general.bw_attach_next(self.__hostname_label,
yoptions=gtk.FILL,
xoptions=gtk.FILL)
self.__general.bw_attach_next(self.__hostname_list,
yoptions=gtk.FILL)
if self.__node.get_info('uptime') is not None:
self.__uptime_label = BWSectionLabel(_('Last boot:'))
seconds = self.__node.get_info('uptime')['seconds']
lastboot = self.__node.get_info('uptime')['lastboot']
text = _('%s (%s seconds).') % (lastboot, seconds)
self.__uptime_value = BWLabel(text)
self.__uptime_value.set_selectable(True)
self.__uptime_value.set_line_wrap(False)
self.__general.bw_attach_next(self.__uptime_label,
yoptions=gtk.FILL,
xoptions=gtk.FILL)
self.__general.bw_attach_next(self.__uptime_value,
yoptions=gtk.FILL)
self.__general_frame.bw_add(self.__general)
self.__general_frame.set_expanded(True)
sequences = self.__node.get_info('sequences')
if len(sequences) > 0:
self.__sequences_frame.bw_add(
self.__create_sequences_widget(sequences))
# operating system information widgets
self.__os = gtk.Notebook()
#.........這裏部分代碼省略.........
示例2: SystemPage
# 需要導入模塊: from radialnet.bestwidgets.expanders import BWExpander [as 別名]
# 或者: from radialnet.bestwidgets.expanders.BWExpander import set_expanded [as 別名]
class SystemPage(BWScrolledWindow):
"""
"""
def __init__(self, node):
"""
"""
BWScrolledWindow.__init__(self)
self.__node = node
self.__font = pango.FontDescription("Monospace")
self.__create_widgets()
def __create_widgets(self):
"""
"""
self.__vbox = BWVBox()
self.__vbox.set_border_width(6)
self.__cell = gtk.CellRendererText()
self.__general_frame = BWExpander(_("General information"))
self.__sequences_frame = BWExpander(_("Sequences"))
self.__os_frame = BWExpander(_("Operating System"))
self.__sequences_frame.bw_add(gtk.Label(_("No sequence information.")))
self.__os_frame.bw_add(gtk.Label(_("No OS information.")))
# general information widgets
self.__general = BWTable(3, 2)
self.__address_label = BWSectionLabel(_("Address:"))
self.__address_list = gtk.combo_box_entry_new_text()
self.__address_list.child.set_editable(False)
for address in self.__node.get_info("addresses"):
params = address["type"], address["addr"]
address_text = SYSTEM_ADDRESS_TEXT % params
if address["vendor"] is not None and address["vendor"] != "":
address_text += " (%s)" % address["vendor"]
self.__address_list.append_text(address_text)
self.__address_list.set_active(0)
self.__general.bw_attach_next(self.__address_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
self.__general.bw_attach_next(self.__address_list, yoptions=gtk.FILL)
if self.__node.get_info("hostnames") is not None:
self.__hostname_label = BWSectionLabel(_("Hostname:"))
self.__hostname_list = gtk.combo_box_entry_new_text()
self.__hostname_list.child.set_editable(False)
for hostname in self.__node.get_info("hostnames"):
params = hostname["type"], hostname["name"]
self.__hostname_list.append_text(SYSTEM_ADDRESS_TEXT % params)
self.__hostname_list.set_active(0)
self.__general.bw_attach_next(self.__hostname_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
self.__general.bw_attach_next(self.__hostname_list, yoptions=gtk.FILL)
if self.__node.get_info("uptime") is not None:
self.__uptime_label = BWSectionLabel(_("Last boot:"))
seconds = self.__node.get_info("uptime")["seconds"]
lastboot = self.__node.get_info("uptime")["lastboot"]
text = _("%s (%s seconds).") % (lastboot, seconds)
self.__uptime_value = BWLabel(text)
self.__uptime_value.set_selectable(True)
self.__uptime_value.set_line_wrap(False)
self.__general.bw_attach_next(self.__uptime_label, yoptions=gtk.FILL, xoptions=gtk.FILL)
self.__general.bw_attach_next(self.__uptime_value, yoptions=gtk.FILL)
self.__general_frame.bw_add(self.__general)
self.__general_frame.set_expanded(True)
sequences = self.__node.get_info("sequences")
if len(sequences) > 0:
self.__sequences_frame.bw_add(self.__create_sequences_widget(sequences))
# operating system information widgets
self.__os = gtk.Notebook()
os = self.__node.get_info("os")
if os is not None:
if "matches" in os:
self.__match_scroll = BWScrolledWindow()
#.........這裏部分代碼省略.........