~ubuntu-branches/ubuntu/lucid/exaile/lucid

« back to all changes in this revision

Viewing changes to xlgui/panel/flatplaylist.py

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2010-02-12 19:51:01 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100212195101-8jt3tculxcl92e6v
Tags: 0.3.1~b1-0ubuntu1
* New upstream release.
* Adjust exaile.install for new plugins.
* debian/control:
 - Drop unneeded python-dev Build-Dep.
 - Bump Standards-Version to 3.8.4 
* debian/rules: No empty po files to delete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008-2009 Adam Olsen 
2
 
#
3
 
# Copyright (C) 2008-2009 Adam Olsen 
 
1
# Copyright (C) 2008-2009 Adam Olsen
4
2
#
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.
18
16
#
19
17
#
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 
27
 
# from your version.
28
 
#
29
 
#
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 
37
 
# from your version.
 
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
 
25
# from your version.
 
26
 
 
27
import gobject
 
28
import gtk
38
29
 
39
30
from xl.nls import gettext as _
40
31
from xlgui import panel, guiutil, menu
41
32
from xl import metadata
42
 
import gtk, gobject
43
33
 
44
34
class FlatPlaylistPanel(panel.Panel):
45
35
    """
50
40
        'queue-items': (gobject.SIGNAL_RUN_LAST, None, (object,)),
51
41
    }
52
42
 
53
 
    gladeinfo = ('flatplaylist_panel.glade', 'FlatPlaylistPanelWindow')
 
43
    ui_info = ('flatplaylist_panel.ui', 'FlatPlaylistPanelWindow')
54
44
 
55
45
    def __init__(self, parent, name=None):
56
46
        panel.Panel.__init__(self, parent, name)
57
47
 
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)
60
50
        self.tracks = []
61
51
        self._setup_tree()
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()
66
56
 
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,
71
61
        })
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"))
122
112
 
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])
130
120
 
131
121
    def get_selected_tracks(self):
132
122
        selection = self.tree.get_selection()
152
142
 
153
143
            if not path:
154
144
                return False
155
 
            
 
145
 
156
146
            if len(self.get_selected_tracks()) >= 2:
157
147
                (mods,paths) = selection.get_selected_rows()
158
148
                if (path[0] in paths):
164
154
        return False
165
155
 
166
156
    def drag_data_received(self, *e):
167
 
        """ 
 
157
        """
168
158
            stub
169
159
        """
170
160
        pass
182
172
        tracks = self.get_selected_tracks()
183
173
        if not tracks: return
184
174
        for track in tracks:
185
 
            guiutil.DragTreeView.dragged_data[track.get_loc()] = track
 
175
            guiutil.DragTreeView.dragged_data[track.get_loc_for_io()] = track
186
176
        urls = guiutil.get_urls_for(tracks)
187
177
        selection.set_uris(urls)
188
178