Exemplo n.º 1
0
    def on_button_press(self, w, e):
        
        if is_middle_click(e):
            self.add_to_tab(True)
            return

        if is_left_click(e):
            # on left click expand selected folders
            return
        
        if is_double_left_click(e):
            # on middle click play selected beans 
            self.add_to_tab()
            return
        
        if is_rigth_click(e):
            # on right click, show pop-up menu
            menu = Popup()
            menu.add_item(_("Add to current tab"), gtk.STOCK_ADD, lambda: self.add_to_tab(True), None)
            menu.add_item(_("Add to new tab"), gtk.STOCK_MEDIA_PLAY, self.add_to_tab, None)
            menu.add_separator()
            menu.add_item(_("Add folder"), gtk.STOCK_OPEN, self.add_folder, None)
            menu.add_separator()

            if FC().tabs_mode == "Multi":
                menu.add_item(_("Add folder in new tab"), gtk.STOCK_OPEN, lambda : self.add_folder(True), None)
                menu.add_item(_("Clear Music Tree"), gtk.STOCK_CLEAR, lambda : self.controls.tabhelper.clear_tree(self.scroll), None)
            menu.add_item(_("Update Music Tree"), gtk.STOCK_REFRESH, lambda: self.controls.tabhelper.on_update_music_tree(self.scroll), None)
                
            menu.show(e)
Exemplo n.º 2
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_double_left_click(e):

            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text,
                                               [selected] + beans,
                                               optimization=True)
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            self.tree_menu.clear()
            self.tree_menu.add_item(_("Add playlist"), "list-add",
                                    self.create_playlist, None)
            bean = self.get_selected_bean()
            if bean:
                if bean.is_file:
                    self.tree_menu.add_item(_("Rename"),
                                            "accessories-text-editor",
                                            self.rename_selected, None)
                    self.tree_menu.add_item(_("Delete"), "edit-delete",
                                            self.delete_selected, None)
                else:
                    self.tree_menu.add_item(_("Rename playlist"),
                                            "accessories-text-editor",
                                            self.rename_selected, None)
                    self.tree_menu.add_item(_("Delete playlist"),
                                            "edit-delete",
                                            self.delete_selected, None)
            #menu.add_item(_("Save as"), "document-save"_AS, None, None)
            #menu.add_item(_("Open as"), "folder-open", None, None)
            self.tree_menu.show(e)
Exemplo n.º 3
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_double_left_click(e):

            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text,
                                               [selected] + beans,
                                               optimization=True)
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            self.tree_menu.clear()
            self.tree_menu.add_item(_("Add playlist"), Gtk.STOCK_ADD,
                                    self.create_playlist, None)
            bean = self.get_selected_bean()
            if bean:
                if bean.is_file:
                    self.tree_menu.add_item(_("Rename"), Gtk.STOCK_EDIT,
                                            self.rename_selected, None)
                    self.tree_menu.add_item(_("Delete"), Gtk.STOCK_DELETE,
                                            self.delete_selected, None)
                else:
                    self.tree_menu.add_item(_("Rename playlist"),
                                            Gtk.STOCK_EDIT,
                                            self.rename_selected, None)
                    self.tree_menu.add_item(_("Delete playlist"),
                                            Gtk.STOCK_DELETE,
                                            self.delete_selected, None)
            #menu.add_item(_("Save as"), Gtk.STOCK_SAVE_AS, None, None)
            #menu.add_item(_("Open as"), Gtk.STOCK_OPEN, None, None)
            self.tree_menu.show(e)
Exemplo n.º 4
0
    def on_button_press(self, w, e):
        if is_middle_click(e):
            """to avoid unselect all selected items"""
            self.stop_emission('button-press-event')
        if is_left_click(e):
            # on left click expand selected folders
            return

        if is_double_left_click(e):
            # on middle click play selected beans
            self.add_to_tab()
            return

        if is_rigth_click(e):
            # on right click, show pop-up menu
            menu = Popup()
            menu.add_item(_("Append to playlist"), gtk.STOCK_ADD,
                          lambda: self.add_to_tab(True), None)
            menu.add_item(_("Open in new playlist"), gtk.STOCK_MEDIA_PLAY,
                          self.add_to_tab, None)
            menu.add_separator()
            menu.add_item(_("Add folder here"), gtk.STOCK_OPEN,
                          self.add_folder, None)
            menu.add_separator()

            if FC().tabs_mode == "Multi":
                menu.add_item(_("Add folder in new tab"), gtk.STOCK_OPEN,
                              lambda: self.add_folder(True), None)
                menu.add_item(
                    _("Clear"), gtk.STOCK_CLEAR,
                    lambda: self.controls.tabhelper.clear_tree(self.scroll),
                    None)
            menu.add_item(
                _("Update"), gtk.STOCK_REFRESH, lambda: self.controls.tabhelper
                .on_update_music_tree(self.scroll), None)

            f_model, f_t_paths = self.get_selection().get_selected_rows()
            if f_t_paths:
                model = f_model.get_model()
                t_paths = [
                    f_model.convert_child_path_to_path(f_t_path)
                    for f_t_path in f_t_paths
                ]
                row = model[t_paths[0]]
                paths = [model[t_path][self.path[0]] for t_path in t_paths]
                row_refs = [
                    gtk.TreeRowReference(model, t_path) for t_path in t_paths
                ]
                menu.add_separator()
                menu.add_item(_("Open in file manager"), None,
                              open_in_filemanager,
                              self.get_selected_bean().path)
                menu.add_item(_("Rename file (folder)"), None,
                              self.rename_files,
                              (row, self.path[0], self.text[0]))
                menu.add_item(
                    _("Delete file(s) / folder(s)"), None, self.delete_files,
                    (row_refs, paths, self.get_iter_from_row_reference))

            menu.show(e)
Exemplo n.º 5
0
 def on_button_press(self, w, e):
     if is_empty_click(w, e):
         w.get_selection().unselect_all()
     
     if is_double_left_click(e):
         selected = self.get_selected_bean()
         beans = self.get_all_child_beans_by_selected()  
         self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
         "run radio channel"
         self.controls.play_first_file_in_playlist()
         
     if is_rigth_click(e): 
         right_click_optimization_for_trees(w, e)
         
         menu = Popup()
         menu.add_item(_("Add Station"), gtk.STOCK_ADD, self.on_add_station, None)
         menu.add_item(_("Create Group"), gtk.STOCK_ADD, self.create_new_group, None)
         bean = self.get_selected_bean()
         if bean:
             if self.get_selected_bean().is_file:
                 menu.add_item(_("Edit Station"), gtk.STOCK_EDIT, self.on_edit_radio, None)
                 menu.add_item(_("Delete Station"), gtk.STOCK_DELETE, self.delete_selected, None)
             else:
                 menu.add_item(_("Rename Group"), gtk.STOCK_EDIT, self.on_rename_group, None)
                 menu.add_item(_("Delete Group"), gtk.STOCK_DELETE, self.delete_selected, None)
         menu.show(e)
Exemplo n.º 6
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            active = self.get_selected_bean()
            if active:
                self.tree_menu.clear()
                if isinstance(active, FModel) and active.path:
                    self.tree_menu.add_item(_('Play'), "media-playback-start",
                                            self.controls.play, active)
                self.tree_menu.add_item(
                    _('Copy to Search Line'), "edit-copy",
                    self.controls.searchPanel.set_search_text, active.text)
                self.tree_menu.show(e)

        if is_double_left_click(e):
            selected = self.get_selected_bean()
            if not selected:
                return

            def task():
                if (selected.user_id
                        not in self.cache) and (not selected.is_file):
                    beans = self.get_user_tracks_as_beans(selected.user_id)
                else:
                    beans = self.get_all_child_beans_by_selected()
                self.controls.notetabs.append_tab(selected.text,
                                                  [selected] + beans,
                                                  optimization=True)
                self.controls.play_first_file_in_playlist()

            self.controls.in_thread.run_with_spinner(task)
Exemplo n.º 7
0
 def on_button_press(self, w, e):
     #self.controls.notetabs.set_active_tree(self)
     if is_rigth_click(e):
         """to avoid unselect all selected items"""
         self.stop_emission('button-press-event')
     if is_double_left_click(e):
         self.controls.play_selected_song()
Exemplo n.º 8
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_double_left_click(e):

            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
                right_click_optimization_for_trees(w, e)
                self.tree_menu.clear()
                self.tree_menu.add_item(_("Add playlist"), "list-add", self.create_playlist, None)
                bean = self.get_selected_bean()
                if bean:
                    if bean.is_file:
                        self.tree_menu.add_item(_("Rename"), "accessories-text-editor", self.rename_selected, None)
                        self.tree_menu.add_item(_("Delete"), "edit-delete", self.delete_selected, None)
                    else:
                        self.tree_menu.add_item(_("Rename playlist"), "accessories-text-editor", self.rename_selected, None)
                        self.tree_menu.add_item(_("Delete playlist"), "edit-delete", self.delete_selected, None)
                #menu.add_item(_("Save as"), "document-save"_AS, None, None)
                #menu.add_item(_("Open as"), "folder-open", None, None)
                self.tree_menu.show(e)
Exemplo n.º 9
0
    def on_button_press(self, w, e):
        if is_double_left_click(e):
            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text,
                                               [selected] + beans,
                                               optimization=True)
            "run radio channel"
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)

            self.tree_menu.clear()
            bean = self.get_selected_bean()
            if bean:
                if self.get_selected_bean().is_file:
                    self.tree_menu.add_item(_("Edit Station"),
                                            "accessories-text-editor",
                                            self.on_edit_radio, None)
                    self.tree_menu.add_item(_("Delete Station"), "edit-delete",
                                            self.delete_selected, None)
                else:
                    self.tree_menu.add_item(_("Rename Group"),
                                            "accessories-text-editor",
                                            self.on_rename_group, None)
                    self.tree_menu.add_item(_("Delete Group"), "edit-delete",
                                            self.delete_selected, None)
                self.tree_menu.add_separator()
            self.tree_menu.add_item(_("Reload radio folder"), "view-refresh",
                                    self.update_radio_tree, None)
            self.tree_menu.show(e)
Exemplo n.º 10
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            active = self.get_selected_bean()
            if active:
                self.tree_menu.clear()
                if isinstance(active, FModel) and active.path:
                    self.tree_menu.add_item(_('Play'), "media-playback-start", self.controls.play, active)
                self.tree_menu.add_item(_('Copy to Search Line'), "edit-copy", self.controls.searchPanel.set_search_text, active.text)
                self.tree_menu.show(e)

        if is_double_left_click(e):
            selected = self.get_selected_bean()
            if not selected:
                return

            def task():
                if (selected.user_id not in self.cache) and (not selected.is_file):
                    beans = self.get_user_tracks_as_beans(selected.user_id)
                else:
                    beans = self.get_all_child_beans_by_selected()
                self.controls.notetabs.append_tab(selected.text, [selected] + beans, optimization=True)
                self.controls.play_first_file_in_playlist()

            self.controls.in_thread.run_with_spinner(task)
Exemplo n.º 11
0
 def on_button_press(self, w, e):
     if is_empty_click(w, e):
         w.get_selection().unselect_all()
     active = self.get_selected_bean()
     if active:
         active.type = FTYPE_NOT_UPDATE_INFO_PANEL
     else:
         return None
     
     if is_left_click(e):
         if active.get_status():
             if active.get_status() == DOWNLOAD_STATUS_ALL:
                 self.controls.dm.filter(None, FTreeModel().status[0])
             else:
                 self.controls.dm.filter(active.get_status(), FTreeModel().status[0])
             
     if is_double_left_click(e):
         self.controls.play(active)
     
     if is_rigth_click(e):
         right_click_optimization_for_trees(w, e)
         menu = Popup()
         menu.add_item('Play', Gtk.STOCK_MEDIA_PLAY, self.controls.play, active)
         menu.add_item('Copy to Search Line', Gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, active.text)
         menu.show(e)
Exemplo n.º 12
0
 def on_button_press(self, w, e):
     #self.controls.notetabs.set_active_tree(self)
     if is_rigth_click(e):
         """to avoid unselect all selected items"""
         self.stop_emission('button-press-event')
     if is_double_left_click(e):
         self.controls.play_selected_song()
Exemplo n.º 13
0
 def on_button_press(self, w, e):
     if is_empty_click(w, e):
         w.get_selection().unselect_all()
     active = self.get_selected_bean()
     if active:
         active.type = FTYPE_NOT_UPDATE_INFO_PANEL
     else:
         return None
     
     if is_left_click(e):
         if active.get_status():
             if active.get_status() == DOWNLOAD_STATUS_ALL:
                 self.controls.dm.filter(None, FTreeModel().status[0])
             else:
                 self.controls.dm.filter(active.get_status(), FTreeModel().status[0])
             
     if is_double_left_click(e):
         self.controls.play(active)
     
     if is_rigth_click(e):
         right_click_optimization_for_trees(w, e)
         menu = Popup()
         menu.add_item('Play', gtk.STOCK_MEDIA_PLAY, self.controls.play, active)
         menu.add_item('Copy to Search Line', gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, active.text)            
         menu.show(e)
Exemplo n.º 14
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_double_left_click(e):

            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
                right_click_optimization_for_trees(w, e)
                self.tree_menu.clear()
                self.tree_menu.add_item(_("Add playlist"), Gtk.STOCK_ADD, self.create_playlist, None)
                bean = self.get_selected_bean()
                if bean:
                    if bean.is_file:
                        self.tree_menu.add_item(_("Rename"), Gtk.STOCK_EDIT, self.rename_selected, None)
                        self.tree_menu.add_item(_("Delete"), Gtk.STOCK_DELETE, self.delete_selected, None)
                    else:
                        self.tree_menu.add_item(_("Rename playlist"), Gtk.STOCK_EDIT, self.rename_selected, None)
                        self.tree_menu.add_item(_("Delete playlist"), Gtk.STOCK_DELETE, self.delete_selected, None)
                #menu.add_item(_("Save as"), Gtk.STOCK_SAVE_AS, None, None)
                #menu.add_item(_("Open as"), Gtk.STOCK_OPEN, None, None)
                self.tree_menu.show(e)
Exemplo n.º 15
0
    def on_button_press(self, w, e):
        if self.header_pressed:
            self.header_pressed = False
            return
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_double_left_click(e):
            self.controls.play_selected_song()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            beans = self.get_selected_beans()
            if beans:
                self.tree_menu.clear()
                self.tree_menu.add_item(_('Play'), Gtk.STOCK_MEDIA_PLAY, self.controls.play_selected_song, None)
                self.tree_menu.add_item(_('Delete from playlist'), Gtk.STOCK_DELETE, self.delete_selected, None)

                paths = []
                inet_paths = []
                local_paths = []
                for bean in beans:
                    if bean.path in paths:
                        continue
                    paths.append(bean.path)
                    if not bean.path or bean.path.startswith("http://"):
                        inet_paths.append(bean.path)
                    else:
                        local_paths.append(bean.path)

                if local_paths:
                    self.tree_menu.add_item(_('Copy To...'), Gtk.STOCK_ADD, copy_to, local_paths)
                    self.tree_menu.add_item(_("Open in file manager"), None, open_in_filemanager, local_paths[0])
                if inet_paths:
                    self.tree_menu.add_item(_('Download'), Gtk.STOCK_ADD,
                                            self.controls.dm.append_tasks, self.get_all_selected_beans())
                    self.tree_menu.add_item(_('Download To...'), Gtk.STOCK_ADD,
                                            self.controls.dm.append_tasks_with_dialog, self.get_all_selected_beans())

                self.tree_menu.add_separator()

                if local_paths:
                    self.tree_menu.add_item(_('Edit Tags'), Gtk.STOCK_EDIT, edit_tags, (self.controls, local_paths))
                    self.tree_menu.add_item(_('Format Converter'), Gtk.STOCK_CONVERT, convert_files, local_paths)
                text = self.get_selected_bean().text
                self.tree_menu.add_item(_('Copy To Search Line'), Gtk.STOCK_COPY,
                                        self.controls.searchPanel.set_search_text, text)
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_('Copy №-Title-Time'), Gtk.STOCK_COPY, self.copy_info_to_clipboard)
                self.tree_menu.add_item(_('Copy Artist-Title-Album'), Gtk.STOCK_COPY,
                                        self.copy_info_to_clipboard, True)
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_('Love This Track(s) by Last.fm'), None,
                                        self.controls.love_this_tracks, self.get_all_selected_beans())
                self.tree_menu.add_item(_('Add to My Audio (VK)'), None,
                                        self.controls.add_to_my_playlist, self.get_all_selected_beans())
                self.tree_menu.add_item(_('Copy link'), None,
                                        self.controls.copy_link, self.get_all_selected_beans())

                self.tree_menu.show(e)
Exemplo n.º 16
0
    def on_button_press(self, w, e):
        if self.header_pressed:
            self.header_pressed = False
            return
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_double_left_click(e):
            self.controls.play_selected_song()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            beans = self.get_selected_beans()
            if beans:
                self.tree_menu.clear()
                self.tree_menu.add_item(_('Play'), "media-playback-start", self.controls.play_selected_song, None)
                self.tree_menu.add_item(_('Delete from playlist'), "edit-delete", self.delete_selected, None)

                paths = []
                inet_paths = []
                local_paths = []
                for bean in beans:
                    if bean.path in paths:
                        continue
                    paths.append(bean.path)
                    if not bean.path or bean.path.startswith("http://"):
                        inet_paths.append(bean.path)
                    else:
                        local_paths.append(bean.path)

                if local_paths:
                    self.tree_menu.add_item(_('Copy To...'), "list-add", copy_to, local_paths)
                    self.tree_menu.add_item(_("Open in file manager"), None, open_in_filemanager, local_paths[0])
                if inet_paths:
                    self.tree_menu.add_item(_('Download'), "list-add",
                                            self.controls.dm.append_tasks, self.get_all_selected_beans())
                    self.tree_menu.add_item(_('Download To...'), "list-add",
                                            self.controls.dm.append_tasks_with_dialog, self.get_all_selected_beans())

                self.tree_menu.add_separator()

                if local_paths:
                    self.tree_menu.add_item(_('Edit Tags'), "accessories-text-editor", edit_tags, (self.controls, local_paths))
                    self.tree_menu.add_item(_('Format Converter'), "applications-utilities", convert_files, local_paths)
                text = self.get_selected_bean().text
                self.tree_menu.add_item(_('Copy To Search Line'), "edit-copy",
                                        self.controls.searchPanel.set_search_text, text)
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_('Copy №-Title-Time'), "edit-copy", self.copy_info_to_clipboard)
                self.tree_menu.add_item(_('Copy Artist-Title-Album'), "edit-copy",
                                        self.copy_info_to_clipboard, True)
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_('Love This Track(s) by Last.fm'), None,
                                        self.controls.love_this_tracks, self.get_all_selected_beans())
                self.tree_menu.add_item(_('Add to My Audio (VK)'), None,
                                        self.controls.add_to_my_playlist, self.get_all_selected_beans())
                self.tree_menu.add_item(_('Copy link'), None,
                                        self.controls.copy_link, self.get_all_selected_beans())

                self.tree_menu.show(e)
Exemplo n.º 17
0
 def on_button_press(self, w, e):
     if is_left_click(e):            
         self.on_func()                         
     if is_double_left_click(e):
         pass
     
     if is_rigth_click(e):
         pass
Exemplo n.º 18
0
 def on_button_press(self, w, e):
     if is_double_left_click(e):
         active = self.get_selected_bean()
         if active:
             if active.get_status() == DOWNLOAD_STATUS_ALL:
                 self.dm_list.filter_by_file(None, FTreeModel().status[0])
             else:
                 self.dm_list.filter_by_file(active.get_status(), FTreeModel().status[0])
Exemplo n.º 19
0
 def on_button_press(self, w, e):
     if is_left_click(e):            
         self.on_func()                         
     if is_double_left_click(e):
         pass
     
     if is_rigth_click(e):
         pass
Exemplo n.º 20
0
 def on_populate_click(self, w, event):
     if is_double_left_click(event):
         selection = self.tree_widget.get_selection()
         model, selected = selection.get_selected()
         
         command = self.model.get_value(selected, 0)
         keystring = self.model.get_value(selected, 1)
         self.action_text.set_text(command)
         self.hotkey_text.set_text(keystring)
Exemplo n.º 21
0
 def on_button_press(self, w, e):
     if is_double_left_click(e):
         active = self.get_selected_bean()
         if active:
             if active.get_status() == DOWNLOAD_STATUS_ALL:
                 self.dm_list.filter_by_file(None, FTreeModel().status[0])
             else:
                 self.dm_list.filter_by_file(active.get_status(),
                                             FTreeModel().status[0])
Exemplo n.º 22
0
    def on_populate_click(self, w, event):
        if is_double_left_click(event):
            selection = self.tree_widget.get_selection()
            model, selected = selection.get_selected()

            command = self.model.get_value(selected, 0)
            keystring = self.model.get_value(selected, 1)
            self.action_text.set_text(command)
            self.hotkey_text.set_text(keystring)
Exemplo n.º 23
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_double_left_click(e):
            self.controls.play_selected_song()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            beans = self.get_selected_beans()
            if beans:
                self.tree_menu.clear()
                self.tree_menu.add_item(_('Play'), Gtk.STOCK_MEDIA_PLAY, self.controls.play_selected_song, None)
                self.tree_menu.add_item(_('Delete from playlist'), Gtk.STOCK_DELETE, self.delete_selected, None)

                paths = []
                inet_paths = []
                local_paths = []
                for bean in beans:
                    if bean.path in paths:
                        continue
                    paths.append(bean.path)
                    if not bean.path or bean.path.startswith("http://"):
                        inet_paths.append(bean.path)
                    else:
                        local_paths.append(bean.path)

                if local_paths:
                    self.tree_menu.add_item(_('Copy To...'), Gtk.STOCK_ADD, copy_to, local_paths)
                    self.tree_menu.add_item(_("Open in file manager"), None, open_in_filemanager, local_paths[0])
                if inet_paths:
                    self.tree_menu.add_item(_('Download'), Gtk.STOCK_ADD,
                                            self.controls.dm.append_tasks, self.get_all_selected_beans())
                    self.tree_menu.add_item(_('Download To...'), Gtk.STOCK_ADD,
                                            self.controls.dm.append_tasks_with_dialog, self.get_all_selected_beans())

                self.tree_menu.add_separator()

                if local_paths:
                    self.tree_menu.add_item(_('Edit Tags'), Gtk.STOCK_EDIT, edit_tags, (self.controls, local_paths))
                    self.tree_menu.add_item(_('Format Converter'), Gtk.STOCK_CONVERT, convert_files, local_paths)
                text = self.get_selected_bean().text
                self.tree_menu.add_item(_('Copy To Search Line'), Gtk.STOCK_COPY,
                                        self.controls.searchPanel.set_search_text, text)
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_('Copy №-Title-Time'), Gtk.STOCK_COPY, self.copy_info_to_clipboard)
                self.tree_menu.add_item(_('Copy Artist-Title-Album'), Gtk.STOCK_COPY,
                                        self.copy_info_to_clipboard, True)
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_('Love This Track(s) by Last.fm'), None,
                                        self.controls.love_this_tracks, self.get_all_selected_beans())
                self.tree_menu.add_item(_('Add to My Audio (VK)'), None,
                                        self.controls.add_to_my_playlist, self.get_all_selected_beans())

                self.tree_menu.show(e)
Exemplo n.º 24
0
 def on_button_press(self, w, e):
     active = self.get_selected_bean()
     if active and is_rigth_click(e):
         menu = Popup()
         menu.add_item(_('Play'), gtk.STOCK_MEDIA_PLAY, self.controls.play, active)
         menu.add_item(_('Copy to Search Line'), gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, active.text)            
         menu.show(e)
      
     
     if is_double_left_click(e):
         selected = self.get_selected_bean()
         beans = self.get_all_child_beans_by_selected()  
         self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
         "run radio channel"
         self.controls.play_first_file_in_playlist()
Exemplo n.º 25
0
 def on_button_press(self, w, e):
     if is_double_left_click(e):
         
         selected = self.get_selected_bean()
         beans = self.get_all_child_beans_by_selected()         
         self.controls.append_to_new_notebook(selected.text, [selected] + beans)
         
     if is_rigth_click(e): 
             menu = Popup()
             menu.add_item(_("Add playlist"), gtk.STOCK_ADD, self.create_playlist, None)
             menu.add_item(_("Rename playlist"), gtk.STOCK_EDIT, self.rename_playlist, None)
             menu.add_item(_("Delete playlist"), gtk.STOCK_DELETE, self.delete_playlist, None)
             #menu.add_item(_("Save as"), gtk.STOCK_SAVE_AS, None, None)
             #menu.add_item(_("Open as"), gtk.STOCK_OPEN, None, None)
             menu.show(e)
Exemplo n.º 26
0
 def on_button_press(self, w, e):
     self.controls.notetabs.set_active_tree(self)
     if is_double_left_click(e):
         self.controls.play_selected_song()
     if is_rigth_click(e):
         menu = Popup()
         menu.add_item(_("Play"), gtk.STOCK_MEDIA_PLAY, self.controls.play_selected_song, None)
         menu.add_item(_("Download"), gtk.STOCK_ADD, self.controls.dm.append_tasks, self.get_all_selected_beans())
         # menu.add_item('Save as', gtk.STOCK_SAVE_AS, self.controls.save_beans_to, self.get_all_selected_beans())
         menu.add_separator()
         path = self.get_selected_bean().path
         menu.add_item(_("Edit tags"), gtk.STOCK_EDIT, edit_tags, path)
         text = self.get_selected_bean().text
         menu.add_item(_("Copy to Search Line"), gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, text)
         menu.show(e)
Exemplo n.º 27
0
 def on_button_press(self, w, e):
     if is_double_left_click(e):
         selected = self.get_selected_bean()
         beans = self.get_all_child_beans_by_selected()  
         self.controls.append_to_new_notebook(selected.text, [selected] + beans)
         "run radio channel"
         self.controls.play_first_file_in_playlist()
         
     if is_rigth_click(e): 
         menu = Popup()
         menu.add_item(_("Add Station"), gtk.STOCK_ADD, self.on_add_station, None)
         menu.add_item(_("Delete Station"), gtk.STOCK_DELETE, self.on_delete_station, None)
         menu.add_item(_("Edit Radio"), gtk.STOCK_EDIT, self.on_edit_radio, None)
         menu.add_separator()
         menu.add_item(_("Reload radio folder"), gtk.STOCK_REFRESH, self.update_radio_tree, None)            
         menu.show(e)
Exemplo n.º 28
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_middle_click(e):
            """to avoid unselect all selected items"""
            self.stop_emission('button-press-event')
        if is_left_click(e):
            # on left click expand selected folders
            return

        if is_double_left_click(e):
            # on middle click play selected beans
            self.add_to_tab()
            return

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            tabhelper = self.controls.perspectives.get_perspective('fs').get_tabhelper()
            # on right click, show pop-up menu
            self.tree_menu.clear()
            self.tree_menu.add_item(_("Append to playlist"), Gtk.STOCK_ADD, lambda: self.add_to_tab(True), None)
            self.tree_menu.add_item(_("Open in new playlist"), Gtk.STOCK_MEDIA_PLAY, self.add_to_tab, None)
            self.tree_menu.add_separator()
            self.tree_menu.add_item(_("Add folder here"), Gtk.STOCK_OPEN, self.add_folder, None)
            self.tree_menu.add_separator()

            if FC().tabs_mode == "Multi":
                self.tree_menu.add_item(_("Add folder in new tab"), Gtk.STOCK_OPEN, lambda: self.add_folder(True), None)
                self.tree_menu.add_item(_("Clear"), Gtk.STOCK_CLEAR, lambda: tabhelper.clear_tree(self.scroll), None)
            self.tree_menu.add_item(_("Update"), Gtk.STOCK_REFRESH, lambda: tabhelper.on_update_music_tree(self.scroll), None)

            f_model, f_t_paths = self.get_selection().get_selected_rows()
            if f_t_paths:
                model = f_model.get_model()
                t_paths = [f_model.convert_child_path_to_path(f_t_path) for f_t_path in f_t_paths]
                row = model[t_paths[0]]
                paths = [model[t_path][self.path[0]] for t_path in t_paths]
                row_refs = [Gtk.TreeRowReference.new(model, t_path) for t_path in t_paths]
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_("Open in file manager"), None, open_in_filemanager, self.get_selected_bean().path)
                self.tree_menu.add_item(_("Create folder"), None, self.create_folder, (model, f_t_paths[0], row))
                self.tree_menu.add_item(_("Rename file (folder)"), None, self.rename_files, (row, self.path[0], self.text[0]))
                self.tree_menu.add_item(_("Delete file(s) / folder(s)"), None, self.delete_files, (row_refs, paths, self.get_iter_from_row_reference))

            self.tree_menu.show(e)
Exemplo n.º 29
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()
        if is_middle_click(e):
            """to avoid unselect all selected items"""
            self.stop_emission('button-press-event')
        if is_left_click(e):
            # on left click expand selected folders
            return

        if is_double_left_click(e):
            # on middle click play selected beans
            self.add_to_tab()
            return

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)
            tabhelper = self.controls.perspectives.get_perspective('fs').get_tabhelper()
            # on right click, show pop-up menu
            self.tree_menu.clear()
            self.tree_menu.add_item(_("Append to playlist"), "list-add", lambda: self.add_to_tab(True), None)
            self.tree_menu.add_item(_("Open in new playlist"), "list-add", self.add_to_tab, None)
            self.tree_menu.add_separator()
            self.tree_menu.add_item(_("Add folder here"), "folder-open", self.add_folder, None)
            self.tree_menu.add_separator()

            if FC().tabs_mode == "Multi":
                self.tree_menu.add_item(_("Add folder in new tab"), "folder-open", lambda: self.add_folder(True), None)
                self.tree_menu.add_item(_("Clear"), "edit-clear", lambda: tabhelper.clear_tree(self.scroll), None)
            self.tree_menu.add_item(_("Update"), "view-refresh", lambda: tabhelper.on_update_music_tree(self.scroll), None)

            f_model, f_t_paths = self.get_selection().get_selected_rows()
            if f_t_paths:
                model = f_model.get_model()
                t_paths = [f_model.convert_child_path_to_path(f_t_path) for f_t_path in f_t_paths]
                row = model[t_paths[0]]
                paths = [model[t_path][self.path[0]] for t_path in t_paths]
                row_refs = [Gtk.TreeRowReference.new(model, t_path) for t_path in t_paths]
                self.tree_menu.add_separator()
                self.tree_menu.add_item(_("Open in file manager"), "system-file-manager", open_in_filemanager, self.get_selected_bean().path)
                self.tree_menu.add_item(_("Create folder"), "folder-new", self.create_folder, (model, f_t_paths[0], row))
                self.tree_menu.add_item(_("Rename file (folder)"), "edit-find-replace", self.rename_files, (row, self.path[0], self.text[0]))
                self.tree_menu.add_item(_("Delete file(s) / folder(s)"), "edit-delete", self.delete_files, (row_refs, paths, self.get_iter_from_row_reference))

            self.tree_menu.show(e)
Exemplo n.º 30
0
    def on_button_press(self, w, e):
        active = self.get_selected_bean()
        if active and is_rigth_click(e):
            menu = Popup()
            menu.add_item(_('Play'), gtk.STOCK_MEDIA_PLAY, self.controls.play,
                          active)
            menu.add_item(_('Copy to Search Line'), gtk.STOCK_COPY,
                          self.controls.searchPanel.set_search_text,
                          active.text)
            menu.show(e)

        if is_double_left_click(e):
            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text,
                                               [selected] + beans,
                                               optimization=True)
            "run radio channel"
            self.controls.play_first_file_in_playlist()
Exemplo n.º 31
0
    def on_button_press(self, w, e):
        if is_double_left_click(e):
            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text,
                                               [selected] + beans,
                                               optimization=True)
            "run radio channel"
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
            menu = Popup()
            menu.add_item(_("Add Station"), gtk.STOCK_ADD, self.on_add_station,
                          None)
            menu.add_item(_("Delete Station"), gtk.STOCK_DELETE,
                          self.on_delete_station, None)
            menu.add_item(_("Edit Radio"), gtk.STOCK_EDIT, self.on_edit_radio,
                          None)
            menu.add_separator()
            menu.add_item(_("Reload radio folder"), gtk.STOCK_REFRESH,
                          self.update_radio_tree, None)
            menu.show(e)
Exemplo n.º 32
0
    def on_button_press(self, w, e):
        if is_double_left_click(e):
            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text, [selected] + beans, optimization=True)
            "run radio channel"
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)

            self.tree_menu.clear()
            bean = self.get_selected_bean()
            if bean:
                if self.get_selected_bean().is_file:
                    self.tree_menu.add_item(_("Edit Station"), Gtk.STOCK_EDIT, self.on_edit_radio, None)
                    self.tree_menu.add_item(_("Delete Station"), Gtk.STOCK_DELETE, self.delete_selected, None)
                else:
                    self.tree_menu.add_item(_("Rename Group"), Gtk.STOCK_EDIT, self.on_rename_group, None)
                    self.tree_menu.add_item(_("Delete Group"), Gtk.STOCK_DELETE, self.delete_selected, None)
                self.tree_menu.add_separator()
            self.tree_menu.add_item(_("Reload radio folder"), Gtk.STOCK_REFRESH, self.update_radio_tree, None)
            self.tree_menu.show(e)
Exemplo n.º 33
0
    def on_button_press(self, w, e):
        if is_empty_click(w, e):
            w.get_selection().unselect_all()

        if is_double_left_click(e):
            selected = self.get_selected_bean()
            beans = self.get_all_child_beans_by_selected()
            self.controls.notetabs._append_tab(selected.text,
                                               [selected] + beans,
                                               optimization=True)
            "run radio channel"
            self.controls.play_first_file_in_playlist()

        if is_rigth_click(e):
            right_click_optimization_for_trees(w, e)

            self.tree_menu.clear()
            self.tree_menu.add_item(_("Add Station"), Gtk.STOCK_ADD,
                                    self.on_add_station, None)
            self.tree_menu.add_item(_("Create Group"), Gtk.STOCK_ADD,
                                    self.create_new_group, None)
            bean = self.get_selected_bean()
            if bean:
                if self.get_selected_bean().is_file:
                    self.tree_menu.add_item(_("Edit Station"), Gtk.STOCK_EDIT,
                                            self.on_edit_radio, None)
                    self.tree_menu.add_item(_("Delete Station"),
                                            Gtk.STOCK_DELETE,
                                            self.delete_selected, None)
                else:
                    self.tree_menu.add_item(_("Rename Group"), Gtk.STOCK_EDIT,
                                            self.on_rename_group, None)
                    self.tree_menu.add_item(_("Delete Group"),
                                            Gtk.STOCK_DELETE,
                                            self.delete_selected, None)
            self.tree_menu.show(e)
Exemplo n.º 34
0
    def on_button_press(self, w, e):
        self.controls.notetabs.set_active_tree(self)
        if is_double_left_click(e):
            self.controls.play_selected_song()
        if is_rigth_click(e):
            menu = Popup()
            menu.add_item(_('Play'), gtk.STOCK_MEDIA_PLAY, self.controls.play_selected_song, None)
            menu.add_item(_('Download'), gtk.STOCK_ADD, self.controls.dm.append_tasks, self.get_all_selected_beans())
            #menu.add_item('Save as', gtk.STOCK_SAVE_AS, self.controls.save_beans_to, self.get_all_selected_beans())
            menu.add_separator()
            paths = [bean.path for bean in self.get_selected_beans()]
            menu.add_item(_('Edit tags'), gtk.STOCK_EDIT, edit_tags, paths)
            text = self.get_selected_bean().text
            menu.add_item(_('Copy to Search Line'), gtk.STOCK_COPY, self.controls.searchPanel.set_search_text, text)

            
            menu.add_separator()
            menu.add_item(_('Copy №-Title-Time'), gtk.STOCK_COPY, self.copy_info_to_clipboard)
            menu.add_item(_('Copy Artist-Title-Album'), gtk.STOCK_COPY, self.copy_info_to_clipboard, True)
            
            menu.add_separator()
            menu.add_item(_('Love this track(s)'), None, self.controls.love_this_tracks, self.get_all_selected_beans())

            menu.show(e)
Exemplo n.º 35
0
    def on_button_press(self, w, e):
        if is_double_left_click(e):
            self.action_function()

        self.grab_focus()
Exemplo n.º 36
0
    def on_button_press(self, w, e):
        if is_double_left_click(e):
            self.action_function()

        self.grab_focus()