Exemplo n.º 1
0
 def __init__(self, *args, **kw):
     Dialog.__init__(self, *args)
     ruler = self.h - 36
     bmwidth = 152 * ruler / 328
     if kw.get("bitmap", True):
         self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin")
     self.line("BottomLine", 0, ruler, self.w, 0)
Exemplo n.º 2
0
 def __init__(self, *args, **kw):
     """Dialog(database, name, x, y, w, h, attributes, title, first,
     default, cancel, bitmap=true)"""
     Dialog.__init__(self, *args)
     ruler = self.h - 36
     bmwidth = 152 * ruler / 328
     self.line('BottomLine', 0, ruler, self.w, 0)
Exemplo n.º 3
0
 def __init__(self, *args, **kw):
     """Dialog(database, name, x, y, w, h, attributes, title, first,
     default, cancel, bitmap=true)"""
     Dialog.__init__(self, *args)
     ruler = self.h - 36
     #if kw.get("bitmap", True):
     #    self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin")
     self.line("BottomLine", 0, ruler, self.w, 0)
Exemplo n.º 4
0
 def __init__(self, *args, **kw):
     """Dialog(database, name, x, y, w, h, attributes, title, first,
     default, cancel, bitmap=true)"""
     Dialog.__init__(self, *args)
     ruler = self.h - 36
     #if kw.get("bitmap", True):
     #    self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin")
     self.line("BottomLine", 0, ruler, self.w, 0)
 def __init__(self, *args, **kw):
     """Dialog(database, name, x, y, w, h, attributes, title, first,
     default, cancel, bitmap=False)"""
     Dialog.__init__(self, *args)
     ruler = self.h - 36
     bmwidth = 152*ruler/328
     self.has_bitmap = kw.get("bitmap", False)
     if self.has_bitmap:
         self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "InstallerBitmap")
     self.line("BottomLine", 0, ruler, self.w, 0)
Exemplo n.º 6
0
    def add_ui(self):
        db = self.db
        x = y = 50
        w = 370
        h = 300
        title = "[ProductName] Setup"

        # see "Dialog Style Bits"
        modal = 3      # visible | modal
        modeless = 1   # visible
        track_disk_space = 32

        # UI customization properties
        add_data(db, "Property",
                 # See "DefaultUIFont Property"
                 [("DefaultUIFont", "DlgFont8"),
                  # See "ErrorDialog Style Bit"
                  ("ErrorDialog", "ErrorDlg"),
                  ("Progress1", "Install"),   # modified in maintenance type dlg
                  ("Progress2", "installs"),
                  ("MaintenanceForm_Action", "Repair"),
                  # possible values: ALL, JUSTME
                  ("WhichUsers", "ALL")
                 ])

        # Fonts, see "TextStyle Table"
        add_data(db, "TextStyle",
                 [("DlgFont8", "Tahoma", 9, None, 0),
                  ("DlgFontBold8", "Tahoma", 8, None, 1), #bold
                  ("VerdanaBold10", "Verdana", 10, None, 1),
                  ("VerdanaRed9", "Verdana", 9, 255, 0),
                 ])

        # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table"
        # Numbers indicate sequence; see sequence.py for how these action integrate
        add_data(db, "InstallUISequence",
                 [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140),
                  ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141),
                  # In the user interface, assume all-users installation if privileged.
                  ("SelectFeaturesDlg", "Not Installed", 1230),
                  # XXX no support for resume installations yet
                  #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240),
                  ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250),
                  ("ProgressDlg", None, 1280)])

        add_data(db, 'ActionText', text.ActionText)
        add_data(db, 'UIText', text.UIText)
        #####################################################################
        # Standard dialogs: FatalError, UserExit, ExitDialog
        fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title,
                     "Finish", "Finish", "Finish")
        fatal.title("[ProductName] Installer ended prematurely")
        fatal.back("< Back", "Finish", active = 0)
        fatal.cancel("Cancel", "Back", active = 0)
        fatal.text("Description1", 15, 70, 320, 80, 0x30003,
                   "[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.")
        fatal.text("Description2", 15, 155, 320, 20, 0x30003,
                   "Click the Finish button to exit the Installer.")
        c=fatal.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title,
                     "Finish", "Finish", "Finish")
        user_exit.title("[ProductName] Installer was interrupted")
        user_exit.back("< Back", "Finish", active = 0)
        user_exit.cancel("Cancel", "Back", active = 0)
        user_exit.text("Description1", 15, 70, 320, 80, 0x30003,
                   "[ProductName] setup was interrupted.  Your system has not been modified.  "
                   "To install this program at a later time, please run the installation again.")
        user_exit.text("Description2", 15, 155, 320, 20, 0x30003,
                   "Click the Finish button to exit the Installer.")
        c = user_exit.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title,
                             "Finish", "Finish", "Finish")
        exit_dialog.title("Completing the [ProductName] Installer")
        exit_dialog.back("< Back", "Finish", active = 0)
        exit_dialog.cancel("Cancel", "Back", active = 0)
        exit_dialog.text("Description", 15, 235, 320, 20, 0x30003,
                   "Click the Finish button to exit the Installer.")
        c = exit_dialog.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Return")

        #####################################################################
        # Required dialog: FilesInUse, ErrorDlg
        inuse = PyDialog(db, "FilesInUse",
                         x, y, w, h,
                         19,                # KeepModeless|Modal|Visible
                         title,
                         "Retry", "Retry", "Retry", bitmap=False)
        inuse.text("Title", 15, 6, 200, 15, 0x30003,
                   r"{\DlgFontBold8}Files in Use")
        inuse.text("Description", 20, 23, 280, 20, 0x30003,
               "Some files that need to be updated are currently in use.")
        inuse.text("Text", 20, 55, 330, 50, 3,
                   "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.")
        inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess",
                      None, None, None)
        c=inuse.back("Exit", "Ignore", name="Exit")
        c.event("EndDialog", "Exit")
        c=inuse.next("Ignore", "Retry", name="Ignore")
        c.event("EndDialog", "Ignore")
        c=inuse.cancel("Retry", "Exit", name="Retry")
        c.event("EndDialog","Retry")

        # See "Error Dialog". See "ICE20" for the required names of the controls.
        error = Dialog(db, "ErrorDlg",
                       50, 10, 330, 101,
                       65543,       # Error|Minimize|Modal|Visible
                       title,
                       "ErrorText", None, None)
        error.text("ErrorText", 50,9,280,48,3, "")
        #error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None)
        error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo")
        error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes")
        error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort")
        error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel")
        error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore")
        error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk")
        error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry")

        #####################################################################
        # Global "Query Cancel" dialog
        cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title,
                        "No", "No", "No")
        cancel.text("Text", 48, 15, 194, 30, 3,
                    "Are you sure you want to cancel [ProductName] installation?")
        #cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None,
        #               "py.ico", None, None)
        c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No")
        c.event("EndDialog", "Exit")

        c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes")
        c.event("EndDialog", "Return")

        #####################################################################
        # Global "Wait for costing" dialog
        costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title,
                         "Return", "Return", "Return")
        costing.text("Text", 48, 15, 194, 30, 3,
                     "Please wait while the installer finishes determining your disk space requirements.")
        c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None)
        c.event("EndDialog", "Exit")

        #####################################################################
        # Preparation dialog: no user input except cancellation
        prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title,
                        "Cancel", "Cancel", "Cancel")
        prep.text("Description", 15, 70, 320, 40, 0x30003,
                  "Please wait while the Installer prepares to guide you through the installation.")
        prep.title("Welcome to the [ProductName] Installer")
        c=prep.text("ActionText", 15, 110, 320, 20, 0x30003, "Pondering...")
        c.mapping("ActionText", "Text")
        c=prep.text("ActionData", 15, 135, 320, 30, 0x30003, None)
        c.mapping("ActionData", "Text")
        prep.back("Back", None, active=0)
        prep.next("Next", None, active=0)
        c=prep.cancel("Cancel", None)
        c.event("SpawnDialog", "CancelDlg")

        #####################################################################
        # Feature (Python directory) selection
        seldlg = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal, title,
                        "Next", "Next", "Cancel")
        seldlg.title("Select Python Installations")

        seldlg.text("Hint", 15, 30, 300, 20, 3,
                    "Select the Python locations where %s should be installed."
                    % self.distribution.get_fullname())

        seldlg.back("< Back", None, active=0)
        c = seldlg.next("Next >", "Cancel")
        order = 1
        c.event("[TARGETDIR]", "[SourceDir]", ordering=order)
        for version in self.versions + [self.other_version]:
            order += 1
            c.event("[TARGETDIR]", "[TARGETDIR%s]" % version,
                    "FEATURE_SELECTED AND &Python%s=3" % version,
                    ordering=order)
        c.event("SpawnWaitDialog", "WaitForCostingDlg", ordering=order + 1)
        c.event("EndDialog", "Return", ordering=order + 2)
        c = seldlg.cancel("Cancel", "Features")
        c.event("SpawnDialog", "CancelDlg")

        c = seldlg.control("Features", "SelectionTree", 15, 60, 300, 120, 3,
                           "FEATURE", None, "PathEdit", None)
        c.event("[FEATURE_SELECTED]", "1")
        ver = self.other_version
        install_other_cond = "FEATURE_SELECTED AND &Python%s=3" % ver
        dont_install_other_cond = "FEATURE_SELECTED AND &Python%s<>3" % ver

        c = seldlg.text("Other", 15, 200, 300, 15, 3,
                        "Provide an alternate Python location")
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)

        c = seldlg.control("PathEdit", "PathEdit", 15, 215, 300, 16, 1,
                           "TARGETDIR" + ver, None, "Next", None)
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)

        #####################################################################
        # Disk cost
        cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title,
                        "OK", "OK", "OK", bitmap=False)
        cost.text("Title", 15, 6, 200, 15, 0x30003,
                 r"{\DlgFontBold8}Disk Space Requirements")
        cost.text("Description", 20, 20, 280, 20, 0x30003,
                  "The disk space required for the installation of the selected features.")
        cost.text("Text", 20, 53, 330, 60, 3,
                  "The highlighted volumes (if any) do not have enough disk space "
              "available for the currently selected features.  You can either "
              "remove some files from the highlighted volumes, or choose to "
              "install less features onto local drive(s), or select different "
              "destination drive(s).")
        cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223,
                     None, "{120}{70}{70}{70}{70}", None, None)
        cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return")

        #####################################################################
        # WhichUsers Dialog. Only available on NT, and for privileged users.
        # This must be run before FindRelatedProducts, because that will
        # take into account whether the previous installation was per-user
        # or per-machine. We currently don't support going back to this
        # dialog after "Next" was selected; to support this, we would need to
        # find how to reset the ALLUSERS property, and how to re-run
        # FindRelatedProducts.
        # On Windows9x, the ALLUSERS property is ignored on the command line
        # and in the Property table, but installer fails according to the documentation
        # if a dialog attempts to set ALLUSERS.
        whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title,
                            "AdminInstall", "Next", "Cancel")
        whichusers.title("Select whether to install [ProductName] for all users of this computer.")
        # A radio group with two options: allusers, justme
        g = whichusers.radiogroup("AdminInstall", 15, 60, 260, 50, 3,
                                  "WhichUsers", "", "Next")
        g.add("ALL", 0, 5, 150, 20, "Install for all users")
        g.add("JUSTME", 0, 25, 150, 20, "Install just for me")

        whichusers.back("Back", None, active=0)

        c = whichusers.next("Next >", "Cancel")
        c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1)
        c.event("EndDialog", "Return", ordering = 2)

        c = whichusers.cancel("Cancel", "AdminInstall")
        c.event("SpawnDialog", "CancelDlg")

        #####################################################################
        # Installation Progress dialog (modeless)
        progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title,
                            "Cancel", "Cancel", "Cancel", bitmap=False)
        progress.text("Title", 20, 15, 200, 15, 0x30003,
                     r"{\DlgFontBold8}[Progress1] [ProductName]")
        progress.text("Text", 35, 65, 300, 30, 3,
                      "Please wait while the Installer [Progress2] [ProductName]. "
                      "This may take several minutes.")
        progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:")

        c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...")
        c.mapping("ActionText", "Text")

        #c=progress.text("ActionData", 35, 140, 300, 20, 3, None)
        #c.mapping("ActionData", "Text")

        c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537,
                           None, "Progress done", None, None)
        c.mapping("SetProgress", "Progress")

        progress.back("< Back", "Next", active=False)
        progress.next("Next >", "Cancel", active=False)
        progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg")

        ###################################################################
        # Maintenance type: repair/uninstall
        maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title,
                         "Next", "Next", "Cancel")
        maint.title("Welcome to the [ProductName] Setup Wizard")
        maint.text("BodyText", 15, 63, 330, 42, 3,
                   "Select whether you want to repair or remove [ProductName].")
        g=maint.radiogroup("RepairRadioGroup", 15, 108, 330, 60, 3,
                            "MaintenanceForm_Action", "", "Next")
        #g.add("Change", 0, 0, 200, 17, "&Change [ProductName]")
        g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]")
        g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]")

        maint.back("< Back", None, active=False)
        c=maint.next("Finish", "Cancel")
        # Change installation: Change progress dialog to "Change", then ask
        # for feature selection
        #c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1)
        #c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2)

        # Reinstall: Change progress dialog to "Repair", then invoke reinstall
        # Also set list of reinstalled features to "ALL"
        c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5)
        c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6)
        c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7)
        c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8)

        # Uninstall: Change progress to "Remove", then invoke uninstall
        # Also set list of removed features to "ALL"
        c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11)
        c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12)
        c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13)
        c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14)

        # Close dialog when maintenance action scheduled
        c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20)
        #c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21)

        maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg")
Exemplo n.º 7
0
    def add_ui(self):
        db = self.db
        x = y = 50
        w = 370
        h = 300
        title = "[ProductName] Setup"

        # see "Dialog Style Bits"
        modal = 3  # visible | modal
        modeless = 1  # visible
        track_disk_space = 32

        # UI customization properties
        add_data(
            db,
            "Property",
            # See "DefaultUIFont Property"
            [
                ("DefaultUIFont", "DlgFont8"),
                # See "ErrorDialog Style Bit"
                ("ErrorDialog", "ErrorDlg"),
                ("Progress1", "Install"),  # modified in maintenance type dlg
                ("Progress2", "installs"),
                ("MaintenanceForm_Action", "Repair"),
                # possible values: ALL, JUSTME
                ("WhichUsers", "ALL")
            ])

        # Fonts, see "TextStyle Table"
        add_data(
            db,
            "TextStyle",
            [
                ("DlgFont8", "Tahoma", 9, None, 0),
                ("DlgFontBold8", "Tahoma", 8, None, 1),  #bold
                ("VerdanaBold10", "Verdana", 10, None, 1),
                ("VerdanaRed9", "Verdana", 9, 255, 0),
            ])

        # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table"
        # Numbers indicate sequence; see sequence.py for how these action integrate
        add_data(
            db,
            "InstallUISequence",
            [
                ("PrepareDlg", "Not Privileged or Windows9x or Installed",
                 140),
                ("WhichUsersDlg",
                 "Privileged and not Windows9x and not Installed", 141),
                # In the user interface, assume all-users installation if privileged.
                ("SelectFeaturesDlg", "Not Installed", 1230),
                # XXX no support for resume installations yet
                #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240),
                ("MaintenanceTypeDlg",
                 "Installed AND NOT RESUME AND NOT Preselected", 1250),
                ("ProgressDlg", None, 1280)
            ])

        add_data(db, 'ActionText', text.ActionText)
        add_data(db, 'UIText', text.UIText)
        #####################################################################
        # Standard dialogs: FatalError, UserExit, ExitDialog
        fatal = PyDialog(db, "FatalError", x, y, w, h, modal, title, "Finish",
                         "Finish", "Finish")
        fatal.title("[ProductName] Installer ended prematurely")
        fatal.back("< Back", "Finish", active=0)
        fatal.cancel("Cancel", "Back", active=0)
        fatal.text(
            "Description1", 15, 70, 320, 80, 0x30003,
            "[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again."
        )
        fatal.text("Description2", 15, 155, 320, 20, 0x30003,
                   "Click the Finish button to exit the Installer.")
        c = fatal.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        user_exit = PyDialog(db, "UserExit", x, y, w, h, modal, title,
                             "Finish", "Finish", "Finish")
        user_exit.title("[ProductName] Installer was interrupted")
        user_exit.back("< Back", "Finish", active=0)
        user_exit.cancel("Cancel", "Back", active=0)
        user_exit.text(
            "Description1", 15, 70, 320, 80, 0x30003,
            "[ProductName] setup was interrupted.  Your system has not been modified.  "
            "To install this program at a later time, please run the installation again."
        )
        user_exit.text("Description2", 15, 155, 320, 20, 0x30003,
                       "Click the Finish button to exit the Installer.")
        c = user_exit.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title,
                               "Finish", "Finish", "Finish")
        exit_dialog.title("Completing the [ProductName] Installer")
        exit_dialog.back("< Back", "Finish", active=0)
        exit_dialog.cancel("Cancel", "Back", active=0)
        exit_dialog.text("Description", 15, 235, 320, 20, 0x30003,
                         "Click the Finish button to exit the Installer.")
        c = exit_dialog.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Return")

        #####################################################################
        # Required dialog: FilesInUse, ErrorDlg
        inuse = PyDialog(
            db,
            "FilesInUse",
            x,
            y,
            w,
            h,
            19,  # KeepModeless|Modal|Visible
            title,
            "Retry",
            "Retry",
            "Retry",
            bitmap=False)
        inuse.text("Title", 15, 6, 200, 15, 0x30003,
                   r"{\DlgFontBold8}Files in Use")
        inuse.text("Description", 20, 23, 280, 20, 0x30003,
                   "Some files that need to be updated are currently in use.")
        inuse.text(
            "Text", 20, 55, 330, 50, 3,
            "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it."
        )
        inuse.control("List", "ListBox", 20, 107, 330, 130, 7,
                      "FileInUseProcess", None, None, None)
        c = inuse.back("Exit", "Ignore", name="Exit")
        c.event("EndDialog", "Exit")
        c = inuse.next("Ignore", "Retry", name="Ignore")
        c.event("EndDialog", "Ignore")
        c = inuse.cancel("Retry", "Exit", name="Retry")
        c.event("EndDialog", "Retry")

        # See "Error Dialog". See "ICE20" for the required names of the controls.
        error = Dialog(
            db,
            "ErrorDlg",
            50,
            10,
            330,
            101,
            65543,  # Error|Minimize|Modal|Visible
            title,
            "ErrorText",
            None,
            None)
        error.text("ErrorText", 50, 9, 280, 48, 3, "")
        #error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None)
        error.pushbutton("N", 120, 72, 81, 21, 3, "No",
                         None).event("EndDialog", "ErrorNo")
        error.pushbutton("Y", 240, 72, 81, 21, 3, "Yes",
                         None).event("EndDialog", "ErrorYes")
        error.pushbutton("A", 0, 72, 81, 21, 3, "Abort",
                         None).event("EndDialog", "ErrorAbort")
        error.pushbutton("C", 42, 72, 81, 21, 3, "Cancel",
                         None).event("EndDialog", "ErrorCancel")
        error.pushbutton("I", 81, 72, 81, 21, 3, "Ignore",
                         None).event("EndDialog", "ErrorIgnore")
        error.pushbutton("O", 159, 72, 81, 21, 3, "Ok",
                         None).event("EndDialog", "ErrorOk")
        error.pushbutton("R", 198, 72, 81, 21, 3, "Retry",
                         None).event("EndDialog", "ErrorRetry")

        #####################################################################
        # Global "Query Cancel" dialog
        cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title, "No", "No",
                        "No")
        cancel.text(
            "Text", 48, 15, 194, 30, 3,
            "Are you sure you want to cancel [ProductName] installation?")
        #cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None,
        #               "py.ico", None, None)
        c = cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No")
        c.event("EndDialog", "Exit")

        c = cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes")
        c.event("EndDialog", "Return")

        #####################################################################
        # Global "Wait for costing" dialog
        costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal,
                         title, "Return", "Return", "Return")
        costing.text(
            "Text", 48, 15, 194, 30, 3,
            "Please wait while the installer finishes determining your disk space requirements."
        )
        c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None)
        c.event("EndDialog", "Exit")

        #####################################################################
        # Preparation dialog: no user input except cancellation
        prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title,
                        "Cancel", "Cancel", "Cancel")
        prep.text(
            "Description", 15, 70, 320, 40, 0x30003,
            "Please wait while the Installer prepares to guide you through the installation."
        )
        prep.title("Welcome to the [ProductName] Installer")
        c = prep.text("ActionText", 15, 110, 320, 20, 0x30003, "Pondering...")
        c.mapping("ActionText", "Text")
        c = prep.text("ActionData", 15, 135, 320, 30, 0x30003, None)
        c.mapping("ActionData", "Text")
        prep.back("Back", None, active=0)
        prep.next("Next", None, active=0)
        c = prep.cancel("Cancel", None)
        c.event("SpawnDialog", "CancelDlg")

        #####################################################################
        # Feature (Python directory) selection
        seldlg = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal, title,
                          "Next", "Next", "Cancel")
        seldlg.title("Select Python Installations")

        seldlg.text(
            "Hint", 15, 30, 300, 20, 3,
            "Select the Python locations where %s should be installed." %
            self.distribution.get_fullname())

        seldlg.back("< Back", None, active=0)
        c = seldlg.next("Next >", "Cancel")
        order = 1
        c.event("[TARGETDIR]", "[SourceDir]", ordering=order)
        for version in self.versions + [self.other_version]:
            order += 1
            c.event("[TARGETDIR]",
                    "[TARGETDIR%s]" % version,
                    "FEATURE_SELECTED AND &Python%s=3" % version,
                    ordering=order)
        c.event("SpawnWaitDialog", "WaitForCostingDlg", ordering=order + 1)
        c.event("EndDialog", "Return", ordering=order + 2)
        c = seldlg.cancel("Cancel", "Features")
        c.event("SpawnDialog", "CancelDlg")

        c = seldlg.control("Features", "SelectionTree", 15, 60, 300, 120, 3,
                           "FEATURE", None, "PathEdit", None)
        c.event("[FEATURE_SELECTED]", "1")
        ver = self.other_version
        install_other_cond = "FEATURE_SELECTED AND &Python%s=3" % ver
        dont_install_other_cond = "FEATURE_SELECTED AND &Python%s<>3" % ver

        c = seldlg.text("Other", 15, 200, 300, 15, 3,
                        "Provide an alternate Python location")
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)

        c = seldlg.control("PathEdit", "PathEdit", 15, 215, 300, 16, 1,
                           "TARGETDIR" + ver, None, "Next", None)
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)

        #####################################################################
        # Disk cost
        cost = PyDialog(db,
                        "DiskCostDlg",
                        x,
                        y,
                        w,
                        h,
                        modal,
                        title,
                        "OK",
                        "OK",
                        "OK",
                        bitmap=False)
        cost.text("Title", 15, 6, 200, 15, 0x30003,
                  r"{\DlgFontBold8}Disk Space Requirements")
        cost.text(
            "Description", 20, 20, 280, 20, 0x30003,
            "The disk space required for the installation of the selected features."
        )
        cost.text(
            "Text", 20, 53, 330, 60, 3,
            "The highlighted volumes (if any) do not have enough disk space "
            "available for the currently selected features.  You can either "
            "remove some files from the highlighted volumes, or choose to "
            "install less features onto local drive(s), or select different "
            "destination drive(s).")
        cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223,
                     None, "{120}{70}{70}{70}{70}", None, None)
        cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return")

        #####################################################################
        # WhichUsers Dialog. Only available on NT, and for privileged users.
        # This must be run before FindRelatedProducts, because that will
        # take into account whether the previous installation was per-user
        # or per-machine. We currently don't support going back to this
        # dialog after "Next" was selected; to support this, we would need to
        # find how to reset the ALLUSERS property, and how to re-run
        # FindRelatedProducts.
        # On Windows9x, the ALLUSERS property is ignored on the command line
        # and in the Property table, but installer fails according to the documentation
        # if a dialog attempts to set ALLUSERS.
        whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title,
                              "AdminInstall", "Next", "Cancel")
        whichusers.title(
            "Select whether to install [ProductName] for all users of this computer."
        )
        # A radio group with two options: allusers, justme
        g = whichusers.radiogroup("AdminInstall", 15, 60, 260, 50, 3,
                                  "WhichUsers", "", "Next")
        g.add("ALL", 0, 5, 150, 20, "Install for all users")
        g.add("JUSTME", 0, 25, 150, 20, "Install just for me")

        whichusers.back("Back", None, active=0)

        c = whichusers.next("Next >", "Cancel")
        c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1)
        c.event("EndDialog", "Return", ordering=2)

        c = whichusers.cancel("Cancel", "AdminInstall")
        c.event("SpawnDialog", "CancelDlg")

        #####################################################################
        # Installation Progress dialog (modeless)
        progress = PyDialog(db,
                            "ProgressDlg",
                            x,
                            y,
                            w,
                            h,
                            modeless,
                            title,
                            "Cancel",
                            "Cancel",
                            "Cancel",
                            bitmap=False)
        progress.text("Title", 20, 15, 200, 15, 0x30003,
                      r"{\DlgFontBold8}[Progress1] [ProductName]")
        progress.text(
            "Text", 35, 65, 300, 30, 3,
            "Please wait while the Installer [Progress2] [ProductName]. "
            "This may take several minutes.")
        progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:")

        c = progress.text("ActionText", 70, 100, w - 70, 20, 3, "Pondering...")
        c.mapping("ActionText", "Text")

        #c=progress.text("ActionData", 35, 140, 300, 20, 3, None)
        #c.mapping("ActionData", "Text")

        c = progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10,
                             65537, None, "Progress done", None, None)
        c.mapping("SetProgress", "Progress")

        progress.back("< Back", "Next", active=False)
        progress.next("Next >", "Cancel", active=False)
        progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg")

        ###################################################################
        # Maintenance type: repair/uninstall
        maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title,
                         "Next", "Next", "Cancel")
        maint.title("Welcome to the [ProductName] Setup Wizard")
        maint.text(
            "BodyText", 15, 63, 330, 42, 3,
            "Select whether you want to repair or remove [ProductName].")
        g = maint.radiogroup("RepairRadioGroup", 15, 108, 330, 60, 3,
                             "MaintenanceForm_Action", "", "Next")
        #g.add("Change", 0, 0, 200, 17, "&Change [ProductName]")
        g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]")
        g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]")

        maint.back("< Back", None, active=False)
        c = maint.next("Finish", "Cancel")
        # Change installation: Change progress dialog to "Change", then ask
        # for feature selection
        #c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1)
        #c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2)

        # Reinstall: Change progress dialog to "Repair", then invoke reinstall
        # Also set list of reinstalled features to "ALL"
        c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5)
        c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"',
                6)
        c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7)
        c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8)

        # Uninstall: Change progress to "Remove", then invoke uninstall
        # Also set list of removed features to "ALL"
        c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11)
        c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"',
                12)
        c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"',
                13)
        c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14)

        # Close dialog when maintenance action scheduled
        c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20)
        #c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21)

        maint.cancel("Cancel",
                     "RepairRadioGroup").event("SpawnDialog", "CancelDlg")
    def add_ui(self):
        db = self.db
        x = y = 50
        w = 370
        h = 300
        title = '[ProductName] Setup'
        modal = 3
        modeless = 1
        add_data(db, 'Property', [('DefaultUIFont', 'DlgFont8'),
                                  ('ErrorDialog', 'ErrorDlg'),
                                  ('Progress1', 'Install'),
                                  ('Progress2', 'installs'),
                                  ('MaintenanceForm_Action', 'Repair'),
                                  ('WhichUsers', 'ALL')])
        add_data(db, 'TextStyle', [('DlgFont8', 'Tahoma', 9, None, 0),
                                   ('DlgFontBold8', 'Tahoma', 8, None, 1),
                                   ('VerdanaBold10', 'Verdana', 10, None, 1),
                                   ('VerdanaRed9', 'Verdana', 9, 255, 0)])
        add_data(
            db, 'InstallUISequence',
            [('PrepareDlg', 'Not Privileged or Windows9x or Installed', 140),
             ('WhichUsersDlg',
              'Privileged and not Windows9x and not Installed', 141),
             ('SelectFeaturesDlg', 'Not Installed', 1230),
             ('MaintenanceTypeDlg',
              'Installed AND NOT RESUME AND NOT Preselected', 1250),
             ('ProgressDlg', None, 1280)])
        add_data(db, 'ActionText', text.ActionText)
        add_data(db, 'UIText', text.UIText)
        fatal = PyDialog(db, 'FatalError', x, y, w, h, modal, title, 'Finish',
                         'Finish', 'Finish')
        fatal.title('[ProductName] Installer ended prematurely')
        fatal.back('< Back', 'Finish', active=0)
        fatal.cancel('Cancel', 'Back', active=0)
        fatal.text(
            'Description1', 15, 70, 320, 80, 196611,
            '[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.'
        )
        fatal.text('Description2', 15, 155, 320, 20, 196611,
                   'Click the Finish button to exit the Installer.')
        c = fatal.next('Finish', 'Cancel', name='Finish')
        c.event('EndDialog', 'Exit')
        user_exit = PyDialog(db, 'UserExit', x, y, w, h, modal, title,
                             'Finish', 'Finish', 'Finish')
        user_exit.title('[ProductName] Installer was interrupted')
        user_exit.back('< Back', 'Finish', active=0)
        user_exit.cancel('Cancel', 'Back', active=0)
        user_exit.text(
            'Description1', 15, 70, 320, 80, 196611,
            '[ProductName] setup was interrupted.  Your system has not been modified.  To install this program at a later time, please run the installation again.'
        )
        user_exit.text('Description2', 15, 155, 320, 20, 196611,
                       'Click the Finish button to exit the Installer.')
        c = user_exit.next('Finish', 'Cancel', name='Finish')
        c.event('EndDialog', 'Exit')
        exit_dialog = PyDialog(db, 'ExitDialog', x, y, w, h, modal, title,
                               'Finish', 'Finish', 'Finish')
        exit_dialog.title('Completing the [ProductName] Installer')
        exit_dialog.back('< Back', 'Finish', active=0)
        exit_dialog.cancel('Cancel', 'Back', active=0)
        exit_dialog.text('Description', 15, 235, 320, 20, 196611,
                         'Click the Finish button to exit the Installer.')
        c = exit_dialog.next('Finish', 'Cancel', name='Finish')
        c.event('EndDialog', 'Return')
        inuse = PyDialog(db,
                         'FilesInUse',
                         x,
                         y,
                         w,
                         h,
                         19,
                         title,
                         'Retry',
                         'Retry',
                         'Retry',
                         bitmap=False)
        inuse.text('Title', 15, 6, 200, 15, 196611,
                   '{\\DlgFontBold8}Files in Use')
        inuse.text('Description', 20, 23, 280, 20, 196611,
                   'Some files that need to be updated are currently in use.')
        inuse.text(
            'Text', 20, 55, 330, 50, 3,
            'The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.'
        )
        inuse.control('List', 'ListBox', 20, 107, 330, 130, 7,
                      'FileInUseProcess', None, None, None)
        c = inuse.back('Exit', 'Ignore', name='Exit')
        c.event('EndDialog', 'Exit')
        c = inuse.next('Ignore', 'Retry', name='Ignore')
        c.event('EndDialog', 'Ignore')
        c = inuse.cancel('Retry', 'Exit', name='Retry')
        c.event('EndDialog', 'Retry')
        error = Dialog(db, 'ErrorDlg', 50, 10, 330, 101, 65543, title,
                       'ErrorText', None, None)
        error.text('ErrorText', 50, 9, 280, 48, 3, '')
        error.pushbutton('N', 120, 72, 81, 21, 3, 'No',
                         None).event('EndDialog', 'ErrorNo')
        error.pushbutton('Y', 240, 72, 81, 21, 3, 'Yes',
                         None).event('EndDialog', 'ErrorYes')
        error.pushbutton('A', 0, 72, 81, 21, 3, 'Abort',
                         None).event('EndDialog', 'ErrorAbort')
        error.pushbutton('C', 42, 72, 81, 21, 3, 'Cancel',
                         None).event('EndDialog', 'ErrorCancel')
        error.pushbutton('I', 81, 72, 81, 21, 3, 'Ignore',
                         None).event('EndDialog', 'ErrorIgnore')
        error.pushbutton('O', 159, 72, 81, 21, 3, 'Ok',
                         None).event('EndDialog', 'ErrorOk')
        error.pushbutton('R', 198, 72, 81, 21, 3, 'Retry',
                         None).event('EndDialog', 'ErrorRetry')
        cancel = Dialog(db, 'CancelDlg', 50, 10, 260, 85, 3, title, 'No', 'No',
                        'No')
        cancel.text(
            'Text', 48, 15, 194, 30, 3,
            'Are you sure you want to cancel [ProductName] installation?')
        c = cancel.pushbutton('Yes', 72, 57, 56, 17, 3, 'Yes', 'No')
        c.event('EndDialog', 'Exit')
        c = cancel.pushbutton('No', 132, 57, 56, 17, 3, 'No', 'Yes')
        c.event('EndDialog', 'Return')
        costing = Dialog(db, 'WaitForCostingDlg', 50, 10, 260, 85, modal,
                         title, 'Return', 'Return', 'Return')
        costing.text(
            'Text', 48, 15, 194, 30, 3,
            'Please wait while the installer finishes determining your disk space requirements.'
        )
        c = costing.pushbutton('Return', 102, 57, 56, 17, 3, 'Return', None)
        c.event('EndDialog', 'Exit')
        prep = PyDialog(db, 'PrepareDlg', x, y, w, h, modeless, title,
                        'Cancel', 'Cancel', 'Cancel')
        prep.text(
            'Description', 15, 70, 320, 40, 196611,
            'Please wait while the Installer prepares to guide you through the installation.'
        )
        prep.title('Welcome to the [ProductName] Installer')
        c = prep.text('ActionText', 15, 110, 320, 20, 196611, 'Pondering...')
        c.mapping('ActionText', 'Text')
        c = prep.text('ActionData', 15, 135, 320, 30, 196611, None)
        c.mapping('ActionData', 'Text')
        prep.back('Back', None, active=0)
        prep.next('Next', None, active=0)
        c = prep.cancel('Cancel', None)
        c.event('SpawnDialog', 'CancelDlg')
        seldlg = PyDialog(db, 'SelectFeaturesDlg', x, y, w, h, modal, title,
                          'Next', 'Next', 'Cancel')
        seldlg.title('Select Python Installations')
        seldlg.text(
            'Hint', 15, 30, 300, 20, 3,
            'Select the Python locations where %s should be installed.' %
            self.distribution.get_fullname())
        seldlg.back('< Back', None, active=0)
        c = seldlg.next('Next >', 'Cancel')
        order = 1
        c.event('[TARGETDIR]', '[SourceDir]', ordering=order)
        for version in self.versions + [self.other_version]:
            order += 1
            c.event('[TARGETDIR]',
                    '[TARGETDIR%s]' % version,
                    'FEATURE_SELECTED AND &Python%s=3' % version,
                    ordering=order)

        c.event('SpawnWaitDialog', 'WaitForCostingDlg', ordering=order + 1)
        c.event('EndDialog', 'Return', ordering=order + 2)
        c = seldlg.cancel('Cancel', 'Features')
        c.event('SpawnDialog', 'CancelDlg')
        c = seldlg.control('Features', 'SelectionTree', 15, 60, 300, 120, 3,
                           'FEATURE', None, 'PathEdit', None)
        c.event('[FEATURE_SELECTED]', '1')
        ver = self.other_version
        install_other_cond = 'FEATURE_SELECTED AND &Python%s=3' % ver
        dont_install_other_cond = 'FEATURE_SELECTED AND &Python%s<>3' % ver
        c = seldlg.text('Other', 15, 200, 300, 15, 3,
                        'Provide an alternate Python location')
        c.condition('Enable', install_other_cond)
        c.condition('Show', install_other_cond)
        c.condition('Disable', dont_install_other_cond)
        c.condition('Hide', dont_install_other_cond)
        c = seldlg.control('PathEdit', 'PathEdit', 15, 215, 300, 16, 1,
                           'TARGETDIR' + ver, None, 'Next', None)
        c.condition('Enable', install_other_cond)
        c.condition('Show', install_other_cond)
        c.condition('Disable', dont_install_other_cond)
        c.condition('Hide', dont_install_other_cond)
        cost = PyDialog(db,
                        'DiskCostDlg',
                        x,
                        y,
                        w,
                        h,
                        modal,
                        title,
                        'OK',
                        'OK',
                        'OK',
                        bitmap=False)
        cost.text('Title', 15, 6, 200, 15, 196611,
                  '{\\DlgFontBold8}Disk Space Requirements')
        cost.text(
            'Description', 20, 20, 280, 20, 196611,
            'The disk space required for the installation of the selected features.'
        )
        cost.text(
            'Text', 20, 53, 330, 60, 3,
            'The highlighted volumes (if any) do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).'
        )
        cost.control('VolumeList', 'VolumeCostList', 20, 100, 330, 150, 393223,
                     None, '{120}{70}{70}{70}{70}', None, None)
        cost.xbutton('OK', 'Ok', None, 0.5).event('EndDialog', 'Return')
        whichusers = PyDialog(db, 'WhichUsersDlg', x, y, w, h, modal, title,
                              'AdminInstall', 'Next', 'Cancel')
        whichusers.title(
            'Select whether to install [ProductName] for all users of this computer.'
        )
        g = whichusers.radiogroup('AdminInstall', 15, 60, 260, 50, 3,
                                  'WhichUsers', '', 'Next')
        g.add('ALL', 0, 5, 150, 20, 'Install for all users')
        g.add('JUSTME', 0, 25, 150, 20, 'Install just for me')
        whichusers.back('Back', None, active=0)
        c = whichusers.next('Next >', 'Cancel')
        c.event('[ALLUSERS]', '1', 'WhichUsers="ALL"', 1)
        c.event('EndDialog', 'Return', ordering=2)
        c = whichusers.cancel('Cancel', 'AdminInstall')
        c.event('SpawnDialog', 'CancelDlg')
        progress = PyDialog(db,
                            'ProgressDlg',
                            x,
                            y,
                            w,
                            h,
                            modeless,
                            title,
                            'Cancel',
                            'Cancel',
                            'Cancel',
                            bitmap=False)
        progress.text('Title', 20, 15, 200, 15, 196611,
                      '{\\DlgFontBold8}[Progress1] [ProductName]')
        progress.text(
            'Text', 35, 65, 300, 30, 3,
            'Please wait while the Installer [Progress2] [ProductName]. This may take several minutes.'
        )
        progress.text('StatusLabel', 35, 100, 35, 20, 3, 'Status:')
        c = progress.text('ActionText', 70, 100, w - 70, 20, 3, 'Pondering...')
        c.mapping('ActionText', 'Text')
        c = progress.control('ProgressBar', 'ProgressBar', 35, 120, 300, 10,
                             65537, None, 'Progress done', None, None)
        c.mapping('SetProgress', 'Progress')
        progress.back('< Back', 'Next', active=False)
        progress.next('Next >', 'Cancel', active=False)
        progress.cancel('Cancel', 'Back').event('SpawnDialog', 'CancelDlg')
        maint = PyDialog(db, 'MaintenanceTypeDlg', x, y, w, h, modal, title,
                         'Next', 'Next', 'Cancel')
        maint.title('Welcome to the [ProductName] Setup Wizard')
        maint.text(
            'BodyText', 15, 63, 330, 42, 3,
            'Select whether you want to repair or remove [ProductName].')
        g = maint.radiogroup('RepairRadioGroup', 15, 108, 330, 60, 3,
                             'MaintenanceForm_Action', '', 'Next')
        g.add('Repair', 0, 18, 200, 17, '&Repair [ProductName]')
        g.add('Remove', 0, 36, 200, 17, 'Re&move [ProductName]')
        maint.back('< Back', None, active=False)
        c = maint.next('Finish', 'Cancel')
        c.event('[REINSTALL]', 'ALL', 'MaintenanceForm_Action="Repair"', 5)
        c.event('[Progress1]', 'Repairing', 'MaintenanceForm_Action="Repair"',
                6)
        c.event('[Progress2]', 'repairs', 'MaintenanceForm_Action="Repair"', 7)
        c.event('Reinstall', 'ALL', 'MaintenanceForm_Action="Repair"', 8)
        c.event('[REMOVE]', 'ALL', 'MaintenanceForm_Action="Remove"', 11)
        c.event('[Progress1]', 'Removing', 'MaintenanceForm_Action="Remove"',
                12)
        c.event('[Progress2]', 'removes', 'MaintenanceForm_Action="Remove"',
                13)
        c.event('Remove', 'ALL', 'MaintenanceForm_Action="Remove"', 14)
        c.event('EndDialog', 'Return', 'MaintenanceForm_Action<>"Change"', 20)
        maint.cancel('Cancel',
                     'RepairRadioGroup').event('SpawnDialog', 'CancelDlg')
        return
 def __init__(self, *args, **kw):
     Dialog.__init__(self, *args)
     ruler = self.h - 36
     self.line('BottomLine', 0, ruler, self.w, 0)
Exemplo n.º 10
0
    def add_ui(self):
        db = self.db
        x = y = 50
        w = 370
        h = 300
        title = "[ProductName] Setup"
        modal = 3
        modeless = 1
        add_data(
            db,
            "Property",
            [
                ("DefaultUIFont", "DlgFont8"),
                ("ErrorDialog", "ErrorDlg"),
                ("Progress1", "Install"),
                ("Progress2", "installs"),
                ("MaintenanceForm_Action", "Repair"),
                ("WhichUsers", "ALL"),
            ],
        )
        add_data(
            db,
            "TextStyle",
            [
                ("DlgFont8", "Tahoma", 9, None, 0),
                ("DlgFontBold8", "Tahoma", 8, None, 1),
                ("VerdanaBold10", "Verdana", 10, None, 1),
                ("VerdanaRed9", "Verdana", 9, 255, 0),
            ],
        )
        add_data(
            db,
            "InstallUISequence",
            [
                ("PrepareDlg", "Not Privileged or Windows9x or Installed", 140),
                ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141),
                ("SelectFeaturesDlg", "Not Installed", 1230),
                ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250),
                ("ProgressDlg", None, 1280),
            ],
        )
        add_data(db, "ActionText", text.ActionText)
        add_data(db, "UIText", text.UIText)
        fatal = PyDialog(db, "FatalError", x, y, w, h, modal, title, "Finish", "Finish", "Finish")
        fatal.title("[ProductName] Installer ended prematurely")
        fatal.back("< Back", "Finish", active=0)
        fatal.cancel("Cancel", "Back", active=0)
        fatal.text(
            "Description1",
            15,
            70,
            320,
            80,
            196611,
            "[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.",
        )
        fatal.text("Description2", 15, 155, 320, 20, 196611, "Click the Finish button to exit the Installer.")
        c = fatal.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")
        user_exit = PyDialog(db, "UserExit", x, y, w, h, modal, title, "Finish", "Finish", "Finish")
        user_exit.title("[ProductName] Installer was interrupted")
        user_exit.back("< Back", "Finish", active=0)
        user_exit.cancel("Cancel", "Back", active=0)
        user_exit.text(
            "Description1",
            15,
            70,
            320,
            80,
            196611,
            "[ProductName] setup was interrupted.  Your system has not been modified.  To install this program at a later time, please run the installation again.",
        )
        user_exit.text("Description2", 15, 155, 320, 20, 196611, "Click the Finish button to exit the Installer.")
        c = user_exit.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")
        exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title, "Finish", "Finish", "Finish")
        exit_dialog.title("Completing the [ProductName] Installer")
        exit_dialog.back("< Back", "Finish", active=0)
        exit_dialog.cancel("Cancel", "Back", active=0)
        exit_dialog.text("Description", 15, 235, 320, 20, 196611, "Click the Finish button to exit the Installer.")
        c = exit_dialog.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Return")
        inuse = PyDialog(db, "FilesInUse", x, y, w, h, 19, title, "Retry", "Retry", "Retry", bitmap=False)
        inuse.text("Title", 15, 6, 200, 15, 196611, "{\\DlgFontBold8}Files in Use")
        inuse.text("Description", 20, 23, 280, 20, 196611, "Some files that need to be updated are currently in use.")
        inuse.text(
            "Text",
            20,
            55,
            330,
            50,
            3,
            "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.",
        )
        inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess", None, None, None)
        c = inuse.back("Exit", "Ignore", name="Exit")
        c.event("EndDialog", "Exit")
        c = inuse.next("Ignore", "Retry", name="Ignore")
        c.event("EndDialog", "Ignore")
        c = inuse.cancel("Retry", "Exit", name="Retry")
        c.event("EndDialog", "Retry")
        error = Dialog(db, "ErrorDlg", 50, 10, 330, 101, 65543, title, "ErrorText", None, None)
        error.text("ErrorText", 50, 9, 280, 48, 3, "")
        error.pushbutton("N", 120, 72, 81, 21, 3, "No", None).event("EndDialog", "ErrorNo")
        error.pushbutton("Y", 240, 72, 81, 21, 3, "Yes", None).event("EndDialog", "ErrorYes")
        error.pushbutton("A", 0, 72, 81, 21, 3, "Abort", None).event("EndDialog", "ErrorAbort")
        error.pushbutton("C", 42, 72, 81, 21, 3, "Cancel", None).event("EndDialog", "ErrorCancel")
        error.pushbutton("I", 81, 72, 81, 21, 3, "Ignore", None).event("EndDialog", "ErrorIgnore")
        error.pushbutton("O", 159, 72, 81, 21, 3, "Ok", None).event("EndDialog", "ErrorOk")
        error.pushbutton("R", 198, 72, 81, 21, 3, "Retry", None).event("EndDialog", "ErrorRetry")
        cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title, "No", "No", "No")
        cancel.text("Text", 48, 15, 194, 30, 3, "Are you sure you want to cancel [ProductName] installation?")
        c = cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No")
        c.event("EndDialog", "Exit")
        c = cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes")
        c.event("EndDialog", "Return")
        costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title, "Return", "Return", "Return")
        costing.text(
            "Text",
            48,
            15,
            194,
            30,
            3,
            "Please wait while the installer finishes determining your disk space requirements.",
        )
        c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None)
        c.event("EndDialog", "Exit")
        prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel")
        prep.text(
            "Description",
            15,
            70,
            320,
            40,
            196611,
            "Please wait while the Installer prepares to guide you through the installation.",
        )
        prep.title("Welcome to the [ProductName] Installer")
        c = prep.text("ActionText", 15, 110, 320, 20, 196611, "Pondering...")
        c.mapping("ActionText", "Text")
        c = prep.text("ActionData", 15, 135, 320, 30, 196611, None)
        c.mapping("ActionData", "Text")
        prep.back("Back", None, active=0)
        prep.next("Next", None, active=0)
        c = prep.cancel("Cancel", None)
        c.event("SpawnDialog", "CancelDlg")
        seldlg = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel")
        seldlg.title("Select Python Installations")
        seldlg.text(
            "Hint",
            15,
            30,
            300,
            20,
            3,
            "Select the Python locations where %s should be installed." % self.distribution.get_fullname(),
        )
        seldlg.back("< Back", None, active=0)
        c = seldlg.next("Next >", "Cancel")
        order = 1
        c.event("[TARGETDIR]", "[SourceDir]", ordering=order)
        for version in self.versions + [self.other_version]:
            order += 1
            c.event(
                "[TARGETDIR]", "[TARGETDIR%s]" % version, "FEATURE_SELECTED AND &Python%s=3" % version, ordering=order
            )

        c.event("SpawnWaitDialog", "WaitForCostingDlg", ordering=order + 1)
        c.event("EndDialog", "Return", ordering=order + 2)
        c = seldlg.cancel("Cancel", "Features")
        c.event("SpawnDialog", "CancelDlg")
        c = seldlg.control("Features", "SelectionTree", 15, 60, 300, 120, 3, "FEATURE", None, "PathEdit", None)
        c.event("[FEATURE_SELECTED]", "1")
        ver = self.other_version
        install_other_cond = "FEATURE_SELECTED AND &Python%s=3" % ver
        dont_install_other_cond = "FEATURE_SELECTED AND &Python%s<>3" % ver
        c = seldlg.text("Other", 15, 200, 300, 15, 3, "Provide an alternate Python location")
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)
        c = seldlg.control("PathEdit", "PathEdit", 15, 215, 300, 16, 1, "TARGETDIR" + ver, None, "Next", None)
        c.condition("Enable", install_other_cond)
        c.condition("Show", install_other_cond)
        c.condition("Disable", dont_install_other_cond)
        c.condition("Hide", dont_install_other_cond)
        cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title, "OK", "OK", "OK", bitmap=False)
        cost.text("Title", 15, 6, 200, 15, 196611, "{\\DlgFontBold8}Disk Space Requirements")
        cost.text(
            "Description",
            20,
            20,
            280,
            20,
            196611,
            "The disk space required for the installation of the selected features.",
        )
        cost.text(
            "Text",
            20,
            53,
            330,
            60,
            3,
            "The highlighted volumes (if any) do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).",
        )
        cost.control(
            "VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223, None, "{120}{70}{70}{70}{70}", None, None
        )
        cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return")
        whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title, "AdminInstall", "Next", "Cancel")
        whichusers.title("Select whether to install [ProductName] for all users of this computer.")
        g = whichusers.radiogroup("AdminInstall", 15, 60, 260, 50, 3, "WhichUsers", "", "Next")
        g.add("ALL", 0, 5, 150, 20, "Install for all users")
        g.add("JUSTME", 0, 25, 150, 20, "Install just for me")
        whichusers.back("Back", None, active=0)
        c = whichusers.next("Next >", "Cancel")
        c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1)
        c.event("EndDialog", "Return", ordering=2)
        c = whichusers.cancel("Cancel", "AdminInstall")
        c.event("SpawnDialog", "CancelDlg")
        progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel", bitmap=False)
        progress.text("Title", 20, 15, 200, 15, 196611, "{\\DlgFontBold8}[Progress1] [ProductName]")
        progress.text(
            "Text",
            35,
            65,
            300,
            30,
            3,
            "Please wait while the Installer [Progress2] [ProductName]. This may take several minutes.",
        )
        progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:")
        c = progress.text("ActionText", 70, 100, w - 70, 20, 3, "Pondering...")
        c.mapping("ActionText", "Text")
        c = progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537, None, "Progress done", None, None)
        c.mapping("SetProgress", "Progress")
        progress.back("< Back", "Next", active=False)
        progress.next("Next >", "Cancel", active=False)
        progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg")
        maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel")
        maint.title("Welcome to the [ProductName] Setup Wizard")
        maint.text("BodyText", 15, 63, 330, 42, 3, "Select whether you want to repair or remove [ProductName].")
        g = maint.radiogroup("RepairRadioGroup", 15, 108, 330, 60, 3, "MaintenanceForm_Action", "", "Next")
        g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]")
        g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]")
        maint.back("< Back", None, active=False)
        c = maint.next("Finish", "Cancel")
        c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5)
        c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6)
        c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7)
        c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8)
        c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11)
        c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12)
        c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13)
        c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14)
        c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20)
        maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg")
        return
Exemplo n.º 11
0
 def __init__(self, *args, **kw):
     """Dialog(database, name, x, y, w, h, attributes, title, first,
     default, cancel, bitmap=true)"""
     Dialog.__init__(self, *args)
     ruler = self.h - 36
     self.line("BottomLine", 0, ruler, self.w, 0)
Exemplo n.º 12
0
    def add_ui(self):
        db = self.db
        x = y = 50
        w = 370
        h = 300
        title = '[ProductName] Setup'
        modal = 3
        modeless = 1
        add_data(db, 'Property', [('DefaultUIFont', 'DlgFont8'),
         ('ErrorDialog', 'ErrorDlg'),
         ('Progress1', 'Install'),
         ('Progress2', 'installs'),
         ('MaintenanceForm_Action', 'Repair'),
         ('WhichUsers', 'ALL')])
        add_data(db, 'TextStyle', [('DlgFont8', 'Tahoma', 9, None, 0),
         ('DlgFontBold8', 'Tahoma', 8, None, 1),
         ('VerdanaBold10', 'Verdana', 10, None, 1),
         ('VerdanaRed9', 'Verdana', 9, 255, 0)])
        add_data(db, 'InstallUISequence', [('PrepareDlg', 'Not Privileged or Windows9x or Installed', 140),
         ('WhichUsersDlg', 'Privileged and not Windows9x and not Installed', 141),
         ('SelectFeaturesDlg', 'Not Installed', 1230),
         ('MaintenanceTypeDlg', 'Installed AND NOT RESUME AND NOT Preselected', 1250),
         ('ProgressDlg', None, 1280)])
        add_data(db, 'ActionText', text.ActionText)
        add_data(db, 'UIText', text.UIText)
        fatal = PyDialog(db, 'FatalError', x, y, w, h, modal, title, 'Finish', 'Finish', 'Finish')
        fatal.title('[ProductName] Installer ended prematurely')
        fatal.back('< Back', 'Finish', active=0)
        fatal.cancel('Cancel', 'Back', active=0)
        fatal.text('Description1', 15, 70, 320, 80, 196611, '[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again.')
        fatal.text('Description2', 15, 155, 320, 20, 196611, 'Click the Finish button to exit the Installer.')
        c = fatal.next('Finish', 'Cancel', name='Finish')
        c.event('EndDialog', 'Exit')
        user_exit = PyDialog(db, 'UserExit', x, y, w, h, modal, title, 'Finish', 'Finish', 'Finish')
        user_exit.title('[ProductName] Installer was interrupted')
        user_exit.back('< Back', 'Finish', active=0)
        user_exit.cancel('Cancel', 'Back', active=0)
        user_exit.text('Description1', 15, 70, 320, 80, 196611, '[ProductName] setup was interrupted.  Your system has not been modified.  To install this program at a later time, please run the installation again.')
        user_exit.text('Description2', 15, 155, 320, 20, 196611, 'Click the Finish button to exit the Installer.')
        c = user_exit.next('Finish', 'Cancel', name='Finish')
        c.event('EndDialog', 'Exit')
        exit_dialog = PyDialog(db, 'ExitDialog', x, y, w, h, modal, title, 'Finish', 'Finish', 'Finish')
        exit_dialog.title('Completing the [ProductName] Installer')
        exit_dialog.back('< Back', 'Finish', active=0)
        exit_dialog.cancel('Cancel', 'Back', active=0)
        exit_dialog.text('Description', 15, 235, 320, 20, 196611, 'Click the Finish button to exit the Installer.')
        c = exit_dialog.next('Finish', 'Cancel', name='Finish')
        c.event('EndDialog', 'Return')
        inuse = PyDialog(db, 'FilesInUse', x, y, w, h, 19, title, 'Retry', 'Retry', 'Retry', bitmap=False)
        inuse.text('Title', 15, 6, 200, 15, 196611, '{\\DlgFontBold8}Files in Use')
        inuse.text('Description', 20, 23, 280, 20, 196611, 'Some files that need to be updated are currently in use.')
        inuse.text('Text', 20, 55, 330, 50, 3, 'The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.')
        inuse.control('List', 'ListBox', 20, 107, 330, 130, 7, 'FileInUseProcess', None, None, None)
        c = inuse.back('Exit', 'Ignore', name='Exit')
        c.event('EndDialog', 'Exit')
        c = inuse.next('Ignore', 'Retry', name='Ignore')
        c.event('EndDialog', 'Ignore')
        c = inuse.cancel('Retry', 'Exit', name='Retry')
        c.event('EndDialog', 'Retry')
        error = Dialog(db, 'ErrorDlg', 50, 10, 330, 101, 65543, title, 'ErrorText', None, None)
        error.text('ErrorText', 50, 9, 280, 48, 3, '')
        error.pushbutton('N', 120, 72, 81, 21, 3, 'No', None).event('EndDialog', 'ErrorNo')
        error.pushbutton('Y', 240, 72, 81, 21, 3, 'Yes', None).event('EndDialog', 'ErrorYes')
        error.pushbutton('A', 0, 72, 81, 21, 3, 'Abort', None).event('EndDialog', 'ErrorAbort')
        error.pushbutton('C', 42, 72, 81, 21, 3, 'Cancel', None).event('EndDialog', 'ErrorCancel')
        error.pushbutton('I', 81, 72, 81, 21, 3, 'Ignore', None).event('EndDialog', 'ErrorIgnore')
        error.pushbutton('O', 159, 72, 81, 21, 3, 'Ok', None).event('EndDialog', 'ErrorOk')
        error.pushbutton('R', 198, 72, 81, 21, 3, 'Retry', None).event('EndDialog', 'ErrorRetry')
        cancel = Dialog(db, 'CancelDlg', 50, 10, 260, 85, 3, title, 'No', 'No', 'No')
        cancel.text('Text', 48, 15, 194, 30, 3, 'Are you sure you want to cancel [ProductName] installation?')
        c = cancel.pushbutton('Yes', 72, 57, 56, 17, 3, 'Yes', 'No')
        c.event('EndDialog', 'Exit')
        c = cancel.pushbutton('No', 132, 57, 56, 17, 3, 'No', 'Yes')
        c.event('EndDialog', 'Return')
        costing = Dialog(db, 'WaitForCostingDlg', 50, 10, 260, 85, modal, title, 'Return', 'Return', 'Return')
        costing.text('Text', 48, 15, 194, 30, 3, 'Please wait while the installer finishes determining your disk space requirements.')
        c = costing.pushbutton('Return', 102, 57, 56, 17, 3, 'Return', None)
        c.event('EndDialog', 'Exit')
        prep = PyDialog(db, 'PrepareDlg', x, y, w, h, modeless, title, 'Cancel', 'Cancel', 'Cancel')
        prep.text('Description', 15, 70, 320, 40, 196611, 'Please wait while the Installer prepares to guide you through the installation.')
        prep.title('Welcome to the [ProductName] Installer')
        c = prep.text('ActionText', 15, 110, 320, 20, 196611, 'Pondering...')
        c.mapping('ActionText', 'Text')
        c = prep.text('ActionData', 15, 135, 320, 30, 196611, None)
        c.mapping('ActionData', 'Text')
        prep.back('Back', None, active=0)
        prep.next('Next', None, active=0)
        c = prep.cancel('Cancel', None)
        c.event('SpawnDialog', 'CancelDlg')
        seldlg = PyDialog(db, 'SelectFeaturesDlg', x, y, w, h, modal, title, 'Next', 'Next', 'Cancel')
        seldlg.title('Select Python Installations')
        seldlg.text('Hint', 15, 30, 300, 20, 3, 'Select the Python locations where %s should be installed.' % self.distribution.get_fullname())
        seldlg.back('< Back', None, active=0)
        c = seldlg.next('Next >', 'Cancel')
        order = 1
        c.event('[TARGETDIR]', '[SourceDir]', ordering=order)
        for version in self.versions + [self.other_version]:
            order += 1
            c.event('[TARGETDIR]', '[TARGETDIR%s]' % version, 'FEATURE_SELECTED AND &Python%s=3' % version, ordering=order)

        c.event('SpawnWaitDialog', 'WaitForCostingDlg', ordering=order + 1)
        c.event('EndDialog', 'Return', ordering=order + 2)
        c = seldlg.cancel('Cancel', 'Features')
        c.event('SpawnDialog', 'CancelDlg')
        c = seldlg.control('Features', 'SelectionTree', 15, 60, 300, 120, 3, 'FEATURE', None, 'PathEdit', None)
        c.event('[FEATURE_SELECTED]', '1')
        ver = self.other_version
        install_other_cond = 'FEATURE_SELECTED AND &Python%s=3' % ver
        dont_install_other_cond = 'FEATURE_SELECTED AND &Python%s<>3' % ver
        c = seldlg.text('Other', 15, 200, 300, 15, 3, 'Provide an alternate Python location')
        c.condition('Enable', install_other_cond)
        c.condition('Show', install_other_cond)
        c.condition('Disable', dont_install_other_cond)
        c.condition('Hide', dont_install_other_cond)
        c = seldlg.control('PathEdit', 'PathEdit', 15, 215, 300, 16, 1, 'TARGETDIR' + ver, None, 'Next', None)
        c.condition('Enable', install_other_cond)
        c.condition('Show', install_other_cond)
        c.condition('Disable', dont_install_other_cond)
        c.condition('Hide', dont_install_other_cond)
        cost = PyDialog(db, 'DiskCostDlg', x, y, w, h, modal, title, 'OK', 'OK', 'OK', bitmap=False)
        cost.text('Title', 15, 6, 200, 15, 196611, '{\\DlgFontBold8}Disk Space Requirements')
        cost.text('Description', 20, 20, 280, 20, 196611, 'The disk space required for the installation of the selected features.')
        cost.text('Text', 20, 53, 330, 60, 3, 'The highlighted volumes (if any) do not have enough disk space available for the currently selected features.  You can either remove some files from the highlighted volumes, or choose to install less features onto local drive(s), or select different destination drive(s).')
        cost.control('VolumeList', 'VolumeCostList', 20, 100, 330, 150, 393223, None, '{120}{70}{70}{70}{70}', None, None)
        cost.xbutton('OK', 'Ok', None, 0.5).event('EndDialog', 'Return')
        whichusers = PyDialog(db, 'WhichUsersDlg', x, y, w, h, modal, title, 'AdminInstall', 'Next', 'Cancel')
        whichusers.title('Select whether to install [ProductName] for all users of this computer.')
        g = whichusers.radiogroup('AdminInstall', 15, 60, 260, 50, 3, 'WhichUsers', '', 'Next')
        g.add('ALL', 0, 5, 150, 20, 'Install for all users')
        g.add('JUSTME', 0, 25, 150, 20, 'Install just for me')
        whichusers.back('Back', None, active=0)
        c = whichusers.next('Next >', 'Cancel')
        c.event('[ALLUSERS]', '1', 'WhichUsers="ALL"', 1)
        c.event('EndDialog', 'Return', ordering=2)
        c = whichusers.cancel('Cancel', 'AdminInstall')
        c.event('SpawnDialog', 'CancelDlg')
        progress = PyDialog(db, 'ProgressDlg', x, y, w, h, modeless, title, 'Cancel', 'Cancel', 'Cancel', bitmap=False)
        progress.text('Title', 20, 15, 200, 15, 196611, '{\\DlgFontBold8}[Progress1] [ProductName]')
        progress.text('Text', 35, 65, 300, 30, 3, 'Please wait while the Installer [Progress2] [ProductName]. This may take several minutes.')
        progress.text('StatusLabel', 35, 100, 35, 20, 3, 'Status:')
        c = progress.text('ActionText', 70, 100, w - 70, 20, 3, 'Pondering...')
        c.mapping('ActionText', 'Text')
        c = progress.control('ProgressBar', 'ProgressBar', 35, 120, 300, 10, 65537, None, 'Progress done', None, None)
        c.mapping('SetProgress', 'Progress')
        progress.back('< Back', 'Next', active=False)
        progress.next('Next >', 'Cancel', active=False)
        progress.cancel('Cancel', 'Back').event('SpawnDialog', 'CancelDlg')
        maint = PyDialog(db, 'MaintenanceTypeDlg', x, y, w, h, modal, title, 'Next', 'Next', 'Cancel')
        maint.title('Welcome to the [ProductName] Setup Wizard')
        maint.text('BodyText', 15, 63, 330, 42, 3, 'Select whether you want to repair or remove [ProductName].')
        g = maint.radiogroup('RepairRadioGroup', 15, 108, 330, 60, 3, 'MaintenanceForm_Action', '', 'Next')
        g.add('Repair', 0, 18, 200, 17, '&Repair [ProductName]')
        g.add('Remove', 0, 36, 200, 17, 'Re&move [ProductName]')
        maint.back('< Back', None, active=False)
        c = maint.next('Finish', 'Cancel')
        c.event('[REINSTALL]', 'ALL', 'MaintenanceForm_Action="Repair"', 5)
        c.event('[Progress1]', 'Repairing', 'MaintenanceForm_Action="Repair"', 6)
        c.event('[Progress2]', 'repairs', 'MaintenanceForm_Action="Repair"', 7)
        c.event('Reinstall', 'ALL', 'MaintenanceForm_Action="Repair"', 8)
        c.event('[REMOVE]', 'ALL', 'MaintenanceForm_Action="Remove"', 11)
        c.event('[Progress1]', 'Removing', 'MaintenanceForm_Action="Remove"', 12)
        c.event('[Progress2]', 'removes', 'MaintenanceForm_Action="Remove"', 13)
        c.event('Remove', 'ALL', 'MaintenanceForm_Action="Remove"', 14)
        c.event('EndDialog', 'Return', 'MaintenanceForm_Action<>"Change"', 20)
        maint.cancel('Cancel', 'RepairRadioGroup').event('SpawnDialog', 'CancelDlg')
        return
Exemplo n.º 13
0
    def add_ui(self):
        x = y = 50
        w = 370
        h = 300
        title = "[ProductName] Setup"

        # Dialog styles
        modal = 3  # visible | modal
        modeless = 1  # visible
        track_disk_space = 32

        add_data(self.db, 'ActionText', uisample.ActionText)
        add_data(self.db, 'UIText', uisample.UIText)

        # Bitmaps
        #add_data(self.db, "Binary",
        #         [("PythonWin", msilib.Binary(srcdir+r"\PCbuild\installer.bmp")), # 152x328 pixels
        #          ("Up",msilib.Binary("Up.bin")),
        #          ("New",msilib.Binary("New.bin")),
        #          ("InfoIcon",msilib.Binary("info.bin")),
        #          ("ExclamationIcon",msilib.Binary("exclamic.bin")),
        #         ])

        # UI customization properties
        add_data(
            self.db,
            "Property",
            [
                ("DefaultUIFont", "DlgFont8"),
                ("ErrorDialog", "ErrorDlg"),
                ("Progress1", "Install"),  # modified in maintenance type dlg
                ("Progress2", "installs"),
                ("MaintenanceForm_Action", "Repair")
            ])

        # Fonts
        add_data(
            self.db,
            "TextStyle",
            [
                ("DlgFont8", "Tahoma", 9, None, 0),
                ("DlgFontBold8", "Tahoma", 8, None, 1),  #bold
                ("VerdanaBold13", "Verdana", 13, None, 1),
            ])

        # Custom actions
        add_data(
            self.db,
            "CustomAction",
            [
                # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty
                ("InitialTargetDir", 307, "TARGETDIR",
                 "[WindowsVolume]Python%s%s" % (self.major, self.minor))
            ])

        # UI Sequences
        add_data(
            self.db,
            "InstallUISequence",
            [
                ("PrepareDlg", None, 140),
                ("InitialTargetDir", 'TARGETDIR=""', 750),
                ("SelectDirectoryDlg", "Not Installed", 1230),
                # XXX notyet
                #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240),
                ("MaintenanceTypeDlg",
                 "Installed AND NOT RESUME AND NOT Preselected", 1250),
                ("ProgressDlg", None, 1280)
            ])
        add_data(self.db, "AdminUISequence",
                 [("InitialTargetDir", 'TARGETDIR=""', 750)])

        # Standard dialogs: FatalError, UserExit, ExitDialog
        fatal = PyDialog.PyDialog(self.db, "FatalError", x, y, w, h, modal,
                                  title, "Finish", "Finish", "Finish")
        fatal.title("[ProductName] Installer ended prematurely")
        fatal.back("< Back", "Finish", active=0)
        fatal.cancel("Cancel", "Back", active=0)
        fatal.text(
            "Description1", 135, 70, 220, 60, 196611,
            "[ProductName] setup ended prematurely because of an error.  Your system has not been modified.  To install this program at a later time, please run the installation again."
        )
        fatal.text("Description2", 135, 135, 220, 20, 196611,
                   "Click the Finish button to exit the Installer.")
        c = fatal.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        user_exit = PyDialog.PyDialog(self.db, "UserExit", x, y, w, h, modal,
                                      title, "Finish", "Finish", "Finish")
        user_exit.title("[ProductName] Installer was interrupted")
        user_exit.back("< Back", "Finish", active=0)
        user_exit.cancel("Cancel", "Back", active=0)
        user_exit.text(
            "Description1", 135, 70, 220, 40, 196611,
            "[ProductName] setup was interrupted.  Your system has not been modified.  "
            "To install this program at a later time, please run the installation again."
        )
        user_exit.text("Description2", 135, 115, 220, 20, 196611,
                       "Click the Finish button to exit the Installer.")
        c = user_exit.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Exit")

        exit_dialog = PyDialog.PyDialog(self.db, "ExitDialog", x, y, w, h,
                                        modal, title, "Finish", "Finish",
                                        "Finish")
        exit_dialog.title("Completing the [ProductName] Installer")
        exit_dialog.back("< Back", "Finish", active=0)
        exit_dialog.cancel("Cancel", "Back", active=0)
        exit_dialog.text("Description", 135, 115, 220, 20, 196611,
                         "Click the Finish button to exit the Installer.")
        c = exit_dialog.next("Finish", "Cancel", name="Finish")
        c.event("EndDialog", "Return")

        # Required dialog: FilesInUse, ErrorDlg
        inuse = PyDialog.PyDialog(self.db,
                                  "FilesInUse",
                                  x,
                                  y,
                                  w,
                                  h,
                                  19,
                                  title,
                                  "Retry",
                                  "Retry",
                                  "Retry",
                                  bitmap=False)
        inuse.text("Title", 15, 6, 200, 15, 196611,
                   r"{\DlgFontBold8}Files in Use")
        inuse.text("Description", 20, 23, 280, 20, 196611,
                   "Some files that need to be updated are currently in use.")
        inuse.text(
            "Text", 20, 55, 330, 50, 3,
            "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it."
        )
        inuse.control("List", "ListBox", 20, 107, 330, 130, 7,
                      "FileInUseProcess", None, None, None)
        c = inuse.back("Exit", "Ignore", name="Exit")
        c.event("EndDialog", "Exit")
        c = inuse.next("Ignore", "Retry", name="Ignore")
        c.event("EndDialog", "Ignore")
        c = inuse.cancel("Retry", "Exit", name="Retry")
        c.event("EndDialog", "Retry")

        error = Dialog(self.db, "ErrorDlg", 50, 10, 330, 101, 65543, title,
                       "ErrorText", None, None)
        error.text("ErrorText", 50, 9, 280, 48, 3, "")
        error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None,
                      "InfoIcon", None, None)
        error.pushbutton("N", 120, 72, 81, 21, 3, "No",
                         None).event("EndDialog", "ErrorNo")
        error.pushbutton("Y", 240, 72, 81, 21, 3, "Yes",
                         None).event("EndDialog", "ErrorYes")
        error.pushbutton("A", 0, 72, 81, 21, 3, "Abort",
                         None).event("EndDialog", "ErrorAbort")
        error.pushbutton("C", 42, 72, 81, 21, 3, "Cancel",
                         None).event("EndDialog", "ErrorCancel")
        error.pushbutton("I", 81, 72, 81, 21, 3, "Ignore",
                         None).event("EndDialog", "ErrorIgnore")
        error.pushbutton("O", 159, 72, 81, 21, 3, "Ok",
                         None).event("EndDialog", "ErrorOk")
        error.pushbutton("R", 198, 72, 81, 21, 3, "Retry",
                         None).event("EndDialog", "ErrorRetry")

        # Global "Query Cancel" dialog
        cancel = Dialog(self.db, "CancelDlg", 50, 10, 260, 85, 3, title, "No",
                        "No", "No")
        cancel.text(
            "Text", 48, 15, 194, 30, 3,
            "Are you sure you want to cancel [ProductName] installation?")
        cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None,
                       "InfoIcon", None, None)
        c = cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No")
        c.event("EndDialog", "Exit")
        c = cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes")
        c.event("EndDialog", "Return")

        # Global "Wait for costing" dialog
        costing = Dialog(self.db, "WaitForCostingDlg", 50, 10, 260, 85, modal,
                         title, "Return", "Return", "Return")
        costing.text(
            "Text", 48, 15, 194, 30, 3,
            "Please wait while the installer finishes determining your disk space requirements."
        )
        costing.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None,
                        "ExclamationIcon", None, None)
        c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None)
        c.event("EndDialog", "Exit")

        # Preparation dialog: no user input except cancellation
        prep = PyDialog.PyDialog(self.db, "PrepareDlg", x, y, w, h, modeless,
                                 title, "Cancel", "Cancel", "Cancel")
        prep.text(
            "Description", 135, 70, 220, 40, 196611,
            "Please wait while the Installer prepares to guide you through the installation."
        )
        prep.title("Welcome to the [ProductName] Installer")
        c = prep.text("ActionText", 135, 110, 220, 20, 196611, "Pondering...")
        c.mapping("AxtionText", "Text")
        c = prep.text("ActionData", 135, 135, 220, 30, 196611, None)
        c.mapping("ActionData", "Text")
        prep.back("Back", None, active=0)
        prep.next("Next", None, active=0)
        c = prep.cancel("Cancel", None)
        c.event("SpawnDialog", "CancelDlg")

        # Target directory selection
        seldlg = PyDialog.PyDialog(self.db, "SelectDirectoryDlg", x, y, w, h,
                                   modal, title, "Next", "Next", "Cancel")
        seldlg.title("Select Destination Directory")
        seldlg.text("Description", 135, 50, 220, 40, 196611,
                    "Please select a directory for the [ProductName] files.")

        seldlg.back("< Back", None, active=0)
        c = seldlg.next("Next >", "Cancel")
        c.event("SetTargetPath", "TARGETDIR", order=1)
        c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete = 1",
                2)
        c.event("NewDialog", "SelectFeaturesDlg", order=3)

        c = seldlg.cancel("Cancel", "DirectoryCombo")
        c.event("SpawnDialog", "CancelDlg")

        seldlg.control("DirectoryCombo", "DirectoryCombo", 135, 70, 172, 80,
                       393219, "TARGETDIR", None, "DirectoryList", None)
        seldlg.control("DirectoryList", "DirectoryList", 135, 90, 208, 136, 3,
                       "TARGETDIR", None, "PathEdit", None)
        seldlg.control("PathEdit", "PathEdit", 135, 230, 206, 16, 3,
                       "TARGETDIR", None, "Next", None)
        c = seldlg.pushbutton("Up", 306, 70, 18, 18, 3670019, "Up", None)
        c.event("DirectoryListUp", "0")
        c = seldlg.pushbutton("NewDir", 324, 70, 18, 18, 3670019, "New", None)
        c.event("DirectoryListNew", "0")

        # SelectFeaturesDlg
        features = PyDialog.PyDialog(self.db, "SelectFeaturesDlg", x, y, w, h,
                                     modal | track_disk_space, title, "Tree",
                                     "Next", "Cancel")
        features.title("Customize [ProductName]")
        features.text("Description", 135, 35, 220, 15, 196611,
                      "Select the way you want features to be installed.")
        features.text(
            "Text", 135, 45, 220, 30, 3,
            "Click on the icons in the tree below to change the way features will be installed."
        )

        c = features.back("< Back", "Next")
        c.event("NewDialog", "SelectDirectoryDlg")  # XXX InstallMode=""

        c = features.next("Next >", "Cancel")
        c.mapping("SelectionNoItems", "Enabled")
        c.event("EndDialog", "Return")

        c = features.cancel("Cancel", "Tree")
        c.event("SpawnDialog", "CancelDlg")

        # The browse property is not used, since we have only a single target path (selected already)
        features.control("Tree", "SelectionTree", 135, 75, 220, 95, 7,
                         "_BrowseProperty", "Tree of selections", "Back", None)

        #c=features.pushbutton("Reset", 42, 243, 56, 17, 3, "Reset", "DiskCost")
        #c.mapping("SelectionNoItems", "Enabled")
        #c.event("Reset", "0")

        features.control("Box", "GroupBox", 135, 170, 225, 90, 1, None, None,
                         None, None)

        c = features.xbutton("DiskCost", "Disk &Usage", None, 0.10)
        c.mapping("SelectionNoItems", "Enabled")
        c.event("SpawnDialog", "DiskCostDlg")

        c = features.text(
            "ItemDescription", 140, 180, 210, 50, 3,
            "Multiline description of the currently selected item.")
        c.mapping("SelectionDescription", "Text")

        c = features.text("ItemSize", 140, 230, 220, 25, 3,
                          "The size of the currently selected item.")
        c.mapping("SelectionSize", "Text")

        # Disk cost
        cost = PyDialog.PyDialog(self.db,
                                 "DiskCostDlg",
                                 x,
                                 y,
                                 w,
                                 h,
                                 modal,
                                 title,
                                 "OK",
                                 "OK",
                                 "OK",
                                 bitmap=False)
        cost.text("Title", 15, 6, 200, 15, 196611,
                  "{\DlgFontBold8}Disk Space Requirements")
        cost.text(
            "Description", 20, 20, 280, 20, 196611,
            "The disk space required for the installation of the selected features."
        )
        cost.text(
            "Text", 20, 53, 330, 60, 3,
            "The highlighted volumes (if any) do not have enough disk space "
            "available for the currently selected features.  You can either "
            "remove some files from the highlighted volumes, or choose to "
            "install less features onto local drive(s), or select different "
            "destination drive(s).")
        cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223,
                     None, "{120}{70}{70}{70}{70}", None, None)
        cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return")

        # Installation Progress dialog (modeless)
        progress = PyDialog.PyDialog(self.db,
                                     "ProgressDlg",
                                     x,
                                     y,
                                     w,
                                     h,
                                     modeless,
                                     title,
                                     "Cancel",
                                     "Cancel",
                                     "Cancel",
                                     bitmap=False)
        progress.text("Title", 20, 15, 200, 15, 196611,
                      "{\DlgFontBold8}[Progress1] [ProductName]")
        progress.text(
            "Text", 35, 65, 300, 30, 3,
            "Please wait while the Installer [Progress2] [ProductName]. "
            "This may take several minutes.")
        progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:")

        c = progress.text("ActionText", 70, 100, w - 70, 20, 3, "Pondering...")
        c.mapping("ActionText", "Text")

        #c=progress.text("ActionData", 35, 140, 300, 20, 3, None)
        #c.mapping("ActionData", "Text")

        c = progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10,
                             65537, None, "Progress done", None, None)
        c.mapping("SetProgress", "Progress")

        progress.back("< Back", "Next", active=False)
        progress.next("Next >", "Cancel", active=False)
        progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg")

        # Maintenance type: repair/uninstall
        maint = PyDialog.PyDialog(self.db, "MaintenanceTypeDlg", x, y, w, h,
                                  modal, title, "Next", "Next", "Cancel")
        maint.title("Welcome to the [ProductName] Setup Wizard")
        maint.text(
            "BodyText", 135, 63, 230, 42, 3,
            "Select whether you want to repair or remove [ProductName].")
        g = maint.radiogroup("RepairRadioGroup", 135, 108, 230, 48, 3,
                             "MaintenanceForm_Action", "", "Next")
        g.add("Repair", 0, 0, 200, 17, "&Repair [ProductName]")
        g.add("Remove", 0, 18, 200, 17, "Re&move [ProductName]")

        maint.back("< Back", None, active=False)
        c = maint.next("Finish", "Cancel")
        # Reinstall: Change progress dialog to "Repair", then invoke reinstall
        # Also set list of reinstalled features to "ALL"
        c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 1)
        c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"',
                2)
        c.event("[Progress2]", "repaires", 'MaintenanceForm_Action="Repair"',
                3)
        c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 4)

        # Uninstall: Change progress to "Remove", then invoke uninstall
        # Also set list of removed features to "ALL"
        c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11)
        c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"',
                12)
        c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"',
                13)
        c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14)

        # Close dialog when maintenance action scheduled
        c.event("EndDialog", "Return", order=20)

        maint.cancel("Cancel",
                     "RepairRadioGroup").event("SpawnDialog", "CancelDlg")