def on_stop_button_press_event(self, widget, event): """ Called when the user clicks on the stop button """ if event.button == 1: if event.state & gtk.gdk.SHIFT_MASK: self.on_spat_clicked() elif event.button == 3: menu = guiutil.Menu() menu.append(_("Toggle: Stop after Selected Track"), self.on_spat_clicked, gtk.STOCK_STOP) menu.popup(None, None, None, event.button, event.time)
def on_stop_button_press_event(self, widget, event): """ Called when the user clicks on the stop button """ if event.button == 1: if event.get_state() & Gdk.ModifierType.SHIFT_MASK: self.on_spat_clicked() elif event.button == 3: menu = guiutil.Menu() menu.append(_("Toggle: Stop after Selected Track"), self.on_spat_clicked, 'process-stop') menu.popup(None, None, None, None, event.button, event.time)
def on_key_released(self, widget, event): """ Called when a key is released in the tree """ if event.keyval == Gdk.KEY_Menu: (mods, paths) = self.tree.get_selection().get_selected_rows() if paths and paths[0]: iter = self.model.get_iter(paths[0]) item = self.model.get_value(iter, 2) if isinstance( item, (xl.radio.RadioStation, xl.radio.RadioList, xl.radio.RadioItem), ): if isinstance(item, xl.radio.RadioStation): station = item else: station = item.station if station and hasattr(station, 'get_menu'): menu = station.get_menu(self) menu.popup(event) elif isinstance(item, xl.playlist.Playlist): Gtk.Menu.popup( self.playlist_menu, None, None, None, None, 0, event.time ) elif isinstance(item, playlistpanel.TrackWrapper): Gtk.Menu.popup( self.track_menu, None, None, None, None, 0, event.time ) return True if event.keyval == Gdk.KEY_Left: (mods, paths) = self.tree.get_selection().get_selected_rows() if paths and paths[0]: self.tree.collapse_row(paths[0]) return True if event.keyval == Gdk.KEY_Right: (mods, paths) = self.tree.get_selection().get_selected_rows() if paths and paths[0]: self.tree.expand_row(paths[0], False) return True return False
def on_key_released(self, widget, event): """ Called when a key is released in the tree """ if event.keyval == Gdk.KEY_Menu: (mods, paths) = self.tree.get_selection().get_selected_rows() if paths and paths[0]: iter = self.model.get_iter(paths[0]) item = self.model.get_value(iter, 2) if isinstance( item, (xl.radio.RadioStation, xl.radio.RadioList, xl.radio.RadioItem), ): if isinstance(item, xl.radio.RadioStation): station = item else: station = item.station if station and hasattr(station, 'get_menu'): menu = station.get_menu(self) menu.popup(event) elif isinstance(item, xl.playlist.Playlist): Gtk.Menu.popup(self.playlist_menu, None, None, None, None, 0, event.time) elif isinstance(item, playlistpanel.TrackWrapper): Gtk.Menu.popup(self.track_menu, None, None, None, None, 0, event.time) return True if event.keyval == Gdk.KEY_Left: (mods, paths) = self.tree.get_selection().get_selected_rows() if paths and paths[0]: self.tree.collapse_row(paths[0]) return True if event.keyval == Gdk.KEY_Right: (mods, paths) = self.tree.get_selection().get_selected_rows() if paths and paths[0]: self.tree.expand_row(paths[0], False) return True return False