def add_packages(self, fnames): """Add packages""" notsupported = [] notcompatible = [] dist = self.distribution for fname in fnames: bname = osp.basename(fname) try: package = wppm.Package(fname) if package.is_compatible_with(dist): self.add_package(package) else: notcompatible.append(bname) except NotImplementedError: notsupported.append(bname) # PyQt4 old SIGNAL: self.emit(SIGNAL('package_added()')) self.package_added.emit() if notsupported: QMessageBox.warning( self, "Warning", "The following packages filenaming are <b>not " "recognized</b> by %s:\n\n%s" % (self.winname, "<br>".join(notsupported)), QMessageBox.Ok, ) if notcompatible: QMessageBox.warning( self, "Warning", "The following packages " "are <b>not compatible</b> with " "Python <u>%s %dbit</u>:\n\n%s" % (dist.version, dist.architecture, "<br>".join(notcompatible)), QMessageBox.Ok, )
def add_packages(self, fnames): """Add packages""" notsupported = [] notcompatible = [] dist = self.distribution for fname in fnames: bname = osp.basename(fname) try: package = wppm.Package(fname) if package.is_compatible_with(dist): self.add_package(package) else: notcompatible.append(bname) except NotImplementedError: notsupported.append(bname) self.emit(SIGNAL('package_added()')) if notsupported: QMessageBox.warning( self, "Warning", "The following packages are <b>not (yet) " "supported</b> by %s:\n\n%s" % (self.winname, "<br>".join(notsupported)), QMessageBox.Ok) if notcompatible: QMessageBox.warning( self, "Warning", "The following packages " "are <b>not compatible</b> with " "Python <u>%s %dbit</u>:\n\n%s" % (dist.version, dist.architecture, "<br>".join(notcompatible)), QMessageBox.Ok)
def select_directory(self): """Select directory""" basedir = to_text_string(self.line_edit.text()) if not osp.isdir(basedir): basedir = getcwd() while True: directory = getexistingdirectory(self, self.TITLE, basedir) if not directory: break if not utils.is_python_distribution(directory): QMessageBox.warning(self, self.TITLE, "The following directory is not a Python distribution.", QMessageBox.Ok) basedir = directory continue directory = osp.abspath(osp.normpath(directory)) self.set_distribution(directory) self.emit(SIGNAL('selected_distribution(QString)'), directory) break
def unregister_distribution(self): """Unregister distribution""" answer = QMessageBox.warning(self, "Unregister distribution", "This will remove file extensions associations, icons and " "Windows explorer's context menu entries ('Edit with IDLE', ...) " "with selected Python distribution in Windows registry. " "<br>Shortcuts for all WinPython launchers will be removed " "from <i>WinPython</i> Start menu group." "<br>If <i>pywin32</i> is installed (it should be on any " "WinPython distribution), the Python ActiveX Scripting client " "will also be unregistered." "<br><br>Do you want to continue?", QMessageBox.Yes | QMessageBox.No) if answer == QMessageBox.Yes: associate.unregister(self.distribution.target)
def register_distribution(self): """Register distribution""" answer = QMessageBox.warning(self, "Register distribution", "This will associate file extensions, icons and " "Windows explorer's context menu entries ('Edit with IDLE', ...) " "with selected Python distribution in Windows registry. " "<br>Shortcuts for all WinPython launchers will be installed " "in <i>WinPython</i> Start menu group (replacing existing " "shortcuts)." "<br>If <i>pywin32</i> is installed (it should be on any " "WinPython distribution), the Python ActiveX Scripting client " "will also be registered." "<br><br><u>Warning</u>: the only way to undo this change is to " "register another Python distribution to Windows registry." "<br><br><u>Note</u>: these actions are exactly the same as those " "performed when installing Python with the official installer " "for Windows.<br><br>Do you want to continue?", QMessageBox.Yes | QMessageBox.No) if answer == QMessageBox.Yes: associate.register(self.distribution.target)