From 9ab4874de65cdb032241a62b9b810d725368c2d0 Mon Sep 17 00:00:00 2001 From: papoteur-mga Date: Sun, 14 Sep 2014 10:57:02 +0200 Subject: Update the function to detect if parameters are already set or not, which did not work --- mageiasync/mageiasync.py | 38 ++++++++++---------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) (limited to 'mageiasync') diff --git a/mageiasync/mageiasync.py b/mageiasync/mageiasync.py index 2e15151..b6737c8 100644 --- a/mageiasync/mageiasync.py +++ b/mageiasync/mageiasync.py @@ -211,39 +211,21 @@ class IsosViewer(QMainWindow, mageiaSyncUI.Ui_mainWindow): def prefsInit(self): # Load the parameters at first params=QtCore.QSettings("Mageia","mageiaSync") - try: + self.release=params.value("release", type="QString") # the parameters already initilised? - self.user=params.value("user", type="QString") - except: + if self.release =="": # Values are not yet set self.pd=prefsDialog() # Set values which are already defined - try: - self.pd.release.setText(params.value("release", type="QString")) - except: - pass - try: - self.pd.password.setText(params.value("password", type="QString")) - except: - pass - try: - self.pd.location.setText(params.value("location", type="QString")) - except: - pass - try: - self.pd.selectDest.setText(params.value("destination", type="QString")) - except: - self.pd.selectDest.setText(QtCore.QDir.currentPath()) - try: - self.pd.bwl.setText(params.value("bwl", type="QInt")) - except: - pass - try: - self.pd.password.setText(params.value("password", type="QString")) - except: - pass + self.pd.user.setText(params.value("user", type="QString")) + self.pd.password.setText(params.value("password", type="QString")) + self.pd.location.setText(params.value("location", type="QString")) + self.pd.selectDest.setText(params.value("destination", type="QString")) + self.pd.selectDest.setText(QtCore.QDir.currentPath()) + self.pd.bwl.setValue(params.value("bwl", type="int")) + self.pd.password.setText(params.value("password", type="QString")) answer=self.pd.exec_() - if answer: + if answer: # Update params params=QtCore.QSettings("Mageia","mageiaSync") params.setValue("release", self.pd.release.text()) -- cgit v1.2.1