This commit is contained in:
Alfredo Monclus 2021-10-07 18:51:13 -03:00 committed by jordanruthe
parent 139115a0e9
commit ac3bde654a
4 changed files with 17 additions and 9 deletions

View File

@ -42,8 +42,8 @@ class HeaterGraph(Gtk.DrawingArea):
height = da.get_allocated_height() height = da.get_allocated_height()
g_width_start = 30 g_width_start = 30
g_width = width - 5 g_width = width - 15
g_height_start = 5 g_height_start = 15
g_height = height - 30 g_height = height - 30
ctx.set_source_rgb(.5, .5, .5) ctx.set_source_rgb(.5, .5, .5)
@ -66,8 +66,11 @@ class HeaterGraph(Gtk.DrawingArea):
] ]
points_per_pixel = self.max_length / (gsize[1][0]-gsize[0][0]) graph_width = gsize[1][0] - gsize[0][0]
data_points = (gsize[1][0]-gsize[0][0]) * points_per_pixel points_per_pixel = self.max_length / graph_width
if points_per_pixel > 3:
points_per_pixel = 3
data_points = graph_width * points_per_pixel
logging.info("aa: %s %s" % (points_per_pixel, data_points)) logging.info("aa: %s %s" % (points_per_pixel, data_points))
max_num = math.ceil(self.get_max_num(data_points) * 1.1 / 10) * 10 max_num = math.ceil(self.get_max_num(data_points) * 1.1 / 10) * 10
d_width = 1 / points_per_pixel d_width = 1 / points_per_pixel
@ -130,7 +133,7 @@ class HeaterGraph(Gtk.DrawingArea):
for i in range(r): for i in range(r):
ctx.set_source_rgb(.5, .5, .5) ctx.set_source_rgb(.5, .5, .5)
lheight = gsize[1][1] - nscale*i*hscale lheight = gsize[1][1] - nscale*i*hscale
ctx.move_to(10, lheight + 3) ctx.move_to(6, lheight + 3)
ctx.show_text(str(nscale*i).rjust(3, " ")) ctx.show_text(str(nscale*i).rjust(3, " "))
ctx.stroke() ctx.stroke()
ctx.set_source_rgba(.5, .5, .5, .2) ctx.set_source_rgba(.5, .5, .5, .2)
@ -156,7 +159,7 @@ class HeaterGraph(Gtk.DrawingArea):
ctx.stroke() ctx.stroke()
ctx.set_source_rgb(.5, .5, .5) ctx.set_source_rgb(.5, .5, .5)
ctx.move_to(x - 15, gsize[1][1] + 10) ctx.move_to(x - 15, gsize[1][1] + 15)
hour = now.hour hour = now.hour
min = now.minute - (now.minute % 2) - i*2 min = now.minute - (now.minute % 2) - i*2

View File

@ -41,10 +41,8 @@ class ScreenPanel:
self._screen._ws.klippy.emergency_stop() self._screen._ws.klippy.emergency_stop()
def format_target(self, temp): def format_target(self, temp):
_ = self.lang.gettext
if temp <= 0: if temp <= 0:
return _("Off") return ""
else: else:
return self.format_temp(temp, 0) return self.format_temp(temp, 0)

View File

@ -94,6 +94,9 @@ class MainPanel(MenuPanel):
name.connect('clicked', self.on_popover_clicked, device) name.connect('clicked', self.on_popover_clicked, device)
name.set_alignment(0, .5) name.set_alignment(0, .5)
name.get_style_context().add_class(class_name) name.get_style_context().add_class(class_name)
child = name.get_children()[0].get_children()[0].get_children()[1]
child.set_ellipsize(True)
child.set_ellipsize(Pango.EllipsizeMode.END)
logging.info("DClass %s %s" % (device, class_name)) logging.info("DClass %s %s" % (device, class_name))

View File

@ -247,6 +247,10 @@ trough {
min-height: 350px; min-height: 350px;
} }
.heater-grid {
margin-right: .5em;
}
.heater-grid label { .heater-grid label {
margin-top: .3em; margin-top: .3em;
margin-bottom: .3em; margin-bottom: .3em;