mirror of
https://github.com/SoongNoonien/mpdevil.git
synced 2023-08-10 21:12:44 +03:00
fixed button and key press events
This commit is contained in:
parent
8a51014fdd
commit
3d44f5e9a5
@ -903,7 +903,7 @@ class AlbumDialog(Gtk.Dialog):
|
|||||||
self.client.play()
|
self.client.play()
|
||||||
|
|
||||||
def on_button_press_event(self, widget, event):
|
def on_button_press_event(self, widget, event):
|
||||||
if event.button == 1:
|
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
try:
|
try:
|
||||||
path = widget.get_path_at_pos(int(event.x), int(event.y))[0]
|
path = widget.get_path_at_pos(int(event.x), int(event.y))[0]
|
||||||
self.client.add(self.store[path][4])
|
self.client.add(self.store[path][4])
|
||||||
@ -912,7 +912,7 @@ class AlbumDialog(Gtk.Dialog):
|
|||||||
|
|
||||||
def on_key_press_event(self, widget, event):
|
def on_key_press_event(self, widget, event):
|
||||||
self.treeview.handler_block(self.key_press_event)
|
self.treeview.handler_block(self.key_press_event)
|
||||||
if event.keyval == 43 or event.keyval == 65451: #+
|
if event.keyval == 112: #p
|
||||||
treeview, treeiter=self.selection.get_selected()
|
treeview, treeiter=self.selection.get_selected()
|
||||||
if not treeiter == None:
|
if not treeiter == None:
|
||||||
self.client.add(self.store.get_value(treeiter, 4))
|
self.client.add(self.store.get_value(treeiter, 4))
|
||||||
@ -1221,9 +1221,9 @@ class AlbumIconView(Gtk.IconView): #TODO function/var names
|
|||||||
selected_album=self.store.get_value(treeiter, 3)
|
selected_album=self.store.get_value(treeiter, 3)
|
||||||
selected_album_year=self.store.get_value(treeiter, 4)
|
selected_album_year=self.store.get_value(treeiter, 4)
|
||||||
selected_artist=self.store.get_value(treeiter, 5)
|
selected_artist=self.store.get_value(treeiter, 5)
|
||||||
if event.button == 2:
|
if event.button == 2 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.client.album_to_playlist(selected_album, selected_artist, selected_album_year, True)
|
self.client.album_to_playlist(selected_album, selected_artist, selected_album_year, True)
|
||||||
elif event.button == 3:
|
elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
if self.client.connected():
|
if self.client.connected():
|
||||||
album = AlbumDialog(self.window, self.client, self.settings, selected_album, selected_artist, selected_album_year)
|
album = AlbumDialog(self.window, self.client, self.settings, selected_album, selected_artist, selected_album_year)
|
||||||
response = album.run()
|
response = album.run()
|
||||||
@ -1373,11 +1373,11 @@ class MainCover(Gtk.Frame):
|
|||||||
album_year=song["date"]
|
album_year=song["date"]
|
||||||
except:
|
except:
|
||||||
album_year=""
|
album_year=""
|
||||||
if event.button == 1:
|
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.client.album_to_playlist(album, artist, album_year, False)
|
self.client.album_to_playlist(album, artist, album_year, False)
|
||||||
elif event.button == 2:
|
elif event.button == 2 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.client.album_to_playlist(album, artist, album_year, True)
|
self.client.album_to_playlist(album, artist, album_year, True)
|
||||||
elif event.button == 3:
|
elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
album_dialog = AlbumDialog(self.window, self.client, self.settings, album, artist, album_year)
|
album_dialog = AlbumDialog(self.window, self.client, self.settings, album, artist, album_year)
|
||||||
response = album_dialog.run()
|
response = album_dialog.run()
|
||||||
if response == Gtk.ResponseType.OK:
|
if response == Gtk.ResponseType.OK:
|
||||||
@ -1566,7 +1566,7 @@ class PlaylistView(Gtk.Box):
|
|||||||
self.treeview.handler_unblock(self.key_press_event)
|
self.treeview.handler_unblock(self.key_press_event)
|
||||||
|
|
||||||
def on_button_press_event(self, widget, event):
|
def on_button_press_event(self, widget, event):
|
||||||
if event.button == 2:
|
if event.button == 2 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
try:
|
try:
|
||||||
path = widget.get_path_at_pos(int(event.x), int(event.y))[0]
|
path = widget.get_path_at_pos(int(event.x), int(event.y))[0]
|
||||||
self.remove_song(path)
|
self.remove_song(path)
|
||||||
@ -2313,10 +2313,10 @@ class SeekBar(Gtk.Box):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def on_scale_button_press_event(self, widget, event):
|
def on_scale_button_press_event(self, widget, event):
|
||||||
if event.button == 1:
|
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.update=False
|
self.update=False
|
||||||
self.scale.set_has_origin(False)
|
self.scale.set_has_origin(False)
|
||||||
if event.button == 3:
|
if event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.jumped=False
|
self.jumped=False
|
||||||
|
|
||||||
def on_scale_button_release_event(self, widget, event):
|
def on_scale_button_release_event(self, widget, event):
|
||||||
@ -2371,15 +2371,15 @@ class SeekBar(Gtk.Box):
|
|||||||
self.rest.set_text("-0:00:00")
|
self.rest.set_text("-0:00:00")
|
||||||
|
|
||||||
def on_elapsed_button_press_event(self, widget, event):
|
def on_elapsed_button_press_event(self, widget, event):
|
||||||
if event.button == 1:
|
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.seek_backward()
|
self.seek_backward()
|
||||||
elif event.button == 3:
|
elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.seek_forward()
|
self.seek_forward()
|
||||||
|
|
||||||
def on_rest_button_press_event(self, widget, event):
|
def on_rest_button_press_event(self, widget, event):
|
||||||
if event.button == 1:
|
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.seek_forward()
|
self.seek_forward()
|
||||||
elif event.button == 3:
|
elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
self.seek_backward()
|
self.seek_backward()
|
||||||
|
|
||||||
def on_reconnected(self, *args):
|
def on_reconnected(self, *args):
|
||||||
@ -2769,7 +2769,7 @@ class SearchWindow(Gtk.Window):
|
|||||||
self.client.play()
|
self.client.play()
|
||||||
|
|
||||||
def on_button_press_event(self, widget, event):
|
def on_button_press_event(self, widget, event):
|
||||||
if event.button == 1:
|
if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS:
|
||||||
try:
|
try:
|
||||||
path = widget.get_path_at_pos(int(event.x), int(event.y))[0]
|
path = widget.get_path_at_pos(int(event.x), int(event.y))[0]
|
||||||
self.client.add(self.store[path][5])
|
self.client.add(self.store[path][5])
|
||||||
@ -2778,7 +2778,7 @@ class SearchWindow(Gtk.Window):
|
|||||||
|
|
||||||
def on_key_press_event(self, widget, event):
|
def on_key_press_event(self, widget, event):
|
||||||
self.treeview.handler_block(self.key_press_event)
|
self.treeview.handler_block(self.key_press_event)
|
||||||
if event.keyval == 43 or event.keyval == 65451: #+
|
if event.keyval == 112: #p
|
||||||
treeview, treeiter=self.selection.get_selected()
|
treeview, treeiter=self.selection.get_selected()
|
||||||
if not treeiter == None:
|
if not treeiter == None:
|
||||||
self.client.add(self.store.get_value(treeiter, 5))
|
self.client.add(self.store.get_value(treeiter, 5))
|
||||||
|
Loading…
Reference in New Issue
Block a user