本文整理汇总了Python中gtk.Frame方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.Frame方法的具体用法?Python gtk.Frame怎么用?Python gtk.Frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.Frame方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: display_text
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def display_text(self, title, text, parent=None, modal=False):
dialog = InfoDialog(title, None, parent, modal)
text_view = gtk.TextView()
text_view.get_buffer().set_text(text)
text_view.set_editable(False)
text_view.set_cursor_visible(False)
text_view.show()
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
sw.show()
sw.add(text_view)
detail_view = gtk.Frame()
detail_view.set_shadow_type(gtk.SHADOW_IN)
detail_view.add(sw)
detail_view.set_border_width(6)
dialog.vbox.add(detail_view)
detail_view.show()
text_view.set_size_request(485, 300)
dialog.run_async()
return
示例2: add_box_hardware
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def add_box_hardware(self, title, text):
vboxframe = gtk.Frame()
vboxframe.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
vboxchild = gtk.Fixed()
vboxevent = gtk.EventBox()
vboxevent.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
vboxevent.add(vboxchild)
vboxframe.add(vboxevent)
vboxchildlabel1 = gtk.Label()
vboxchildlabel1.set_selectable(True)
vboxchildlabel1.set_markup("<b>" + title + "</b>")
vboxchild.put(vboxchildlabel1, 5, 5)
vboxchildlabel2 = gtk.Label()
vboxchildlabel2.set_selectable(True)
vboxchildlabel2.set_text('\n'.join(text) + "\n")
vboxchild.put(vboxchildlabel2, 5, 35)
self.wine.builder.get_object("hosttablehw").add(vboxframe)
self.wine.builder.get_object("hosttablehw").show_all()
示例3: _create_field_tooltip
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def _create_field_tooltip(self):
self._field_tooltip_window = gtk.Window(type=gtk.WINDOW_POPUP)
self._field_tooltip_window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_TOOLTIP)
self._field_tooltip_window.set_resizable(False)
# This copies the style of GTK tooltips.
self._field_tooltip_window.set_name("gtk-tooltips")
self._field_tooltip_text = gtk.Label()
self._field_tooltip_hbox = gtk.HBox(homogeneous=False)
self._field_tooltip_hbox.pack_start(
self._field_tooltip_text, expand=False, fill=False)
self._field_tooltip_frame = gtk.Frame()
self._field_tooltip_frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
self._field_tooltip_frame.add(self._field_tooltip_hbox)
self._field_tooltip_frame.show_all()
self._field_tooltip_window.add(self._field_tooltip_frame)
示例4: show_new_files
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def show_new_files(self, files):
"""
Given a list of new files, display message showing them to the user
Args:
files: list of files or file => linked file pairs
"""
message = """FileBot has created the following new files:\n"""
title = "New Files Created"
dialog = InfoDialog(title, message)
files = [' => '.join(f) if isinstance(f, tuple) else f for f in files]
files = pprint.pformat(files)
text_view = gtk.TextView()
text_view.get_buffer().set_text(files)
text_view.set_editable(False)
text_view.set_cursor_visible(False)
text_view.show()
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
sw.show()
sw.add(text_view)
detail_view = gtk.Frame()
detail_view.set_shadow_type(gtk.SHADOW_IN)
detail_view.add(sw)
detail_view.set_border_width(6)
dialog.vbox.add(detail_view)
text_view.set_size_request(485, 300)
detail_view.show()
dialog.run_async()
return
示例5: fill_custom_fields_table
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def fill_custom_fields_table(self, add=False):
pool_ref = self.xc_servers[self.selected_host].all['pool'].keys()[0]
self.vboxchildtext = {}
if "XenCenter.CustomFields" in self.xc_servers[self.selected_host].all['pool'][pool_ref]["gui_config"]:
for ch in self.builder.get_object("vboxcustomfields").get_children():
self.builder.get_object("vboxcustomfields").remove(ch)
dom = xml.dom.minidom.parseString(
self.xc_servers[self.selected_host].all['pool'][pool_ref]["gui_config"]["XenCenter.CustomFields"])
for node in dom.getElementsByTagName("CustomFieldDefinition"):
name = node.attributes.getNamedItem("name").value
if name not in self.vboxchildtext:
vboxframe = gtk.Frame()
vboxframe.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
vboxframe.set_size_request(500, 30)
vboxchild = gtk.Fixed()
vboxchild.set_size_request(500, 30)
vboxevent = gtk.EventBox()
vboxevent.add(vboxchild)
vboxchildlabel = gtk.Label()
vboxchildlabel.set_selectable(True)
vboxchildlabel.set_label(name)
vboxchild.put(vboxchildlabel, 5, 5)
self.vboxchildtext[name] = gtk.Entry()
self.vboxchildtext[name].set_size_request(200, 20)
vboxchild.put(self.vboxchildtext[name], 300, 5)
vboxevent.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
self.builder.get_object("vboxcustomfields").pack_start(vboxevent, False, False, 0)
self.builder.get_object("vboxcustomfields").show_all()
if add:
self.set_custom_fields_values()
示例6: unicast_packets
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def unicast_packets(argv, community="public"):
"""Display a set of strip charts, one for each set of parameters in argv.
The set is a "host interface" pair. For example: device1 2 device2 4 """
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.set_title("Unicast Packets")
vbox = gtk.VBox()
vbox.show()
win.add(vbox)
sessions = {}
while argv:
host = argv.pop(0)
ifindex = int(argv.pop(0))
if host in sessions:
sess = sessions[host]
else:
sess = SNMP.get_session(host, community)
sessions[host] = sess
graph = rtgraph.HScrollLineGraph(
scrollRate = 2,
pollInterval = 1000,
size = (384,128),
gridSize = 32,
channels = [SNMPChannel(sess, IF_MIB.ifInUcastPkts, ifindex, color=(1,0,0)),
SNMPChannel(sess, IF_MIB.ifOutUcastPkts, ifindex, color=(0,1,0))],
bgColor = (0, 0, 0.3),
gridColor = (0, 0, 0.5),
range = (0, 19),
)
graph.show()
frame = gtk.Frame()
frame.set_label("device %s ifindex %s" % (host, ifindex))
frame.add(graph)
frame.show()
vbox.pack_end(frame)
del sessions
win.show()
win.connect("destroy", gtk.main_quit)
gtk.main()
示例7: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def __init__(self, explorer, rootGroup, canvas):
"""Place a new Visage of an explorer in a canvas group.
I also need a 'canvas' reference is for certain coordinate
conversions, and pygnome doesn't give access to my GtkObject's
.canvas attribute. :(
"""
# Ugh. PyGtk/GtkObject/GnomeCanvas interfacing grits.
gnome.CanvasGroup.__init__(self,
_obj = rootGroup.add('group')._o)
self.propertyLabels = PairList()
reflect.accumulateClassList(self.__class__, 'propertyLabels',
self.propertyLabels)
self.groupLabels = PairList()
reflect.accumulateClassList(self.__class__, 'groupLabels',
self.groupLabels)
self.explorer = explorer
self.identifier = explorer.identifier
self.objectId = explorer.id
self.canvas = canvas
self.rootGroup = rootGroup
self.ebox = gtk.EventBox()
self.ebox.set_name("Visage")
self.frame = gtk.Frame(self.identifier)
self.container = gtk.VBox()
self.ebox.add(self.frame)
self.frame.add(self.container)
self.canvasWidget = self.add('widget', widget=self.ebox,
x=0, y=0, anchor=gtk.ANCHOR_NW,
size_pixels=0)
self.border = self.add('rect', x1=0, y1=0,
x2=1, y2=1,
fill_color=None,
outline_color=self.color['border'],
width_pixels=self.border_width)
self.subtable = {}
self._setup_table()
# TODO:
# Collapse me
# Movable/resizeable me
# Destroy me
# Set my detail level
self.frame.connect("size_allocate", self.signal_size_allocate,
None)
self.connect("destroy", self.signal_destroy, None)
self.connect("event", self.signal_event)
self.ebox.show_all()
# Our creator will call our fill_ methods when she has the goods.
示例8: _on_menu_item_add_tag_activate
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Frame [as 别名]
def _on_menu_item_add_tag_activate(self, menu_item_add_tag):
def _on_popup_focus_out_event(popup, event):
popup.destroy()
def _on_popup_key_press_event(popup, event):
key_name = gtk.gdk.keyval_name(event.keyval)
if key_name in ["Return", "KP_Enter"]:
entry_text = entry_add_tag.get_text()
if entry_text and entry_text not in self._tags_menu_items:
menu_item = self._add_tag_menu_item(entry_text, entry_text)
menu_item.set_active(True)
self._add_remove_tag_menu_item(entry_text, entry_text)
popup.destroy()
return True
elif key_name == "Escape":
popup.destroy()
return True
def _set_popup_position(popup, window):
if self._tags_menu_relative_position is not None:
window_absolute_position = window.get_window().get_origin()
popup.move(
window_absolute_position[0] + self._tags_menu_relative_position[0],
window_absolute_position[1] + self._tags_menu_relative_position[1])
self._tags_menu_relative_position = None
popup_add_tag = gtk.Window(gtk.WINDOW_TOPLEVEL)
popup_add_tag.set_decorated(False)
popup_add_tag.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_POPUP_MENU)
toplevel = pg.gui.get_toplevel_window(self)
if toplevel is not None:
popup_add_tag.set_transient_for(toplevel)
_set_popup_position(popup_add_tag, toplevel)
label_tag_name = gtk.Label(_("Tag Name:"))
entry_add_tag = gtk.Entry()
hbox = gtk.HBox()
hbox.set_spacing(self._ADD_TAG_POPUP_HBOX_SPACING)
hbox.pack_start(label_tag_name, expand=False, fill=False)
hbox.pack_start(entry_add_tag, expand=False, fill=False)
hbox.set_border_width(self._ADD_TAG_POPUP_BORDER_WIDTH)
frame = gtk.Frame()
frame.add(hbox)
popup_add_tag.add(frame)
popup_add_tag.connect("focus-out-event", _on_popup_focus_out_event)
popup_add_tag.connect("key-press-event", _on_popup_key_press_event)
popup_add_tag.show_all()