Example #1
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 #2
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 #3
0
import sys
from winpython import associate, utils
from argparse import ArgumentParser

parser = ArgumentParser(description="Register Python file extensions, icons "\
                        "and Windows explorer context menu to a target "\
                        "Python distribution.")
try:
    str_type = unicode
except NameError:
    str_type = str
parser.add_argument('--target',
                    metavar='path',
                    type=str,
                    default=sys.prefix,
                    help='path to the target Python distribution')
parser.add_argument('--all', dest='all', action='store_const',
                    const=True, default=False,
                    help='register to all users, requiring administrative '\
                         'privileges (default: register to current user only)')
args = parser.parse_args()

print(args.target)
if utils.is_python_distribution(args.target):
    associate.register(args.target, current=not args.all)
else:
    raise WindowsError("Invalid Python distribution %s" % args.target)
Example #4
0
from winpython import associate, utils
from argparse import ArgumentParser

parser = ArgumentParser(
    description="Register Python file extensions, icons "
    "and Windows explorer context menu to a target "
    "Python distribution."
)
try:
    str_type = unicode
except NameError:
    str_type = str
parser.add_argument(
    "--target", metavar="path", type=str, default=sys.prefix, help="path to the target Python distribution"
)
parser.add_argument(
    "--all",
    dest="all",
    action="store_const",
    const=True,
    default=False,
    help="register to all users, requiring administrative " "privileges (default: register to current user only)",
)
args = parser.parse_args()

print(args.target)
if utils.is_python_distribution(args.target):
    associate.register(args.target, current=not args.all)
else:
    raise WindowsError("Invalid Python distribution %s" % args.target)