1
# Copyright (C) 2008-2009 Adam Olsen
3
# Copyright (C) 2008-2009 Adam Olsen
1
# Copyright (C) 2008-2009 Adam Olsen
5
3
# This program is free software; you can redistribute it and/or modify
6
4
# it under the terms of the GNU General Public License as published by
17
15
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
# The developers of the Exaile media player hereby grant permission
21
# for non-GPL compatible GStreamer and Exaile plugins to be used and
22
# distributed together with GStreamer and Exaile. This permission is
23
# above and beyond the permissions granted by the GPL license by which
24
# Exaile is covered. If you modify this code, you may extend this
25
# exception to your version of the code, but you are not obligated to
26
# do so. If you do not wish to do so, delete this exception statement
30
# The developers of the Exaile media player hereby grant permission
31
# for non-GPL compatible GStreamer and Exaile plugins to be used and
32
# distributed together with GStreamer and Exaile. This permission is
33
# above and beyond the permissions granted by the GPL license by which
34
# Exaile is covered. If you modify this code, you may extend this
35
# exception to your version of the code, but you are not obligated to
36
# do so. If you do not wish to do so, delete this exception statement
18
# The developers of the Exaile media player hereby grant permission
19
# for non-GPL compatible GStreamer and Exaile plugins to be used and
20
# distributed together with GStreamer and Exaile. This permission is
21
# above and beyond the permissions granted by the GPL license by which
22
# Exaile is covered. If you modify this code, you may extend this
23
# exception to your version of the code, but you are not obligated to
24
# do so. If you do not wish to do so, delete this exception statement
39
30
from xl.nls import gettext as _
40
31
from xlgui import panel, guiutil, menu
41
32
from xl import metadata
44
34
class FlatPlaylistPanel(panel.Panel):
50
40
'queue-items': (gobject.SIGNAL_RUN_LAST, None, (object,)),
53
gladeinfo = ('flatplaylist_panel.glade', 'FlatPlaylistPanelWindow')
43
ui_info = ('flatplaylist_panel.ui', 'FlatPlaylistPanelWindow')
55
45
def __init__(self, parent, name=None):
56
46
panel.Panel.__init__(self, parent, name)
58
self.box = self.xml.get_widget('FlatPlaylistPanel')
48
self.box = self.builder.get_object('FlatPlaylistPanel')
59
49
self.model = gtk.ListStore(int, str, object)
62
52
if not hasattr(self.parent, 'do_import'):
63
self.xml.get_widget("import_button").hide()
53
self.builder.get_object("import_button").hide()
64
54
self.menu = menu.TrackSelectMenu()
65
55
self._connect_events()
67
57
def _connect_events(self):
68
self.xml.signal_autoconnect({
58
self.builder.connect_signals({
69
59
'on_add_button_clicked': self._on_add_button_clicked,
70
60
'on_import_button_clicked': self._on_import_button_clicked,
118
108
def _title_data_func(self, col, cell, model, iter):
119
109
if not model.iter_is_valid(iter): return
120
110
item = model.get_value(iter, 2)
121
cell.set_property('text', metadata.j(item['title']))
111
cell.set_property('text', item.get_tag_display("title"))
123
113
def set_playlist(self, pl):
124
114
self.model.clear()
126
116
tracks = pl.get_tracks()
127
117
self.tracks = tracks
128
118
for i, track in enumerate(tracks):
129
self.model.append([i + 1, metadata.j(track['title']), track])
119
self.model.append([i + 1, track.get_tag_display("title"), track])
131
121
def get_selected_tracks(self):
132
122
selection = self.tree.get_selection()