Logo Search packages:      
Sourcecode: viridian version File versions  Download package

def AmpacheTools::AmpacheGUI::AmpacheGUI::__init__ (   self,
  ampache_conn,
  audio_engine,
  db_session,
  is_first_time,
  version 
)
Constructor for the AmpacheGUI Class.
Takes an AmpacheSession Object, an AudioEngine Object and a DatabaseSession Object.

Definition at line 133 of file AmpacheGUI.py.

                                                                                        :
            """Constructor for the AmpacheGUI Class.
            Takes an AmpacheSession Object, an AudioEngine Object and a DatabaseSession Object."""
00137             #################################
            # Set Variables
            #################################
00140             global VERSION_NUMBER
            VERSION_NUMBER    = version
            self.audio_engine = audio_engine
00143             self.ampache_conn = ampache_conn
            self.db_session   = db_session
            
00146             plugins_list = self.__find_plugins(PLUGINS_DIR)
            self.plugins = {}
            for plugin_name in plugins_list:
                  plugin = self.__import_plugin(plugin_name)
                  if plugin != None:
00151                         self.plugins[plugin_name] = plugin
00152             print "Plugins = ", self.plugins # DEBUG
            
            self.enabled_plugins = self.db_session.variable_get('enabled_plugins', [])
00155             
            xmlrpc_port       = self.db_session.variable_get('xmlrpc_port', XML_RPC_PORT)
            self.xml_server   = XMLServer('', xmlrpc_port)
00158             
            self.is_first_time = is_first_time
            
00161             self.catalog_up_to_date = None
00162             self.current_song_info = None
            self.tree_view_dict = {}
            dbfunctions.create_initial_tables(self.db_session)
            
            volume = self.db_session.variable_get('volume', float(100))
            width  = self.db_session.variable_get('window_size_width', 1150)
            height = self.db_session.variable_get('window_size_height', 600)
00169 
00170             ##################################
00171             # Load Images
            ##################################
            self.images_pixbuf_play  = guifunctions.create_image_pixbuf(IMAGES_DIR + 'play.png', 75)
            self.images_pixbuf_pause = guifunctions.create_image_pixbuf(IMAGES_DIR + 'pause.png', 75)
            self.images_pixbuf_gold_star = guifunctions.create_image_pixbuf(IMAGES_DIR + 'star_rating_gold.png', 16)
            self.images_pixbuf_gray_star = guifunctions.create_image_pixbuf(IMAGES_DIR + 'star_rating_gray.png', 16)
            images_pixbuf_prev = guifunctions.create_image_pixbuf(IMAGES_DIR + 'prev.png', 75)
00178             images_pixbuf_next = guifunctions.create_image_pixbuf(IMAGES_DIR + 'next.png', 75)
            self.images_pixbuf_playing = guifunctions.create_image_pixbuf(IMAGES_DIR + 'playing.png', 15)
            self.images_pixbuf_empty   = guifunctions.create_image_pixbuf(IMAGES_DIR + 'empty.png', 1)
00181 
            self.images_pixbuf_viridian_simple = guifunctions.create_image_pixbuf(IMAGES_DIR + 'ViridianSimple.png', 20)
            self.images_pixbuf_viridian_app    = guifunctions.create_image_pixbuf(IMAGES_DIR + 'ViridianApp.png', 70)
00184 
            ##################################
            # Main Window
00187             ##################################
            self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)

            self.window.connect("delete_event", self.delete_event)
            self.window.connect("destroy", self.destroy)
            self.window.set_title("Viridian")
            self.window.resize(width, height)
            self.window.set_icon(self.images_pixbuf_viridian_simple)

            main_box = gtk.VBox()
            
            #################################
            # Menu Bar
            #################################
            menu_bar = gtk.MenuBar()
            
            agr = gtk.AccelGroup()
            self.window.add_accel_group(agr)
            
            """Start File Menu"""
            file_menu = gtk.Menu()
            filem = gtk.MenuItem(_("_File"))
            filem.set_submenu(file_menu)

            newi = gtk.MenuItem(_("Reauthenticate"))
            newi.connect("activate", self.button_reauthenticate_clicked)
            file_menu.append(newi)

            self.go_to_ampache_menu_item = gtk.MenuItem(_("Open Ampache"))
            self.go_to_ampache_menu_item.connect("activate", lambda x: self.gnome_open(self.ampache_conn.url))
            self.go_to_ampache_menu_item.set_sensitive(False)
            file_menu.append(self.go_to_ampache_menu_item)
            
            sep = gtk.SeparatorMenuItem()
            file_menu.append(sep)
            
            newi = gtk.ImageMenuItem(_("Save Playlist"), agr)
            img = gtk.image_new_from_stock(gtk.STOCK_SAVE, gtk.ICON_SIZE_MENU)
            newi.set_image(img)
            key, mod = gtk.accelerator_parse("<Control>S")
            newi.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE)
            newi.connect("activate", self.button_save_playlist_clicked)
            file_menu.append(newi)
            
            newi = gtk.ImageMenuItem(_("Load Playlist"), agr)
            img = gtk.image_new_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_MENU)
            newi.set_image(img)
            key, mod = gtk.accelerator_parse("<Control>O")
            newi.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE)
            newi.connect("activate", self.button_load_playlist_clicked)
            file_menu.append(newi)
            
            newi = gtk.ImageMenuItem(_("Export Playlist..."))#, agr)
            img = gtk.image_new_from_stock(gtk.STOCK_SAVE_AS, gtk.ICON_SIZE_MENU)
            newi.set_image(img)
            #key, mod = gtk.accelerator_parse("<Control>E")
            #newi.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE)
            newi.connect("activate", self.button_export_playlist_clicked)
            file_menu.append(newi)
            
            sep = gtk.SeparatorMenuItem()
            file_menu.append(sep)
            
            newi = gtk.MenuItem(_("Clear Album Art"))
            newi.connect("activate", self.button_clear_album_art_clicked)
            file_menu.append(newi)
            
            newi = gtk.MenuItem(_("Clear Local Cache"))
            newi.connect("activate", self.button_clear_cached_artist_info_clicked)
            file_menu.append(newi)
            
            newi = gtk.MenuItem(_("Pre-Cache"))
            newi.connect("activate", self.button_pre_cache_info_clicked)
            file_menu.append(newi)
            
            sep = gtk.SeparatorMenuItem()
            file_menu.append(sep)

            exit = gtk.ImageMenuItem(gtk.STOCK_QUIT, agr)
            key, mod = gtk.accelerator_parse("<Control>Q")
            exit.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE)

            exit.connect("activate", self.destroy)

            file_menu.append(exit)

            menu_bar.append(filem)
            """End File Menu"""
            
            """Start Edit Menu"""
            edit_menu = gtk.Menu()
            editm = gtk.MenuItem(_("_Edit"))
            editm.set_submenu(edit_menu)

            newi = gtk.MenuItem(_("Plugins"))
            newi.connect("activate", self.show_plugins_window)
            edit_menu.append(newi)

            newi = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES, agr)
            key, mod = gtk.accelerator_parse("<Control>P")
            newi.add_accelerator("activate", agr, key, mod, gtk.ACCEL_VISIBLE)

            newi.connect("activate", self.show_settings)

            edit_menu.append(newi)

            menu_bar.append(editm)
            """End Edit Menu"""

            """Start View Menu"""
            view_menu = gtk.Menu()
            viewm = gtk.MenuItem(_("_View"))
            viewm.set_submenu(view_menu)

            newi = gtk.CheckMenuItem(_("Show Playlist"))
            show_playlist = self.db_session.variable_get('show_playlist', True)

            newi.set_active(show_playlist)
            newi.connect("activate", self.toggle_playlist_view)
            view_menu.append(newi)
            
            self.show_downloads_checkbox = gtk.CheckMenuItem(_("Show Downloads"))
            show_downloads = self.db_session.variable_get('show_downloads', False)
            self.show_downloads_checkbox.set_active(show_downloads)
            self.show_downloads_checkbox.connect("activate", self.toggle_downloads_view)
            view_menu.append(self.show_downloads_checkbox)
            
            sep = gtk.SeparatorMenuItem()
            view_menu.append(sep)

            newi = gtk.CheckMenuItem(_("View Statusbar"))
            view_statusbar = self.db_session.variable_get('view_statusbar', True)
            newi.set_active(view_statusbar)
            newi.connect("activate", self.toggle_statusbar_view)
            view_menu.append(newi)

            menu_bar.append(viewm)
            """End View Menu"""
            
            """Start Help Menu"""
            help_menu = gtk.Menu()
            helpm = gtk.MenuItem(_("_Help"))
            helpm.set_submenu(help_menu)
            
            newi = gtk.ImageMenuItem(gtk.STOCK_HELP)
            newi.connect("activate", self.show_help)
            help_menu.append(newi)
            
            newi = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
            newi.connect("activate", self.create_about_dialog)
            help_menu.append(newi)
            
            menu_bar.append(helpm)
            """End Help Menu"""

            vbox = gtk.VBox(False, 2)
            vbox.pack_start(menu_bar, False, False, 0)

            main_box.pack_start(vbox, False, False, 0)
            """End Menu Bar"""
      
            #################################
            # Top Control Bar
            #################################
            top_bar = gtk.HBox()
            
            top_bar_left = gtk.VBox()
            top_bar_left_top = gtk.HBox()
            top_bar_left_bottom = gtk.HBox()
            
            ### Prev Button
            prev_image = gtk.Image()
            prev_image.set_from_pixbuf(images_pixbuf_prev)
            
            event_box_prev = gtk.EventBox()
            event_box_prev.connect("button_release_event", self.button_prev_clicked)
            event_box_prev.add(prev_image)
            
            
            ### Play/Pause Button
            self.play_pause_image = gtk.Image()
            self.play_pause_image.set_from_pixbuf(self.images_pixbuf_play)
            
            event_box_play = gtk.EventBox()
            event_box_play.connect("button_release_event", self.button_play_pause_clicked)
            event_box_play.add(self.play_pause_image)
            
            
            next_image = gtk.Image()
            next_image.set_from_pixbuf(images_pixbuf_next)
            
            event_box_next = gtk.EventBox()
            event_box_next.connect("button_release_event", self.button_next_clicked)
            event_box_next.add(next_image)

            
            top_bar_left_top.pack_start(event_box_prev, False, False, 0)
            top_bar_left_top.pack_start(event_box_play, False, False, 0)
            top_bar_left_top.pack_start(event_box_next, False, False, 0)
            
            ### Volume slider, repeat songs
            self.volume_slider = gtk.HScale()
            self.volume_slider.set_inverted(False)
            self.volume_slider.set_range(0, 100)
            self.volume_slider.set_increments(1, 10)
            self.volume_slider.set_draw_value(False)
            self.volume_slider.connect('change-value', self.on_volume_slider_change)
            self.volume_slider.set_size_request(80, 20)
            self.volume_slider.set_value(volume)
      
            repeat_songs_checkbutton = gtk.CheckButton(_("Repeat"))
            repeat_songs_checkbutton.set_active(False)
            repeat_songs_checkbutton.connect("toggled", self.toggle_repeat_songs)
            
            shuffle_songs_checkbutton = gtk.CheckButton(_("Shuffle"))
            shuffle_songs_checkbutton.set_active(False)
            shuffle_songs_checkbutton.connect("toggled", self.toggle_shuffle_songs)
            
            hbox = gtk.HBox()
            vbox = gtk.VBox()
            label = gtk.Label()
            label.set_markup(_('<span size="6000"><b>Volume</b></span>'))
            vbox.pack_start(label, False, False, 0)
            vbox.pack_start(self.volume_slider, False, False, 0)
            
            hbox.pack_start(vbox, False, False, 0)
            
            vbox = gtk.VBox()
            vbox.pack_start(repeat_songs_checkbutton, False, False, 0)
            
            hbox.pack_start(vbox, False, False, 0)
            
            vbox = gtk.VBox()
            vbox.pack_start(shuffle_songs_checkbutton, False, False, 0)
            
            hbox.pack_start(vbox, False, False, 0)
            
            top_bar_left_bottom.pack_start(hbox, False, False, 0)

            
            #top_bar_left_bottom.pack_start(gtk.Label("Volume: "), False, False, 0)
            #top_bar_left_bottom.pack_start(self.volume_slider, False, False, 2)
            #top_bar_left_bottom.pack_start(repeat_songs_checkbutton, False, False, 2)
            
            top_bar_left.pack_start(top_bar_left_top, False, False, 0)
            top_bar_left.pack_start(top_bar_left_bottom, False, False, 0)
            
            top_bar.pack_start(top_bar_left, False, False, 0)
            """End Top Control Bar"""
            
            #################################
            # Scrubbing Bar
            #################################
            vbox = gtk.VBox()
            
            vbox.pack_start(gtk.Label(" "), False, False, 1) # filler
            
            self.time_seek_label = gtk.Label(" ")
            vbox.pack_start(self.time_seek_label, False, False, 2)
                  
            hbox = gtk.HBox()
            
            self.time_elapsed_label = gtk.Label("0:00")
            hbox.pack_start(self.time_elapsed_label, False, False, 2)
            
            self.time_elapsed_slider = gtk.HScale()
            self.time_elapsed_slider.set_inverted(False)
            self.time_elapsed_slider.set_range(0, 1)
            self.time_elapsed_slider.set_increments(1, 10)
            self.time_elapsed_slider.set_draw_value(False)
            self.time_elapsed_slider.set_update_policy(gtk.UPDATE_DELAYED)
            self.time_elapsed_signals = []
            self.time_elapsed_signals.append(self.time_elapsed_slider.connect('value-changed', self.on_time_elapsed_slider_change))
            self.time_elapsed_signals.append(self.time_elapsed_slider.connect('change-value', self.on_time_elapsed_slider_change_value))
            hbox.pack_start(self.time_elapsed_slider, True, True, 2)
            
            self.time_total_label = gtk.Label("0:00")
            hbox.pack_start(self.time_total_label, False, False, 2)
            
            vbox.pack_start(hbox, False, False, 2)
            
            top_bar.pack_start(vbox)
            #################################
            # Now Playing
            #################################
            now_playing_info = gtk.VBox()

            filler = gtk.Label()
            self.current_song_label   = gtk.Label()
            self.current_artist_label = gtk.Label()
            self.current_album_label  = gtk.Label()

            now_playing_info.pack_start(filler, False, False, 0)
            now_playing_info.pack_start(self.current_song_label,   False, False, 1)
            now_playing_info.pack_start(self.current_artist_label, False, False, 1)
            now_playing_info.pack_start(self.current_album_label,  False, False, 1)
            
            top_bar.pack_start(now_playing_info, False, False, 5)
            
            #################################
            #  Album Art
            #################################
            vbox = gtk.VBox()
            
            self.album_art_image = gtk.Image()
            
            event_box_album = gtk.EventBox()
            event_box_album.connect("button_release_event", self.button_album_art_clicked)
            event_box_album.add(self.album_art_image)
            
            hbox = gtk.HBox()
            
            ### Stars
            self.rating_stars_list = []
            
            i = 0
            while i < 5: # 5 stars
                  self.rating_stars_list.append(gtk.Image())
                  hbox.pack_start(self.rating_stars_list[i], False, False, 1)
                  i += 1
      
            vbox.pack_start(event_box_album, False, False, 0)
            vbox.pack_start(hbox, False, False, 0)
      
            top_bar.pack_start(vbox, False, False, 1)
            
            
            ########
            main_box.pack_start(top_bar, False, False, 3)
            """End Now Playing Info/Album Art"""
            
            #################################
            # Middle Section
            #################################
            hpaned = gtk.HPaned()
            hpaned.set_position(270)
            
            #################################
            # Playlist / Downloads Window
            #################################
            self.side_panel = gtk.VBox()
            
            ###################### Playlist ########################
            self.playlist_window = gtk.VBox()
            
            playlist_scrolled_window = gtk.ScrolledWindow()
            playlist_scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            playlist_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
                  
            # str, title - artist - album, song_id
            self.playlist_list_store = gtk.ListStore(gtk.gdk.Pixbuf, str, int)

            tree_view = gtk.TreeView(self.playlist_list_store)
            self.tree_view_dict['playlist'] = tree_view
            tree_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
            tree_view.set_reorderable(True)
            tree_view.connect("drag-end", self.on_playlist_drag)
            tree_view.connect("row-activated", self.playlist_on_activated)
            tree_view.connect("button_press_event", self.playlist_on_right_click)
            tree_view.set_rules_hint(True)
            
            new_column = guifunctions.create_column("    ", 0, None, True)
            new_column.set_reorderable(False)
            new_column.set_resizable(False)
            new_column.set_clickable(False)
            new_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            new_column.set_fixed_width(20)
            tree_view.append_column(new_column)
            
            renderer_text = gtk.CellRendererText()
            new_column = gtk.TreeViewColumn(_("Current Playlist"), renderer_text, markup=1)
            #new_column = guifunctions.create_column("Current Playlist", 1)
            new_column.set_reorderable(False)
            new_column.set_resizable(False)
            new_column.set_clickable(False)
            new_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            tree_view.append_column(new_column)
            
            playlist_scrolled_window.add(tree_view)
            
            self.playlist_window.pack_start(playlist_scrolled_window)
            
            hbox = gtk.HBox()
            
            button = gtk.Button(_("Clear Playlist"))
            button.connect('clicked', self.audio_engine.clear_playlist)
            
            hbox.pack_start(button, False, False, 2)
            
            combobox = gtk.combo_box_new_text()
            combobox.append_text(_('Replace Mode'))
            combobox.append_text(_('Add Mode'))
            combobox.connect('changed', self.playlist_mode_changed)
            
            
            hbox.pack_start(combobox, False, False, 2)
            
            self.playlist_window.pack_start(hbox, False, False, 2)
            
            self.side_panel.pack_start(self.playlist_window)
            
            ########################## Downloads ######################
                        
            self.downloads_window = gtk.VBox()  
            
            downloads_panel_scrolled_window = gtk.ScrolledWindow()
            downloads_panel_scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            downloads_panel_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
            
            downloads_window_list = gtk.VBox()
            
            self.downloads_list_store = gtk.ListStore(str, int, str)
            tree_view = gtk.TreeView(self.downloads_list_store)
            self.tree_view_dict['downloads'] = tree_view
            tree_view.connect("row-activated", self.downloads_on_activated)
            tree_view.connect("button_press_event", self.downloads_on_right_click)
            tree_view.set_rules_hint(True)
            column = gtk.TreeViewColumn(_("File"), gtk.CellRendererText(), text=0)
            column.set_reorderable(False)
            column.set_resizable(True)
            column.set_clickable(False)
            column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            column.set_fixed_width(100)
            
            tree_view.append_column(column)
            
            rendererprogress = gtk.CellRendererProgress()
            column = gtk.TreeViewColumn(_("Progress"))
            column.pack_start(rendererprogress, True)
            column.add_attribute(rendererprogress, "value", 1)
            column.set_reorderable(False)
            column.set_resizable(True)
            column.set_clickable(False)
            column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            
            tree_view.append_column(column)
                  
            downloads_window_list.pack_start(tree_view)
            
            downloads_panel_scrolled_window.add_with_viewport(downloads_window_list)
            
            self.downloads_window.pack_start(downloads_panel_scrolled_window)
            
            self.side_panel.pack_start(self.downloads_window)
            
            #############################
            
            hpaned.pack1(self.side_panel)
            
            ####################################
            # Artists/Albums/Songs
            ####################################
            
            middle_vpaned = gtk.VPaned()
            middle_vpaned.set_position(170)
            
            """Middle Top"""
            middle_top = gtk.HBox()

            """Middle Top Left"""
            #################################
            # Artists
            #################################
            artists_scrolled_window = gtk.ScrolledWindow()
            artists_scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            artists_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
            
            renderer_text = gtk.CellRendererText()
            artists_column = gtk.TreeViewColumn(_("Artists"), renderer_text, markup=0)
            artists_column.set_resizable(False)
            artists_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            artists_column.set_sort_column_id(0)


            # name, id, custom_name
            self.artist_list_store = gtk.ListStore(str, int, str)
            self.artist_list_store.set_sort_func(0, helperfunctions.sort_artists_by_custom_name, artists_column)
            self.artist_list_store.set_sort_column_id(0, gtk.SORT_ASCENDING)

            tree_view = gtk.TreeView(self.artist_list_store)
            self.tree_view_dict['artists'] = tree_view
            tree_view.set_rules_hint(False)
            artists_column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
            tree_view.append_column(artists_column)


            tree_view.connect("cursor-changed", self.artists_cursor_changed)
            #tree_view.connect("popup-menu", self.artists_cursor_changed)
            tree_view.set_search_column(0)
            
            artists_scrolled_window.add(tree_view)
            """End Middle Top Left"""
            
            """Begin Middle Top Right"""
            #################################
            # Albums
            #################################
            albums_scrolled_window = gtk.ScrolledWindow()
            albums_scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            albums_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
      

            #albums_column = guifunctions.create_column("Albums", 0)
            renderer_text = gtk.CellRendererText()
            albums_column = gtk.TreeViewColumn(_("Albums"), renderer_text, markup=0)
            albums_column.set_resizable(False)
            albums_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            albums_column.set_sort_column_id(0)
      
            # name, id, year, stars
            self.album_list_store = gtk.ListStore(str, int, int, int)
            self.album_list_store.set_sort_column_id(0, gtk.SORT_ASCENDING)
            self.album_list_store.set_sort_func(0, helperfunctions.sort_albums_by_year, albums_column ) # sort albums by year!
            
            tree_view = gtk.TreeView(self.album_list_store)
            self.tree_view_dict['albums'] = tree_view
            tree_view.set_rules_hint(False)
            albums_column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
            tree_view.append_column(albums_column)

            tree_view.connect("cursor-changed", self.albums_cursor_changed)
            tree_view.connect("row-activated",  self.albums_on_activated)
            tree_view.connect("button_press_event", self.albums_on_right_click)
            tree_view.set_search_column(0)
            
            albums_scrolled_window.add(tree_view)
            """End Middle Top Right"""
            
            middle_top.pack_start(artists_scrolled_window, True, True, 0)
            middle_top.pack_start(albums_scrolled_window, True, True, 0)

            """End Middle Top"""
            
            """Middle Bottom"""
            #################################
            # Songs
            #################################
            songs_scrolled_window = gtk.ScrolledWindow()
            songs_scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            songs_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
                  
            # track, title, time, size, id
            self.song_list_store = gtk.ListStore(int, str, str, str, str, str, int)
            self.song_list_store.set_sort_func(0, helperfunctions.sort_songs_by_track) 
            self.song_list_store.set_sort_func(1, helperfunctions.sort_songs_by_title) 
            self.song_list_store.set_sort_func(2, helperfunctions.sort_songs_by_artist) 
            self.song_list_store.set_sort_func(3, helperfunctions.sort_songs_by_album) 
            self.song_list_store.set_sort_column_id(2,gtk.SORT_ASCENDING)

            tree_view = gtk.TreeView(self.song_list_store)
            self.tree_view_dict['songs'] = tree_view
            tree_view.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
            tree_view.connect("row-activated", self.songs_on_activated)
            tree_view.connect("button_press_event", self.songs_on_right_click)
            tree_view.set_rules_hint(True)
            tree_view.set_search_column(1)
            
            i = 0
            for column in (_("Track"), _("Title"), _("Artist"), _("Album"), _("Time"), _("Size")):
                  new_column = guifunctions.create_column(column, i)
                  new_column.set_reorderable(True)
                  new_column.set_resizable(True)
                  new_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
                  if column == _("Track"):
                        new_column.set_fixed_width(65)
                  elif column == _("Title"):
                        new_column.set_fixed_width(230)
                  elif column == _("Artist"):
                        new_column.set_fixed_width(170)
                  elif column == _("Album"):
                        new_column.set_fixed_width(190)
                  elif column == _("Time"):
                        new_column.set_fixed_width(90)
                  elif column == _("Size"):
                        new_column.set_fixed_width(70)
                  tree_view.append_column(new_column)
                  i += 1
            
            songs_scrolled_window.add(tree_view)
            """End Middle Bottom"""
            
            middle_vpaned.pack1(middle_top)
            middle_vpaned.pack2(songs_scrolled_window)
            
            hpaned.pack2(middle_vpaned)
            
            main_box.pack_start(hpaned, True, True, 0)
      
            """End Middle"""  

            """Start status bar"""
            #################################
            # Status Bar
            #################################
            self.statusbar = gtk.Statusbar()
            self.statusbar.set_has_resize_grip(True)
            self.update_statusbar(_("Ready"))

            
            main_box.pack_start(self.statusbar, False, False, 0)
            """End status bar"""
            self.window.add(main_box)
            """Show All"""
            
            self.window.show_all()
            if view_statusbar == False:
                  self.statusbar.hide()
            if show_playlist == False:
                  self.playlist_window.hide()
            if show_downloads == False:
                  self.downloads_window.hide()
            if show_downloads == False and show_playlist == False:
                  self.side_panel.hide()
            """End Show All"""
            
            # check repeat songs if the user wants it
            repeat_songs = self.db_session.variable_get('repeat_songs', False)
            repeat_songs_checkbutton.set_active(repeat_songs)
            self.audio_engine.set_repeat_songs(repeat_songs)
            
            # check shuffle songs_on_activated
            shuffle_songs = self.db_session.variable_get('shuffle_songs', False)
            shuffle_songs_checkbutton.set_active(shuffle_songs)
            self.audio_engine.set_shuffle_songs(shuffle_songs)
            
            self.playlist_mode = self.db_session.variable_get('playlist_mode', 0)
            combobox.set_active(self.playlist_mode)   
            
            if DBUS_AVAILABLE:
                  try:
                        session_bus = dbus.SessionBus()
                        gnome_settings_daemon = session_bus.get_object("org.gnome.SettingsDaemon", "/org/gnome/SettingsDaemon/MediaKeys")
                        media_keys = dbus.Interface(gnome_settings_daemon, "org.gnome.SettingsDaemon.MediaKeys")
                        media_keys.connect_to_signal("MediaPlayerKeyPressed", self.media_key_pressed)
                  except:
                        pass
                        

Generated by  Doxygen 1.6.0   Back to index