mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 22:23:57 -06:00
Make translateSettingName use dictionary look-up
This solution is a bit neater in code. It makes the function perform a single purpose, since it no longer translates a list of setting names but just one. Also it now neatly puts the translations in a separate, easy-to-modify dict. Only disadvantage is when simple key look-up is not sufficient, such as when renaming lots of settings at once, where substring matching would make the code a bit shorter. But we shouldn't do such a rename anyway. Contributes to issue CURA-844.
This commit is contained in:
parent
f07598a228
commit
88b36ad3d7
2 changed files with 14 additions and 13 deletions
|
@ -53,7 +53,8 @@ class Preferences:
|
|||
visible_settings = self._config.get("machines", "setting_visibility")
|
||||
visible_settings = visible_settings.split(",")
|
||||
import VersionUpgrade21to22 #Import here to prevent a circular dependency.
|
||||
VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateSettingNames(visible_settings)
|
||||
visible_settings = [VersionUpgrade21to22.VersionUpgrade21to22.VersionUpgrade21to22.translateSettingName(setting_name)
|
||||
for setting_name in visible_settings]
|
||||
visible_settings = ",".join(visible_settings)
|
||||
self._config.set("machines", "setting_visibility", value = visible_settings)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue