Skip to content

Commit 90c6949

Browse files
committed
Updated codestyle, added 16/8bit png check, fixed some documentation and error messages, added Select file buttons to gui
1 parent 5ff27d6 commit 90c6949

File tree

2 files changed

+590
-483
lines changed

2 files changed

+590
-483
lines changed

argparseui.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def to_command_line():
362362
else:
363363
return []
364364
return to_command_line
365-
365+
366366
def makeStoreActionEntry(self, a, optional=True):
367367
"""
368368
make a dialog entry for a StoreAction entry
@@ -399,21 +399,42 @@ def makeStoreActionEntry(self, a, optional=True):
399399
lineedit.setText("{0}".format(a.default))
400400
if validator is not None:
401401
lineedit.setValidator(validator(self))
402-
402+
403403
if optional:
404404
include = QtGui.QCheckBox(comb(helpstring, typehelp), self.options)
405405
enabled = a.default is not None
406406
include.setChecked(enabled)
407407
self.disableOnClick(lineedit)(enabled)
408-
include.clicked.connect(self.disableOnClick(lineedit))
408+
include.clicked.connect(self.disableOnClick(lineedit))
409409
self.registerDisplayStateInfo(a.dest, [include])
410410
else:
411411
include = QtGui.QLabel(comb(helpstring, typehelp), self.options)
412-
412+
413413
self.registerDisplayStateInfo(a.dest, [lineedit])
414414
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+
417438
def createFunctionToMakeStoreEntryCommandLine(self, include_widget, value_widget, argument):
418439
"""
419440
function to create a function that generates a command line string,

0 commit comments

Comments
 (0)