def show(self): if self.visible: return if self._animator: self._animator.stop() self._animator = animator.Animator(0.5) self._animator.add(_Animation(self, 1.0)) self._animator.start()
def __init__(self): layout = SpreadLayout() # Round off icon size to an even number to ensure that the icon self._owner_icon = BuddyIcon(buddy=get_owner_instance(), pixel_size=style.XLARGE_ICON_SIZE & ~1) ViewContainer.__init__(self, layout, self._owner_icon) self._animator = animator.Animator(0.3) self._animator.connect('completed', self._animation_completed_cb)
def hide(self): if not self.visible: return if self._animator: self._animator.stop() palettegroup.popdown_all() self._animator = animator.Animator(0.5) self._animator.add(_Animation(self, 0.0)) self._animator.start()
def show(self): if self._wanted: return self._wanted = True if self._animator: self._animator.stop() self._animator = animator.Animator(0.5, widget=self._top_panel) self._animator.add(_Animation(self, 1.0)) self._animator.start()
def __init__(self): layout = SpreadLayout() # Round off icon size to an even number to ensure that the icon owner = get_owner_instance() self._owner_icon = Icon(icon_name='computer-xo', xo_color=owner.get_color(), pixel_size=style.XLARGE_ICON_SIZE & ~1) ViewContainer.__init__(self, layout, self._owner_icon) self._animator = animator.Animator(0.3, widget=self) self._animator.connect('completed', self._animation_completed_cb)
def hide(self): if not self._wanted: return self._wanted = False if self._animator: self._animator.stop() palettegroup.popdown_all() self._animator = animator.Animator(0.5, widget=self._top_panel) self._animator.add(_Animation(self, 0.0)) self._animator.start()
def __init__(self, **kwargs): self._group_id = None self._invoker = None self._invoker_hids = [] self._cursor_x = 0 self._cursor_y = 0 self._alignment = None self._up = False self._palette_state = None self._widget = None self._popup_anim = animator.Animator(.5, 10) self._popup_anim.add(_PopupAnimation(self)) self._popdown_anim = animator.Animator(0.6, 10) self._popdown_anim.add(_PopdownAnimation(self)) GObject.GObject.__init__(self, **kwargs) self.set_group_id('default') self._mouse_detector = MouseSpeedDetector(200, 5)
def __init__(self, label=None, accel_path=None, text_maxlen=style.MENU_WIDTH_CHARS, **kwargs): # DEPRECATED: label is passed with the primary-text property, # accel_path is set via the invoker property self._primary_text = None self._secondary_text = None self._icon = None self._icon_visible = True self._palette_state = self.PRIMARY self._primary_event_box = Gtk.EventBox() self._primary_event_box.show() self._primary_box = Gtk.HBox() self._primary_event_box.add(self._primary_box) self._primary_box.show() self._icon_box = Gtk.HBox() self._icon_box.set_size_request(style.GRID_CELL_SIZE, -1) self._primary_box.pack_start(self._icon_box, False, True, 0) labels_box = Gtk.VBox() self._label_alignment = Gtk.Alignment(xalign=0, yalign=0.5, xscale=1, yscale=0.33) self._label_alignment.set_padding( style.DEFAULT_SPACING, style.DEFAULT_SPACING, style.DEFAULT_SPACING, style.DEFAULT_SPACING) self._label_alignment.add(labels_box) self._label_alignment.show() self._primary_box.pack_start(self._label_alignment, True, True, 0) labels_box.show() self._label = Gtk.AccelLabel(label='') self._label.set_alignment(0, 0.5) if text_maxlen > 0: self._label.set_max_width_chars(text_maxlen) self._label.set_ellipsize(Pango.EllipsizeMode.MIDDLE) labels_box.pack_start(self._label, True, True, 0) self._primary_event_box.connect('button-release-event', self.__button_release_event_cb) self._primary_event_box.set_events(Gdk.EventMask.BUTTON_RELEASE_MASK) self._secondary_label = Gtk.Label() self._secondary_label.set_alignment(0, 0.5) labels_box.pack_start(self._secondary_label, True, True, 0) self._secondary_box = Gtk.VBox() self._separator = Gtk.HSeparator() self._secondary_box.pack_start(self._separator, True, True, 0) 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) self._full_request = [0, 0] self._content = None # we set these for backward compatibility if label is not None: self.props.primary_text = label self._add_content() self.action_bar = PaletteActionBar() self._secondary_box.pack_start(self.action_bar, True, True, 0) self.action_bar.show() self.connect('notify::invoker', self.__notify_invoker_cb) self.connect('popdown', self.__popdown_cb) # Default to a normal window palette self._content_widget = None self.set_content(None)
self.start_size = start_size self.end_size = end_size def next_frame(self, current): d = (self.end_size - self.start_size) * current self._icon.props.pixel_size = int(self.start_size + d) def __animation_completed_cb(anim): print 'Animation completed' w = Gtk.Window() w.connect('delete-event', Gtk.main_quit) box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) w.add(box) anim = animator.Animator(5) anim.connect('completed', __animation_completed_cb) my_icon = Icon(icon_name='go-next') box.pack_start(my_icon, False, False, 0) anim.add(_Animation(my_icon, style.STANDARD_ICON_SIZE, style.XLARGE_ICON_SIZE)) anim.start() w.show_all() Gtk.main()