Пример #1
0
 def set_volume(self, volume):
     self.player.set_volume(volume)
     if volume >= 0.7:
         self.volume_btn.set_image(get_icon('volume_max'))
     elif volume >= 0.3:
         self.volume_btn.set_image(get_icon('volume_mid'))
     else:
         self.volume_btn.set_image(get_icon('volume_min'))
Пример #2
0
 def set_repeat(self, state):
     self.current_playlist().set_repeat(state)
     if state == playlist.REPEAT_ALL:
         self.repeat_btn.set_image(get_icon('repeat_all'))
     elif state == playlist.REPEAT_ONE:
         self.repeat_btn.set_image(get_icon('repeat_one'))
     elif state == playlist.REPEAT_OFF:
         self.repeat_btn.set_image(get_icon('repeat_off'))
Пример #3
0
 def stop(self):
     self.player.stop()
     self.audio_label.set_text('')
     self.status_icon.set_tooltip('Muuse')
     self.play_btn.set_image(get_icon('play'))
     self.audio_slider.set_fraction(0)
     self.audio_slider.set_text('')
Пример #4
0
 def play(self, audio, focus=False):
     self.player.stop()
     index = self.current_playlist().current_index
     self.listbox.select_and_scroll(index, focus)
     self.audio_label.set_text(str(audio))
     self.status_icon.set_tooltip(u'Playing: %s' % audio)
     update_progress = self.progress_updater()
     gobject.timeout_add(250, update_progress.next)
     self.player.play(audio)
     self.play_btn.set_image(get_icon('pause'))
Пример #5
0
    def setup_gui(self):
        self.setup_tray_icon()

        # create the main window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Muuse")
        self.window.set_icon_from_file(to_icon_uri('muuse'))
        self.window.set_default_size(s.WIDTH, s.HEIGHT)
        
        # create the main content holder
        self.content_box = gtk.VBox(False, 0)
        
        # create content holder for top portion of the window
        self.top_box = gtk.VBox(False, 0)
        # create the label displaying info about currently playing audio file
        self.audio_label = gtk.Label('')
        self.audio_label.set_ellipsize(pango.ELLIPSIZE_END)
        # create the progress bar for the audio file that a user can click
        self.audio_slider = gtk.ProgressBar()
        # create a button box
        self.button_box = gtk.HBox(False, 0)
        # create the buttons
        self.play_btn = gtk.Button()
        self.play_btn.set_image(get_icon('play'))
        self.stop_btn = gtk.Button()
        self.stop_btn.set_image(get_icon('stop'))
        self.previous_btn = gtk.Button()
        self.previous_btn.set_image(get_icon('previous'))
        self.next_btn = gtk.Button()
        self.next_btn.set_image(get_icon('next'))
        self.repeat_btn = gtk.Button()
        self.repeat_btn.set_image(get_icon('repeat_all'))
        self.shuffle_btn = gtk.Button()
        self.shuffle_btn.set_image(get_icon('shuffle_off'))
        self.volume_btn = gtk.VolumeButton()
        self.volume_btn.set_image(get_icon('volume_mid'))
        self.volume_btn.set_value(0.5)
        # add them to the button box
        self.button_box.pack_start(self.play_btn, True, True, 0)
        self.button_box.pack_start(self.stop_btn, True, True, 0)
        self.button_box.pack_start(self.previous_btn, True, True, 0)
        self.button_box.pack_start(self.next_btn, True, True, 0)
        self.button_box.pack_start(self.repeat_btn, True, True, 0)
        self.button_box.pack_start(self.shuffle_btn, True, True, 0)
        self.button_box.pack_start(self.volume_btn, True, True, 0)
        # add everything so far to the top portion of the window
        self.top_box.pack_start(self.audio_label, False, True, 5)
        self.top_box.pack_start(self.audio_slider, False, True, 0)
        self.top_box.pack_start(self.button_box, False, True, 0)
        
        # create content holder for bottom portion of window
        self.bottom_box = gtk.VBox(False, 0)
        # create the listbox for audio to be added to
        self.listbox = ListBox(s.WIDTH, max(s.HEIGHT-77, 0), "Library")
        # create notebook to hold boxes below
        self.notebook = gtk.Notebook()
        # create box to hold cli
        self.cli_box = gtk.HBox(True, 0)
        self.cli = CLIEntry()
        self.cli_box.pack_start(self.cli, False, True, 0)
        # create box to hold add buttons
        self.add_box = gtk.HBox(True, 0)
        self.add_file_btn = gtk.Button("Add File")
        self.add_folder_btn = gtk.Button("Add Folder")
        self.add_box.pack_start(self.add_file_btn, False, True, 0)
        self.add_box.pack_start(self.add_folder_btn, False, True, 0)
        # create box to hold remove buttons
        self.rem_box = gtk.HBox(True, 0)
        self.rem_sel_btn = gtk.Button("Remove Selected")
        self.rem_all_btn = gtk.Button("Remove All")
        self.rem_box.pack_start(self.rem_sel_btn, False, True, 0)
        self.rem_box.pack_start(self.rem_all_btn, False, True, 0)
        # create box to hold selection buttons
        self.sel_box = gtk.HBox(True, 0)
        self.sel_inverse_btn = gtk.Button("Select Inverse")
        self.sel_all_btn = gtk.Button("Select All")
        self.sel_none_btn = gtk.Button("Select None")
        self.sel_box.pack_start(self.sel_inverse_btn, False, True, 0)
        self.sel_box.pack_start(self.sel_all_btn, False, True, 0)
        self.sel_box.pack_start(self.sel_none_btn, False, True, 0)
        # create box to hold playlist options
        self.list_opts_box = gtk.HBox(True, 0)
        self.list_save_btn = gtk.Button("Save Playlist")
        self.list_load_btn = gtk.Button("Load Playlist")
        self.list_opts_box.pack_start(self.list_save_btn, False, True, 0)
        self.list_opts_box.pack_start(self.list_load_btn, False, True, 0)
        # add each box to the notebook
        self.notebook.append_page(self.cli_box, None)
        self.notebook.append_page(self.add_box, None)
        self.notebook.append_page(self.rem_box, None)
        self.notebook.append_page(self.sel_box, None)
        self.notebook.append_page(self.list_opts_box, None)
        self.notebook.set_tab_label_text(self.cli_box, "CLI")
        self.notebook.set_tab_label_text(self.add_box, "Add")
        self.notebook.set_tab_label_text(self.rem_box, "Remove")
        self.notebook.set_tab_label_text(self.sel_box, "Select")
        self.notebook.set_tab_label_text(self.list_opts_box, "Playlist Opts.")
        # add everything so far to the bottom portion of the window
        self.bottom_box.pack_start(self.listbox, True, True, 0)
        self.bottom_box.pack_start(self.notebook, False, True, 0)
        
        # add the top and bottom boxes to the main content box
        self.content_box.pack_start(self.top_box, False, True, 0)
        self.content_box.pack_start(self.bottom_box, True, True, 0)
        
        # add the content box to the window.. we have a GUI!
        self.window.add(self.content_box)
Пример #6
0
 def resume(self):
     self.player.resume()
     self.play_btn.set_image(get_icon('pause'))
     self.status_icon.set_tooltip(u'Playing: %s' % self.player.current_audio())
Пример #7
0
 def pause(self):
     self.player.pause()
     self.play_btn.set_image(get_icon('play'))
     self.status_icon.set_tooltip(u'Paused: %s' % self.player.current_audio())
Пример #8
0
 def set_shuffle(self, shuffling):
     self.current_playlist().set_shuffle(shuffling)
     if shuffling:
         self.shuffle_btn.set_image(get_icon('shuffle_on'))
     else:
         self.shuffle_btn.set_image(get_icon('shuffle_off'))