Example #1
0
    def insert_closable_page(self, widget, label, index_page=-1):
        #hbox will be used to store a label and button, as notebook tab title
        hbox = gtk.HBox(False, 0)
        #label = gtk.Label(title)
        hbox.pack_start(label, False, False)

        #get a stock close button image
        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE,
                                               gtk.ICON_SIZE_MENU)
        image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)

        #make the close button
        btn = gtk.Button()
        btn.set_relief(gtk.RELIEF_NONE)
        btn.set_focus_on_click(False)
        btn.add(close_image)
        hbox.pack_start(btn, False, False)
        btn.set_size_request(image_w + 4, image_h)

        #this reduces the size of the button
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        btn.modify_style(style)

        hbox.show_all()

        #the tab will have a single widget: a label
        #widget = gtk.Label(title) #remove

        #add the tab
        self.insert_page(widget, hbox, index_page)  #hbox = label+close_button

        btn.connect('clicked', self.on_closetab_button_clicked, widget)
Example #2
0
	def createButton(self,title):
		
		#~ def create_tab(self, title):
		#hbox will be used to store a label and button, as notebook tab title
		hbox = gtk.HBox(False, 0)
		label = gtk.Label(title)
		hbox.pack_start(label)

		#get a stock close button image
		close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
		image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
		
		#make the close button
		btn = gtk.Button()
		btn.set_relief(gtk.RELIEF_NONE)
		btn.set_focus_on_click(False)
		btn.add(close_image)
		hbox.pack_start(btn, False, False)
		
		#~ #this reduces the size of the button
		style = gtk.RcStyle()
		style.xthickness = 0
		style.ythickness = 0
		btn.modify_style(style)

		
		
		#connect the close button
		
		btn.connect('clicked', self.on_closetab_button_clicked, self.new_editor)
		return hbox
Example #3
0
    def _open_new_tab(self, widget, data=None):
        ''' Callback para abrir un nuevo tab '''
        ''' hacemos una caja horizontal donde meteremos el titulo y el boton de cerrar
        tab '''
        hbox = gtk.HBox(False, 0)
        ''' Titulo '''
        label = gtk.Label("New Tab")
        hbox.pack_start(label, False, False)
        ''' Boton de cerrar '''
        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE,
                                               gtk.ICON_SIZE_MENU)
        image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
        btn = gtk.Button()
        btn.set_relief(gtk.RELIEF_NONE)
        btn.set_focus_on_click(False)
        btn.add(close_image)
        btn.connect('clicked', self._close_current_tab)
        hbox.pack_end(btn, False, False)
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        btn.modify_style(style)

        hbox.show_all()

        current_page = self.notebook.get_current_page()
        page_tuple = (self._create_tab(), hbox)
        self.tabs.insert(current_page + 1, page_tuple)
        self.notebook.insert_page(page_tuple[0], page_tuple[1],
                                  current_page + 1)
        self.notebook.set_current_page(current_page + 1)
Example #4
0
    def update_button(self):
        """Update the state of our close button"""
        if not self.config['close_button_on_tab']:
            if self.button:
                self.button.remove(self.icon)
                self.remove(self.button)
                del (self.button)
                del (self.icon)
                self.button = None
                self.icon = None
            return

        if not self.button:
            self.button = gtk.Button()
        if not self.icon:
            self.icon = gtk.Image()
            self.icon.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)

        self.button.set_focus_on_click(False)
        self.button.set_relief(gtk.RELIEF_NONE)
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        self.button.modify_style(style)
        self.button.add(self.icon)
        self.button.connect('clicked', self.on_close)
        self.button.set_name('terminator-tab-close-button')
        if hasattr(self.button, 'set_tooltip_text'):
            self.button.set_tooltip_text(_('Close Tab'))
        self.pack_start(self.button, False, False)
        self.show_all()
Example #5
0
    def mk_tab_label(self, tab):
        #hbox will be used to store a label and button, as notebook tab title
        hbox = gtk.HBox(False, 0)
        label = gtk.Label(tab.get_name())
        tab.label = label
        hbox.pack_start(label)

        #get a stock close button image
        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)

        #make the close button
        btn = gtk.Button()
        btn.set_relief(gtk.RELIEF_NONE)
        btn.set_focus_on_click(False)
        btn.connect('clicked', self.on_tab_close_click, tab)
        btn.add(close_image)
        hbox.pack_start(btn, False, False)

        #this reduces the size of the button
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        btn.modify_style(style)

        hbox.show_all()
        return hbox
Example #6
0
    def __init__(self, text):
        gtk.HBox.__init__(self)
        #http://www.eurion.net/python-snippets/snippet/Notebook%20close%20button.html
        self.label = gtk.Label(text)
        self.pack_start(self.label)

        #get a stock close button image
        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE,
                                               gtk.ICON_SIZE_MENU)
        image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)

        #make the close button
        self.btn = gtk.Button()
        self.btn.set_relief(gtk.RELIEF_NONE)
        self.btn.set_focus_on_click(False)
        self.btn.add(close_image)
        self.pack_start(self.btn, False, False)

        #this reduces the size of the button
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        self.btn.modify_style(style)

        self.show_all()
Example #7
0
    def __init__(self):
        self.tab_label = gtk.Label('Tab Name')
        self.tab_label.show()

        self.ui = None

        self.tab_label_hbox = gtk.HBox(False, 4)

        # add icon
        self.tab_label_icon = gtk.Image()
        self.tab_label_icon.set_from_file(os.path.join(icons_path,
                                                       'table.png'))
        self.tab_label_icon.show()
        self.tab_label_hbox.pack_start(self.tab_label_icon)

        # add label
        self.tab_label_hbox.pack_start(self.get_label())

        # add close tab button
        self.tab_label_close_img = gtk.image_new_from_stock(
            gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
        self.tab_label_close_img.show()

        self.tab_label_close_button = gtk.Button()
        self.tab_label_close_button.set_relief(gtk.RELIEF_NONE)
        self.tab_label_close_button.set_focus_on_click(False)
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        self.tab_label_close_button.modify_style(style)
        self.tab_label_close_button.set_tooltip_text('Close (Ctrl+W)')
        self.tab_label_close_button.show()
        self.tab_label_close_button.add(self.tab_label_close_img)

        self.tab_label_hbox.pack_end(self.tab_label_close_button)
Example #8
0
def create_tab(self, child, filename):

    newTab = gtk.Label(os.path.basename(filename))
    hbox = gtk.HBox(False, 3)
    label2 = gtk.Label(os.path.basename(filename))
    hbox.pack_start(label2)

    #get a stock close button image
    close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
    image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)

    #make the close button
    btn = gtk.Button()
    btn.set_relief(gtk.RELIEF_NONE)
    btn.set_focus_on_click(False)
    btn.add(close_image)
    btn.connect('clicked', remove_page, self.scrolledwindow2)
    hbox.pack_start(btn, False, False)

    #this reduces the size of the button
    style = gtk.RcStyle()
    style.xthickness = 0
    style.ythickness = 0
    btn.modify_style(style)
    hbox.show_all()
    addTabToDictionary(self, str(get_tab_num(self) + 1), filename)
    self.pdfDisplayArea.unparent()
    self.fileDisplayArea.append_page(self.pdfDisplayArea, hbox)
    self.fileDisplayArea.next_page()
Example #9
0
 def create_tab(self,widget=None,data=None):
     self.page_ += 1 
     self.index_ = len(self.hbox)
     self.hbox.append(gtk.HBox(False, 0))
     self.hbox_.append(gtk.HBox(False,0))
     self.hbox[self.index_].set_spacing(1)
     # kullanici labelleri degistirebilsin diye diziye atildi
     self.tab_name_no()
     self.hbox[self.index_].pack_end(self.label[self.index_])
     # sekmelerde kapatma simgesinin gelmesi icin
     close_image = gtk.Image()
     close_image.set_from_file("close_button.png")
     close_image.show()
     # sekmenin uzerinde sekme kapatma ozelligi olmasi icin 
     btn = gtk.Button()
     btn.set_size_request(30,30)
     btn.set_relief(gtk.RELIEF_NONE)
     btn.set_focus_on_click(False)
     btn.add(close_image)
     self.hbox[self.index_].pack_end(btn, False, False)
     # kapatma butonunun boyutunun ayarlanmasi icin
     style = gtk.RcStyle()
     style.xthickness = 0
     style.ythickness = 0
     btn.modify_style(style)
     self.hbox[self.index_].show_all()
     # yeni terminal olusturulmasi
     self.terminal_hpane()
     self.notebook.insert_page(self.hbox_[self.index_],self.hbox[self.index_])
     # yeni sekme acildiginda gostermesi icin
     win.show_all() 
     # yeni sekme acildiginda direkt o sekmeye gecsin diye
     self.notebook.set_current_page(self.page_-1)
Example #10
0
    def add_tab(self, tab, switch=True):
        if tab.has_close_button():
            button = gtk.Button()
            button.set_relief(gtk.RELIEF_NONE)
            button.set_focus_on_click(False)
            icon = gtk.image_new_from_stock(gtk.STOCK_CLOSE,
                                            gtk.ICON_SIZE_MENU)

            style = gtk.RcStyle()
            style.xthickness = 0
            style.ythickness = 0
            button.modify_style(style)
            button.add(icon)
            button.connect("clicked", lambda w: tab.close())
            w = gtk.HBox(False, 0)
            w.pack_start(gtk.Label(tab.get_name()))
            w.pack_start(button, False, False)
            w.show_all()
        else:
            w = gtk.Label(tab.get_name())
        self.notebook.append_page(tab.get_widget(), w)
        self.notebook.set_tab_reorderable(tab.get_widget(), True)
        tab.get_widget().show()
        tab.window = self
        self.tablist.append(tab)
        if switch:
            self.switch_to_tab(tab)
Example #11
0
    def configure(self):
        """Apply widget-wide settings"""
        # FIXME: The old reordered handler updated Terminator.terminals with
        # the new order of terminals. We probably need to preserve this for
        # navigation to next/prev terminals.
        #self.connect('page-reordered', self.on_page_reordered)
        self.set_property('homogeneous', True)
        self.set_scrollable(self.config['scroll_tabbar'])

        if self.config['tab_position'] == 'hidden' or self.config[
                'hide_tabbar']:
            self.set_show_tabs(False)
        else:
            self.set_show_tabs(True)
            pos = getattr(gtk, 'POS_%s' % self.config['tab_position'].upper())
            self.set_tab_pos(pos)

        for tab in xrange(0, self.get_n_pages()):
            label = self.get_tab_label(self.get_nth_page(tab))
            label.update_angle()

        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        self.modify_style(style)
Example #12
0
    def __init__(self, *args, **kwargs):
        super(Browser, self).__init__(*args, **kwargs)
        ''' Le decimos a gtk que use hilos '''
        gobject.threads_init()
        ''' Definimos algunas propiedades de la ventana principal '''

        self.set_title('Triana Browser')
        self.set_icon_from_file('./iconn.png')
        self.connect("destroy", gtk.main_quit)
        self.maximize()
        ''' Instanciamos un objeto notebook que es el que nos permite menejar varias tabs '''
        self.notebook = gtk.Notebook()
        # self.notebook.set_property('show-tabs', False)
        self.notebook.set_scrollable(True)
        ''' Para mantener la lista de tab abiertas '''
        self.tabs = []
        self.set_size_request(400, 400)
        ''' HBox viene de Horizontal Box, y es el tipo de caja que hemos decido usar para meter 
        la cabecera de cada tab del notebook '''
        hbox = gtk.HBox(False, 0)
        ''' Boton de cerrar tab'''
        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE,
                                               gtk.ICON_SIZE_MENU)
        image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)

        label = gtk.Label("Nuevo Tab")
        hbox.pack_start(label, False, False)

        btn = gtk.Button()
        btn.set_relief(gtk.RELIEF_NONE)
        btn.set_focus_on_click(False)
        btn.add(close_image)
        btn.connect('clicked', self._close_current_tab)
        hbox.pack_end(btn, False, False)
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        btn.modify_style(style)

        hbox.show_all()
        ''' Para empezar creamos una tab vacia  '''
        self.tabs.append((self._create_tab(), hbox))
        self.notebook.append_page(*self.tabs[0])
        ''' La caja principal donde lo metemos todo, de momento solo 
        tenemos el notebook '''
        box = gtk.VBox()
        box.pack_start(self.notebook)
        ''' Agragamos la caja a la ventana principal '''
        self.add(box)
        ''' Eventos que queremos manejar 
        Primero el evento producido por presionar alguna/s tecla/s '''
        # self.connect("key-press-event", self._key_pressed)
        ''' El evento producido al cambiar de tab, le pasamos la funcion 
        _tab_changed cada vez que se produzca'''
        self.notebook.connect("switch-page", self._tab_changed)
        ''' Lo mostramos todo '''
        self.show_all()
Example #13
0
    def on_change_background(self, applet, type, color, pixmap):
        applet.set_style(None)
        applet.modify_style(gtk.RcStyle())

        if type == gnomeapplet.COLOR_BACKGROUND:
            applet.modify_bg(gtk.STATE_NORMAL, color)
        elif type == gnomeapplet.PIXMAP_BACKGROUND:
            style = applet.get_style().copy()
            style.bg_pixmap[gtk.STATE_NORMAL] = pixmap
            applet.set_style(style)
Example #14
0
 def set_rcstyle(self, status):
     rcstyle = gtk.RcStyle()
     rcstyle.fg[2] = gtk.gdk.Color(HobColors.BLACK)
     if status == "stop":
         rcstyle.bg[3] = gtk.gdk.Color(HobColors.WARNING)
     elif status == "fail":
         rcstyle.bg[3] = gtk.gdk.Color(HobColors.ERROR)
     else:
         rcstyle.bg[3] = gtk.gdk.Color(HobColors.RUNNING)
     self.modify_style(rcstyle)
Example #15
0
    def __init__(self):
        """Generate a treeview for viewing search history"""
        super(HistoryTreeview, self).__init__()
        self.treestore_hist = gtk.TreeStore(str, str, bool)
        self.treeview_hist = gtk.TreeView(self.treestore_hist)
        self.treeview_hist.show()
        self.treeview_hist.set_rules_hint(True)
        self.treeview_scroll_hist = gtk.ScrolledWindow()
        self.treeview_scroll_hist.set_policy(gtk.POLICY_AUTOMATIC,
                                             gtk.POLICY_AUTOMATIC)
        self.treeview_scroll_hist.add(self.treeview_hist)
        self.treeview_scroll_hist.set_shadow_type(gtk.SHADOW_IN)
        cols = [rosie.browser.HISTORY_TREEVIEW_TYPE,
                rosie.browser.HISTORY_TREEVIEW_PARAMETERS,
                rosie.browser.HISTORY_TREEVIEW_ALL_REVISIONS]
        for i, title in enumerate(cols):
            col = gtk.TreeViewColumn()
            col.set_title(title.replace("_", "__"))

            if title != rosie.browser.HISTORY_TREEVIEW_ALL_REVISIONS:
                cell = gtk.CellRendererText()
                col.pack_start(cell)
                col.add_attribute(cell, attribute='text',
                                  column=i)
            else:
                cell = gtk.CellRendererToggle()
                col.pack_start(cell)
                col.add_attribute(cell, attribute='active',
                                  column=i)

            col.set_sort_column_id(i)
            col.set_resizable(True)
            self.treeview_hist.append_column(col)
        self.treeview_hist.set_search_column(1)
        self.close_pane = gtk.HBox()
        self.close_button = rose.gtk.util.CustomButton(
            stock_id=gtk.STOCK_CLOSE,
            tip_text=rosie.browser.TIP_CLOSE_HISTORY_BUTTON)

        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        setattr(style, "inner-border", [0, 0, 0, 0])
        self.close_button.modify_style(style)

        self.close_button.show()
        label = gtk.Label()
        label.set_text(rosie.browser.LABEL_HISTORY_TREEVIEW)
        label.show()
        self.close_pane.pack_end(self.close_button, expand=False, fill=False)
        self.close_pane.pack_start(label, expand=False, fill=False, padding=5)
        self.close_pane.show()
        self.pack_start(self.close_pane, expand=False, fill=False)
        self.pack_start(self.treeview_scroll_hist, padding=5)
        self.treeview_scroll_hist.show()
Example #16
0
 def on_use_custom_style_changed(self, window):
     self.use_custom_style = window.use_custom_style
     if not self.style_mods:
         return  # no need to do any work here
     if self.use_custom_style:
         for (what, state), color in self.style_mods.items():
             self.do_modify_style(what, state, color)
     else:
         # This should reset the style changes we've made
         self._widget.modify_style(gtk.RcStyle())
     self.handle_custom_style_change()
Example #17
0
    def change_background(self, applet, bg_type, color, pixmap):
        """
        Changes the background of the applet when the panel's background
        changes.
        """

        applet.set_style(None)
        self.eventbox.set_style(None)

        applet.modify_style(gtk.RcStyle())
        self.eventbox.modify_style(gtk.RcStyle())

        if bg_type == gnomeapplet.PIXMAP_BACKGROUND:
            style = applet.get_style()
            style.bg_pixmap[gtk.STATE_NORMAL] = pixmap
            applet.set_style(style)
            self.eventbox.set_style(style)
        elif bg_type == gnomeapplet.COLOR_BACKGROUND:
            applet.modify_bg(gtk.STATE_NORMAL, color)
            self.eventbox.modify_bg(gtk.STATE_NORMAL, color)
Example #18
0
    def __init__(self, application, parent):
        self._container = gtk.EventBox()

        self._application = application
        self._parent = parent

        # initialize tab events
        self._container.add_events(gtk.gdk.BUTTON_RELEASE_MASK)
        self._container.connect('button-release-event',
                                self._button_release_event)
        self._container.set_visible_window(False)

        # create interface
        self._hbox = gtk.HBox(False, 0)
        self._container.add(self._hbox)

        self._label = gtk.Label()
        self._label.set_max_width_chars(20)
        self._label.set_ellipsize(pango.ELLIPSIZE_END)

        self._lock_image = gtk.Image()
        self._lock_image.set_property('no-show-all', True)
        self._lock_image.set_from_icon_name('changes-prevent-symbolic',
                                            gtk.ICON_SIZE_MENU)

        image = gtk.Image()
        image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
        image_width, image_height = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)
        image.show()

        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0

        self._button = gtk.Button()
        self._button.set_focus_on_click(False)
        self._button.add(image)
        self._button.set_relief(gtk.RELIEF_NONE)
        self._button.modify_style(style)
        self._button.connect('clicked', self._close_tab)
        self._button.set_property('no-show-all', True)
        self._button.set_size_request(image_width + 2, image_height + 2)

        # pack interface
        self._hbox.pack_start(self._lock_image, False, False, 0)
        self._hbox.pack_start(self._label, True, True, 0)
        self._hbox.pack_start(self._button, False, False, 0)

        # show controls
        if self._application.options.get('tab_close_button'):
            self._button.show()
            self._hbox.set_spacing(3)

        self._container.show_all()
Example #19
0
    def add_msg_box(self, th_id):
        """"""
        [frame.hide_all() for frame in self.widgets_list]

        frame = gtk.Frame(label=None)
        halign1 = gtk.Alignment(0, 0, 0, 0)  #left
        halign2 = gtk.Alignment(1, 0, 0, 0)  #left

        hbox = gtk.HBox(False, 20)
        label = gtk.Label(_("Extracting:") + " " + self.download_item.name)
        hbox.pack_start(label)
        status_label = gtk.Label("(" + _("Running") + ")")
        hbox.pack_start(status_label)

        halign1.add(hbox)

        #get a stock close button image
        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE,
                                               gtk.ICON_SIZE_MENU)
        image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)

        #make the close button
        btn = gtk.Button()
        btn.set_relief(gtk.RELIEF_NONE)
        btn.set_focus_on_click(False)
        btn.add(close_image)
        btn.set_size_request(image_w + 4, image_h + 4)

        #this reduces the size of the button
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        btn.modify_style(style)

        btn.connect('clicked', self.on_close_button, frame)

        halign2.add(btn)

        hbox3 = gtk.HBox()
        hbox3.pack_start(halign1)
        hbox3.pack_start(halign2)
        frame.add(hbox3)

        self.widgets_list.append(frame)

        self.parent.vbox2.pack_start(frame, False, False)

        frame.show_all()
        btn.hide()  #close btn

        gobject.timeout_add(1000, self.update_status, th_id, frame, btn,
                            status_label)
Example #20
0
    def _on_applet_change_background(self, applet, background_type, color,
                                     pixmap):
        applet.set_style(None)
        rc_style = gtk.RcStyle()
        applet.modify_style(rc_style)

        if background_type == mateapplet.NO_BACKGROUND:
            pass
        elif background_type == mateapplet.COLOR_BACKGROUND:
            applet.modify_bg(gtk.STATE_NORMAL, color)
        elif background_type == mateapplet.PIXMAP_BACKGROUND:
            style = applet.style.copy()
            style.bg_pixmap[gtk.STATE_NORMAL] = pixmap
            applet.set_style(style)
Example #21
0
    def __init__(self, titulo, icono, widget, xScreen, yScreen, diccConfig):
        self.cantidad = 0
        self.x = 10
        self.y = 10

        self.xScreen = xScreen
        self.yScreen = yScreen
        """ Calculo cantidad de iconos """
        self.sizeIconoX = int(diccConfig["sizeiconox"])
        self.sizeIconoY = int(diccConfig["sizeiconoy"])
        self.sizeEspaciadoIconosX = int(diccConfig["sizeespaciadoiconosx"])
        self.sizeEspaciadoIconosY = int(diccConfig["sizeespaciadoiconosy"])

        self.cantidadPorLinea = int(
            self.xScreen / (self.sizeIconoX + self.sizeEspaciadoIconosX)) - 1
        """ Genero un hbox y le agrego el label """
        self.hbox = gtk.HBox(False, 0)
        """ Genero el label que sera el nombre del tabs. """
        self.label = gtk.Label(titulo)
        """ Imagen X para poder luego cerrar es parte del boton """
        imagen = gtk.image_new_from_file("/usr/share/interfaz-1.0/" + icono)
        """ Creo el boton con el grafico del icono del tabs """
        self.boton = gtk.Button()
        self.boton.add(imagen)
        """ Muestro primero el icono y luego la etiqueta """
        self.hbox.pack_start(self.boton, False, False)
        self.hbox.pack_start(self.label)
        """ Le cambio el estilo al boton para que no tenga
            echo un recuadro.
        """
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        self.boton.modify_style(style)

        self.hbox.show_all()
        """ Agrego un fixed para luego colocar los datos en el fixed2 donde
            pondremos los botones como imagenes
        """
        self.fixed = gtk.Fixed()
        """ Inserta a la izquierda """
        widget.append_page(self.fixed, self.hbox)
        """ Creo la imagen del Logo """
        self.logoCentrux = gtk.Image()
        self.logoCentrux.set_from_file(
            "/usr/share/interfaz-1.0/imagenes/centrux.png")
        """ Incorporo Imagen Logo """
        self.fixed.put(self.logoCentrux, self.xScreen - 500,
                       self.yScreen - 110)
Example #22
0
    def changeBackground(self, applet, type, color, pixmap):

        self.applyTheme()

        # get reset style
        self.applet.set_style(None)
        rc_style = gtk.RcStyle()
        self.applet.modify_style(rc_style)

        if gnomeapplet.COLOR_BACKGROUND == type:
            applet.modify_bg(gtk.STATE_NORMAL, color)
        elif gnomeapplet.PIXMAP_BACKGROUND == type:
            style = applet.style
            style.bg_pixmap[gtk.STATE_NORMAL] = pixmap
            applet.set_style(style)
Example #23
0
    def __change_background_cb(self, applet, type, color, pixmap):
        applet.set_style(None)
        applet.modify_style(gtk.RcStyle())

        if type == mateapplet.NO_BACKGROUND:
            pass
        elif type == mateapplet.COLOR_BACKGROUND:
            applet.modify_bg(gtk.STATE_NORMAL, color)
        elif type == mateapplet.PIXMAP_BACKGROUND:
            style = applet.get_style().copy()
            style.bg_pixmap[gtk.STATE_NORMAL] = pixmap
            applet.set_style(style)

        for widget in [self.__scroller, self.__time, self.__rating]:
            widget.queue_draw()
Example #24
0
 def panel_bg(self, applet, bg_type, color, pixmap):
     # Reset styles
     rc_style = gtk.RcStyle()
     self.applet.set_style(None)
     self.ev_box.set_style(None)
     self.applet.modify_style(rc_style)
     self.ev_box.modify_style(rc_style)
     
     if bg_type == gnomeapplet.PIXMAP_BACKGROUND:
         style = self.applet.get_style()
         style.bg_pixmap[gtk.STATE_NORMAL] = pixmap
         self.applet.set_style(style)
         self.ev_box.set_style(style)
     if bg_type == gnomeapplet.COLOR_BACKGROUND:
         self.applet.modify_bg(gtk.STATE_NORMAL, color)
         self.ev_box.modify_bg(gtk.STATE_NORMAL, color)
Example #25
0
 def update_button(self):
     self.button = gtk.Button()
     self.icon = gtk.Image()
     self.icon.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
     self.button.set_focus_on_click(False)
     self.button.set_relief(gtk.RELIEF_NONE)
     style = gtk.RcStyle()
     style.xthickness = 0
     style.ythickness = 0
     self.button.modify_style(style)
     self.button.add(self.icon)
     self.button.connect('clicked', self.on_close)
     self.button.set_name('tab-close-button')
     if hasattr(self.button, 'set_tooltip_text'):
         self.button.set_tooltip_text('Close Tab')
     self.pack_start(self.button, False, False)
     self.show_all()
Example #26
0
    def create_tab(self, name, closeable=False, tab_style=None):
        tab = gtk.HBox()
        tab.set_spacing(4)

        if tab_style == 'CANVAS':
            name = '<b>%s</b>' % name
        else:
            image = gtk.Image()
            if tab_style == 'oper':
                image.set_from_stock(gtk.STOCK_ORIENTATION_PORTRAIT,
                                     gtk.ICON_SIZE_MENU)
            elif tab_style == 'group':
                image.set_from_stock(gtk.STOCK_DND_MULTIPLE,
                                     gtk.ICON_SIZE_MENU)
            else:
                image.set_from_stock(gtk.STOCK_EDIT, gtk.ICON_SIZE_MENU)

            tab.pack_start(image, expand=False)
            tab.image = image

        label = gtk.Label()
        label.set_markup(name)
        tab.pack_start(label, expand=True)
        tab.label = label

        if closeable:
            # add a close button
            image = gtk.Image()
            image.set_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)

            button = gtk.Button()
            button.add(image)
            button.set_relief(gtk.RELIEF_NONE)
            button.set_focus_on_click(False)

            style = gtk.RcStyle()
            style.xthickness = 0
            style.ythickness = 0
            button.modify_style(style)

            tab.pack_start(button, expand=False)
            tab.button = button

        tab.show_all()
        return tab
Example #27
0
 def _generate_message_widget(self):
     # Generate the message display widget.
     self._message_widget = gtk.EventBox()
     self._message_widget.show()
     message_hbox = gtk.HBox()
     message_hbox.show()
     self._message_widget.add(message_hbox)
     self._message_widget.connect("enter-notify-event",
                                  self._handle_enter_message_widget)
     self._message_widget_error_image = gtk.image_new_from_stock(
         gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_MENU)
     self._message_widget_info_image = gtk.image_new_from_stock(
         gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_MENU)
     self._message_widget_label = gtk.Label()
     self._message_widget_label.show()
     vsep = gtk.VSeparator()
     vsep.show()
     self._console_launcher = rose.gtk.util.CustomButton(
         stock_id=gtk.STOCK_INFO,
         size=gtk.ICON_SIZE_MENU,
         tip_text=rose.config_editor.STATUS_BAR_CONSOLE_TIP,
         as_tool=True)
     self._console_launcher.connect("clicked", self._launch_console)
     style = gtk.RcStyle()
     style.xthickness = 0
     style.ythickness = 0
     setattr(style, "inner-border", [0, 0, 0, 0])
     self._console_launcher.modify_style(style)
     message_hbox.pack_start(self._message_widget_error_image,
                             expand=False,
                             fill=False)
     message_hbox.pack_start(self._message_widget_info_image,
                             expand=False,
                             fill=False)
     message_hbox.pack_start(self._message_widget_label,
                             expand=False,
                             fill=False,
                             padding=rose.config_editor.SPACING_SUB_PAGE)
     message_hbox.pack_start(vsep,
                             expand=False,
                             fill=False,
                             padding=rose.config_editor.SPACING_SUB_PAGE)
     message_hbox.pack_start(self._console_launcher,
                             expand=False,
                             fill=False)
Example #28
0
    def _on_panel_change_background(self, widget, bg_type, color, pixmap):
        """
		Update the Cardapio applet background when the user changes
		the panel background
		"""

        self.button.parent.set_style(None)

        clean_style = gtk.RcStyle()
        self.button.parent.modify_style(clean_style)

        if bg_type == mateapplet.COLOR_BACKGROUND:
            self.button.parent.modify_bg(gtk.STATE_NORMAL, color)

        elif bg_type == mateapplet.PIXMAP_BACKGROUND:
            style = self.button.parent.get_style()
            style.bg_pixmap[gtk.STATE_NORMAL] = pixmap
            self.button.parent.set_style(style)
Example #29
0
def add_close_button(label):
    hb = gtk.HBox(False, 0)
    hb.pack_start(label)

    # Make the close button for the tab.
    b = gtk.Button()
    b.set_relief(gtk.RELIEF_NONE)
    b.set_focus_on_click(False)
    close_icon = gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
    b.add(close_icon)
    hb.pack_start(b, False, False)

    # Reduce the button size as much as possible.
    style = gtk.RcStyle()
    style.xthickness = style.ythickness = 0
    b.modify_style(style)
    hb.show_all()
    return (b, hb)
Example #30
0
    def add_tab(self, inti, rpi, rvi, tstart, tperiod):
        rp = self.rpl[rpi]
        rv = self.rvl[rvi]
        tend = tstart + tperiod
        ga, v0, v1 = self.get_data_from_db(rp.id, rv.id, tstart, tend)
        #ga=self.get_data_from_db2(rp.id, rv.id, tstart, tend, TSTEP)
        if len(ga) < 2:
            self.msgbox1.run()
            self.msgbox1.hide()
            return

        hbox = gtk.HBox(False, 0)
        label = gtk.Label(rp.name)
        hbox.pack_start(label)

        close_image = gtk.image_new_from_stock(gtk.STOCK_CLOSE,
                                               gtk.ICON_SIZE_MENU)
        image_w, image_h = gtk.icon_size_lookup(gtk.ICON_SIZE_MENU)

        #make the close button
        btn = gtk.Button()
        btn.set_relief(gtk.RELIEF_NONE)
        btn.set_focus_on_click(False)
        btn.add(close_image)
        hbox.pack_start(btn, False, False)

        #this reduces the size of the button
        style = gtk.RcStyle()
        style.xthickness = 0
        style.ythickness = 0
        btn.modify_style(style)

        hbox.show_all()

        widget = garea.GArea(_ga=ga,
                             _tstart=tstart,
                             _tperiod=tperiod,
                             _vunit=rv.unit)
        widget.set_ref_dict(inti, rpi, rvi)
        #add the tab
        self.nb.insert_page(widget, hbox)
        self.nb.show_all()
        #connect the close button
        btn.connect('clicked', self.on_closetab_button_clicked, widget)