diff --git a/syncplay/ui/ConfigurationGetter.py b/syncplay/ui/ConfigurationGetter.py index 34c5f0e..7ee31b7 100644 --- a/syncplay/ui/ConfigurationGetter.py +++ b/syncplay/ui/ConfigurationGetter.py @@ -101,7 +101,7 @@ class ConfigurationGetter(object): if(hostNotValid or portNotValid): raise InvalidConfigValue("Hostname can't be empty") elif(self._config[key] == "" or self._config[key] is None): - raise InvalidConfigValue("{} can't be empty".format(key)) + raise InvalidConfigValue("{} can't be empty".format(key.capitalize())) def _overrideConfigWithArgs(self, args): for key, val in vars(args).items(): @@ -156,20 +156,20 @@ class ConfigurationGetter(object): def _checkConfig(self): try: self._validateArguments() - except InvalidConfigValue: + except InvalidConfigValue as e: try: - for key, value in self._promptForMissingArguments().items(): + for key, value in self._promptForMissingArguments(e.message).items(): self._config[key] = value self._checkConfig() except: sys.exit() - def _promptForMissingArguments(self): + def _promptForMissingArguments(self, error = None): if(self._config['noGui']): print getMessage("en", "missing-arguments-error") sys.exit() elif(GuiConfiguration): - gc = GuiConfiguration(self._config) + gc = GuiConfiguration(self._config, error = error) gc.setAvailablePaths(self._playerFactory.getAvailablePlayerPaths()) gc.run() return gc.getProcessedConfiguration() diff --git a/syncplay/ui/GuiConfiguration.py b/syncplay/ui/GuiConfiguration.py index 4f4ee0e..4b05970 100644 --- a/syncplay/ui/GuiConfiguration.py +++ b/syncplay/ui/GuiConfiguration.py @@ -7,12 +7,16 @@ import sys from syncplay.messages import getMessage class GuiConfiguration: - def __init__(self, config): + def __init__(self, config, error = None): self.config = config self._availablePlayerPaths = [] - + self.error = error + def run(self): - self.app = QtGui.QApplication(sys.argv) + try: + self.app = QtGui.QApplication(sys.argv) + except: + pass dialog = ConfigDialog(self.config, self._availablePlayerPaths) dialog.exec_()