def __init__(self, prompt_text, click_text, callback=None): super(LoadingBox, self).__init__() loading_pixbuf = gtk.gdk.PixbufAnimation(get_common_image("loading.gif")) loading_image = gtk.Image() loading_image.set_from_animation(loading_pixbuf) self.click_label = ClickLabel(prompt_text, click_text, callback) self.update_prompt_text = self.click_label.update_prompt_text main_box = gtk.VBox(spacing=5) main_box.pack_start(loading_image) main_box.pack_start(set_widget_hcenter(self.click_label)) self.add(set_widget_vcenter(main_box))
def __init__(self): Window.__init__(self, window_type=gtk.WINDOW_POPUP, shape_frame_function=self.shape_mini_frame, expose_frame_function=self.expose_mini_frame) self.set_property("skip-pager-hint", True) self.set_property("skip-taskbar-hint", True) self.body_box = gtk.VBox() self.control_box = gtk.HBox() self.action_box = gtk.HBox() self.event_box = gtk.HBox() self.info_box = gtk.HBox() # Build info box self.logo_padding_left = 10 self.logo_padding_right = 10 logo_box = self.create_logo_box() logo_box_align = set_widget_gravity(logo_box, (0.5, 0.5, 0, 0), (0, 0, self.logo_padding_left, self.logo_padding_right)) self.playinfo = PlayInfo(239, None, 0, "#000000") self.info_box.pack_start(logo_box_align, False, False) self.info_box.pack_start(self.playinfo, False, False) # Build control box self.lyrics_button = self.create_lyrics_button() self.signal_auto = False if config.getboolean("lyrics", "status"): self.lyrics_button.set_active(True) self.signal_auto = True self.lyrics_padding_left = 10 self.lyrics_padding_right = 8 lyrics_button_align = set_widget_gravity(self.lyrics_button, (0.5, 0.5, 0, 0), (0, 0, self.lyrics_padding_left, self.lyrics_padding_right)) self.previous_button = self.create_button("previous") self.next_button = self.create_button("next") self.playpause_button = self.create_playpause_button() # swap played status handler self.__id_signal_play = self.playpause_button.connect("toggled", self.on_player_playpause) Player.connect("played", self.__swap_play_status, True) Player.connect("paused", self.__swap_play_status, False) Player.connect("stopped", self.__swap_play_status, False) Player.connect("play-end", self.__swap_play_status, False) self.volume_slider = VolumeSlider(auto_hide=False, mini_mode=True) self.volume_padding_left = 8 volume_slider_align = set_widget_gravity(self.volume_slider, (0.5, 0.5, 0, 0), (0, 0, self.volume_padding_left, 0)) self.action_box.pack_start(lyrics_button_align, False, False) self.action_box.pack_start(set_widget_vcenter(self.previous_button), False, False) self.action_box.pack_start(set_widget_vcenter(self.playpause_button), False, True) self.action_box.pack_start(set_widget_vcenter(self.next_button), False, False) self.action_box.pack_start(volume_slider_align, False, False) # Build event box. quell_button = QuellButton() quell_button.connect("clicked", self.on_quell_button_clicked) min_button = MinButton() min_button.connect("clicked", lambda w: self.min_window()) close_button = CloseButton() close_button.connect("clicked", self.try_to_quit) self.event_box.pack_start(quell_button, False, False) self.event_box.pack_start(min_button, False, False) self.event_box.pack_start(close_button, False, False) event_box_align = set_widget_gravity(self.event_box, paddings=(0, 0, 8, 0)) self.control_box.pack_start(self.action_box, False, True) self.control_box.pack_end(event_box_align, False, True) self.connect("configure-event", self.on_configure_event) self.connect("enter-notify-event", self.on_enter_notify_event) self.connect("leave-notify-event", self.on_leave_notify_event) self.connect("button-press-event", self.on_button_press_event) self.connect("motion-notify-event", self.on_motion_notify_event) self.connect("button-release-event", self.on_button_release_event) Dispatcher.connect("close-lyrics", lambda w : self.lyrics_button.set_active(False)) Dispatcher.connect("show-lyrics", lambda w: self.lyrics_button.set_active(True)) if config.get("mini", "x") == "-1": self.set_position(gtk.WIN_POS_CENTER) else: self.move(int(config.get("mini","x")),int(config.get("mini","y"))) # pixbufs self.info_pixbuf = None self.control_pixbuf = None self.body_box.add(self.info_box) self.window_frame.add(self.body_box) self.set_size_request(305, 40) # animation params. self.active_alpha = 1.0 self.target_alpha = 0.0 self.in_animation = False self.animation_time = 1000 self.animation_timeout_id = None self.draw_animation = False self.active_draw_func = None self.target_draw_func = None # drag params. self.drag_move = False self.old_x = self.old_y = self.mouse_x = self.mouse_y = 0
def __init__(self): gtk.EventBox.__init__(self) self.set_visible_window(False) # init. self.cover_box = PlayerCoverButton() self.cover_box.show_all() # play button play_normal_pixbuf = app_theme.get_pixbuf("action/play_normal.png") pause_normal_pixbuf = app_theme.get_pixbuf("action/pause_normal.png") play_hover_pixbuf = app_theme.get_pixbuf("action/play_hover.png") pause_hover_pixbuf = app_theme.get_pixbuf("action/pause_hover.png") play_press_pixbuf = app_theme.get_pixbuf("action/play_press.png") pause_press_pixbuf = app_theme.get_pixbuf("action/pause_press.png") self.__play = ToggleButton(play_normal_pixbuf, pause_normal_pixbuf, play_hover_pixbuf, pause_hover_pixbuf, play_press_pixbuf, pause_press_pixbuf, ) Tooltip.text(self.__play, _("Play/Pause")) # swap played status handler Player.connect("played", self.__swap_play_status, True) Player.connect("paused", self.__swap_play_status, False) Player.connect("stopped", self.__swap_play_status, False) Player.connect("play-end", self.__swap_play_status, False) self.__id_signal_play = self.__play.connect("toggled", self.on_player_playpause) prev_button = self.__create_button("previous", _("Previous")) next_button = self.__create_button("next", _("Next")) # lyrics button self.lyrics_button = self.__create_simple_toggle_button("lyrics", self.change_lyrics_status) Tooltip.text(self.lyrics_button, _("Show/Hide Lyrics")) lyrics_button_align = gtk.Alignment() lyrics_button_align.set_padding(0, 0, 0, 10) lyrics_button_align.set(0.5, 0.5, 0, 0) lyrics_button_align.add(self.lyrics_button) volume_button_align = gtk.Alignment() volume_button_align.set_padding(0, 0, 10, 0) volume_button_align.set(0.5, 0.5, 0, 0) self.volume_slider = VolumeSlider() volume_button_align.add(self.volume_slider) # volume_button_align.add(VolumeButton()) # action_box action_box = gtk.HBox() action_box.pack_start(lyrics_button_align, False, False) action_box.pack_start(set_widget_vcenter(prev_button), False, False) action_box.pack_start(set_widget_vcenter(self.__play), False, False) action_box.pack_start(set_widget_vcenter(next_button), False, False) action_box.pack_start(volume_button_align, False, False) # combo_box playinfo_align = gtk.Alignment() playinfo_align.set_padding(0, 0, 12, 0) playinfo_align.add(PlayInfo(200)) self.action_box_align = gtk.Alignment() self.action_box_align.set_padding(6, 0, 6, 0) self.action_box_align.add(action_box) self.action_box_align.connect("expose-event", self.on_expose_event) self.timer_label = "00:00" self.song_timer = SongTimer(self.draw_timer_label) combo_vbox = gtk.VBox(spacing=5) combo_vbox.pack_start(playinfo_align, False, False) combo_vbox.pack_start(self.action_box_align, False, False) cover_box_align = gtk.Alignment() cover_box_align.set_padding(0, 0, 10, 0) cover_box_align.add(self.cover_box) cover_main_box = gtk.HBox() cover_main_box.pack_start(cover_box_align, False, False) cover_main_box.pack_start(combo_vbox, False, False) body_vbox = gtk.VBox(spacing=6) body_vbox.pack_start(cover_main_box, False, True) body_vbox.pack_start(self.song_timer, False, True) # progressbar_align = gtk.Alignment() # progressbar_align.add(ProgressBar()) # progressbar_align.set(1, 1, 1, 1) # progressbar_align.set_padding(0, 0, 2, 2) # body_vbox.pack_start(progressbar_align, False, True) self.add(body_vbox) # right click self.connect("button-press-event", self.right_click_cb) Dispatcher.connect("close-lyrics", lambda w : self.lyrics_button.set_active(False)) Dispatcher.connect("show-lyrics", lambda w: self.lyrics_button.set_active(True)) self.signal_auto = False if config.getboolean("lyrics", "status"): self.lyrics_button.set_active(True) self.signal_auto = True
def __init__(self): gtk.EventBox.__init__(self) self.set_visible_window(False) # init. self.cover_box = PlayerCoverButton() self.cover_box.show_all() # play button play_normal_pixbuf = app_theme.get_pixbuf("action/play_normal.png") pause_normal_pixbuf = app_theme.get_pixbuf("action/pause_normal.png") play_hover_pixbuf = app_theme.get_pixbuf("action/play_hover.png") pause_hover_pixbuf = app_theme.get_pixbuf("action/pause_hover.png") play_press_pixbuf = app_theme.get_pixbuf("action/play_press.png") pause_press_pixbuf = app_theme.get_pixbuf("action/pause_press.png") self.__play = ToggleButton( play_normal_pixbuf, pause_normal_pixbuf, play_hover_pixbuf, pause_hover_pixbuf, play_press_pixbuf, pause_press_pixbuf, ) Tooltip.text(self.__play, _("Play/Pause")) # swap played status handler Player.connect("played", self.__swap_play_status, True) Player.connect("paused", self.__swap_play_status, False) Player.connect("stopped", self.__swap_play_status, False) Player.connect("play-end", self.__swap_play_status, False) self.__id_signal_play = self.__play.connect("toggled", self.on_player_playpause) prev_button = self.__create_button("previous", _("Previous")) next_button = self.__create_button("next", _("Next")) # lyrics button self.lyrics_button = self.__create_simple_toggle_button( "lyrics", self.change_lyrics_status) Tooltip.text(self.lyrics_button, _("Show/Hide Lyrics")) lyrics_button_align = gtk.Alignment() lyrics_button_align.set_padding(0, 0, 0, 10) lyrics_button_align.set(0.5, 0.5, 0, 0) lyrics_button_align.add(self.lyrics_button) volume_button_align = gtk.Alignment() volume_button_align.set_padding(0, 0, 10, 0) volume_button_align.set(0.5, 0.5, 0, 0) self.volume_slider = VolumeSlider() volume_button_align.add(self.volume_slider) # volume_button_align.add(VolumeButton()) # action_box action_box = gtk.HBox() action_box.pack_start(lyrics_button_align, False, False) action_box.pack_start(set_widget_vcenter(prev_button), False, False) action_box.pack_start(set_widget_vcenter(self.__play), False, False) action_box.pack_start(set_widget_vcenter(next_button), False, False) action_box.pack_start(volume_button_align, False, False) # combo_box playinfo_align = gtk.Alignment() playinfo_align.set_padding(0, 0, 12, 0) playinfo_align.add(PlayInfo(200)) self.action_box_align = gtk.Alignment() self.action_box_align.set_padding(6, 0, 6, 0) self.action_box_align.add(action_box) self.action_box_align.connect("expose-event", self.on_expose_event) self.timer_label = "00:00" self.song_timer = SongTimer(self.draw_timer_label) combo_vbox = gtk.VBox(spacing=5) combo_vbox.pack_start(playinfo_align, False, False) combo_vbox.pack_start(self.action_box_align, False, False) cover_box_align = gtk.Alignment() cover_box_align.set_padding(0, 0, 10, 0) cover_box_align.add(self.cover_box) cover_main_box = gtk.HBox() cover_main_box.pack_start(cover_box_align, False, False) cover_main_box.pack_start(combo_vbox, False, False) body_vbox = gtk.VBox(spacing=6) body_vbox.pack_start(cover_main_box, False, True) body_vbox.pack_start(self.song_timer, False, True) # progressbar_align = gtk.Alignment() # progressbar_align.add(ProgressBar()) # progressbar_align.set(1, 1, 1, 1) # progressbar_align.set_padding(0, 0, 2, 2) # body_vbox.pack_start(progressbar_align, False, True) self.add(body_vbox) # right click self.connect("button-press-event", self.right_click_cb) Dispatcher.connect("close-lyrics", lambda w: self.lyrics_button.set_active(False)) Dispatcher.connect("show-lyrics", lambda w: self.lyrics_button.set_active(True)) self.signal_auto = False if config.getboolean("lyrics", "status"): self.lyrics_button.set_active(True) self.signal_auto = True