Python gtk.STATE_NORMAL Examples

The following are 20 code examples of gtk.STATE_NORMAL(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gtk , or try the search function .
Example #1
Source File: oxcSERVER_host.py    From openxenmanager with GNU General Public License v2.0 6 votes vote down vote up
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() 
Example #2
Source File: gtkbase.py    From gui-o-matic with GNU Lesser General Public License v3.0 6 votes vote down vote up
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) 
Example #3
Source File: entries.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
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() 
Example #4
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
def restore_color(self):
        bg = self.label.style.bg
        self.eb.modify_bg(gtk.STATE_ACTIVE, bg[gtk.STATE_ACTIVE])
        self.eb2.modify_bg(gtk.STATE_ACTIVE, bg[gtk.STATE_ACTIVE])
        self.eb.modify_bg(gtk.STATE_NORMAL, bg[gtk.STATE_NORMAL])
        self.eb2.modify_bg(gtk.STATE_NORMAL, bg[gtk.STATE_NORMAL]) 
Example #5
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #6
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
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 { 
Example #7
Source File: gnome_connection_manager.py    From gnome-connection-manager with GNU General Public License v3.0 5 votes vote down vote up
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 { 
Example #8
Source File: radmin.py    From rpy2 with GNU General Public License v2.0 5 votes vote down vote up
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 
Example #9
Source File: gtkbase.py    From gui-o-matic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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) 
Example #10
Source File: entries.py    From gimp-plugin-export-layers with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #11
Source File: pywidgets.py    From BitTorrent with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #12
Source File: window_vm.py    From openxenmanager with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #13
Source File: window_properties.py    From openxenmanager with GNU General Public License v2.0 5 votes vote down vote up
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() 
Example #14
Source File: recipe-576820.py    From code with MIT License 5 votes vote down vote up
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 
Example #15
Source File: views.py    From nightmare with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #16
Source File: __init__.py    From nightmare with GNU General Public License v2.0 5 votes vote down vote up
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) 
Example #17
Source File: terminal.py    From NINJA-PingU with GNU General Public License v3.0 4 votes vote down vote up
def on_drag_motion(self, widget, drag_context, x, y, _time, _data):
        """*shrug*"""
        if not drag_context.targets == ['vte'] and \
           (gtk.targets_include_text(drag_context.targets) or \
           gtk.targets_include_uri(drag_context.targets)):
            # copy text from another widget
            return
        srcwidget = drag_context.get_source_widget()
        if(isinstance(srcwidget, gtk.EventBox) and 
           srcwidget == self.titlebar) or widget == srcwidget:
            # on self
            return

        alloc = widget.allocation
        rect = gtk.gdk.Rectangle(0, 0, alloc.width, alloc.height)

        if self.config['use_theme_colors']:
            color = self.vte.get_style().text[gtk.STATE_NORMAL]
        else:
            color = gtk.gdk.color_parse(self.config['foreground_color'])

        pos = self.get_location(widget, x, y)
        topleft = (0, 0)
        topright = (alloc.width, 0)
        topmiddle = (alloc.width/2, 0)
        bottomleft = (0, alloc.height)
        bottomright = (alloc.width, alloc.height)
        bottommiddle = (alloc.width/2, alloc.height)
        middleleft = (0, alloc.height/2)
        middleright = (alloc.width, alloc.height/2)
        #print "%f %f %d %d" %(coef1, coef2, b1,b2)
        coord = ()
        if pos == "right":
            coord = (topright, topmiddle, bottommiddle, bottomright)
        elif pos == "top":
            coord = (topleft, topright, middleright , middleleft)
        elif pos == "left":
            coord = (topleft, topmiddle, bottommiddle, bottomleft)
        elif pos == "bottom":
            coord = (bottomleft, bottomright, middleright , middleleft) 

        #here, we define some widget internal values
        widget._expose_data = { 'color': color, 'coord' : coord }
        #redraw by forcing an event
        connec = widget.connect_after('expose-event', self.on_expose_event)
        widget.window.invalidate_rect(rect, True)
        widget.window.process_updates(True)
        #finaly reset the values
        widget.disconnect(connec)
        widget._expose_data = None 
Example #18
Source File: GTKstrip.py    From rpi_wordclock with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, weh):
        super(GTKstrip, self).__init__()
        self.label = "GTKstrip"

        chars = "ESKISTLFÜNFZEHNZWANZIGDREIVIERTELTGNACHVORJMHALBQZWÖLFPZWEINSIEBENKDREIRHFÜNFELFNEUNVIERWACHTZEHNRSBSECHSFMUHR...."

        self.labels = []
        self.colors = []
        self.brightness = 180

        self.weh = weh

        self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)

        self.win.connect("delete_event", self.delete_event)
        self.win.connect("destroy", self.destroy)
        self.win.connect("key_press_event", self.key_press_event)

        table = gtk.Table(11, 11, True)

        x = 0
        y = 0
        for i in unicode(chars):
            label = gtk.Label(i)
            self.labels.append(label)
            self.colors.append(Color(0, 0, 0))

            table.attach(label, x, x + 1, y, y + 1, FILL, FILL)

            x += 1
            if x == 11:
                x = 0
                y += 1

            attrs = pango.AttrList()
            # attrs.insert(pango.AttrLanguage("de"))
            attrs.insert(pango.AttrForeground(0, 0, 0))
            attrs.insert(pango.AttrSize(30 * 1000))
            attrs.insert(pango.AttrBackground(0, 0, 0))
            label.set_attributes(attrs)

            label.show()

        color = gtk.gdk.color_parse('#000000')
        self.win.modify_bg(gtk.STATE_NORMAL, color)
        self.win.add(table)
        self.win.show_all() 
Example #19
Source File: xdot.py    From openxenmanager with GNU General Public License v2.0 4 votes vote down vote up
def __init__(self, window):
        #gtk.Window.__init__(self)

        self.graph = Graph()

        #window = self

        #window.set_title('Dot Viewer')
        #window.set_default_size(512, 512)
        vbox = gtk.VBox()
        window.add(vbox)

        self.widget = DotWidget()

        # Create a UIManager instance
        uimanager = self.uimanager = gtk.UIManager()

        # Add the accelerator group to the toplevel window
        #accelgroup = uimanager.get_accel_group()
        #window.add_accel_group(accelgroup)

        # Create an ActionGroup
        actiongroup = gtk.ActionGroup('Actions')
        self.actiongroup = actiongroup

        # Create actions
        actiongroup.add_actions((
        #    ('Open', gtk.STOCK_OPEN, None, None, None, self.on_open),
            ('ZoomIn', gtk.STOCK_ZOOM_IN, None, None, None, self.widget.on_zoom_in),
            ('ZoomOut', gtk.STOCK_ZOOM_OUT, None, None, None, self.widget.on_zoom_out),
            ('ZoomFit', gtk.STOCK_ZOOM_FIT, None, None, None, self.widget.on_zoom_fit),
            ('Zoom100', gtk.STOCK_ZOOM_100, None, None, None, self.widget.on_zoom_100),
        ))

        # Add the actiongroup to the uimanager
        uimanager.insert_action_group(actiongroup, 0)

        # Add a UI descrption
        uimanager.add_ui_from_string(self.ui)

        # Create a Toolbar
        toolbar = uimanager.get_widget('/ToolBar')
        toolbar.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#d5e5f7"))
        vbox.pack_start(toolbar, False)

        vbox.pack_start(self.widget)

        #self.set_focus(self.widget)

        #self.show_all()
        self.widget.zoom_image(1.0) 
Example #20
Source File: hazzygremlin.py    From hazzy with GNU General Public License v2.0 3 votes vote down vote up
def __init__(self, inifile, width, height):
        gobject.GObject.__init__(self)

        super(HazzyGremlin, self).__init__(inifile)

        self.width = width
        self.height = height

        self.percent = 0
        self.mouse_mode = None
        self.zoom_in_pressed = False
        self.zoom_out_pressed = False

        self.set_display_units('in')

        # Gremlin3D width = width - 40 to allow room for the controls
        self.set_size_request(self.width - 40, self.height)

        # Add gremlin back-plot
        self.gremlin_view = gtk.HBox()
        fixed = gtk.Fixed()
        fixed.put(self, 0, 0)
        self.gremlin_view.add(fixed)
        self.connect('button_press_event', self.on_gremlin_clicked)

        # Add touchscreen controls
        gladefile = os.path.join(UIDIR, 'controls.glade')
        self.builder = gtk.Builder()
        self.builder.add_from_file(gladefile)
        self.builder.connect_signals(self)
        controls = self.builder.get_object('controls')
        controls.set_size_request(40, self.height)
        self.gremlin_view.add(controls)

        # Add progress label
        self.label = gtk.Label()
        self.label.modify_font(pango.FontDescription('FreeSans 11'))
        self.label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.Color('White'))
        labelbox = gtk.EventBox()
        labelbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color('Black'))
        labelbox.set_size_request(-1, 20)
        labelbox.add(self.label)
        fixed.put(labelbox, 0 , self.height - 20)


#    def fileloading(self, current_line):
#        self.progressbar.show()
#        percent = current_line * 100 / self.line_count
#        if self.percent != percent:
#            self.percent = percent
#            msg = "Generating preview {}%".format(self.percent)
#            self.progressbar.set_text(msg)
#            self.progressbar.set_fraction(self.percent / 100)
#            log.debug(msg)
#            self.emit('loading_progress', percent)