Skip to content

Commit

Permalink
Addes some clarifying comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaVainio committed Feb 12, 2023
1 parent 9e03553 commit 0a91b98
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down Expand Up @@ -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."""

Expand Down Expand Up @@ -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."""

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand All @@ -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))

0 comments on commit 0a91b98

Please sign in to comment.