@@ -13,11 +13,12 @@ class KlippyGtk:
|
||||
width_ratio = 16
|
||||
height_ratio = 9.375
|
||||
|
||||
def __init__(self, screen, width, height):
|
||||
def __init__(self, screen, width, height, theme):
|
||||
self.screen = screen
|
||||
|
||||
self.width = width
|
||||
self.height = height
|
||||
|
||||
self.theme = theme
|
||||
self.font_size = int(min(
|
||||
self.width / self.font_ratio[0],
|
||||
self.height / self.font_ratio[1]
|
||||
@@ -64,7 +65,7 @@ class KlippyGtk:
|
||||
def ImageLabel(self, image_name, text, size=20, style=False, width_scale=.32, height_scale=.32):
|
||||
box1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=15)
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
"%s/styles/z-bolt/images/%s.svg" % (klipperscreendir, str(image_name)),
|
||||
"%s/styles/%s/images/%s.svg" % (klipperscreendir, self.theme, str(image_name)),
|
||||
int(round(self.img_width * width_scale)), int(round(self.img_height * height_scale)), True)
|
||||
|
||||
image = Gtk.Image.new_from_pixbuf(pixbuf)
|
||||
@@ -82,7 +83,7 @@ class KlippyGtk:
|
||||
|
||||
def Image(self, image_name, style=False, width_scale=1, height_scale=1):
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
"%s/styles/z-bolt/images/%s" % (klipperscreendir, str(image_name)),
|
||||
"%s/styles/%s/images/%s" % (klipperscreendir, self.theme, str(image_name)),
|
||||
int(round(self.img_width * width_scale)), int(round(self.img_height * height_scale)), True)
|
||||
|
||||
return Gtk.Image.new_from_pixbuf(pixbuf)
|
||||
@@ -132,7 +133,7 @@ class KlippyGtk:
|
||||
|
||||
def ButtonImage(self, image_name, label=None, style=None, width_scale=1, height_scale=1,
|
||||
position=Gtk.PositionType.TOP, word_wrap=True):
|
||||
filename = "%s/styles/z-bolt/images/%s.svg" % (klipperscreendir, str(image_name))
|
||||
filename = "%s/styles/%s/images/%s.svg" % (klipperscreendir, self.theme, str(image_name))
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
filename,
|
||||
int(round(self.img_width * width_scale)),
|
||||
@@ -198,7 +199,7 @@ class KlippyGtk:
|
||||
|
||||
|
||||
def ToggleButtonImage(self, image_name, label, style=False, width_scale=1, height_scale=1):
|
||||
filename = "%s/styles/z-bolt/images/%s.svg" % (klipperscreendir, str(image_name))
|
||||
filename = "%s/styles/%s/images/%s.svg" % (klipperscreendir, self.theme, str(image_name))
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
|
||||
filename,
|
||||
int(round(self.img_width * width_scale)),
|
||||
@@ -257,5 +258,5 @@ class KlippyGtk:
|
||||
|
||||
def formatTemperatureString(self, temp, target):
|
||||
if (target > temp-2 and target < temp+2) or round(target,0) == 0:
|
||||
return str(round(temp,2)) + "°C" #°C →"
|
||||
return str(round(temp,1)) + "°C" #°C →"
|
||||
return str(round(temp)) + " → " + str(round(target)) + "°C"
|
||||
|
Reference in New Issue
Block a user