Example #1
0
 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)
Example #2
0
 def about(self):
     """About this program"""
     QMessageBox.about(
         self, "About %s" % self.NAME, """<b>%s %s</b>
         <br>Package Manager and Advanced Tasks
         <p>Copyright &copy; 2012 Pierre Raybaut
         <br>Licensed under the terms of the MIT License
         <p>Created, developed and maintained by Pierre Raybaut
         <p>WinPython's community:
         <ul><li>Bug reports and feature requests: 
         <a href="%s">Google Code</a>
         </li><li>Discussions around the project: 
         <a href="%s">Google Group</a>
         </li></ul>
         <p>This program is executed by:<br>
         <b>%s</b><br>
         Python %s, Qt %s, %s %s""" % (
             self.NAME,
             __version__,
             __project_url__,
             __forum_url__,
             python_distribution_infos(),
             platform.python_version(),
             winpython.qt.QtCore.__version__,
             winpython.qt.API_NAME,
             winpython.qt.__version__,
         ))
Example #3
0
 def about(self):
     """About this program"""
     QMessageBox.about(
         self,
         "About %s" % self.NAME,
         """<b>%s %s</b>
         <br>Package Manager and Advanced Tasks
         <p>Copyright &copy; 2012 Pierre Raybaut
         <br>Licensed under the terms of the MIT License
         <p>Created, developed and maintained by Pierre Raybaut
         <p>WinPython's community:
         <ul><li>Bug reports and feature requests: 
         <a href="%s">Google Code</a>
         </li><li>Discussions around the project: 
         <a href="%s">Google Group</a>
         </li></ul>
         <p>This program is executed by:<br>
         <b>%s</b><br>
         Python %s, Qt %s, %s %s"""
         % (
             self.NAME,
             __version__,
             __project_url__,
             __forum_url__,
             python_distribution_infos(),
             platform.python_version(),
             winpython.qt.QtCore.__version__,
             winpython.qt.API_NAME,
             winpython.qt.__version__,
         ),
     )
Example #4
0
 def about(self):
     """About this program"""
     QMessageBox.about(
         self,
         "About %s" % self.NAME,
         """<b>%s %s</b>
         <br>Package Manager and Advanced Tasks
         <p>Copyright &copy; 2012 Pierre Raybaut
         <br>Licensed under the terms of the MIT License
         <p>Created, developed and maintained by Pierre Raybaut
         <p><a href="%s">WinPython at Github.io</a>: downloads, bug reports,
         discussions, etc.</p>
         <p>This program is executed by:<br>
         <b>%s</b><br>
         Python %s, Qt %s, %s %s"""
         % (
             self.NAME,
             __version__,
             __project_url__,
             python_distribution_infos(),
             platform.python_version(),
             winpython.qt.QtCore.__version__,
             winpython.qt.API_NAME,
             winpython.qt.__version__,
         ),
     )
Example #5
0
 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,
         )
Example #6
0
 def process_packages(self, action):
     """Install/uninstall packages"""
     if action == "install":
         text, table = "Installing", self.table
         if not self.get_packages_to_be_installed():
             return
     elif action == "uninstall":
         text, table = "Uninstalling", self.untable
     else:
         raise AssertionError
     packages = table.get_selected_packages()
     if not packages:
         return
     func = getattr(self.distribution, action)
     thread = Thread(self)
     for widget in self.children():
         if isinstance(widget, QWidget):
             widget.setEnabled(False)
     try:
         status = self.statusBar()
     except AttributeError:
         status = self.parent().statusBar()
     progress = QProgressDialog(self, Qt.FramelessWindowHint)
     progress.setMaximum(len(packages))  #  old vicious bug:len(packages)-1
     for index, package in enumerate(packages):
         progress.setValue(index)
         progress.setLabelText("%s %s %s..." % (text, package.name, package.version))
         QApplication.processEvents()
         if progress.wasCanceled():
             break
         if package in table.model.actions:
             try:
                 thread.callback = lambda: func(package)
                 thread.start()
                 while thread.isRunning():
                     QApplication.processEvents()
                     if progress.wasCanceled():
                         status.setEnabled(True)
                         status.showMessage("Cancelling operation...")
                 table.remove_package(package)
                 error = thread.error
             except Exception as error:
                 error = to_text_string(error)
             if error is not None:
                 pstr = package.name + " " + package.version
                 QMessageBox.critical(
                     self,
                     "Error",
                     "<b>Unable to %s <i>%s</i></b>" "<br><br>Error message:<br>%s" % (action, pstr, error),
                 )
     progress.setValue(progress.maximum())
     status.clearMessage()
     for widget in self.children():
         if isinstance(widget, QWidget):
             widget.setEnabled(True)
     thread = None
     for table in (self.table, self.untable):
         table.refresh_distribution(self.distribution)
Example #7
0
 def process_packages(self, action):
     """Install/uninstall packages"""
     if action == 'install':
         text, table = 'Installing', self.table
         if not self.get_packages_to_be_installed():
             return
     elif action == 'uninstall':
         text, table = 'Uninstalling', self.untable
     else:
         raise AssertionError
     packages = table.get_selected_packages()
     if not packages:
         return
     func = getattr(self.distribution, action)
     thread = Thread(self)
     for widget in self.children():
         if isinstance(widget, QWidget):
             widget.setEnabled(False)
     try:
         status = self.statusBar()
     except AttributeError:
         status = self.parent().statusBar()
     progress = QProgressDialog(self, Qt.FramelessWindowHint)
     progress.setMaximum(len(packages)) #  old vicious bug:len(packages)-1
     for index, package in enumerate(packages):
         progress.setValue(index)
         progress.setLabelText("%s %s %s..."
                               % (text, package.name, package.version))
         QApplication.processEvents()
         if progress.wasCanceled():
             break
         if package in table.model.actions:
             try:
                 thread.callback = lambda: func(package)
                 thread.start()
                 while thread.isRunning():
                     QApplication.processEvents()
                     if progress.wasCanceled():
                         status.setEnabled(True)
                         status.showMessage("Cancelling operation...")
                 table.remove_package(package)
                 error = thread.error
             except Exception as error:
                 error = to_text_string(error)
             if error is not None:
                 pstr = package.name + ' ' + package.version
                 QMessageBox.critical(self, "Error",
                                      "<b>Unable to %s <i>%s</i></b>"
                                      "<br><br>Error message:<br>%s"
                                      % (action, pstr, error))
     progress.setValue(progress.maximum())
     status.clearMessage()
     for widget in self.children():
         if isinstance(widget, QWidget):
             widget.setEnabled(True)
     thread = None
     for table in (self.table, self.untable):
         table.refresh_distribution(self.distribution)
Example #8
0
 def about(self):
     """About this program"""
     QMessageBox.about(self,
         "About %s" % self.NAME,
         """<b>%s %s</b>
         <br>Package Manager and Advanced Tasks
         <p>Copyright &copy; 2012 Pierre Raybaut
         <br>Licensed under the terms of the MIT License
         <p>Created, developed and maintained by Pierre Raybaut
         <p><a href="%s">WinPython at Github.io</a>: downloads, bug reports,
         discussions, etc.</p>
         <p>This program is executed by:<br>
         <b>%s</b><br>
         Python %s, Qt %s, %s %s"""
         % (self.NAME, __version__, __project_url__,
            python_distribution_infos(),
            platform.python_version(), winpython.qt.QtCore.__version__,
            winpython.qt.API_NAME, winpython.qt.__version__,))
Example #9
0
 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
Example #10
0
 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)
Example #11
0
 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)
Example #12
0
 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)
Example #13
0
 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)