Some fixes for config getter, GUI always shows up when no file selected

This commit is contained in:
Uriziel 2013-01-25 23:23:29 +01:00
parent df5410dd95
commit 1be4a53627

View File

@ -191,20 +191,26 @@ class ConfigurationGetter(object):
if(changed): if(changed):
parser.write(codecs.open(iniPath, "wb", "utf_8_sig")) parser.write(codecs.open(iniPath, "wb", "utf_8_sig"))
def _forceGuiPrompt(self):
try:
self._validateArguments()
except InvalidConfigValue:
pass
try:
for key, value in self._promptForMissingArguments().items():
self._config[key] = value
except:
sys.exit()
def getConfiguration(self): def getConfiguration(self):
iniPath = self._getConfigurationFilePath() iniPath = self._getConfigurationFilePath()
self._parseConfigFile(iniPath) self._parseConfigFile(iniPath)
args = self._argparser.parse_args() args = self._argparser.parse_args()
self._overrideConfigWithArgs(args) self._overrideConfigWithArgs(args)
if(self._config['forceGuiPrompt']): #Arguments not validated yet - booleans are still text values
try: if(self._config['forceGuiPrompt'] == "True" or not self._config['file']):
self._validateArguments() self._forceGuiPrompt()
except InvalidConfigValue:
pass
try:
self._promptForMissingArguments()
except:
sys.exit()
self._checkConfig() self._checkConfig()
self._saveConfig(iniPath) self._saveConfig(iniPath)
return self._config return self._config