Graph: improve look when there is little space

This commit is contained in:
alfrix 2022-02-05 10:24:09 -03:00
parent c1b9123e9e
commit 20aa25256f
2 changed files with 6 additions and 11 deletions

View File

@ -69,8 +69,8 @@ class HeaterGraph(Gtk.DrawingArea):
g_width_start = 30
g_width = width - 15
g_height_start = 15
g_height = height - 30
g_height_start = 10
g_height = height - 20
ctx.set_source_rgb(.5, .5, .5)
ctx.set_line_width(1)
@ -144,14 +144,9 @@ class HeaterGraph(Gtk.DrawingArea):
ctx.fill()
def graph_lines(self, ctx, gsize, max_num):
if max_num <= 30:
nscale = 5
elif max_num <= 60:
nscale = 10
elif max_num <= 130:
nscale = 25
else:
nscale = 50
nscale = 5
while (max_num / nscale) > 5:
nscale += 5
# nscale = math.floor((max_num / 10) / 4) * 10
r = int(max_num/nscale) + 1
hscale = (gsize[1][1] - gsize[0][1]) / (r * nscale)

View File

@ -21,7 +21,7 @@ class PrinterSelect(ScreenPanel):
printers = self._config.get_printers()
grid = self._gtk.HomogeneousGrid()
grid = self._gtk.HomogeneousGrid()
self.content.add(grid)
length = len(printers)