@@ -51,14 +51,15 @@ def add_config(self, fullname):
51
51
msilib .add_data (self .db , 'InstallUISequence' ,
52
52
[("PrepareDlg" , None , 140 ),
53
53
("A_SET_TARGET_DIR" , 'TARGETDIR=""' , 401 ),
54
- (" LicenseDlg" , " not Installed" , 1230 ),
55
- (" MaintenanceTypeDlg" ,
56
- " Installed and not Resume and not Preselected" , 1250 ),
57
- (" ProgressDlg" , None , 1280 )
54
+ (' LicenseDlg' , ' not Installed' , 1230 ),
55
+ (' MaintenanceTypeDlg' ,
56
+ ' Installed and not Resume and not Preselected' , 1250 ),
57
+ (' ProgressDlg' , None , 1280 )
58
58
])
59
59
60
60
# TODO: Add ability to pass arguments to executable
61
61
# TODO: Validate shortcut values against known MSI table
62
+ # TODO: Add ability to specify nested shortcuts
62
63
for index , shortcut in enumerate (self .shortcuts ):
63
64
shortcut = shortcut .split ('=' )
64
65
baseName = '{}.exe' .format (shortcut [1 ].strip ())
@@ -76,59 +77,59 @@ def add_config(self, fullname):
76
77
msilib .add_data (self .db , tableName , data )
77
78
78
79
def add_cancel_dialog (self ):
79
- dialog = msilib .Dialog (self .db , " CancelDlg" , 50 , 10 , 260 , 85 , 3 ,
80
- self .title , "No" , "No" , "No" )
81
- dialog .text (" Text" , 48 , 15 , 194 , 30 , 3 ,
82
- " Are you sure you want to cancel [ProductName] installation?" )
83
- button = dialog .pushbutton (" Yes" , 72 , 57 , 56 , 17 , 3 , " Yes" , "No" )
84
- button .event (" EndDialog" , " Exit" )
85
- button = dialog .pushbutton ("No" , 132 , 57 , 56 , 17 , 3 , "No" , " Yes" )
86
- button .event (" EndDialog" , " Return" )
80
+ dialog = msilib .Dialog (self .db , ' CancelDlg' , 50 , 50 , 260 , 85 , 3 ,
81
+ self .title , 'No' , 'No' , 'No' )
82
+ dialog .text (' Text' , 48 , 15 , 194 , 30 , 3 ,
83
+ ' Are you sure you want to cancel [ProductName] installation?' )
84
+ button = dialog .pushbutton (' Yes' , 72 , 57 , 56 , 17 , 3 , ' Yes' , 'No' )
85
+ button .event (' EndDialog' , ' Exit' )
86
+ button = dialog .pushbutton ('No' , 132 , 57 , 56 , 17 , 3 , 'No' , ' Yes' )
87
+ button .event (' EndDialog' , ' Return' )
87
88
88
89
def add_error_dialog (self ):
89
- dialog = msilib .Dialog (self .db , " ErrorDlg" , 50 , 10 , 330 , 101 , 65543 ,
90
- self .title , " ErrorText" , None , None )
91
- dialog .text (" ErrorText" , 50 , 9 , 280 , 48 , 3 , "" )
92
- for text , x in [("No" , 120 ), (" Yes" , 240 ), (" Abort" , 0 ),
93
- (" Cancel" , 42 ), (" Ignore" , 81 ), ("Ok" , 159 ), (" Retry" , 198 )]:
90
+ dialog = msilib .Dialog (self .db , ' ErrorDlg' , 50 , 10 , 330 , 101 , 65543 ,
91
+ self .title , ' ErrorText' , None , None )
92
+ dialog .text (' ErrorText' , 50 , 9 , 280 , 48 , 3 , '' )
93
+ for text , x in [('No' , 120 ), (' Yes' , 240 ), (' Abort' , 0 ),
94
+ (' Cancel' , 42 ), (' Ignore' , 81 ), ('Ok' , 159 ), (' Retry' , 198 )]:
94
95
button = dialog .pushbutton (text [0 ], x , 72 , 81 , 21 , 3 , text , None )
95
- button .event (" EndDialog" , " Error%s" % text )
96
+ button .event (' EndDialog' , ' Error%s' % text )
96
97
97
98
def add_exit_dialog (self ):
98
- dialog = distutils .command .bdist_msi .PyDialog (self .db , " ExitDialog" ,
99
+ dialog = distutils .command .bdist_msi .PyDialog (self .db , ' ExitDialog' ,
99
100
self .x , self .y , self .width , self .height , self .modal ,
100
- self .title , " Finish" , " Finish" , " Finish" )
101
- dialog .title (" Completing the [ProductName] installer" )
102
- dialog .back ("< Back" , " Finish" , active = False )
103
- dialog .cancel (" Cancel" , " Back" , active = False )
104
- dialog .text (" Description" , 15 , 235 , 320 , 20 , 0x30003 ,
105
- " Click the Finish button to exit the installer." )
106
- button = dialog .next (" Finish" , " Cancel" , name = " Finish" )
107
- button .event (" EndDialog" , " Return" )
101
+ self .title , ' Finish' , ' Finish' , ' Finish' )
102
+ dialog .title (' Completing the [ProductName] installer' )
103
+ dialog .back (' Back' , ' Finish' , active = False )
104
+ dialog .cancel (' Cancel' , ' Back' , active = False )
105
+ dialog .text (' Description' , 15 , 207 , 320 , 20 , 0x30003 ,
106
+ ' Click the Finish button to exit the installer.' )
107
+ button = dialog .next (' Finish' , ' Cancel' , name = ' Finish' )
108
+ button .event (' EndDialog' , ' Return' )
108
109
109
110
def add_fatal_error_dialog (self ):
110
- dialog = distutils .command .bdist_msi .PyDialog (self .db , " FatalError" ,
111
+ dialog = distutils .command .bdist_msi .PyDialog (self .db , ' FatalError' ,
111
112
self .x , self .y , self .width , self .height , self .modal ,
112
- self .title , " Finish" , " Finish" , " Finish" )
113
- dialog .title (" [ProductName] installer ended prematurely" )
114
- dialog .back ("< Back" , " Finish" , active = False )
115
- dialog .cancel (" Cancel" , " Back" , active = False )
116
- dialog .text (" Description1" , 15 , 70 , 320 , 80 , 0x30003 ,
117
- " [ProductName] setup ended prematurely because of an error. "
118
- " Your system has not been modified. To install this program "
119
- " at a later time, please run the installation again." )
120
- dialog .text (" Description2" , 15 , 155 , 320 , 20 , 0x30003 ,
121
- " Click the Finish button to exit the installer." )
122
- button = dialog .next (" Finish" , " Cancel" , name = " Finish" )
123
- button .event (" EndDialog" , " Exit" )
113
+ self .title , ' Finish' , ' Finish' , ' Finish' )
114
+ dialog .title (' [ProductName] installer ended prematurely' )
115
+ dialog .back (' Back' , ' Finish' , active = False )
116
+ dialog .cancel (' Cancel' , ' Back' , active = False )
117
+ dialog .text (' Description1' , 15 , 70 , 320 , 80 , 0x30003 ,
118
+ ' [ProductName] setup ended prematurely because of an error. '
119
+ ' Your system has not been modified. To install this program '
120
+ ' at a later time, please run the installation again.' )
121
+ dialog .text (' Description2' , 15 , 155 , 320 , 20 , 0x30003 ,
122
+ ' Click the Finish button to exit the installer.' )
123
+ button = dialog .next (' Finish' , ' Cancel' , name = ' Finish' )
124
+ button .event (' EndDialog' , ' Exit' )
124
125
125
126
def add_files (self ):
126
127
db = self .db
127
- cab = msilib .CAB (" distfiles" )
128
- f = msilib .Feature (db , " default" , " Default Feature" , " Everything" , 1 , directory = " TARGETDIR" )
128
+ cab = msilib .CAB (' distfiles' )
129
+ f = msilib .Feature (db , ' default' , ' Default Feature' , ' Everything' , 1 , directory = ' TARGETDIR' )
129
130
f .set_current ()
130
131
rootdir = os .path .abspath (self .bdist_dir )
131
- root = msilib .Directory (db , cab , None , rootdir , " TARGETDIR" , " SourceDir" )
132
+ root = msilib .Directory (db , cab , None , rootdir , ' TARGETDIR' , ' SourceDir' )
132
133
db .Commit ()
133
134
todo = [root ]
134
135
while todo :
@@ -143,26 +144,26 @@ def add_files(self):
143
144
cab .commit (db )
144
145
145
146
def add_files_in_use_dialog (self ):
146
- dialog = distutils .command .bdist_msi .PyDialog (self .db , " FilesInUse" ,
147
+ dialog = distutils .command .bdist_msi .PyDialog (self .db , ' FilesInUse' ,
147
148
self .x , self .y , self .width , self .height , 19 , self .title ,
148
- " Retry" , " Retry" , " Retry" , bitmap = False )
149
- dialog .text (" Title" , 15 , 6 , 200 , 15 , 0x30003 ,
150
- r" {\DlgFontBold8}Files in Use" )
151
- dialog .text (" Description" , 20 , 23 , 280 , 20 , 0x30003 ,
152
- " Some files that need to be updated are currently in use." )
153
- dialog .text (" Text" , 20 , 55 , 330 , 50 , 3 ,
154
- " The following applications are using files that need to be "
155
- " updated by this setup. Close these applications and then "
156
- " click Retry to continue the installation or Cancel to exit "
157
- " it." )
158
- dialog .control (" List" , " ListBox" , 20 , 107 , 330 , 130 , 7 ,
159
- " FileInUseProcess" , None , None , None )
160
- button = dialog .back (" Exit" , " Ignore" , name = " Exit" )
161
- button .event (" EndDialog" , " Exit" )
162
- button = dialog .next (" Ignore" , " Retry" , name = " Ignore" )
163
- button .event (" EndDialog" , " Ignore" )
164
- button = dialog .cancel (" Retry" , " Exit" , name = " Retry" )
165
- button .event (" EndDialog" , " Retry" )
149
+ ' Retry' , ' Retry' , ' Retry' , bitmap = False )
150
+ dialog .text (' Title' , 15 , 6 , 200 , 15 , 0x30003 ,
151
+ r' {\DlgFontBold8}Files in Use' )
152
+ dialog .text (' Description' , 20 , 23 , 280 , 20 , 0x30003 ,
153
+ ' Some files that need to be updated are currently in use.' )
154
+ dialog .text (' Text' , 20 , 55 , 330 , 50 , 3 ,
155
+ ' The following applications are using files that need to be '
156
+ ' updated by this setup. Close these applications and then '
157
+ ' click Retry to continue the installation or Cancel to exit '
158
+ ' it.' )
159
+ dialog .control (' List' , ' ListBox' , 20 , 107 , 330 , 130 , 7 ,
160
+ ' FileInUseProcess' , None , None , None )
161
+ button = dialog .back (' Exit' , ' Ignore' , name = ' Exit' )
162
+ button .event (' EndDialog' , ' Exit' )
163
+ button = dialog .next (' Ignore' , ' Retry' , name = ' Ignore' )
164
+ button .event (' EndDialog' , ' Ignore' )
165
+ button = dialog .cancel (' Retry' , ' Exit' , name = ' Retry' )
166
+ button .event (' EndDialog' , ' Retry' )
166
167
167
168
def add_maintenance_type_dialog (self ):
168
169
dialog = distutils .command .bdist_msi .PyDialog (self .db ,
@@ -175,7 +176,7 @@ def add_maintenance_type_dialog(self):
175
176
"MaintenanceForm_Action" , "" , "Next" )
176
177
group .add ("Repair" , 0 , 18 , 300 , 17 , "&Repair [ProductName]" )
177
178
group .add ("Remove" , 0 , 36 , 300 , 17 , "Re&move [ProductName]" )
178
- dialog .back ("< Back" , None , active = False )
179
+ dialog .back ("Back" , None , active = False )
179
180
button = dialog .next ("Finish" , "Cancel" )
180
181
button .event ("[REINSTALL]" , "ALL" ,
181
182
'MaintenanceForm_Action="Repair"' , 5 )
@@ -231,8 +232,8 @@ def add_progress_dialog(self):
231
232
control = dialog .control ("ProgressBar" , "ProgressBar" , 35 , 120 , 300 ,
232
233
10 , 65537 , None , "Progress done" , None , None )
233
234
control .mapping ("SetProgress" , "Progress" )
234
- dialog .back ("< Back" , "Next" , active = False )
235
- dialog .next ("Next > " , "Cancel" , active = False )
235
+ dialog .back ("Back" , "Next" , active = False )
236
+ dialog .next ("Next" , "Cancel" , active = False )
236
237
button = dialog .cancel ("Cancel" , "Back" )
237
238
button .event ("SpawnDialog" , "CancelDlg" )
238
239
@@ -256,28 +257,22 @@ def add_properties(self):
256
257
props .append (("UpgradeCode" , self .upgrade_code ))
257
258
msilib .add_data (self .db , 'Property' , props )
258
259
259
- def add_select_directory_dialog (self ):
260
- # TODO: Parse other types of license files
261
- for file in ['LICENSE' , 'LICENSE.txt' ]:
262
- if os .path .isfile (file ):
263
- license_file = open (file )
264
- break
265
-
266
- if license_file :
260
+ def add_license_dialog (self ):
261
+ if self .license_text :
267
262
dialog = distutils .command .bdist_msi .PyDialog (self .db , 'LicenseDlg' ,
268
263
self .x , self .y , self .width , self .height , self .modal ,
269
264
self .title , 'Next' , 'Next' , 'Cancel' , bitmap = False )
270
265
dialog .title ('License Agreement' )
271
- dialog .control ('ScrollableText' , 'ScrollableText' , 15 , 30 , 340 , 200 , 3 , None , license_text ( license_file ) ,
272
- None , None )
273
- dialog .checkbox ('AcceptLicense' , 15 , 240 , 340 , 15 , 3 , 'LicenseAccepted' ,
266
+ dialog .control ('ScrollableText' , 'ScrollableText' , 20 , 60 , 330 , 140 , 7 , None ,
267
+ self . license_text , None , None )
268
+ dialog .checkbox ('AcceptLicense' , 20 , 207 , 330 , 18 , 3 , 'LicenseAccepted' ,
274
269
'I accept the terms in the License Agreement' , None )
275
- dialog .back ('< Back' , 'Next' , active = False )
270
+ dialog .back ('Back' , 'Next' , active = False )
276
271
277
- button = dialog .next ('Next > ' , 'Cancel' , active = False )
278
- button .event ('SetTargetPath' , 'TARGETDIR' , ordering = 1 )
279
- button .event ('SpawnWaitDialog' , 'WaitForCostingDlg' , ordering = 2 )
280
- button .event ('EndDialog' , 'Return' , ordering = 3 )
272
+ button = dialog .next ('Next' , 'Cancel' , active = False )
273
+ # button.event('SetTargetPath', 'TARGETDIR', ordering=1)
274
+ button .event ('SpawnWaitDialog' , 'WaitForCostingDlg' , ordering = 1 )
275
+ button .event ('EndDialog' , 'Return' , ordering = 2 )
281
276
button .condition ('Enable' , 'LicenseAccepted' )
282
277
button .condition ('Disable' , 'Not LicenseAccepted' )
283
278
@@ -302,7 +297,7 @@ def add_ui(self):
302
297
self .add_files_in_use_dialog ()
303
298
self .add_wait_for_costing_dialog ()
304
299
self .add_prepare_dialog ()
305
- self .add_select_directory_dialog ()
300
+ self .add_license_dialog ()
306
301
self .add_progress_dialog ()
307
302
self .add_maintenance_type_dialog ()
308
303
@@ -316,20 +311,20 @@ def add_upgrade_config(self, sversion):
316
311
])
317
312
318
313
def add_user_exit_dialog (self ):
319
- dialog = distutils .command .bdist_msi .PyDialog (self .db , " UserExit" ,
314
+ dialog = distutils .command .bdist_msi .PyDialog (self .db , ' UserExit' ,
320
315
self .x , self .y , self .width , self .height , self .modal ,
321
- self .title , " Finish" , " Finish" , " Finish" )
322
- dialog .title (" [ProductName] installer was interrupted" )
323
- dialog .back ("< Back" , " Finish" , active = False )
324
- dialog .cancel (" Cancel" , " Back" , active = False )
325
- dialog .text (" Description1" , 15 , 70 , 320 , 80 , 0x30003 ,
326
- " [ProductName] setup was interrupted. Your system has not "
327
- " been modified. To install this program at a later time, "
328
- " please run the installation again." )
329
- dialog .text (" Description2" , 15 , 155 , 320 , 20 , 0x30003 ,
330
- " Click the Finish button to exit the installer." )
331
- button = dialog .next (" Finish" , " Cancel" , name = " Finish" )
332
- button .event (" EndDialog" , " Exit" )
316
+ self .title , ' Finish' , ' Finish' , ' Finish' )
317
+ dialog .title (' [ProductName] installer was interrupted' )
318
+ dialog .back (' Back' , ' Finish' , active = False )
319
+ dialog .cancel (' Cancel' , ' Back' , active = False )
320
+ dialog .text (' Description1' , 15 , 70 , 320 , 80 , 0x30003 ,
321
+ ' [ProductName] setup was interrupted. Your system has not '
322
+ ' been modified. To install this program at a later time, '
323
+ ' please run the installation again.' )
324
+ dialog .text (' Description2' , 15 , 207 , 320 , 20 , 0x30003 ,
325
+ ' Click the Finish button to exit the installer.' )
326
+ button = dialog .next (' Finish' , ' Cancel' , name = ' Finish' )
327
+ button .event (' EndDialog' , ' Exit' )
333
328
334
329
def add_wait_for_costing_dialog (self ):
335
330
dialog = msilib .Dialog (self .db , "WaitForCostingDlg" , 50 , 10 , 260 , 85 ,
@@ -381,6 +376,7 @@ def finalize_options(self):
381
376
raise EnvironmentError ('Unable to identify build directory!' )
382
377
383
378
self .bdist_dir = os .path .join (self .bdist_dir , build_dir ())
379
+ self .height = 270
384
380
385
381
def initialize_options (self ):
386
382
distutils .command .bdist_msi .bdist_msi .initialize_options (self )
@@ -393,8 +389,14 @@ def initialize_options(self):
393
389
self .data = None
394
390
self .shortcuts = None
395
391
392
+ # TODO: Parse other types of license files
393
+ for file in ['LICENSE' , 'LICENSE.txt' ]:
394
+ if os .path .isfile (file ):
395
+ self .license_text = license_text (open (file ))
396
+ break
397
+
396
398
def run (self ):
397
- self .skip_build = True
399
+ # self.skip_build = True
398
400
if not self .skip_build :
399
401
self .run_command ('build_exe' )
400
402
'''
0 commit comments