Пример #1
0
 def on_click_header(self, w, e):
     self.header_pressed = True
     if is_rigth_click(e):
         if "menu" in w.__dict__:
             w.menu.show(e)
         else:
             self.menu.show(e)
Пример #2
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)
Пример #3
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)
Пример #4
0
 def on_button_press(self, w, e):
     active = self.get_selected_bean()
     if 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)
Пример #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)
            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)
Пример #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)
Пример #7
0
 def on_click_header(self, w, e):
     self.header_pressed = True
     if is_rigth_click(e):
         if "menu" in w.__dict__:
             w.menu.show(e)
         else:
             self.menu.show(e)
Пример #8
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)
Пример #9
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)
Пример #10
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)
Пример #11
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)
Пример #12
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)
Пример #13
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)
Пример #14
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)
Пример #15
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()
Пример #16
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)
Пример #17
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()
Пример #18
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)
Пример #19
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)
Пример #20
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
Пример #21
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
Пример #22
0
 def on_button_press(self, w, e):
     active = self.get_selected_bean()
     if 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)
Пример #23
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()
         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)
Пример #24
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()
         self.tree_menu.clear()
         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)
Пример #25
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)
Пример #26
0
 def on_button_press(self, w, e):
     logging.debug("on dm button release")
     if is_rigth_click(e):
         menu = Popup()
         try:            
             if self.get_selected_bean():
                 menu.add_item(_("Open in file manager"), None, open_in_filemanager, self.get_selected_bean().path)
             else:
                 menu.add_item(_("Open in file manager"), None, open_in_filemanager, FC().online_save_to_folder)
         except Exception, e:
             logging.error(e)
         menu.show(e)
Пример #27
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()
         self.tree_menu.clear()
         self.tree_menu.add_item(_('Play'), Gtk.STOCK_MEDIA_PLAY,
                                 self.controls.play, active)
         self.tree_menu.add_item(_('Copy to Search Line'), Gtk.STOCK_COPY,
                                 self.controls.searchPanel.set_search_text,
                                 active.text)
         self.tree_menu.show(e)
Пример #28
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()
         self.tree_menu.clear()
         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)
Пример #29
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)
Пример #30
0
 def on_button_press(self, w, e):
     logging.debug("on dm button press")
     if is_empty_click(w, e):
         w.get_selection().unselect_all()
     if is_rigth_click(e):
         right_click_optimization_for_trees(w, e)
         try:
             self.tree_menu.clear()
             if self.get_selected_bean():
                 self.tree_menu.add_item(_("Open in file manager"), None, open_in_filemanager, self.get_selected_bean().path)
             else:
                 self.tree_menu.add_item(_("Open in file manager"), None, open_in_filemanager, FC().online_save_to_folder)
             self.tree_menu.show(e)
         except Exception, e:
             logging.error(e)
Пример #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.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)
Пример #32
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()
Пример #33
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)
Пример #34
0
 def on_button_press(self, w, e):
     logging.debug("on dm button release")
     if is_rigth_click(e):
         menu = Popup()
         try:
             if self.get_selected_bean():
                 menu.add_item(_("Open in file manager"), None,
                               open_in_filemanager,
                               self.get_selected_bean().path)
             else:
                 menu.add_item(_("Open in file manager"), None,
                               open_in_filemanager,
                               FC().online_save_to_folder)
         except Exception, e:
             logging.error(e)
         menu.show(e)
Пример #35
0
    def on_button_press(self, w, e, tab_content=None):
        """there were two problems in the handler:
        1. when you click on eventbox, appears extra the signal from the notebook
        2. when double-clicking, the first click is handled"""

        if type(w) == Gtk.EventBox:
            self.stop_handling = True

            #add delay in the background

            def start_handling():
                self.stop_handling = False

            threading.Timer(0.3, start_handling).start()

        #Get rid of the parasitic signal
        if self.stop_handling and type(w) != Gtk.EventBox:
            return

        #handling of double middle click
        if is_double_middle_click(e) and type(w) == Gtk.EventBox:
            #this variable helps to ignore first click, when double-clicking
            self.val = False
            self.on_rename_tab(tab_content)

        #handling of middle click
        elif is_middle_click(e):
            self.val = True

            def midclick():
                if self.val:
                    if type(w) == Gtk.EventBox:
                        n = self.page_num(tab_content)
                        self.remove_page(n)
                    else:
                        self.empty_tab()

            #add delay in the background
            #for check (is second click or not)
            threading.Timer(0.5, midclick).start()

        #to show context menu
        elif is_rigth_click(e):
            if type(w) == Gtk.EventBox:
                w.menu.show_all()
                w.menu.popup(None, None, None, None, e.button, e.time)
Пример #36
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)
Пример #37
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)
Пример #38
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()
Пример #39
0
    def on_button_press(self, w, e, tab_content=None):
        """there were two problems in the handler:
        1. when you click on eventbox, appears extra the signal from the notebook
        2. when double-clicking, the first click is handled"""

        if type(w) == Gtk.EventBox:
            self.stop_handling = True
            #add delay in the background

            def start_handling():
                self.stop_handling = False
            threading.Timer(0.3, start_handling).start()

        #Get rid of the parasitic signal
        if self.stop_handling and type(w) != Gtk.EventBox:
            return

        #handling of double middle click
        if is_double_middle_click(e) and type(w) == Gtk.EventBox:
            #this variable helps to ignore first click, when double-clicking
            self.val = False
            self.on_rename_tab(tab_content)

        #handling of middle click
        elif is_middle_click(e):
            self.val = True

            def midclick():
                if self.val:
                    if type(w) == Gtk.EventBox:
                        n = self.page_num(tab_content)
                        self.remove_page(n)
                    else:
                        self.empty_tab()
            #add delay in the background
            #for check (is second click or not)
            threading.Timer(0.5, midclick).start()

        #to show context menu
        elif is_rigth_click(e):
            if type(w) == Gtk.EventBox:
                w.menu.show_all()
                w.menu.popup(None, None, None, None, e.button, e.time)
Пример #40
0
 def on_button_press(self, w, e):
     logging.debug("on dm button press")
     if is_empty_click(w, e):
         w.get_selection().unselect_all()
     if is_rigth_click(e):
         right_click_optimization_for_trees(w, e)
         try:
             self.tree_menu.clear()
             if self.get_selected_bean():
                 self.tree_menu.add_item(_("Open in file manager"), None,
                                         open_in_filemanager,
                                         self.get_selected_bean().path)
             else:
                 self.tree_menu.add_item(_("Open in file manager"), None,
                                         open_in_filemanager,
                                         FC().online_save_to_folder)
             self.tree_menu.show(e)
         except Exception, e:
             logging.error(e)
Пример #41
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)
Пример #42
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)
Пример #43
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)
Пример #44
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)
Пример #45
0
 def on_click_header(self, w, e):
     if is_rigth_click(e):
         if w.__dict__.has_key("menu"):
             w.menu.show(e)
         else:
             self.menu.show(e)
Пример #46
0
 def on_click_header(self, w, e):
     if is_rigth_click(e):
         if w.__dict__.has_key("menu"):
             w.menu.show(e)
         else:
             self.menu.show(e)
Пример #47
0
 def on_button_press(self, w, e):
     if is_rigth_click(e):
         menu = Popup()
         menu.add_item('Restore Defaults', "view-refresh", None)
         menu.show(e)
Пример #48
0
 def on_button_press(self, w, e):
     if is_rigth_click(e):
         menu = Popup()
         menu.add_item('Restore Defaults', "view-refresh", None)
         menu.show(e)
Пример #49
0
 def on_button_press(self, w, e):
     if is_rigth_click(e):
         menu = Popup()
         menu.add_item('Restore Defaults', gtk.STOCK_REFRESH, None)
         menu.show(e)
Пример #50
0
 def on_button_press(self, w, e):
     if is_rigth_click(e):
         menu = Popup()
         menu.add_item('Restore Defaults', gtk.STOCK_REFRESH, None)
         menu.show(e)