Python msilib gui

From wikinotes

Dialog Order

The order that dialogs are presented to the user is determined by the msi InstallUISequence table.

Dialogs

NOTE:

The 'next_control' values must form a cycle. ex: Next -> Cancel -> PathEdit -> Next...

dialog = msilib.Dialog(db=db, 
                       name="SelectFeaturesDlg",     # control-name (not displayed)
                       x=50, y=50,                   # topleft corner
                       w=370, h=300,                 # dimensions
                       attr=3,                       # modal=3, modeless=1, ..
                       title='[ProductName] Setup',  # window-title
                       first="Next",                 # selected control
                       default="Next",               # when 'enter' is pressed
                       cancel="Cancel")              # when 'esc' is pressed

next_btn = dialog.pushbutton(name='Next',
                             x=180,
                             y=dialog.h - 27,
                             w=56, h=17,
                             next_control='Cancel')  # next selected control in 'Tab' cycle

cancel_btn = dialog.pushbutton(name='Cancel',
                               x=180,
                               y=dialog.h - 27,
                               w=56, h=17,
                               next_control='Next')    # next selected control in 'Tab' cycle

Events

Events determine what action is performed when a control is activated (clicked, item selected, etc).

Only 4x types of controls are supported, and unlike Qt, there is only one type of event.

See the msi ControlEvent table for more details.

cancel_btn = dialog.pushbutton(name='Cancel', ...)
cancel_btn.event("SpawnDialog", "CancelDlg")

close_btn = dialog.pushbutton(name='Close', ...)
close_btn.event('EndDialog', 'Return')

Control Types

PathEdit

installpath_fld = dialog.control('InstallPathFld',  # name
                                 'PathEdit',        # type
                                 15, 215,           # x/y
                                 300, 16,           # w/h
                                 1,                 # attributes (visible/disabled)
                                 'TARGETDIR',       # property
                                 None,              # text
                                 'Next',            # control_next
                                 None)              # help