@@ -362,7 +362,7 @@ def to_command_line():
362
362
else :
363
363
return []
364
364
return to_command_line
365
-
365
+
366
366
def makeStoreActionEntry (self , a , optional = True ):
367
367
"""
368
368
make a dialog entry for a StoreAction entry
@@ -399,21 +399,42 @@ def makeStoreActionEntry(self, a, optional=True):
399
399
lineedit .setText ("{0}" .format (a .default ))
400
400
if validator is not None :
401
401
lineedit .setValidator (validator (self ))
402
-
402
+
403
403
if optional :
404
404
include = QtGui .QCheckBox (comb (helpstring , typehelp ), self .options )
405
405
enabled = a .default is not None
406
406
include .setChecked (enabled )
407
407
self .disableOnClick (lineedit )(enabled )
408
- include .clicked .connect (self .disableOnClick (lineedit ))
408
+ include .clicked .connect (self .disableOnClick (lineedit ))
409
409
self .registerDisplayStateInfo (a .dest , [include ])
410
410
else :
411
411
include = QtGui .QLabel (comb (helpstring , typehelp ), self .options )
412
-
412
+
413
413
self .registerDisplayStateInfo (a .dest , [lineedit ])
414
414
self .commandLineArgumentCreators .append (self .createFunctionToMakeStoreEntryCommandLine (include , lineedit , a ))
415
- self .optionsLayout .addRow (include , lineedit )
416
-
415
+
416
+ #Yay for the following example of why I suck at OO concepts:
417
+ if a .type == str :
418
+ btn = self .addButton ("Select file" )
419
+ btn .lineedit = lineedit
420
+ btn .include = include
421
+
422
+ def openAFile ():
423
+ filename = QtGui .QFileDialog .getOpenFileName ()
424
+ if filename :
425
+ btn .lineedit .setText (filename )
426
+ btn .lineedit .setEnabled (True )
427
+ btn .include .setChecked (True )
428
+ btn .clickyclicky = openAFile
429
+ btn .clicked .connect (btn .clickyclicky )
430
+ hBox = QtGui .QHBoxLayout ()
431
+ hBox .addWidget (lineedit )
432
+ hBox .addWidget (btn )
433
+ self .optionsLayout .addRow (include , hBox )
434
+ #self.optionsLayout.addRow(include, lineedit)
435
+ else :
436
+ self .optionsLayout .addRow (include , lineedit )
437
+
417
438
def createFunctionToMakeStoreEntryCommandLine (self , include_widget , value_widget , argument ):
418
439
"""
419
440
function to create a function that generates a command line string,
0 commit comments