Exemplo n.º 1
0
    def __key_press_event(self, treeview, event):
        if self.__browser_id == blaconst.BROWSER_FILESYSTEM:
            return False

        if blagui.is_accel(event, "Q"):
            self.__send_to_queue()

        elif (blagui.is_accel(event, "Return") or
              blagui.is_accel(event, "KP_Enter")):
            action = blacfg.getint("library", "return.action")

            selections = self.get_selection().get_selected_rows()[-1]
            if not selections:
                return True
            name = self.get_model()[selections[0]][-1]
            tracks = self.get_tracks()

            if action == blaconst.ACTION_SEND_TO_CURRENT:
                playlist_manager.send_to_current_playlist(tracks)
            elif action == blaconst.ACTION_ADD_TO_CURRENT:
                playlist_manager.add_to_current_playlist(tracks)
            elif action == blaconst.ACTION_SEND_TO_NEW:
                playlist_manager.send_to_new_playlist(tracks, name)

        return False
Exemplo n.º 2
0
    def __key_press_event(self, event):
        def get_previous_valid_path(model, path):
            if model.iter_n_children(None) == 0 or path[0] == 1:
                return None
            path = (path[0]-1,)
            release = model[path][0]
            if isinstance(release, BlaRelease):
                return path
            return (path[0]-1,)

        def get_next_valid_path(model, path):
            n = model.iter_n_children(None)
            if path[0] == n-1:
                return None
            path = (path[0]+1,)
            release = model[path][0]
            if isinstance(release, BlaRelease):
                return path
            return (path[0]+1,)

        model, iterator = self.__treeview.get_selection().get_selected()
        path = model.get_path(iterator)

        path_func = None
        if blagui.is_accel(event, "Up"):
            path_func = get_previous_valid_path
        elif blagui.is_accel(event, "Down"):
            path_func = get_next_valid_path

        if path_func is not None:
            path = path_func(model, path)
            if path is not None:
                self.__treeview.set_cursor(path)
            return True
        return False
Exemplo n.º 3
0
 def key_press_event(window, event):
     if blagui.is_accel(event, "Escape"):
         window.child.emit("toggle_fullscreen")
     elif blagui.is_accel(event, "space"):
         player.play_pause()
     elif blagui.is_accel(event, "<Ctrl>Q"):
         blaplay.shutdown()
Exemplo n.º 4
0
 def key_press_event_entry(entry, event):
     if (blagui.is_accel(event, "Escape") or
         blagui.is_accel(event, "<Ctrl>L")):
         self.__entry.select_region(-1, -1)
         self.__treeview.grab_focus()
         return True
     elif (blagui.is_accel(event, "Up") or
           blagui.is_accel(event, "Down")):
         return True
     return False
Exemplo n.º 5
0
 def __key_press_event(self, treeview, event):
     if blagui.is_accel(event, "<Ctrl>X"):
         self.cut()
     elif blagui.is_accel(event, "<Ctrl>C"):
         self.copy()
     elif blagui.is_accel(event, "<Ctrl>V"):
         self.paste()
     elif blagui.is_accel(event, "Delete"):
         self.remove()
     return False
Exemplo n.º 6
0
 def __key_press_event(self, treeview, event):
     if blagui.is_accel(event, "Delete"):
         self.__remove_stations()
     return False
Exemplo n.º 7
0
 def key_press_event(treeview, event):
     if blagui.is_accel(event, "<Ctrl>L"):
         self.__entry.grab_focus()
         return True
     return False
Exemplo n.º 8
0
 def key_press_event(treeview, event):
     if blagui.is_accel(event, "Delete"):
         model, paths = treeview.get_selection().get_selected_rows()
         identifiers = [model[path][0] for path in paths]
         if identifiers:
             self.__delete_tags(identifiers)