Ejemplo n.º 1
0
 def popdown(self, immediate=False):
     if immediate:
         self._secondary_anim.stop()
         self._popdown_submenus()
         # to suppress glitches while later re-opening
         self.set_palette_state(self.PRIMARY)
     PaletteWindow.popdown(self, immediate)
Ejemplo n.º 2
0
 def popdown(self, immediate=False):
     if immediate:
         self._secondary_anim.stop()
         self._popdown_submenus()
         # to suppress glitches while later re-opening
         self.set_palette_state(self.PRIMARY)
     PaletteWindow.popdown(self, immediate)
Ejemplo n.º 3
0
    def do_size_request(self, requisition):
        PaletteWindow.do_size_request(self, requisition)

        # gtk.AccelLabel request doesn't include the accelerator.
        label_width = (
            self._label_alignment.size_request()[0] + self._label.get_accel_width() + 2 * self.get_border_width()
        )

        requisition.width = max(requisition.width, label_width, self._full_request[0])
Ejemplo n.º 4
0
    def do_size_request(self, requisition):
        PaletteWindow.do_size_request(self, requisition)

        # gtk.AccelLabel request doesn't include the accelerator.
        label_width = self._label_alignment.size_request()[0] + \
                      self._label.get_accel_width() + \
                      2 * self.get_border_width()

        requisition.width = max(requisition.width, label_width,
                                self._full_request[0])
Ejemplo n.º 5
0
    def popup(self, immediate=False, state=None):
        if self._invoker is not None:
            self._update_full_request()

        PaletteWindow.popup(self, immediate)

        if state is None:
            state = self.PRIMARY
        self.set_palette_state(state)

        if state == self.PRIMARY:
            self._secondary_anim.start()
        else:
            self._secondary_anim.stop()
Ejemplo n.º 6
0
    def popup(self, immediate=False, state=None):
        if self._invoker is not None:
            self._update_full_request()

        PaletteWindow.popup(self, immediate)

        if state is None:
            state = self.PRIMARY
        self.set_palette_state(state)

        if state == self.PRIMARY:
            self._secondary_anim.start()
        else:
            self._secondary_anim.stop()
Ejemplo n.º 7
0
    def __init__(self, label=None, accel_path=None, menu_after_content=False,
                 text_maxlen=60, **kwargs):
        # DEPRECATED: label is passed with the primary-text property,
        # accel_path is set via the invoker property, and menu_after_content
        # is not used

        self._primary_text = None
        self._secondary_text = None
        self._icon = None
        self._icon_visible = True
        self._palette_state = self.PRIMARY

        palette_box = gtk.VBox()

        primary_box = gtk.HBox()
        palette_box.pack_start(primary_box, expand=False)
        primary_box.show()

        self._icon_box = gtk.HBox()
        self._icon_box.set_size_request(style.GRID_CELL_SIZE, -1)
        primary_box.pack_start(self._icon_box, expand=False)

        labels_box = gtk.VBox()
        self._label_alignment = gtk.Alignment(xalign=0, yalign=0.5,
                                              xscale=1, yscale=0.33)
        self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
                                          style.DEFAULT_SPACING)
        self._label_alignment.add(labels_box)
        self._label_alignment.show()
        primary_box.pack_start(self._label_alignment, expand=True)
        labels_box.show()

        self._label = gtk.AccelLabel('')
        self._label.set_alignment(0, 0.5)

        if text_maxlen > 0:
            self._label.set_max_width_chars(text_maxlen)
            self._label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
        labels_box.pack_start(self._label, expand=True)

        self._secondary_label = gtk.Label()
        self._secondary_label.set_alignment(0, 0.5)

        if text_maxlen > 0:
            self._secondary_label.set_max_width_chars(text_maxlen)
            self._secondary_label.set_ellipsize(pango.ELLIPSIZE_END)

        labels_box.pack_start(self._secondary_label, expand=True)

        self._secondary_box = gtk.VBox()
        palette_box.pack_start(self._secondary_box)

        self._separator = gtk.HSeparator()
        self._secondary_box.pack_start(self._separator)

        self._menu_content_separator = gtk.HSeparator()

        self._secondary_anim = animator.Animator(2.0, 10)
        self._secondary_anim.add(_SecondaryAnimation(self))

        # we init after initializing all of our containers
        PaletteWindow.__init__(self, **kwargs)

        primary_box.set_size_request(-1, style.GRID_CELL_SIZE
                                     - 2 * self.get_border_width())

        self._full_request = [0, 0]
        self._menu_box = None
        self._content = None

        # we set these for backward compatibility
        if label is not None:
            self.props.primary_text = label

        self._add_menu()
        self._secondary_box.pack_start(self._menu_content_separator)
        self._add_content()

        self.action_bar = PaletteActionBar()
        self._secondary_box.pack_start(self.action_bar)
        self.action_bar.show()

        self.add(palette_box)
        palette_box.show()

        # The menu is not shown here until an item is added
        self.menu = _Menu(self)
        self.menu.connect('item-inserted', self.__menu_item_inserted_cb)

        self.connect('realize', self.__realize_cb)
        self.connect('show', self.__show_cb)
        self.connect('hide', self.__hide_cb)
        self.connect('notify::invoker', self.__notify_invoker_cb)
        self.connect('destroy', self.__destroy_cb)
        self.connect('map', self.__map_cb)
Ejemplo n.º 8
0
 def on_enter(self, event):
     PaletteWindow.on_enter(self, event)
     self._secondary_anim.start()
Ejemplo n.º 9
0
    def __init__(self,
                 label=None,
                 accel_path=None,
                 menu_after_content=False,
                 text_maxlen=60,
                 **kwargs):
        # DEPRECATED: label is passed with the primary-text property,
        # accel_path is set via the invoker property, and menu_after_content
        # is not used

        self._primary_text = None
        self._secondary_text = None
        self._icon = None
        self._icon_visible = True
        self._palette_state = self.PRIMARY

        palette_box = gtk.VBox()

        primary_box = gtk.HBox()
        palette_box.pack_start(primary_box, expand=False)
        primary_box.show()

        self._icon_box = gtk.HBox()
        self._icon_box.set_size_request(style.GRID_CELL_SIZE, -1)
        primary_box.pack_start(self._icon_box, expand=False)

        labels_box = gtk.VBox()
        self._label_alignment = gtk.Alignment(xalign=0,
                                              yalign=0.5,
                                              xscale=1,
                                              yscale=0.33)
        self._label_alignment.set_padding(0, 0, style.DEFAULT_SPACING,
                                          style.DEFAULT_SPACING)
        self._label_alignment.add(labels_box)
        self._label_alignment.show()
        primary_box.pack_start(self._label_alignment, expand=True)
        labels_box.show()

        self._label = gtk.AccelLabel('')
        self._label.set_alignment(0, 0.5)

        if text_maxlen > 0:
            self._label.set_max_width_chars(text_maxlen)
            self._label.set_ellipsize(pango.ELLIPSIZE_MIDDLE)
        labels_box.pack_start(self._label, expand=True)

        self._secondary_label = gtk.Label()
        self._secondary_label.set_alignment(0, 0.5)

        if text_maxlen > 0:
            self._secondary_label.set_max_width_chars(text_maxlen)
            self._secondary_label.set_ellipsize(pango.ELLIPSIZE_END)

        labels_box.pack_start(self._secondary_label, expand=True)

        self._secondary_box = gtk.VBox()
        palette_box.pack_start(self._secondary_box)

        self._separator = gtk.HSeparator()
        self._secondary_box.pack_start(self._separator)

        self._menu_content_separator = gtk.HSeparator()

        self._secondary_anim = animator.Animator(2.0, 10)
        self._secondary_anim.add(_SecondaryAnimation(self))

        # we init after initializing all of our containers
        PaletteWindow.__init__(self, **kwargs)

        primary_box.set_size_request(
            -1, style.GRID_CELL_SIZE - 2 * self.get_border_width())

        self._full_request = [0, 0]
        self._menu_box = None
        self._content = None

        # we set these for backward compatibility
        if label is not None:
            self.props.primary_text = label

        self._add_menu()
        self._secondary_box.pack_start(self._menu_content_separator)
        self._add_content()

        self.action_bar = PaletteActionBar()
        self._secondary_box.pack_start(self.action_bar)
        self.action_bar.show()

        self.add(palette_box)
        palette_box.show()

        # The menu is not shown here until an item is added
        self.menu = _Menu(self)
        self.menu.connect('item-inserted', self.__menu_item_inserted_cb)

        self.connect('realize', self.__realize_cb)
        self.connect('show', self.__show_cb)
        self.connect('hide', self.__hide_cb)
        self.connect('notify::invoker', self.__notify_invoker_cb)
        self.connect('destroy', self.__destroy_cb)
Ejemplo n.º 10
0
 def on_enter(self, event):
     PaletteWindow.on_enter(self, event)
     self._secondary_anim.start()