def __create_widgets(self):
        """
        """
        self.__control = ControlVariableWidget(self.__name,
                                               self.__get_function,
                                               self.__set_function,
                                               self.__increment_pass)

        self.__left_button = gtk.Button()
        self.__left_button.set_size_request(20, 20)
        self.__left_arrow = gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_NONE)
        self.__left_button.add(self.__left_arrow)
        self.__left_button.connect('pressed',
                                   self.__pressed,
                                   -self.__increment_pass)
        self.__left_button.connect('released', self.__released)

        self.__right_button = gtk.Button()
        self.__right_button.set_size_request(20, 20)
        self.__right_arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE)
        self.__right_button.add(self.__right_arrow)
        self.__right_button.connect('pressed',
                                    self.__pressed,
                                    self.__increment_pass)
        self.__right_button.connect('released', self.__released)

        self.bw_pack_start_noexpand_nofill(self.__left_button)
        self.bw_pack_start_expand_fill(self.__control)
        self.bw_pack_start_noexpand_nofill(self.__right_button)
Example #2
0
    def _init_widgets(self):
        # Create widgets
        self.btn_back = gtk.Button()
        self.btn_forward = gtk.Button()
        self.btn_back.add(gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_NONE))
        self.btn_forward.add(gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE))

        self.tvw_items, self.lst_items = self._init_treeview()
        frame = gtk.Frame()
        #frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        frame.add(self.tvw_items)

        self.btn_popup = PopupWidgetButton(frame, label='(uninitialised)')

        # Connect to signals
        self.btn_back.connect('clicked', self._on_back_clicked)
        self.btn_forward.connect('clicked', self._on_forward_clicked)

        self.btn_popup.connect('key-press-event',
                               self._on_popup_key_press_event)

        # Add widgets to containers
        self.pack_start(self.btn_back, expand=False, fill=False)
        self.pack_start(self.btn_popup, expand=True, fill=True)
        self.pack_start(self.btn_forward, expand=False, fill=False)
Example #3
0
    def __init__(self, rango):

        gtk.EventBox.__init__(self)

        self.set_border_width(2)
        self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#ffffff"))

        self.rango = rango
        self.valor = min(self.rango)

        hbox = gtk.HBox()
        vbox = gtk.VBox()

        self.mas = gtk.Button()
        self.mas.add(gtk.Arrow(0, 1))
        self.mas.connect("clicked", self.__change, "+")
        vbox.pack_start(self.mas, False, False, 0)

        self.menos = gtk.Button()
        self.menos.add(gtk.Arrow(1, 1))
        self.menos.connect("clicked", self.__change, "-")
        vbox.pack_start(self.menos, False, False, 0)

        self.label = gtk.Label("0")
        set_font(self.label, "text", typewidget="Label")

        hbox.pack_end(vbox, False, False, 0)
        hbox.pack_end(self.label, False, False, 3)

        self.add(hbox)
        self.show_all()

        self.label.set_text(str(self.valor))
        self.menos.set_sensitive(False)
        gobject.idle_add(self.emit, "valor", self.valor)
Example #4
0
    def __init__(self, w3af, callback, maxpages=None):
        self.w3af = w3af
        gtk.HBox.__init__(self)
        self.callback = callback
        self.page = 1

        self.left = gtk.Button()
        self.left.connect("clicked", self._arrow, -1)
        self.left.add(gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_OUT))

        self.pack_start(self.left, False, False)
        self.pageentry = PagesEntry(maxpages)
        self.pageentry.connect("activate", self._textpage)
        self.pageentry.set_width_chars(5)
        self.pageentry.set_alignment(.5)
        self.pack_start(self.pageentry, False, False)

        self.total = gtk.Label()
        self.pack_start(self.total, False, False)

        self.right = gtk.Button()
        self.right.connect("clicked", self._arrow, 1)
        self.right.add(gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_OUT))
        self.pack_start(self.right, False, False)

        if maxpages is None:
            self.set_sensitive(False)
        else:
            self.total.set_text(" of %d " % maxpages)
            self.maxpages = maxpages
            self._arrow()
        self.show_all()
 def __init__(self, default_value):
     gtk.HBox.__init__(self)
     self.m_value = mpd.notename_to_int(default_value)
     self.g_label = gtk.Label(mpd.int_to_user_octave_notename(self.m_value))
     self.g_label.set_use_markup(1)
     frame = gtk.Frame()
     e = gtk.EventBox()
     frame.add(e)
     self.pack_start(frame, False)
     self.g_label.set_size_request(60, -1)#FIXME hardcoded value
     frame.set_shadow_type(gtk.SHADOW_IN)
     e.add(self.g_label)
     vbox = gtk.VBox()
     self.pack_start(vbox, False)
     # up
     self.g_up = gtk.Arrow(gtk.ARROW_UP, gtk.SHADOW_OUT)
     eb1 = gtk.EventBox()
     eb1.connect('button-press-event', self.on_up_press)
     eb1.connect('button-release-event', self.on_up_release)
     frame = gtk.Frame()
     frame.set_shadow_type(gtk.SHADOW_OUT)
     frame.add(self.g_up)
     eb1.add(frame)
     vbox.pack_start(eb1)
     # down
     self.g_down = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_ETCHED_IN)
     eb2 = gtk.EventBox()
     eb2.connect('button-press-event', self.on_down_press)
     eb2.connect('button-release-event', self.on_down_release)
     frame = gtk.Frame()
     frame.set_shadow_type(gtk.SHADOW_OUT)
     frame.add(self.g_down)
     eb2.add(frame)
     vbox.pack_start(eb2)
     self.m_timeout = None
Example #6
0
    def __init__(self, date=None, count=7, callback=None, debug=False):
        super(gtk.HBox, self).__init__()

        # Treat the parameter
        if date and not isinstance(date, datetime.date) and \
          isinstance(date, tuple) and len(date) == 3:
            date = datetime.date(date[0], date[1], date[2])
        else:
            date = datetime.date.today()

        self.set_border_width(3)

        self.connect('size-allocate', self._on_size_allocate)

        # Create Timeline box
        self.timeline_box = TimelineBox(count=count, callback=callback)
        self.timeline_box.connect('value-changed',
                                  lambda widget, *arg:
                                      self.emit('value-changed', *arg))
        self.timeline_box.connect('event-added',
                                  lambda widget, *arg:
                                      self.emit('event-added', *arg))
        self.timeline_box.connect('cleared',
                                  lambda widget, *arg:
                                      self.emit('cleared', *arg))

        self.refresh = self.timeline_box.refresh
        self.can_zoom_in = self.timeline_box.can_zoom_in
        self.can_zoom_out = self.timeline_box.can_zoom_out
        self.zoom_in = self.timeline_box.zoom_in
        self.zoom_out = self.timeline_box.zoom_out
        self.add_event = self.timeline_box.add_event

        # Create scroll buttons
        left_arrow = gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_IN)
        self.left_bttn = gtk.Button();
        self.left_bttn.add(left_arrow)
        self.left_bttn.set_relief(gtk.RELIEF_NONE)
        self.left_bttn.set_property('can-focus', False)
        self.left_bttn.connect('released', self._on_left_bttn_released)
        self.left_bttn.connect('pressed', self._on_left_bttn_pressed)

        right_arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_IN)
        self.right_bttn = gtk.Button();
        self.right_bttn.add(right_arrow)
        self.right_bttn.set_relief(gtk.RELIEF_NONE)
        self.right_bttn.set_property('can-focus', False)
        self.right_bttn.connect('released', self._on_right_bttn_released)
        self.right_bttn.connect('pressed', self._on_right_bttn_pressed)

        self.add(self.left_bttn)
        self.add(self.timeline_box)
        self.add(self.right_bttn)

        self.set_child_packing(self.left_bttn, False, False, 0, gtk.PACK_START)
        self.set_child_packing(self.timeline_box, True, True, 0, gtk.PACK_START)
        self.set_child_packing(self.right_bttn, False, False, 0, gtk.PACK_START)
Example #7
0
    def __init__(self, driveorder, diskset):
        self.driveOrder = driveorder
        self.diskset = diskset

        hbox = gtk.HBox(False, 5)

        # different widget for this maybe?
        self.driveOrderStore = gtk.ListStore(gobject.TYPE_STRING,
                                             gobject.TYPE_STRING,
                                             gobject.TYPE_STRING)
        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)

        self.driveOrderView = gtk.TreeView(self.driveOrderStore)
        i = 0
        for columnName in [N_("Drive"), N_("Size"), N_("Model")]:
            renderer = gtk.CellRendererText()
            column = gtk.TreeViewColumn(columnName, renderer, text=i)
            i = i + 1
            column.set_clickable(False)
            self.driveOrderView.append_column(column)

        self.driveOrderView.set_rules_hint(False)
        self.driveOrderView.set_headers_visible(False)
        self.driveOrderView.set_enable_search(False)

        self.makeDriveOrderStore()

        sw.add(self.driveOrderView)
        self.driveOrderView.set_size_request(375, 80)
        hbox.pack_start(sw, False)

        arrowbox = gtk.VBox(False, 5)
        arrowButton = gtk.Button()
        arrow = gtk.Arrow(gtk.ARROW_UP, gtk.SHADOW_ETCHED_IN)
        arrowButton.add(arrow)
        arrowButton.connect("clicked", self.arrowClicked, gtk.ARROW_UP)
        arrowbox.pack_start(arrowButton, False)

        spacer = gtk.Label("")
        spacer.set_size_request(10, 1)
        arrowbox.pack_start(spacer, False)

        arrowButton = gtk.Button()
        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_ETCHED_IN)
        arrowButton.add(arrow)
        arrowButton.connect("clicked", self.arrowClicked, gtk.ARROW_DOWN)
        arrowbox.pack_start(arrowButton, False)

        alignment = gtk.Alignment()
        alignment.set(0, 0.5, 0, 0)
        alignment.add(arrowbox)
        hbox.pack_start(alignment, False)

        self.widget = hbox
Example #8
0
    def getArrow(self, direction):
        '''
        Get arrow from direction
        
        @param direction:
        '''
        if direction == GameTile.DIR_HORIZ:
            return gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_OUT)
        if direction == GameTile.DIR_VERT:
            return gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_OUT)

        return None
Example #9
0
 def set_arrow(self):
     # create arrow
     if (self.get_orientation() == gtk.ORIENTATION_HORIZONTAL):
         self._arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
     else:
         self._arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE)
     self._arrow.show()
     # show arrow
     if (self.get_child().get_child() is not None):
         self._previous_child = self.get_child().get_child()
         self.get_child().remove(self.get_child().get_child())
     self.get_child().add(self._arrow)
     self.get_child().show()
Example #10
0
    def __init__(self, right_way_up = True):
        gtk.VBox.__init__(self)
        self.__resizer = widgets.sizer()
        #self.__resizer.connect('dragged', self.cb_resized)
        self.__bodyarea = gtk.EventBox()
        self.__hiddenarea = gtk.EventBox()
        self.__bodywidget = None
        self.__labelarea = gtk.EventBox()
        self.__labelarea.add_events(gtk.gdk.BUTTON_PRESS_MASK |
                                    gtk.gdk.BUTTON_RELEASE_MASK)
        self.__labelarea.connect('button-press-event', self.cb_label_press)
        self.__labelarea.connect('button-release-event', self.cb_label_release)
        self.__labelcontainer = gtk.HBox()
        self.__labelarea.add(self.__labelcontainer)
        self.__arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_ETCHED_IN)
        self.__labelcontainer.pack_start(self.__arrow, expand=False)
        self.__labelholder = gtk.EventBox()
        self.__labelcontainer.pack_start(self.__labelholder)

        #self.pack_start(self.__resizer, expand=False)

        if right_way_up:
            self.pack_start(self.__labelarea, expand=False, padding=0)
            self.pack_start(self.__bodyarea, expand=True, padding=2)
        else:
            self.pack_start(self.__bodyarea, expand=True, padding=2)
            self.pack_start(self.__labelarea, expand=False, padding=0)

        self.__expanded = False
        self.waiting = False
        self.populate()
        self.collapse()
Example #11
0
    def __init__(self):
        gtk.HBox.__init__(self)

        self._popping_down = False
        self._old_date = None

        # bootstrap problems, kiwi.ui.widgets.entry imports dateentry
        # we need to use a proxy entry because we want the mask
        from kiwi.ui.widgets.entry import ProxyEntry
        self.entry = ProxyEntry()
        self.entry.connect('changed', self._on_entry__changed)
        self.entry.connect('activate', self._on_entry__activate)
        self.entry.set_property('data-type', datetime.date)
        mask = self.entry.get_mask()
        if mask:
            self.entry.set_width_chars(len(mask))
        self.pack_start(self.entry, False, False)
        self.entry.show()

        self._button = gtk.ToggleButton()
        self._button.connect('scroll-event', self._on_entry__scroll_event)
        self._button.connect('toggled', self._on_button__toggled)
        self._button.set_focus_on_click(False)
        self.pack_start(self._button, False, False)
        self._button.show()

        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
        self._button.add(arrow)
        arrow.show()

        self._popup = _DateEntryPopup(self)
        self._popup.connect('date-selected', self._on_popup__date_selected)
        self._popup.connect('hide', self._on_popup__hide)
        self._popup.set_size_request(-1, 24)
Example #12
0
 def set_layout_by_orientation (self, orientation):
     """
     @param orientation: should be a mateapplet.ORIENT_{UP,DOWN,LEFT,RIGHT}.
     
     This method calls self.show_all()
     """
     if self.box != None:
         self.box.remove (self.button_arrow)
         self.box.remove (self.button_main)
         self.remove (self.box)
     if self.arrow != None:
         self.button_arrow.remove (self.arrow)
     
     if orientation in [mateapplet.ORIENT_UP,mateapplet.ORIENT_DOWN]:
         self.box = gtk.HBox ()
     else:
         self.box = gtk.VBox ()
             
     self.arrow = gtk.Arrow (self.mateapplet_dir_to_arrow_dir(orientation), gtk.SHADOW_IN)
     
     self.add (self.box)
     self.button_arrow.add (self.arrow)
     
     self.box.pack_start (self.button_main)
     self.box.pack_end (self.button_arrow, False, False)
             
     self.show_all ()
Example #13
0
File: title.py Project: alnvdl/oks
    def __init__(self, parent_window, label, *actions_list):
        gtk.ToggleButton.__init__(self)
        self.set_relief(gtk.RELIEF_NONE)
        self.set_property("can_focus", False)
        
        self.parent_window = parent_window
        
        self.label = gtk.Label(label)
        self.label.set_use_underline(True)
        self.arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
        
        hbox = gtk.HBox()
        hbox.set_spacing(6)
        hbox.pack_start(self.label)
        hbox.pack_start(self.arrow)
        self.add(hbox)

        self.menu = ActionsMenu()
        # Using set property, since PyGTK doesn't support the setter method
        # for this property yet.
        # self.menu.set_property("reserve-toggle-size", False)
        self.menu.set_actions(*actions_list)
        self.menu.connect("selection-done", self.on_selection_done)
        self.connect("button-press-event", self.on_button_press_event)
        self.connect("activate", self.on_button_press_event)
Example #14
0
 def __init__(self, button_icon, blank_icon, small_icon, medium_icon, large_icon, grid_type=GridType.Blank):
     gtk.Button.__init__(self)
     hbox = gtk.HBox()
     hbox.pack_start(button_icon)
     hbox.pack_start(gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN))
     self.add(hbox)
     self.set_property("can-default", False)
     self.set_property("can-focus", False)
     self.set_border_width(0)
     self.set_relief(gtk.RELIEF_NONE)
     self._grid_type = grid_type
     
     ### Grid Menu
     self._blank_item = self.__create_grid_item('Blank', blank_icon, GridType.Blank)
     self._small_item = self.__create_grid_item('Small grid', small_icon, GridType.Small)
     self._medium_item = self.__create_grid_item('Medium grid', medium_icon, GridType.Medium)
     self._large_item = self.__create_grid_item('Large grid', large_icon, GridType.Large)
     
     self._grid_menu = gtk.Menu()
     self._grid_menu.append(self._blank_item)
     self._grid_menu.append(gtk.SeparatorMenuItem())
     self._grid_menu.append(self._small_item)        
     self._grid_menu.append(self._medium_item)
     self._grid_menu.append(self._large_item)
     self._grid_menu.connect("unmap-event", self.__win_unmap)           
Example #15
0
 def set_column_widget(self, column, field, attributes, arrow=True):
     tooltips = Tooltips()
     hbox = gtk.HBox(False, 2)
     label = gtk.Label(attributes['string'])
     if field and self.editable:
         required = field.attrs.get('required')
         readonly = field.attrs.get('readonly')
         if required or not readonly:
             attrlist = pango.AttrList()
             if required:
                 attrlist.insert(pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1))
             if not readonly:
                 attrlist.change(pango.AttrStyle(pango.STYLE_ITALIC, 0, -1))
             label.set_attributes(attrlist)
     label.show()
     help = attributes['string']
     if field and field.attrs.get('help'):
         help += '\n' + field.attrs['help']
     elif attributes.get('help'):
         help += '\n' + attributes['help']
     tooltips.set_tip(label, help)
     tooltips.enable()
     if arrow:
         arrow_widget = gtk.Arrow(gtk.ARROW_NONE, gtk.SHADOW_NONE)
         arrow_widget.show()
         column.arrow = arrow_widget
     hbox.pack_start(label, True, True, 0)
     if arrow:
         hbox.pack_start(arrow_widget, False, False, 0)
         column.set_clickable(True)
     hbox.show()
     column.set_widget(hbox)
     column.set_alignment(0.5)
Example #16
0
def create_arrow_button(arrow_type, shadow_type):
    button = gtk.Button();
    arrow = gtk.Arrow(arrow_type, shadow_type);
    button.add(arrow)
    button.show()
    arrow.show()
    return button
Example #17
0
    def _create_box_cell(self, index):
        """ """
        self._create_menue_protozoon(index)
        cellBox = gtk.VBox()
        cellBox.set_border_width(3)
        self._widget_list.remember('vbox_' + str(index), cellBox)
        hBox = gtk.HBox()
        openPopupButton = gtk.Button()
        self._widget_list.remember('open_popup_' + str(index), openPopupButton)
        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_OUT)
        openPopupButton.add(arrow)
        hBox.pack_start(openPopupButton, expand=False, fill=False)
        fitnessScale = gtk.HScale()
        self._widget_list.remember('fitness_' + str(index), fitnessScale)
        fitnessScale.set_value_pos(gtk.POS_RIGHT)
        fitnessScale.set_digits(0)
        fitnessScale.set_adjustment(
            gtk.Adjustment(value=1.0,
                           lower=0.0,
                           upper=10.0,
                           step_incr=1.0,
                           page_incr=1.0,
                           page_size=1.0))
        hBox.pack_start(fitnessScale, expand=True, fill=True)
        cellBox.pack_start(hBox, expand=False, fill=True)

        aspectframe = gtk.AspectFrame()
        drawingarea = gtk.DrawingArea()
        self._widget_list.remember('drawingarea_' + str(index), drawingarea)
        aspectframe.add(drawingarea)
        cellBox.pack_start(aspectframe, expand=True, fill=True)
        return cellBox
Example #18
0
 def set_column_widget(self,
                       column,
                       field,
                       attributes,
                       arrow=True,
                       align=0.5):
     hbox = gtk.HBox(False, 2)
     label = gtk.Label(attributes['string'])
     if field and self.editable:
         required = field.attrs.get('required')
         readonly = field.attrs.get('readonly')
         common.apply_label_attributes(label, readonly, required)
     label.show()
     help = None
     if field and field.attrs.get('help'):
         help = field.attrs['help']
     elif attributes.get('help'):
         help = attributes['help']
     if help:
         tooltips = Tooltips()
         tooltips.set_tip(label, help)
         tooltips.enable()
     if arrow:
         arrow_widget = gtk.Arrow(gtk.ARROW_NONE, gtk.SHADOW_NONE)
         arrow_widget.show()
         column.arrow = arrow_widget
     hbox.pack_start(label, True, True, 0)
     if arrow:
         hbox.pack_start(arrow_widget, False, False, 0)
         column.set_clickable(True)
     hbox.show()
     column.set_widget(hbox)
     column.set_alignment(align)
Example #19
0
    def __init__(self):
        gtk.ToggleButton.__init__(self)
        self.set_relief(gtk.RELIEF_NONE)

        self.label = label = gtk.Label()
        label.set_alignment(0, 0.5)
        self.hbox = hbox = gtk.HBox()
        self.image = gtk.Image()
        hbox.pack_start(self.image, False, False)
        hbox.pack_start(label)
        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_OUT)
        hbox.pack_start(arrow, False, False)
        self.add(hbox)
        self.show_all()

        self.connect("button_press_event", self.button_press)
        self.connect("key_press_event", self.key_press)
        self.connect("scroll_event", self.scroll_event)

        self.menu = menu = gtk.Menu()
        deactivate = lambda w: self.set_active(False)
        menu.connect("deactivate", deactivate)
        menu.attach_to_widget(self, None)

        self.markup = "", ""

        self._active = -1
        self._items = []
Example #20
0
    def __init__(self, name, format="%a %b %d %Y", parent_window=None):
        try:
            if not gobject.signal_lookup("on-change-cbcalendar", self):
                gobject.signal_new("on-change-cbcalendar", self,
                                   gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
                                   (float, ))
        except:
            pass

        self.format = format
        self._name = name
        self.parent_window = parent_window

        gtk.HBox.__init__(self)

        self.entry = gtk.Entry()
        self.button = gtk.Button()
        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN)
        self.button.add(arrow)

        self.entry.set_editable(False)
        self.button.connect("pressed", self.show_calendar)

        self.pack_start(self.entry, False, False)
        self.pack_start(self.button, False, False)

        self._value = 0

        self.direction = 'down'

        self.show_all()
Example #21
0
    def __init__(self, text, menu):
        gtk.Button.__init__(self)
        self.menu = menu
        hbox1 = gtk.HBox()
        hbox2 = gtk.HBox()
        label = gtk.Label()
        hbox1.pack_start(label, True, True)
        arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN)
        hbox1.pack_start(arrow, False, False)
        hbox2.pack_start(hbox1, True, True, widgets.SPACING_TIGHT)

        # Text settings
        text = unicode(text)
        markup = "<b>%s</b>" % escape(text)
        label.set_markup(markup)

        self.add(hbox2)
        self.set_relief(gtk.RELIEF_NONE)
        self.connect("button-press-event", self.on_button_press)

        # No keynav.
        #DISABLED: self.connect("toggled", self.on_toggled)
        self.set_can_focus(False)
        self.set_can_default(False)

        for sig in "selection-done", "deactivate", "cancel":
            menu.connect(sig, self.on_menu_dismiss)
    def __init__(self, txt):
        super(ClosableLabel, self).__init__(False, 2)

        self.arrow = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_NONE)

        self.arrow_box = gtk.EventBox()
        self.arrow_box.add(self.arrow)
        self.arrow_box.set_visible_window(False)
        self.arrow_box.connect('button-press-event', self.__on_arrow_btn)

        self.label = gtk.Label(txt)
        self.label.set_use_markup(True)
        self.label.set_alignment(0, 0.5)
        self.label.set_ellipsize(pango.ELLIPSIZE_START)
        self.label.set_size_request(150, -1)

        self.button = gtk.Button()
        self.button.add(gtk.image_new_from_pixbuf(self.__close_icon))
        self.button.set_relief(gtk.RELIEF_NONE)
        self.button.connect('clicked', self.__on_clicked)

        self.pack_start(self.arrow_box, False, False)
        self.pack_start(self.label)
        self.pack_start(self.button, False, False)

        self.label.show_all()
        self.button.show_all()
Example #23
0
 def __init__(self, model=None, changed_cb=None, value=None):
     gtk.HBox.__init__(self)
     self._left_button = borderless_button(tooltip=_("Previous item"))
     self._left_button.add(gtk.Arrow(gtk.ARROW_LEFT, self.ARROW_SHADOW_TYPE))
     self._left_button.connect("clicked", self._spin_button_clicked, -1)
     self._right_button = borderless_button(tooltip=_("Next item"))
     self._right_button.add(gtk.Arrow(gtk.ARROW_RIGHT, self.ARROW_SHADOW_TYPE))
     self._right_button.connect("clicked", self._spin_button_clicked, 1)
     self._label = gtk.Label()
     self.pack_start(self._left_button, False, False)
     self.pack_start(self._label, True, True)
     self.pack_start(self._right_button, False, False)
     self._changed_cb = None
     self.set_changed_callback(changed_cb)
     self._model = None
     self._model_index = None
     self.set_model(model, value)
Example #24
0
def create_arrow_button(arrow_type, shadow_type):
    button = gtk.Button()
    arrow = gtk.Arrow(arrow_type, shadow_type)
    button.add(arrow)
    button.connect("clicked", callback, [arrow_type, shadow_type])
    button.show()
    arrow.show()
    return button
Example #25
0
def create_arrow_button(arrow_type, shadow_type):
    """Create an Arrow widget with the specified parameters and pack it into a button"""
    button = gtk.Button()
    arrow = gtk.Arrow(arrow_type, shadow_type)
    button.add(arrow)
    button.show()
    arrow.show()
    return button
Example #26
0
 def _create_container(self):
     """Create list container"""
     # Create fixed layout to put list labels on
     self.fixd = gtk.Fixed()
     self.fixd.set_size_request(self.width, self.height)
     self.fixd.show()
     # Create top & bottom scroll arrows
     self.arwScrollTop = gtk.Arrow(gtk.ARROW_UP, gtk.SHADOW_NONE)
     self.arwScrollBottom = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
     self.arwScrollTop.show()
     self.arwScrollBottom.show()
     self.arwScrollTop.set_alignment(0.5, 1.0)
     self.arwScrollBottom.set_alignment(0.5, 0.0)
     self.arwScrollTop.set_property('visible', False)
     self.arwScrollBottom.set_property('visible', False)
     self.fixd.add(self.arwScrollTop)
     self.fixd.add(self.arwScrollBottom)
Example #27
0
 def add_label_widget_with_arrow(self, label_widget):
     arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_IN)
     hbox = gtk.HBox()
     label_alignment = gtk.Alignment(0.0, 0.0, 1.0, 1.0)
     label_alignment.set_padding(0, 0, widgets.SPACING_TIGHT, 0)
     label_alignment.add(label_widget)
     hbox.pack_start(label_alignment, True, True)
     hbox.pack_start(arrow, False, False)
     self.add(hbox)
Example #28
0
def make_tool_button_widget(label):
    """Make a GtkToolButton label-widget suggestive of a menu dropdown"""
    arrow = gtk.Arrow(gtk.ARROW_DOWN, gtk.SHADOW_NONE)
    label = gtk.Label(label)
    hbox = gtk.HBox(spacing=3)
    hbox.pack_end(arrow)
    hbox.pack_end(label)
    hbox.show_all()
    return hbox
Example #29
0
def create_arrow_button(arrow_type, shadow_type, label_name):
    button = gtk.Button()
    arrow = gtk.Arrow(arrow_type, shadow_type)
    box = gtk.HBox()
    label = gtk.Label(label_name)
    box.pack_start(arrow)
    box.pack_start(label)
    button.add(box)
    return button
Example #30
0
    def __init__(self, session):
        gtk.HBox.__init__(self)

        self.session = session
        self.ft = extension.get_default('filetransfer widget')

        self.set_spacing(3)

        self.hbox = gtk.HBox()
        self.hbox.set_spacing(3)

        self.layout = gtk.Layout()
        self.layout.put(self.hbox, 0, 0)
        self.layout.set_size(self.hbox.get_allocation().width, \
                               self.hbox.get_allocation().height + 100)

        self.current = 0
        self.speed = 5
        self.page = 0
        self.twidth = 150
        self.num_transfers = 0
        self.dest = 0
        self.div = 0
        self.new_transfer_bar = None
        self.transfers = {}

        arrow_left = gtk.Arrow(gtk.ARROW_LEFT, gtk.SHADOW_IN)
        arrow_right = gtk.Arrow(gtk.ARROW_RIGHT, gtk.SHADOW_IN)
        self.b_go_left = gtk.Button()
        self.b_go_left.add(arrow_left)
        self.b_go_left.set_sensitive(False)
        self.b_go_left.set_relief(gtk.RELIEF_NONE)
        self.b_go_left.connect('clicked', self._on_left_button_clicked)

        self.b_go_right = gtk.Button()
        self.b_go_right.add(arrow_right)
        self.b_go_right.set_sensitive(False)
        self.b_go_right.set_relief(gtk.RELIEF_NONE)
        self.b_go_right.connect('clicked', self._on_right_button_clicked)

        self.pack_start(self.b_go_left, False, False)
        self.pack_start(self.layout)
        self.pack_start(self.b_go_right, False, False)