bed_level/move/temperature/zcalibrate: RTL support

This commit is contained in:
Jordan Ruthe 2021-01-09 22:21:27 -05:00
parent 4f929ba342
commit 0453627d40
4 changed files with 24 additions and 11 deletions

View File

@ -90,10 +90,16 @@ class BedLevelPanel(ScreenPanel):
self.labels['fr'] = self._gtk.ButtonImage("bed-level-b-r", None, None, 3, 3)
self.labels['fr'].connect("clicked", self.go_to_position, self.screws[1])
grid.attach(self.labels['bl'], 1, 0, 1, 1)
grid.attach(self.labels['br'], 2, 0, 1, 1)
grid.attach(self.labels['fl'], 1, 1, 1, 1)
grid.attach(self.labels['fr'], 2, 1, 1, 1)
if self._screen.lang_ltr:
grid.attach(self.labels['bl'], 1, 0, 1, 1)
grid.attach(self.labels['br'], 2, 0, 1, 1)
grid.attach(self.labels['fl'], 1, 1, 1, 1)
grid.attach(self.labels['fr'], 2, 1, 1, 1)
else:
grid.attach(self.labels['bl'], 2, 0, 1, 1)
grid.attach(self.labels['br'], 1, 0, 1, 1)
grid.attach(self.labels['fl'], 2, 1, 1, 1)
grid.attach(self.labels['fr'], 1, 1, 1, 1)
self.labels['home'] = self._gtk.ButtonImage("home",_("Home All"),"color2")
self.labels['home'].connect("clicked", self.home)

View File

@ -40,9 +40,12 @@ class MovePanel(ScreenPanel):
self.labels['home'] = self._gtk.ButtonImage("home", _("Home All"))
self.labels['home'].connect("clicked", self.home)
grid.attach(self.labels['x+'], 2, 1, 1, 1)
grid.attach(self.labels['x-'], 0, 1, 1, 1)
if self._screen.lang_ltr:
grid.attach(self.labels['x+'], 2, 1, 1, 1)
grid.attach(self.labels['x-'], 0, 1, 1, 1)
else:
grid.attach(self.labels['x+'], 0, 1, 1, 1)
grid.attach(self.labels['x-'], 2, 1, 1, 1)
grid.attach(self.labels['y+'], 1, 0, 1, 1)
grid.attach(self.labels['y-'], 1, 1, 1, 1)
grid.attach(self.labels['z+'], 3, 0, 1, 1)
@ -54,11 +57,12 @@ class MovePanel(ScreenPanel):
j = 0;
for i in self.distances:
self.labels[i] = self._gtk.ToggleButton(i)
self.labels[i].set_direction(Gtk.TextDirection.LTR)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if j == 0:
if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_top")
elif j == len(self.distances)-1:
elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
@ -76,6 +80,7 @@ class MovePanel(ScreenPanel):
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
bottomgrid = self._gtk.HomogeneousGrid()
bottomgrid.set_direction(Gtk.TextDirection.LTR)
self.labels['pos_x'] = Gtk.Label("X: 0")
self.labels['pos_y'] = Gtk.Label("Y: 0")
self.labels['pos_z'] = Gtk.Label("Z: 0")

View File

@ -113,6 +113,7 @@ class TemperaturePanel(ScreenPanel):
_ = self.lang.gettext
numpad = self._gtk.HomogeneousGrid()
numpad.set_direction(Gtk.TextDirection.LTR)
keys = [
['1','numpad_tleft'],

View File

@ -43,11 +43,12 @@ class ZCalibratePanel(ScreenPanel):
j = 0;
for i in self.distances:
self.labels[i] = self._gtk.ToggleButton(i)
self.labels[i].set_direction(Gtk.TextDirection.LTR)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if j == 0:
if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_top")
elif j == len(self.distances)-1:
elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")