Merge lp:~isleshocky77/pithos/doubleclick_select_song into lp:~kevin-mehall/pithos/trunk

Proposed by Stephen Ostrow
Status: Merged
Merged at revision: 111
Proposed branch: lp:~isleshocky77/pithos/doubleclick_select_song
Merge into: lp:~kevin-mehall/pithos/trunk
Diff against target: 46 lines (+25/-10)
1 file modified
bin/pithos (+25/-10)
To merge this branch: bzr merge lp:~isleshocky77/pithos/doubleclick_select_song
Reviewer Review Type Date Requested Status
Kevin Mehall Pending
Review via email: mp+32419@code.launchpad.net

Description of the change

Adds the ability to double click any song in the future play list to play it.

To post a comment you must log in.
Revision history for this message
Stephen Ostrow (isleshocky77) wrote :

This can be merged after we discuss the question I sent to you privately

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pithos'
2--- bin/pithos 2010-08-09 21:58:17 +0000
3+++ bin/pithos 2010-08-12 06:13:44 +0000
4@@ -613,17 +613,32 @@
5 self.bookmark_song_artist(self.selected_song())
6
7 def on_treeview_button_press_event(self, treeview, event):
8- if event.button == 3:
9- x = int(event.x)
10- y = int(event.y)
11- time = event.time
12- pthinfo = treeview.get_path_at_pos(x, y)
13- if pthinfo is not None:
14- path, col, cellx, celly = pthinfo
15- treeview.grab_focus()
16- treeview.set_cursor( path, col, 0)
17+ x = int(event.x)
18+ y = int(event.y)
19+ time = event.time
20+ pthinfo = treeview.get_path_at_pos(x, y)
21+ if pthinfo is not None:
22+ path, col, cellx, celly = pthinfo
23+ treeview.grab_focus()
24+ treeview.set_cursor( path, col, 0)
25+
26+ if event.button == 3:
27 self.song_menu.popup( None, None, None, event.button, time)
28- return True
29+ return True
30+
31+ if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
32+ logging.info("Double clicked on song %s", self.selected_song().index)
33+ if self.selected_song().index <= self.current_song_index:
34+ return False
35+ songs_remaining = len(self.songs_model) - self.selected_song().index
36+ if songs_remaining <= 0:
37+ self.get_playlist(start = True)
38+ else:
39+ self.song_changed(self.selected_song().index)
40+ if songs_remaining == 1:
41+ self.get_playlist()
42+ return True
43+
44
45 def station_properties(self, *ignore):
46 webbrowser.open(self.current_station.info_url)