本文整理汇总了Python中gtk.STATE_NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Python gtk.STATE_NORMAL属性的具体用法?Python gtk.STATE_NORMAL怎么用?Python gtk.STATE_NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类gtk
的用法示例。
在下文中一共展示了gtk.STATE_NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_box_hardware
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [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()
示例2: set_status_display
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def set_status_display(self,
id=None, title=None, details=None, icon=None, color=None):
status = self.status_display.get(id)
if not status:
return
if icon:
self._set_status_display_icon(
status, icon, status.get('icon_size', 32))
if title:
status['title'].set_markup(title)
if details:
status['details'].set_markup(details)
if color:
color = gtk.gdk.color_parse(color)
for which in ('title', 'details'):
status[which].modify_fg(gtk.STATE_NORMAL, color)
status[which].modify_text(gtk.STATE_NORMAL, color)
示例3: do_realize
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def do_realize(self):
self.set_flags(self.flags() | gtk.REALIZED)
self.window = gdk.Window(self.get_parent_window(),
width=20,
height=self.allocation.height,
window_type=gdk.WINDOW_CHILD,
wclass=gdk.INPUT_OUTPUT,
event_mask=self.get_events() | gdk.EXPOSURE_MASK | gdk.BUTTON_PRESS_MASK
)
self.window.set_user_data(self)
self.style.attach(self.window)
self.style.set_background(self.window, gtk.STATE_NORMAL)
示例4: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def __init__(self, tagtable=None):
VView.__init__(self)
self.textview = gtk.TextView()
self.textview.connect("populate_popup", self.vwGetPopup)
self.add(self.textview)
if tagtable == None:
tagtable = gtk.TextTagTable()
self.vwSetTagTable(tagtable)
style = gtk.Style()
style.base[gtk.STATE_NORMAL] = gdk.Color(0,0,0)
style.text[gtk.STATE_NORMAL] = gdk.Color(0,0,0xff)
style.base[gtk.STATE_INSENSITIVE] = gdk.Color(0,0,0)
style.text[gtk.STATE_INSENSITIVE] = gdk.Color(20,20,20)
self.textview.set_style(style)
self.tagcfg = ConfigParser()
self.curtag = None # Is a current tag selected?
#self.deftag =
self.vwInitTag(VTextTag("default"))
start,end = self.textbuf.get_bounds()
self.textbuf.create_mark("insertend", end)
示例5: area_expose_cb
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def area_expose_cb(self, area, event):
self.style = self.area.get_style()
self.gc = self.style.fg_gc[gtk.STATE_NORMAL]
self.draw_text()
return True
示例6: fill_custom_fields_table
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [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()
示例7: on_tabboximport_switch_page
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def on_tabboximport_switch_page(self, widget, data=None, data2=None):
"""
Function called when you change the page in "import vm" process
"""
# Set colors..
white = gtk.gdk.color_parse("white")
blue = gtk.gdk.color_parse("#d5e5f7")
for i in range(0,5):
self.builder.get_object("eventimport" + str(i)).modify_bg(gtk.STATE_NORMAL, white)
self.builder.get_object("eventimport" + str(data2)).modify_bg(gtk.STATE_NORMAL, blue)
# If page is the first, you cannot go to previous page
self.builder.get_object("previousvmimport").set_sensitive(data2 != 0)
示例8: console
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def console(self, message):
self.set_point(self.get_length())
self.freeze()
previous_kind = None
style = self.get_style()
style_cache = {}
try:
for element in message:
if element[0] == 'exception':
s = traceback.format_list(element[1]['traceback'])
s.extend(element[1]['exception'])
s = string.join(s, '')
else:
s = element[1]
if element[0] != previous_kind:
style = style_cache.get(element[0], None)
if style is None:
gtk.rc_parse_string(
'widget \"Manhole.*.Console\" '
'style \"Console_%s\"\n'
% (element[0]))
self.set_rc_style()
style_cache[element[0]] = style = self.get_style()
# XXX: You'd think we'd use style.bg instead of 'None'
# here, but that doesn't seem to match the color of
# the backdrop.
self.insert(style.font, style.fg[gtk.STATE_NORMAL],
None, s)
previous_kind = element[0]
l = self.get_length()
diff = self.maxBufSz - l
if diff < 0:
diff = - diff
self.delete_text(0,diff)
finally:
self.thaw()
a = self.get_vadjustment()
a.set_value(a.upper - a.page_size)
示例9: _unassign_placeholder_text
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def _unassign_placeholder_text(self):
if self._has_placeholder_text_assigned:
self._has_placeholder_text_assigned = False
self._modify_font_for_placeholder_text(gtk.STATE_NORMAL, pango.STYLE_NORMAL)
self._do_assign_text(b"")
self._popup.save_last_value()
示例10: _modify_font_for_placeholder_text
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def _modify_font_for_placeholder_text(self, state_for_color, style):
self.modify_text(gtk.STATE_NORMAL, self.style.fg[state_for_color])
font_description = self.get_pango_context().get_font_description()
font_description.set_style(style)
self.modify_font(font_description)
示例11: _set_background_image
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def _set_background_image(self, container, image):
themed_image = self._theme_image(image)
img = gtk.gdk.pixbuf_new_from_file(themed_image)
def draw_background(widget, ev):
alloc = widget.get_allocation()
pb = img.scale_simple(alloc.width, alloc.height,
gtk.gdk.INTERP_BILINEAR)
widget.window.draw_pixbuf(
widget.style.bg_gc[gtk.STATE_NORMAL],
pb, 0, 0, alloc.x, alloc.y)
if (hasattr(widget, 'get_child') and
widget.get_child() is not None):
widget.propagate_expose(widget.get_child(), ev)
return False
container.connect('expose_event', draw_background)
示例12: get_splash
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def get_splash():
splash = gtk.Window(gtk.WINDOW_TOPLEVEL)
splash.set_events(splash.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
def f(widget, data=None):
splash.destroy()
splash.connect('button_press_event', f)
eb = gtk.EventBox()
eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
image = gtk.Image()
image.show()
image.set_from_file(os.path.join(rpy2.__path__[0], "images", "rpy2_logo.png"))
splashVBox = gtk.VBox()
splashVBox.pack_start(image, True, True, 0)
splashVBox.pack_start(gtk.Label("A GTK+ toy user interface"),
True, True, 0)
eb.add(splashVBox)
splash.add(eb)
splash.realize()
splash.window.set_type_hint (gtk.gdk.WINDOW_TYPE_HINT_SPLASHSCREEN)
# needed on Win32
splash.set_decorated (False)
splash.set_position (gtk.WIN_POS_CENTER)
return splash
示例13: on_txtSearch_focus
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def on_txtSearch_focus(self, widget, *args):
if widget.get_text() == _('buscar...'):
widget.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color('black'))
widget.set_text('')
#-- Wmain.on_txtSearch_focus }
#-- Wmain.on_txtSearch_focus_out_event {
示例14: on_txtSearch_focus_out_event
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def on_txtSearch_focus_out_event(self, widget, *args):
if widget.get_text() == '':
widget.modify_text(gtk.STATE_NORMAL, gtk.gdk.Color('darkgray'))
widget.set_text(_('buscar...'))
#-- Wmain.on_txtSearch_focus_out_event }
#-- Wmain.on_btnSearchBack_clicked {
示例15: change_color
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import STATE_NORMAL [as 别名]
def change_color(self, color):
self.eb.modify_bg(gtk.STATE_ACTIVE, color)
self.eb2.modify_bg(gtk.STATE_ACTIVE, color)
self.eb.modify_bg(gtk.STATE_NORMAL, color)
self.eb2.modify_bg(gtk.STATE_NORMAL, color)