def uninstallPackages(self, packages, cmd=""): """ Public method to uninstall the given list of packages. @param packages list of packages to uninstall (list of string) @param cmd pip command to be used (string) @return flag indicating a successful execution (boolean) """ res = False if packages: from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), self.tr("Do you really want to uninstall these packages?"), packages) if dlg.exec_() == QDialog.Accepted: if not cmd: cmd = self.__plugin.getPreferences("CurrentPipExecutable") args = ["uninstall", "--yes"] + packages dia = PipDialog(self.tr('Uninstall Packages')) res = dia.startProcess(cmd, args) if res: dia.exec_() return res
def __deleteFile(self): """ Private method to delete a form file from the project. """ itmList = self.getSelectedItems() files = [] fullNames = [] for itm in itmList: fn2 = itm.fileName() fullNames.append(fn2) fn = self.project.getRelativePath(fn2) files.append(fn) from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete forms"), self.tr( "Do you really want to delete these forms from the project?"), files) if dlg.exec_() == QDialog.Accepted: for fn2, fn in zip(fullNames, files): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn)
def _deleteDirectory(self): """ Protected method to delete the selected directory from the project data area. """ itmList = self.getSelectedItems() dirs = [] fullNames = [] for itm in itmList: dn = itm.dirName() fullNames.append(dn) dn = self.project.getRelativePath(dn) dirs.append(dn) from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( self.parent(), QCoreApplication.translate("ProjectBaseBrowser", "Delete directories"), QCoreApplication.translate( "ProjectBaseBrowser", "Do you really want to delete these directories from" " the project?"), dirs) if dlg.exec_() == QDialog.Accepted: for dn in fullNames: self.project.deleteDirectory(dn)
def __deleteFile(self): """ Private method to delete files from the project. """ itmList = self.getSelectedItems() files = [] fullNames = [] for itm in itmList: fn2 = unicode(itm.fileName()) fullNames.append(fn2) fn = self.project.getRelativePath(fn2) files.append(fn) dlg = DeleteFilesConfirmationDialog( self.parent(), self.trUtf8("Delete interfaces"), self.trUtf8("Do you really want to delete these interfaces from" " the project?"), files, ) if dlg.exec_() == QDialog.Accepted: for fn2, fn in zip(fullNames, files): self.emit(SIGNAL("closeSourceWindow"), fn2) self.project.deleteFile(fn)
def _deleteDirectory(self): """ Protected method to delete the selected directory from the project data area. """ itmList = self.getSelectedItems() dirs = [] fullNames = [] for itm in itmList: dn = itm.dirName() fullNames.append(dn) dn = self.project.getRelativePath(dn) dirs.append(dn) from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete directories"), self.tr("Do you really want to delete these directories from" " the project?"), dirs) if dlg.exec_() == QDialog.Accepted: for dn in fullNames: self.project.deleteDirectory(dn)
def uninstallPackages(self, packages, venvName): """ Public method to uninstall the given list of packages. @param packages list of packages to uninstall @type list of str @param venvName name of the virtual environment to be used @type str @return flag indicating a successful execution @rtype bool """ res = False if packages and venvName: from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), self.tr("Do you really want to uninstall these packages?"), packages) if dlg.exec_() == QDialog.Accepted: interpreter = self.getVirtualenvInterpreter(venvName) if not interpreter: return False args = ["-m", "pip", "uninstall", "--yes"] + packages dia = PipDialog(self.tr('Uninstall Packages')) res = dia.startProcess(interpreter, args) if res: dia.exec_() return res
def removeVirtualEnvs(self, venvNames): """ Public method to delete virtual environment from the list. @param venvNames list of logical names for the virtual environments @type list of str """ venvMessages = [] for venvName in venvNames: if venvName in self.__virtualEnvironments: venvMessages.append( self.tr("{0} - {1}").format( venvName, self.__virtualEnvironments[venvName]["path"])) if venvMessages: from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( None, self.tr("Remove Virtual Environments"), self.tr("""Do you really want to remove these virtual""" """ environments?"""), venvMessages) if dlg.exec_() == QDialog.Accepted: for venvName in venvNames: if venvName in self.__virtualEnvironments: del self.__virtualEnvironments[venvName] self.__saveSettings() self.virtualEnvironmentRemoved.emit() if self.__virtualenvManagerDialog: self.__virtualenvManagerDialog.refresh()
def __deleteLocalFile(self, localDevice=False): """ Private slot to delete a local file. @param localDevice flag indicating device access via local file system @type bool """ if localDevice: cwdWidget = self.deviceCwd fileTreeWidget = self.deviceFileTreeWidget else: cwdWidget = self.localCwd fileTreeWidget = self.localFileTreeWidget if bool(len(fileTreeWidget.selectedItems())): name = fileTreeWidget.selectedItems()[0].text(0) filename = os.path.join(cwdWidget.text(), name) dlg = DeleteFilesConfirmationDialog( self, self.tr("Delete File"), self.tr("Do you really want to delete this file?"), [filename]) if dlg.exec_() == QDialog.Accepted: try: os.remove(filename) self.__listLocalFiles(cwdWidget.text(), localDevice=localDevice) except (OSError, IOError) as exc: E5MessageBox.critical( self, self.tr("Delete File"), self.tr("""<p>The file <b>{0}</b> could not be""" """ deleted.</p><p>Reason: {1}</p>""").format( filename, str(exc)))
def __deleteDeviceDirectoryTree(self): """ Private slot to delete a directory and all its subdirectories recursively. """ if self.__deviceWithLocalAccess: self.__deleteLocalDirectoryTree(True) else: if bool(len(self.deviceFileTreeWidget.selectedItems())): name = self.deviceFileTreeWidget.selectedItems()[0].text(0) cwd = self.deviceCwd.text() if cwd: if cwd != "/": dirname = cwd + "/" + name[:-1] else: dirname = "/" + name[:-1] else: dirname = name[:-1] dlg = DeleteFilesConfirmationDialog( self, self.tr("Delete Directory Tree"), self.tr( "Do you really want to delete this directory tree?"), [dirname]) if dlg.exec_() == QDialog.Accepted: self.__fileManager.rmdir(dirname, recursive=True)
def __deleteFile(self): """ Private method to delete a resource file from the project. """ itmList = self.getSelectedItems() files = [] fullNames = [] for itm in itmList: fn2 = itm.fileName() fullNames.append(fn2) fn = self.project.getRelativePath(fn2) files.append(fn) from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete resources"), self.tr( "Do you really want to delete these resources from the" " project?"), files) if dlg.exec_() == QDialog.Accepted: for fn2, fn in zip(fullNames, files): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn)
def __HgForget(self): """ Private slot called by the context menu to remove the selected file from the Mercurial repository leaving a copy in the project directory. """ from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog if self.isTranslationsBrowser: items = self.browser.getSelectedItems([ProjectBrowserFileItem]) names = [itm.fileName() for itm in items] dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Remove from repository only"), self.tr("Do you really want to remove these files" " from the repository?"), names) else: items = self.browser.getSelectedItems() names = [itm.fileName() for itm in items] files = [ self.browser.project.getRelativePath(name) for name in names ] dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Remove from repository only"), self.tr("Do you really want to remove these files" " from the repository?"), files) if dlg.exec_() == QDialog.Accepted: self.vcs.hgForget(names) for fn in names: self._updateVCSStatus(fn)
def _VCSRemove(self): """ Protected slot called by the context menu to remove the selected file from the VCS repository. """ if self.isTranslationsBrowser: items = self.browser.getSelectedItems( [ProjectBrowserSimpleDirectoryItem]) if items: return # not supported isRemoveDirs = False items = self.browser.getSelectedItems([ProjectBrowserFileItem]) names = [itm.fileName() for itm in items] dlg = DeleteFilesConfirmationDialog( self.parent(), QCoreApplication.translate( "VcsProjectBrowserHelper", "Remove from repository (and disk)"), QCoreApplication.translate( "VcsProjectBrowserHelper", "Do you really want to remove these translation files from" " the repository (and disk)?"), names) else: items = self.browser.getSelectedItems() isRemoveDirs = (len(items) == self.browser.getSelectedItemsCount([ ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem ])) if isRemoveDirs: names = [itm.dirName() for itm in items] else: names = [itm.fileName() for itm in items] files = [ self.browser.project.getRelativePath(name) for name in names ] dlg = DeleteFilesConfirmationDialog( self.parent(), QCoreApplication.translate( "VcsProjectBrowserHelper", "Remove from repository (and disk)"), QCoreApplication.translate( "VcsProjectBrowserHelper", "Do you really want to remove these files/directories" " from the repository (and disk)?"), files) if dlg.exec_() == QDialog.Accepted: status = self.vcs.vcsRemove(names) if status: if isRemoveDirs: self.browser._removeDir() # remove directories from Project else: self.browser._removeFile() # remove file(s) from project
def _VCSRemove(self): """ Protected slot called by the context menu to remove the selected file from the VCS repository. """ if self.isTranslationsBrowser: items = self.browser.getSelectedItems( [ProjectBrowserSimpleDirectoryItem]) if items: return # not supported isRemoveDirs = False items = self.browser.getSelectedItems([ProjectBrowserFileItem]) names = [itm.fileName() for itm in items] dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Remove from repository (and disk)"), self.tr( "Do you really want to remove these translation files from" " the repository (and disk)?"), names) else: items = self.browser.getSelectedItems() isRemoveDirs = len(items) == \ self.browser.getSelectedItemsCount( [ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem]) if isRemoveDirs: names = [itm.dirName() for itm in items] else: names = [itm.fileName() for itm in items] files = [self.browser.project.getRelativePath(name) for name in names] dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Remove from repository (and disk)"), self.tr( "Do you really want to remove these files/directories" " from the repository (and disk)?"), files) if dlg.exec_() == QDialog.Accepted: status = self.vcs.vcsRemove(names) if status: if isRemoveDirs: self.browser._removeDir() # remove directories from Project else: self.browser._removeFile() # remove file(s) from project
def __deleteItem(self): """ Private method to delete the selected entry from the OTHERS project data area. """ itmList = self.getSelectedItems() items = [] names = [] fullNames = [] dirItems = [] dirNames = [] dirFullNames = [] for itm in itmList: if isinstance(itm, ProjectBrowserFileItem): fn2 = itm.fileName() fn = self.project.getRelativePath(fn2) items.append(itm) fullNames.append(fn2) names.append(fn) else: dn2 = itm.dirName() dn = self.project.getRelativePath(dn2) dirItems.append(itm) dirFullNames.append(dn2) dirNames.append(dn) items.extend(dirItems) fullNames.extend(dirFullNames) names.extend(dirNames) del itmList del dirFullNames del dirNames from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete files/directories"), self.tr( "Do you really want to delete these entries from the" " project?"), names) if dlg.exec_() == QDialog.Accepted: for itm, fn2, fn in zip(items[:], fullNames, names): if isinstance(itm, ProjectBrowserFileItem): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) elif isinstance(itm, ProjectBrowserDirectoryItem): self.project.deleteDirectory(fn2)
def uninstallPackages(self, packages, name="", prefix=""): """ Public method to uninstall packages of a conda environment (including all no longer needed dependencies). @param packages list of package names to be uninstalled @type list of str @param name name of the environment @type str @param prefix prefix of the environment @type str @return flag indicating success @rtype bool @exception RuntimeError raised to indicate an error in parameters Note: only one of name or prefix must be given. """ if name and prefix: raise RuntimeError("Only one of 'name' or 'prefix' must be given.") if not name and not prefix: raise RuntimeError("One of 'name' or 'prefix' must be given.") if packages: from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), self.tr("Do you really want to uninstall these packages and" " their dependencies?"), packages) if dlg.exec_() == QDialog.Accepted: args = [ "remove", "--json", "--yes", ] if condaVersion() >= (4, 4, 0): args.append("--prune", ) if name: args.extend(["--name", name]) elif prefix: args.extend(["--prefix", prefix]) args.extend(packages) dlg = CondaExecDialog("remove", self.__ui) dlg.start(args) dlg.exec_() ok, _ = dlg.getResult() else: ok = False else: ok = False return ok
def __uninstallRequirements(self): """ Private slot to uninstall packages as given in a requirements file. """ from .PipRequirementsSelectionDialog import \ PipRequirementsSelectionDialog dlg = PipRequirementsSelectionDialog(self.__plugin) if dlg.exec_() == QDialog.Accepted: command, requirements = dlg.getData() if requirements and os.path.exists(requirements): try: f = open(requirements, "r") reqs = f.read().splitlines() f.close() except (OSError, IOError): return from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), self.tr("Do you really want to uninstall these packages?"), reqs) if dlg.exec_() == QDialog.Accepted: if not command: command = self.__plugin.getPreferences( "CurrentPipExecutable") args = ["uninstall", "--requirement", requirements] dia = PipDialog( self.tr('Uninstall Packages from Requirements')) res = dia.startProcess(command, args) if res: dia.exec_()
def __deleteItem(self): """ Private method to delete the selected entry from the OTHERS project data area. """ itmList = self.getSelectedItems() items = [] names = [] fullNames = [] dirItems = [] dirNames = [] dirFullNames = [] for itm in itmList: if isinstance(itm, ProjectBrowserFileItem): fn2 = itm.fileName() fn = self.project.getRelativePath(fn2) items.append(itm) fullNames.append(fn2) names.append(fn) else: dn2 = itm.dirName() dn = self.project.getRelativePath(dn2) dirItems.append(itm) dirFullNames.append(dn2) dirNames.append(dn) items.extend(dirItems) fullNames.extend(dirFullNames) names.extend(dirNames) del itmList del dirFullNames del dirNames from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete files/directories"), self.tr("Do you really want to delete these entries from the" " project?"), names) if dlg.exec_() == QDialog.Accepted: for itm, fn2, fn in zip(items[:], fullNames, names): if isinstance(itm, ProjectBrowserFileItem): self.closeSourceWindow.emit(fn2) self.project.deleteFile(fn) elif isinstance(itm, ProjectBrowserDirectoryItem): self.project.deleteDirectory(fn2)
def __deleteLanguageFile(self): """ Private method to delete a translation file from the project. """ itmList = self.getSelectedItems() translationFiles = [unicode(itm.fileName()) for itm in itmList] dlg = DeleteFilesConfirmationDialog(self.parent(), self.trUtf8("Delete translation files"), self.trUtf8("Do you really want to delete these translation files" " from the project?"), translationFiles) if dlg.exec_() == QDialog.Accepted: for fn in translationFiles: self.emit(SIGNAL('closeSourceWindow'), fn) self.project.deleteLanguageFile(fn)
def __closeBranchHeads(self): """ Private slot to close the selected branches. """ branches = [ itm.text(3) for itm in self.tagsList.selectedItems() if itm.text(3) != "default" ] from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Close Branches"), self.tr("Do you really want to close all listed branches?"), branches) yes = dlg.exec_() == QDialog.Accepted if yes: self.vcs.getExtensionObject("closehead").hgCloseheads( self.__repoDir, branches)
def deleteVirtualEnvs(self, venvNames): """ Public method to delete virtual environments from the list and disk. @param venvNames list of logical names for the virtual environments @type list of str """ venvMessages = [] for venvName in venvNames: if (venvName in self.__virtualEnvironments and bool(self.__virtualEnvironments[venvName]["path"])): venvMessages.append( self.tr("{0} - {1}").format( venvName, self.__virtualEnvironments[venvName]["path"])) if venvMessages: from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( None, self.tr("Delete Virtual Environments"), self.tr("""Do you really want to delete these virtual""" """ environments?"""), venvMessages) if dlg.exec_() == QDialog.Accepted: for venvName in venvNames: if self.__isEnvironmentDeleteable(venvName): if self.isCondaEnvironment(venvName): conda = e5App().getObject("Conda") path = self.__virtualEnvironments[venvName]["path"] res = conda.removeCondaEnvironment(prefix=path) if res: del self.__virtualEnvironments[venvName] else: shutil.rmtree( self.__virtualEnvironments[venvName]["path"], True) del self.__virtualEnvironments[venvName] self.__saveSettings() self.virtualEnvironmentRemoved.emit() if self.__virtualenvManagerDialog: self.__virtualenvManagerDialog.refresh()
def hgPurge(self, name, deleteAll=False): """ Public method to purge files and directories not tracked by Mercurial. @param name file/directory name (string) @param deleteAll flag indicating to delete all files including ignored ones (boolean) """ # find the root of the repo repodir = self.vcs.splitPath(name)[0] while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): repodir = os.path.dirname(repodir) if os.path.splitdrive(repodir)[1] == os.sep: return if deleteAll: title = self.tr("Purge All Files") message = self.tr( """Do really want to delete all files not tracked by""" """ Mercurial (including ignored ones)?""") else: title = self.tr("Purge Files") message = self.tr( """Do really want to delete files not tracked by Mercurial?""") entries = self.__getEntries(repodir, deleteAll) from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog(None, title, message, entries) if dlg.exec_() == QDialog.Accepted: args = self.vcs.initCommand("purge") if deleteAll: args.append("--all") args.append("-v") dia = HgDialog(title, self.vcs) res = dia.startProcess(args, repodir) if res: dia.exec_()
def hgPurge(self, name, all=False): """ Public method to purge files and directories not tracked by Mercurial. @param name file/directory name (string) @param all flag indicating to delete all files including ignored ones (boolean) """ # find the root of the repo repodir = self.vcs.splitPath(name)[0] while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): repodir = os.path.dirname(repodir) if os.path.splitdrive(repodir)[1] == os.sep: return if all: title = self.tr("Purge All Files") message = self.tr( """Do really want to delete all files not tracked by""" """ Mercurial (including ignored ones)?""") else: title = self.tr("Purge Files") message = self.tr( """Do really want to delete files not tracked by Mercurial?""") entries = self.__getEntries(repodir, all) from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog dlg = DeleteFilesConfirmationDialog(None, title, message, entries) if dlg.exec_() == QDialog.Accepted: args = self.vcs.initCommand("purge") if all: args.append("--all") args.append("-v") dia = HgDialog(title, self.vcs) res = dia.startProcess(args, repodir) if res: dia.exec_()
def __deleteDeviceFile(self): """ Private slot to delete a file. """ if self.__deviceWithLocalAccess: self.__deleteLocalFile(True) else: if bool(len(self.deviceFileTreeWidget.selectedItems())): name = self.deviceFileTreeWidget.selectedItems()[0].text(0) dirname = self.deviceCwd.text() if dirname: if dirname != "/": filename = dirname + "/" + name else: filename = "/" + name else: filename = name dlg = DeleteFilesConfirmationDialog( self, self.tr("Delete File"), self.tr("Do you really want to delete this file?"), [filename]) if dlg.exec_() == QDialog.Accepted: self.__fileManager.delete(filename)
def __HgForget(self): """ Private slot called by the context menu to remove the selected file from the Mercurial repository leaving a copy in the project directory. """ from UI.DeleteFilesConfirmationDialog import \ DeleteFilesConfirmationDialog if self.isTranslationsBrowser: items = self.browser.getSelectedItems([ProjectBrowserFileItem]) names = [itm.fileName() for itm in items] dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Remove from repository only"), self.tr( "Do you really want to remove these files" " from the repository?"), names) else: items = self.browser.getSelectedItems() names = [itm.fileName() for itm in items] files = [self.browser.project.getRelativePath(name) for name in names] dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Remove from repository only"), self.tr( "Do you really want to remove these files" " from the repository?"), files) if dlg.exec_() == QDialog.Accepted: self.vcs.hgForget(names) for fn in names: self._updateVCSStatus(fn)
def hgDeleteShelves(self, name, shelveNames=None): """ Public method to delete named shelves. @param name name of the project directory (string) @param shelveNames name of shelves to delete (list of string) """ # find the root of the repo repodir = name while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): repodir = os.path.dirname(repodir) if os.path.splitdrive(repodir)[1] == os.sep: return if not shelveNames: from .HgShelvesSelectionDialog import HgShelvesSelectionDialog dlg = HgShelvesSelectionDialog( self.tr("Select the shelves to be deleted:"), self.__hgGetShelveNamesList(repodir)) if dlg.exec_() == QDialog.Accepted: shelveNames = dlg.getSelectedShelves() else: return from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog ) dlg = DeleteFilesConfirmationDialog( None, self.tr("Delete shelves"), self.tr("Do you really want to delete these shelves?"), shelveNames) if dlg.exec_() == QDialog.Accepted: args = self.vcs.initCommand("shelve") args.append("--delete") args.extend(shelveNames) dia = HgDialog(self.tr('Delete shelves'), self.vcs) res = dia.startProcess(args, repodir) if res: dia.exec_()
def uninstallRequirements(self, venvName): """ Public method to uninstall packages as given in a requirements file. @param venvName name of the virtual environment to be used @type str """ if venvName: from .PipFileSelectionDialog import PipFileSelectionDialog dlg = PipFileSelectionDialog(self, "requirements", install=False) if dlg.exec_() == QDialog.Accepted: requirements, _user = dlg.getData() if requirements and os.path.exists(requirements): try: f = open(requirements, "r") reqs = f.read().splitlines() f.close() except (OSError, IOError): return from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"), self.tr( "Do you really want to uninstall these packages?"), reqs) if dlg.exec_() == QDialog.Accepted: interpreter = self.getVirtualenvInterpreter(venvName) if not interpreter: return args = [ "-m", "pip", "uninstall", "--requirement", requirements ] dia = PipDialog( self.tr('Uninstall Packages from Requirements')) res = dia.startProcess(interpreter, args) if res: dia.exec_()