fix: do not flip the UI on RTL languages

This commit is contained in:
Alfredo Monclus committed 2026-01-28 18:24:28 -03:00
1 parent 92b56f039b
commit f123c0ae1e
2 files changed
+6 -18

No files matched your search

+6 -16
View File
@@ -59,27 +59,17 @@ class Panel(ScreenPanel):
adjust.set_hexpand(False)
grid = Gtk.Grid(row_homogeneous=True, column_homogeneous=True)
if self._screen.vertical_mode:
if self._screen.lang_ltr:
grid.attach(self.buttons["x+"], 2, 1, 1, 1)
grid.attach(self.buttons["x-"], 0, 1, 1, 1)
grid.attach(self.buttons["z+"], 2, 2, 1, 1)
grid.attach(self.buttons["z-"], 0, 2, 1, 1)
else:
grid.attach(self.buttons["x+"], 0, 1, 1, 1)
grid.attach(self.buttons["x-"], 2, 1, 1, 1)
grid.attach(self.buttons["z+"], 0, 2, 1, 1)
grid.attach(self.buttons["z-"], 2, 2, 1, 1)
grid.attach(self.buttons["x+"], 2, 1, 1, 1)
grid.attach(self.buttons["x-"], 0, 1, 1, 1)
grid.attach(self.buttons["z+"], 2, 2, 1, 1)
grid.attach(self.buttons["z-"], 0, 2, 1, 1)
grid.attach(adjust, 1, 2, 1, 1)
grid.attach(self.buttons["y+"], 1, 0, 1, 1)
grid.attach(self.buttons["y-"], 1, 1, 1, 1)
else:
if self._screen.lang_ltr:
grid.attach(self.buttons["x+"], 2, 1, 1, 1)
grid.attach(self.buttons["x-"], 0, 1, 1, 1)
else:
grid.attach(self.buttons["x+"], 0, 1, 1, 1)
grid.attach(self.buttons["x-"], 2, 1, 1, 1)
grid.attach(self.buttons["x+"], 2, 1, 1, 1)
grid.attach(self.buttons["x-"], 0, 1, 1, 1)
grid.attach(self.buttons["y+"], 1, 0, 1, 1)
grid.attach(self.buttons["y-"], 1, 1, 1, 1)
if self._config.get_config()["main"].getboolean("invert_z", False):
-2
View File
@@ -99,7 +99,6 @@ class KlipperScreen(Gtk.Window):
configfile = os.path.normpath(os.path.expanduser(args.configfile))
self._config = KlipperScreenConfig(configfile, self)
self.lang_ltr = set_text_direction(self._config.get_main_config().get("language", None))
self.env = Environment(extensions=["jinja2.ext.i18n"], autoescape=True)
self.env.install_gettext_translations(self._config.get_lang())
@@ -807,7 +806,6 @@ class KlipperScreen(Gtk.Window):
def change_language(self, widget, lang):
self._config.install_language(lang)
self.lang_ltr = set_text_direction(lang)
self.env.install_gettext_translations(self._config.get_lang())
self._config._create_configurable_options(self)
self._config.set('main', 'language', lang)