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

def AmpacheTools::AmpacheGUI::AmpacheGUI::show_playlist_select (   self,
  type = None 
)
The playlist pane

Definition at line 1477 of file AmpacheGUI.py.

                                               :
            """The playlist pane"""
01480             #################################
            # playlist select
            #################################
            if type != "Load" and type != "Save" and type != "Export":
                  return True
            if hasattr(self, 'playlist_select_window'):
                  if self.playlist_select_window != None:
                        self.playlist_select_window.present()
                        return True
                        
            self.playlist_select_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
            self.playlist_select_window.set_transient_for(self.window)
            self.playlist_select_window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
            self.playlist_select_window.resize(490, 300)
            self.playlist_select_window.set_resizable(True)
            self.playlist_select_window.set_icon(self.images_pixbuf_viridian_simple)
            self.playlist_select_window.connect("delete_event", self.destroy_playlist)
            self.playlist_select_window.connect("destroy", self.destroy_playlist)         
            self.playlist_select_window.set_title(type + " playlist")
            
            vbox = gtk.VBox()
            vbox.set_border_width(10)

            hbox = gtk.HBox()
            hbox.pack_start(gtk.Label("Select a Playlist to " + type + "..."), False, False, 2)
            vbox.pack_start(hbox, False, False, 2)

            scrolled_window = gtk.ScrolledWindow()
            scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
            

            # name, items, owner, type, id
            playlist_list_store = gtk.ListStore(str, int, str, str, int)
            tree_view = gtk.TreeView(playlist_list_store)
            tree_view.set_rules_hint(True)
            
            i = 0
            for column in (_("Name"), _("Songs"), _("Owner"), _("Type")):
                  if column == _("Name"):
                        renderer_text = gtk.CellRendererText()
                        new_column = gtk.TreeViewColumn(column, renderer_text, markup=0)
                  else:
                        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 == _("Name"):
                        new_column.set_fixed_width(200)
                  elif column == _("Songs"):
                        new_column.set_fixed_width(70)
                  elif column == _("Owner"):
                        new_column.set_fixed_width(90)
                  elif column == _("Type"):
                        new_column.set_fixed_width(60)
                  tree_view.append_column(new_column)
                  i += 1

                  
            scrolled_window.add(tree_view)

            vbox.pack_start(scrolled_window, True, True, 5)
            
            text_entry = gtk.Entry()
            text_entry.set_text('')
            if type == 'Save':
                  hbox = gtk.HBox()
                  hbox.pack_start(gtk.Label(_("Playlist Name: ")), False, False, 1)
                  hbox.pack_start(text_entry, False, False, 2)
                  vbox.pack_start(hbox, False, False, 2)

            bottom_bar = gtk.HBox()
            
            
            remove = gtk.Button(stock=gtk.STOCK_DELETE)
            remove.connect("clicked", self.button_delete_playlist_clicked, tree_view.get_selection(), type)
            
            close = gtk.Button(stock=gtk.STOCK_CLOSE)
            close.connect("clicked", self.destroy_playlist)
            
            button = gtk.Button(stock=gtk.STOCK_SAVE)
            if type == 'Load':
                  button = gtk.Button(stock=gtk.STOCK_OPEN)
            elif type == 'Export':
                  button = gtk.Button(_("Export as M3U..."))
            button.connect("clicked", self.button_load_or_save_playlist_clicked, tree_view.get_selection(), text_entry, type)

            bottom_bar.pack_start(remove, False, False, 2)
            bottom_bar.pack_end(button, False, False, 2)
            bottom_bar.pack_end(close, False, False, 2)

            vbox.pack_start(bottom_bar, False, False, 1)

            self.playlist_select_window.add(vbox)
            
            self.update_playlist_select(type, playlist_list_store)
            
            self.playlist_select_window.show_all()
            

Generated by  Doxygen 1.6.0   Back to index