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

def AmpacheTools::AmpacheGUI::AmpacheGUI::playlist_on_right_click (   self,
  treeview,
  event,
  data = None 
)
The user right-clicked the playlist.

Definition at line 2123 of file AmpacheGUI.py.

                                                                   :
            """The user right-clicked the playlist."""
            if event.button == 3:
                  # check to see if there is multiple selections
                  list = []
                  self.tree_view_dict['playlist'].get_selection().selected_foreach(self.foreach, [list, 2])
                  x = int(event.x)
                  y = int(event.y)
                  pthinfo = treeview.get_path_at_pos(x, y)
                  if len(list) > 1: # multiple selected
                        if pthinfo != None:
                              path, col, cellx, celly = pthinfo
                              # create popup
                              song_id = treeview.get_model()[path][2]
                              m = gtk.Menu()
                              i = gtk.MenuItem(_("Remove From Playlist"))
                              i.connect('activate', self.remove_from_playlist, song_id, treeview, list)
                              m.append(i)
                              m.append(gtk.SeparatorMenuItem())
                              i = gtk.MenuItem(_("Download Songs"))
                              i.connect('activate', self.download_songs_clicked, list)
                              m.append(i)
                              m.show_all()
                              m.popup(None, None, None, event.button, event.time, None)
                        return True
                  else: # single selected
                        if pthinfo != None:
                              path, col, cellx, celly = pthinfo
                              # create popup
                              song_id = treeview.get_model()[path][2]
                              m = gtk.Menu()
                              i = gtk.MenuItem(_("Remove From Playlist"))
                              i.connect('activate', self.remove_from_playlist, song_id, treeview)
                              m.append(i)
                              m.append(gtk.SeparatorMenuItem())
                              i = gtk.MenuItem(_("Download Song"))
                              i.connect('activate', self.download_song_clicked, song_id)
                              m.append(i)
                              i = gtk.MenuItem(_("Copy URL to Clipboard"))
                              i.connect('activate', lambda y: self.copy_song_url_to_clipboard(song_id))
                              m.append(i)
                              m.show_all()
                              m.popup(None, None, None, event.button, event.time, None)
                        

Generated by  Doxygen 1.6.0   Back to index