Пример #1
0
    def removeSelectedLibraries(self, list):
        """ Remove all selected libraries """
        import shutil

        from gui import questionMsgBox

        if list.getSelectedRowsCount() == 1:
            remark   = _('You will be able to recreate this library later on if you wish so.')
            question = _('Remove the selected library?')
        else:
            remark   = _('You will be able to recreate these libraries later on if you wish so.')
            question = _('Remove all selected libraries?')

        if questionMsgBox(self.cfgWindow, question, '%s %s' % (_('Your media files will not be removed.'), remark)) == gtk.RESPONSE_YES:
            for row in list.getSelectedRows():
                libName = row[0]

                if self.currLib == libName:
                    self.currLib = None

                # Remove the library from the disk
                libPath = os.path.join(ROOT_PATH, libName)
                if isdir(libPath):
                    shutil.rmtree(libPath)
                # Remove the corresponding explorer
                modules.postMsg(consts.MSG_CMD_EXPLORER_REMOVE, {'modName': MOD_L10N, 'expName': libName})
                del self.libraries[libName]
                # Remove tree states
                self.removeTreeStates(libName)
            # Clean up the listview
            list.removeSelectedRows()
Пример #2
0
    def onBtnClearCache(self, btn):
        """ Clear CDDB cache """
        text     = _('This will remove all disc information stored on your hard drive.')
        question = _('Clear CDDB cache?')

        if gui.questionMsgBox(self.cfgWin, question, text) == gtk.RESPONSE_YES:
            self.clearCache()
Пример #3
0
    def onRemoveSelectedFolder(self, list):
        """ Remove the selected media folder """
        import gui

        if list.getSelectedRowsCount() == 1:
            remark   = _('You will be able to add this root folder again later on if you wish so.')
            question = _('Remove the selected entry?')
        else:
            remark   = _('You will be able to add these root folders again later on if you wish so.')
            question = _('Remove all selected entries?')

        if gui.questionMsgBox(self.cfgWin, question, '%s %s' % (_('Your media files will not be deleted.'), remark)) == gtk.RESPONSE_YES:
            for row in self.cfgList.getSelectedRows():
                name = row[0]
                modules.postMsg(consts.MSG_CMD_EXPLORER_REMOVE, {'modName': MOD_L10N, 'expName': name})
                del self.folders[name]

                # Remove the tree, if any, from the scrolled window
                if self.currRoot == name:
                    self.currRoot = None

                # Remove the saved state of the tree, if any
                if name in self.treeState:
                    del self.treeState[name]

            self.cfgList.removeSelectedRows()
Пример #4
0
    def onRemoveSelectedFolder(self, list):
        """ Remove the selected media folder """
        import gui

        if list.getSelectedRowsCount() == 1:
            remark = _(
                'You will be able to add this root folder again later on if you wish so.'
            )
            question = _('Remove the selected entry?')
        else:
            remark = _(
                'You will be able to add these root folders again later on if you wish so.'
            )
            question = _('Remove all selected entries?')

        if gui.questionMsgBox(
                self.cfgWin, question,
                '%s %s' % (_('Your media files will not be deleted.'),
                           remark)) == gtk.RESPONSE_YES:
            for row in self.cfgList.getSelectedRows():
                name = row[0]
                modules.postMsg(consts.MSG_CMD_EXPLORER_REMOVE, {
                    'modName': MOD_L10N,
                    'expName': name
                })
                del self.folders[name]

                # Remove the tree, if any, from the scrolled window
                if self.currRoot == name:
                    self.currRoot = None

                # Remove the saved state of the tree, if any
                if name in self.treeState:
                    del self.treeState[name]

            self.cfgList.removeSelectedRows()