Skip to content

Commit

Permalink
Added error hotkey translation
Browse files Browse the repository at this point in the history
  • Loading branch information
LOUDO56 committed May 29, 2024
1 parent 4532014 commit 105a5b9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/hotkeys/hotkeys_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def enableHotKeyDetection(self, type_of_hotkey, entry_to_change, index):
self.index_to_change = index
self.changeKey = True
self.entry_to_change = entry_to_change
self.entry_to_change.configure(text="Please key")
self.entry_to_change.configure(text=self.main_app.text_content["options_menu"]["settings_menu"]["hotkeys_settings"]["please_key_text"])

def clearHotKey(self, type, entry_to_change):
self.settings.change_settings("Hotkeys", type, None, [])
Expand Down Expand Up @@ -72,10 +72,10 @@ def __on_press(self, key):
and userSettings["Hotkeys"]["Record_Start"] == self.hotkeys
):
messagebox.showerror(
"Error",
"You can't have same hotkeys on start record and start playback.",
self.main_app.text_content["global"]["error"],
self.main_app.text_content["options_menu"]["settings_menu"]["hotkeys_settings"]["error_hotkeys"],
)
self.entry_to_change.configure(text="Please key")
self.entry_to_change.configure(text=self.main_app.text_content["options_menu"]["settings_menu"]["hotkeys_settings"]["please_key_text"])
self.hotkeys = []
self.hotkey_visible = []
return
Expand Down
3 changes: 2 additions & 1 deletion src/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"start_playback_text": "Start playback",
"stop_playback_text": "Stop playback",
"clear_text": "Clear",
"please_key_text": "Please key"
"please_key_text": "Please key",
"error_hotkeys": "You can't have same hotkeys on start record and start playback"
},
"minimization_text": "Minimization",
"minimization_menu": {
Expand Down
3 changes: 2 additions & 1 deletion src/langs/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"start_playback_text": "Jouer la lecture",
"stop_playback_text": "Stop la lecture",
"clear_text": "Effacer",
"please_key_text": "Touche svp"
"please_key_text": "Touche svp",
"error_hotkeys": "Vous ne pouvez pas avoir les mêmes touches de raccourci au démarrage de l'enregistrement et au démarrage de la lecture."
},
"minimization_text": "Minimisation",
"minimization_menu": {
Expand Down
13 changes: 8 additions & 5 deletions src/utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
from requests.exceptions import RequestException

class Version:
def __init__(self, userSettings):
def __init__(self, userSettings, main_app):
self.main_app = main_app
self.version = "1.1.7"
self.new_version = ""
if userSettings["Others"]["Check_update"]:
self.update = self.checkVersion()
else:
self.update = "Check update disabled"
self.update = self.main_app.text_content["help_menu"]["about_settings"]["version_check_update_text"]["disabled"]

def checkVersion(self):
api_url = f'https://api.github.com/repos/LOUDO56/PyMacroRecord/releases/latest'
Expand All @@ -19,8 +20,10 @@ def checkVersion(self):
if response.status_code == 200:
release_data = response.json()
self.new_version = release_data['tag_name'].replace('v', '')
return "Outdated" if self.new_version != self.version else "Up to Date"
return self.main_app.text_content["help_menu"]["about_settings"]["version_check_update_text"]["outdated"] \
if self.new_version != self.version \
else self.main_app.text_content["help_menu"]["about_settings"]["version_check_update_text"]["up_to_date"]
else:
return "Cannot fetch if new update"
return self.main_app.text_content["help_menu"]["about_settings"]["version_check_update_text"]["failed"]
except RequestException:
return "Cannot fetch if new update"
return self.main_app.text_content["help_menu"]["about_settings"]["version_check_update_text"]["failed"]
2 changes: 1 addition & 1 deletion src/windows/main/main_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self):
self.macro_recorded = False
self.prevent_record = False

self.version = Version(self.settings.get_config())
self.version = Version(self.settings.get_config(), self)

self.menu = MenuBar(self) # Menu Bar
self.macro = Macro(self)
Expand Down

0 comments on commit 105a5b9

Please sign in to comment.