From 0a91b98d7d654c8b16810da566ef733a5f0edef7 Mon Sep 17 00:00:00 2001 From: Mika Vainio Date: Sun, 12 Feb 2023 11:07:24 +0200 Subject: [PATCH] Addes some clarifying comments --- dialogs.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dialogs.py b/dialogs.py index 2af8327..01d5b88 100644 --- a/dialogs.py +++ b/dialogs.py @@ -58,11 +58,8 @@ def saveSettings(self): saveSettingsToJsonFile('settings.json', self.settings) self.close() - - # TODO: lisää virheenkäsittely kaikkiin tiedosto-operaatioihin - - +# A class for setting element sizes in all UIs class SetSize(QDialog): """Increases or decreases the size of UI elements.""" @@ -101,7 +98,7 @@ def saveSizeSetting(self): saveSettingsToJsonFile('settings.json', self.settings) self.close() - +# A class for separate cleaning dialog for the dictionary class SanitizeDictionary(QDialog): """Sorts dictionary, removes duplicates and updates the word counter.""" @@ -163,7 +160,7 @@ def saveSanitized(self): file.writelines(self.sanitizedWordList) self.close() - +# A class for adding words from Joukahainen to the dictionary class JoukahainenDialog(QDialog): """Dialog for getting words from Joukahainen dictionary.""" @@ -206,7 +203,9 @@ def joukahainenToDictionary(self): # COMMON FUNCTIONS FOR FILE OPERATIONS -# A function for informing about errors eq insufficient rights to use settings file etc +# A function for informing about errors eq. insufficient rights to use settings file +# in certain environments where administrative rights are needed to change files in program folders + def alert(windowTitle, alertMsg, additionalMsg, details): """Creates a message box for critical errors Args: @@ -245,7 +244,7 @@ def settingsFromJsonFile(file): settingsFile.close() return settingsData except Exception as e: - alert('Asetusten lukeminen ei onnistunut', 'Virhe avattaessa asetuksia', 'Lisätietoja Details-apinikkeella', str(e)) + alert('Asetusten lukeminen ei onnistunut', 'Virhe avattaessa asetuksia', 'Lisätietoja Details-painikkeella', str(e)) # A Function to save connection settings to a JSON file def saveSettingsToJsonFile(file, settingData): @@ -260,4 +259,4 @@ def saveSettingsToJsonFile(file, settingData): json.dump(settingData, settingsFile) settingsFile.close() # Close the file after except Exception as e: - alert('Asetusten tallennus ei onnistunut', 'Virhe tallennettaessa asetuksia', 'Lisätietoja Details-apinikkeella', str(e)) + alert('Asetusten tallennus ei onnistunut', 'Virhe tallennettaessa asetuksia', 'Lisätietoja Details-painikkeella', str(e))