def button_release(self, widget, event): """ Called when someone clicks on the tree """ if event.button == Gdk.BUTTON_SECONDARY: (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) if path: iter = self.model.get_iter(path[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(None, None, None, None, event.button, event.time) elif isinstance(item, xl.playlist.Playlist): self.playlist_menu.popup(event) elif isinstance(item, playlistpanel.TrackWrapper): self.track_menu.popup(event)
def button_release(self, widget, event): """ Called when someone clicks on the tree """ if event.button == 3: (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) if path: iter = self.model.get_iter(path[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(None, None, None, event.button, event.time) elif isinstance(item, xl.playlist.Playlist): self.playlist_menu.popup(event) elif isinstance(item, playlistpanel.TrackWrapper): self.track_menu.popup(event)
def _on_moodbar_motion(self, moodbar, event): """ :type moodbar: Moodbar :type event: Gdk.Event """ if self.seeking: w = moodbar.get_allocation().width x = event.get_coords()[0] x = max(0, min(x, w)) moodbar.seek_position = x / w
def button_press(self, widget, event): """ Called when the user clicks on the tree """ selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) if event.type == Gdk.EventType._2BUTTON_PRESS: replace = settings.get_option('playlist/replace_content', False) self.append_to_playlist(replace=replace) return False elif event.button == 2: self.append_to_playlist(replace=True) return False
def button_press(self, widget, event): """ Called when the user clicks on the tree """ #selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) #path = self.tree.get_path_at_pos(x, y) if event.type == Gdk.EventType._2BUTTON_PRESS: replace = settings.get_option('playlist/replace_content', False) self.append_to_playlist(replace=replace) return False elif event.button == Gdk.BUTTON_MIDDLE: self.append_to_playlist(replace=True) return False
def modSeekMotionNotify(self, this, event): if self.seeking: track = self.player.current if not track or not (track.is_local() or \ track.get_tag_raw('__length')): return mouse_x, mouse_y = event.get_coords() progress_loc = self.get_size() value = mouse_x / progress_loc if value < 0: value = 0 if value > 1: value = 1 self.curpos = value self.mod.queue_draw_area(0, 0, progress_loc, 24)
def do_start_editing(self, event, widget, path, background_area, cell_area, flags): if event: has_coords, x, y = event.get_coords() if has_coords: # The 'aligned area' seems to correspond to where the text actually # is rendered. If the coordinates don't overlap that, then we don't # allow the edit to occur. Conveniently, this should deal with RTL # issues as well (not tested) aa = self.get_aligned_area(widget, flags, cell_area) if x < aa.x or x > aa.x + aa.width: return None return Gtk.CellRendererText.do_start_editing(self, event, widget, path, background_area, cell_area, flags)
def button_release(self, widget, event): """ Called when the user releases the mouse button on the tree """ selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) if event.button == 3: self.menu.popup(event) if not path: return False (mods,paths) = selection.get_selected_rows() if (path[0] in paths): if event.get_state() & (Gdk.ModifierType.SHIFT_MASK|Gdk.ModifierType.CONTROL_MASK): return False return True else: return False
def button_release(self, widget, event): """ Called when the user releases the mouse button on the tree """ selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) if event.button == 3: self.menu.popup(event) if not path: return False (mods, paths) = selection.get_selected_rows() if (path[0] in paths): if event.get_state() & guiutil.ModifierType.PRIMARY_SHIFT_MASK: return False return True else: return False
def button_release(self, widget, event): """ Called when the user releases the mouse button on the tree """ selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) if event.button == 3: self.menu.popup(event) if not path: return False (mods, paths) = selection.get_selected_rows() if (path[0] in paths): if event.state & (gtk.gdk.SHIFT_MASK | gtk.gdk.CONTROL_MASK): return False return True else: return False
def modSeekEnd(self,this,event): self.seeking = False track = player.PLAYER.current if not track or not (track.is_local() or \ track.get_tag_raw('__length')): return mouse_x, mouse_y = event.get_coords() progress_loc = self.get_size() value = mouse_x / progress_loc if value < 0: value = 0 if value > 1: value = 1 self.curpos=value length = track.get_tag_raw('__length') self.mod.queue_draw_area(0, 0, progress_loc, 24) #redrawMod(self) seconds = float(value * length) player.PLAYER.seek(seconds)
def button_release(self, button, event): """ Called when the user clicks on the playlist """ if event.button == 3: selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) self.menu.popup(event) if not path: return False model, paths = selection.get_selected_rows() if path[0] in paths: if event.get_state() & (Gdk.ModifierType.SHIFT_MASK|Gdk.ModifierType.CONTROL_MASK): return False return True else: return False return False
def button_release(self, button, event): """ Called when the user clicks on the playlist """ if event.button == Gdk.BUTTON_SECONDARY: selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) self.menu.popup(event) if not path: return False model, paths = selection.get_selected_rows() if path[0] in paths: if event.get_state() & guiutil.ModifierType.PRIMARY_SHIFT_MASK: return False return True else: return False return False
def button_release(self, button, event): """ Called when the user clicks on the playlist """ if event.button == 3: selection = self.tree.get_selection() (x, y) = map(int, event.get_coords()) path = self.tree.get_path_at_pos(x, y) self.menu.popup(event) if not path: return False model, paths = selection.get_selected_rows() if path[0] in paths: if event.state & (gtk.gdk.SHIFT_MASK|gtk.gdk.CONTROL_MASK): return False return True else: return False return False