PEP8, typos and warnings fixes
This commit is contained in:
parent
fd2a717ece
commit
5a36729b76
@ -106,7 +106,7 @@ temperature_fan: 40
|
|||||||
gcode: MY_HEATSOAK_MACRO
|
gcode: MY_HEATSOAK_MACRO
|
||||||
```
|
```
|
||||||
|
|
||||||
There is an special preheat setting named cooldown to do additional things when the _cooldown_ button is pressed
|
There is a special preheat setting named cooldown to do additional things when the _cooldown_ button is pressed
|
||||||
for example:
|
for example:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
## Create Translations
|
## Create Translations
|
||||||
|
|
||||||
You can use a editor such as [poedit](https://poedit.net/) to assist in translations. This guide will assume that you
|
You can use an editor such as [poedit](https://poedit.net/) to assist in translations. This guide will assume that you
|
||||||
will be using poedit.
|
will be using poedit.
|
||||||
|
|
||||||
This guide will refer to `language designation`. This can be found from running `echo $LANG` on your pi, as long as you
|
This guide will refer to `language designation`. This can be found from running `echo $LANG` on your pi, as long as you
|
||||||
|
@ -47,7 +47,7 @@ If you have another fb, try changing it:
|
|||||||
|
|
||||||
for example: change `/dev/fb0` to `/dev/fb1`
|
for example: change `/dev/fb0` to `/dev/fb1`
|
||||||
|
|
||||||
Once you have saved that file, restart KlipperScreen and it should show up on your display.
|
Once you have saved that file, restart KlipperScreen.
|
||||||
|
|
||||||
## Screen is all white or blank or no signal
|
## Screen is all white or blank or no signal
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
class KlippyGcodes:
|
class KlippyGcodes:
|
||||||
|
|
||||||
HOME = "G28"
|
HOME = "G28"
|
||||||
HOME_X = "G28 X"
|
HOME_X = "G28 X"
|
||||||
HOME_Y = "G28 Y"
|
HOME_Y = "G28 Y"
|
||||||
@ -33,7 +32,6 @@ class KlippyGcodes:
|
|||||||
RESTART = "RESTART"
|
RESTART = "RESTART"
|
||||||
FIRMWARE_RESTART = "FIRMWARE_RESTART"
|
FIRMWARE_RESTART = "FIRMWARE_RESTART"
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_bed_temp(temp):
|
def set_bed_temp(temp):
|
||||||
return "%s S%s" % (KlippyGcodes.SET_BED_TEMP, str(temp))
|
return "%s S%s" % (KlippyGcodes.SET_BED_TEMP, str(temp))
|
||||||
@ -52,7 +50,7 @@ class KlippyGcodes:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_fan_speed(speed):
|
def set_fan_speed(speed):
|
||||||
speed = str(int(float(int(speed) % 101)/100*255))
|
speed = str(int(float(int(speed) % 101) / 100 * 255))
|
||||||
return "%s S%s" % (KlippyGcodes.SET_FAN_SPEED, speed)
|
return "%s S%s" % (KlippyGcodes.SET_FAN_SPEED, speed)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -7,6 +7,7 @@ import pathlib
|
|||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import Gdk, GdkPixbuf, Gio, Gtk, Pango
|
from gi.repository import Gdk, GdkPixbuf, Gio, Gtk, Pango
|
||||||
|
|
||||||
|
|
||||||
class KlippyGtk:
|
class KlippyGtk:
|
||||||
labels = {}
|
labels = {}
|
||||||
keyboard_ratio = .22
|
keyboard_ratio = .22
|
||||||
@ -29,7 +30,7 @@ class KlippyGtk:
|
|||||||
))
|
))
|
||||||
if fontsize_type == "small":
|
if fontsize_type == "small":
|
||||||
self.font_size = round(self.font_size * 0.91)
|
self.font_size = round(self.font_size * 0.91)
|
||||||
elif (fontsize_type == "large"):
|
elif fontsize_type == "large":
|
||||||
self.font_size = round(self.font_size * 1.09)
|
self.font_size = round(self.font_size * 1.09)
|
||||||
self.header_size = int(round((self.width / self.width_ratio) / 1.33))
|
self.header_size = int(round((self.width / self.width_ratio) / 1.33))
|
||||||
self.img_width = int(round(self.width / self.width_ratio))
|
self.img_width = int(round(self.width / self.width_ratio))
|
||||||
@ -46,7 +47,7 @@ class KlippyGtk:
|
|||||||
|
|
||||||
for key in self.color_list:
|
for key in self.color_list:
|
||||||
if "base" in self.color_list[key]:
|
if "base" in self.color_list[key]:
|
||||||
rgb = [int(self.color_list[key]['base'][i:i+2], 16) for i in range(0, 6, 2)]
|
rgb = [int(self.color_list[key]['base'][i:i + 2], 16) for i in range(0, 6, 2)]
|
||||||
self.color_list[key]['rgb'] = rgb
|
self.color_list[key]['rgb'] = rgb
|
||||||
|
|
||||||
logging.debug("img width: %s height: %s" % (self.img_width, self.img_height))
|
logging.debug("img width: %s height: %s" % (self.img_width, self.img_height))
|
||||||
@ -89,14 +90,14 @@ class KlippyGtk:
|
|||||||
rgb[1] = rgb[1] + self.color_list[device]['hsplit'] * self.color_list[device]['state']
|
rgb[1] = rgb[1] + self.color_list[device]['hsplit'] * self.color_list[device]['state']
|
||||||
self.color_list[device]['state'] += 1
|
self.color_list[device]['state'] += 1
|
||||||
color = '{:02X}{:02X}{:02X}'.format(rgb[0], rgb[1], rgb[2])
|
color = '{:02X}{:02X}{:02X}'.format(rgb[0], rgb[1], rgb[2])
|
||||||
rgb = [x/255 for x in rgb]
|
rgb = [x / 255 for x in rgb]
|
||||||
# logging.debug("Assigning color: %s %s %s" % (device, rgb, color))
|
# logging.debug("Assigning color: %s %s %s" % (device, rgb, color))
|
||||||
else:
|
else:
|
||||||
colors = self.color_list[device]['colors']
|
colors = self.color_list[device]['colors']
|
||||||
if self.color_list[device]['state'] >= len(colors):
|
if self.color_list[device]['state'] >= len(colors):
|
||||||
self.color_list[device]['state'] = 0
|
self.color_list[device]['state'] = 0
|
||||||
color = colors[self.color_list[device]['state'] % len(colors)]
|
color = colors[self.color_list[device]['state'] % len(colors)]
|
||||||
rgb = [int(color[i:i+2], 16)/255 for i in range(0, 6, 2)]
|
rgb = [int(color[i:i + 2], 16) / 255 for i in range(0, 6, 2)]
|
||||||
self.color_list[device]['state'] += 1
|
self.color_list[device]['state'] += 1
|
||||||
# logging.debug("Assigning color: %s %s %s" % (device, rgb, color))
|
# logging.debug("Assigning color: %s %s %s" % (device, rgb, color))
|
||||||
|
|
||||||
@ -106,14 +107,13 @@ class KlippyGtk:
|
|||||||
for key in self.color_list:
|
for key in self.color_list:
|
||||||
self.color_list[key]['state'] = 0
|
self.color_list[key]['state'] = 0
|
||||||
|
|
||||||
|
|
||||||
def Label(self, label, style=None):
|
def Label(self, label, style=None):
|
||||||
la = Gtk.Label(label)
|
la = Gtk.Label(label)
|
||||||
if style is not None and style is not False:
|
if style is not None and style is not False:
|
||||||
la.get_style_context().add_class(style)
|
la.get_style_context().add_class(style)
|
||||||
return la
|
return la
|
||||||
|
|
||||||
def Image(self, image_name, scale=1):
|
def Image(self, image_name, scale=1.0):
|
||||||
filename = os.path.join(self.themedir, str(image_name) + ".svg")
|
filename = os.path.join(self.themedir, str(image_name) + ".svg")
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename,
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename,
|
||||||
@ -201,7 +201,7 @@ class KlippyGtk:
|
|||||||
button = dialog.get_children()[0].get_children()[0].get_children()[0].get_children()[i]
|
button = dialog.get_children()[0].get_children()[0].get_children()[0].get_children()[i]
|
||||||
button.get_child().set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
button.get_child().set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
||||||
button.get_child().set_line_wrap(True)
|
button.get_child().set_line_wrap(True)
|
||||||
button.set_size_request((screen.width-30)/3, screen.height/5)
|
button.set_size_request((screen.width - 30) / 3, screen.height / 5)
|
||||||
|
|
||||||
dialog.connect("response", callback, *args)
|
dialog.connect("response", callback, *args)
|
||||||
dialog.get_style_context().add_class("dialog")
|
dialog.get_style_context().add_class("dialog")
|
||||||
@ -222,7 +222,6 @@ class KlippyGtk:
|
|||||||
|
|
||||||
return dialog
|
return dialog
|
||||||
|
|
||||||
|
|
||||||
def ToggleButtonImage(self, image_name, label, style=False, scale=1.38):
|
def ToggleButtonImage(self, image_name, label, style=False, scale=1.38):
|
||||||
|
|
||||||
b = Gtk.ToggleButton(label=label)
|
b = Gtk.ToggleButton(label=label)
|
||||||
@ -263,21 +262,20 @@ class KlippyGtk:
|
|||||||
return name[0:25] + "\n" + name[25:50]
|
return name[0:25] + "\n" + name[25:50]
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
def formatTimeString(self, seconds):
|
def formatTimeString(self, seconds):
|
||||||
time = int(seconds)
|
time = int(seconds)
|
||||||
text = ""
|
text = ""
|
||||||
if int(time/86400) != 0:
|
if int(time / 86400) != 0:
|
||||||
text += str(int(time/86400))+"d "
|
text += str(int(time / 86400)) + "d "
|
||||||
if int(time/3600) != 0:
|
if int(time / 3600) != 0:
|
||||||
text += str(int(time/3600) % 24)+"h "
|
text += str(int(time / 3600) % 24) + "h "
|
||||||
if int(time/60) != 0:
|
if int(time / 60) != 0:
|
||||||
text += str(int(time/60) % 60)+"m "
|
text += str(int(time / 60) % 60) + "m "
|
||||||
else:
|
else:
|
||||||
text = str(time % 60)+"s"
|
text = str(time % 60) + "s"
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def formatTemperatureString(self, temp, target):
|
def formatTemperatureString(self, temp, target):
|
||||||
if (target > temp-2 and target < temp+2) or round(target, 0) == 0:
|
if (temp - 2 < target < temp + 2) or round(target, 0) == 0:
|
||||||
return str(round(temp, 1)) + "°C" # °C →"
|
return str(round(temp, 1)) + "°C" # °C →"
|
||||||
return str(round(temp)) + " °C\n(" + str(round(target)) + ")"
|
return str(round(temp)) + " °C\n(" + str(round(target)) + ")"
|
||||||
|
@ -2,6 +2,7 @@ import json
|
|||||||
import requests
|
import requests
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class KlippyRest:
|
class KlippyRest:
|
||||||
def __init__(self, ip, port=7125, api_key=False):
|
def __init__(self, ip, port=7125, api_key=False):
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
|
@ -26,6 +26,7 @@ api = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class KlippyWebsocket(threading.Thread):
|
class KlippyWebsocket(threading.Thread):
|
||||||
_req_id = 0
|
_req_id = 0
|
||||||
connected = False
|
connected = False
|
||||||
@ -70,7 +71,7 @@ class KlippyWebsocket(threading.Thread):
|
|||||||
if self.reconnect_count > 3:
|
if self.reconnect_count > 3:
|
||||||
self._screen.panels['splash_screen'].update_text(
|
self._screen.panels['splash_screen'].update_text(
|
||||||
_("Cannot connect to Moonraker") +
|
_("Cannot connect to Moonraker") +
|
||||||
("\n\n%s\n\n") % self._url +
|
"\n\n%s\n\n" % self._url +
|
||||||
_("Retry #%s") % self.reconnect_count)
|
_("Retry #%s") % self.reconnect_count)
|
||||||
return False
|
return False
|
||||||
token = self._screen.apiclient.get_oneshot_token()
|
token = self._screen.apiclient.get_oneshot_token()
|
||||||
@ -195,6 +196,7 @@ class KlippyWebsocket(threading.Thread):
|
|||||||
def on_error(self, ws, error):
|
def on_error(self, ws, error):
|
||||||
logging.debug("Websocket error: %s" % error)
|
logging.debug("Websocket error: %s" % error)
|
||||||
|
|
||||||
|
|
||||||
class MoonrakerApi:
|
class MoonrakerApi:
|
||||||
def __init__(self, ws):
|
def __init__(self, ws):
|
||||||
self._ws = ws
|
self._ws = ws
|
||||||
|
@ -12,19 +12,21 @@ from io import StringIO
|
|||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
SCREEN_BLANKING_OPTIONS = [
|
SCREEN_BLANKING_OPTIONS = [
|
||||||
"300", # 5 Minutes
|
"300", # 5 Minutes
|
||||||
"900", # 15 Minutes
|
"900", # 15 Minutes
|
||||||
"1800", # 30 Minutes
|
"1800", # 30 Minutes
|
||||||
"3600", # 1 Hour
|
"3600", # 1 Hour
|
||||||
"7200", # 2 Hours
|
"7200", # 2 Hours
|
||||||
"14400", # 4 Hours
|
"14400", # 4 Hours
|
||||||
]
|
]
|
||||||
|
|
||||||
klipperscreendir = pathlib.Path(__file__).parent.resolve().parent
|
klipperscreendir = pathlib.Path(__file__).parent.resolve().parent
|
||||||
|
|
||||||
|
|
||||||
class ConfigError(Exception):
|
class ConfigError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class KlipperScreenConfig:
|
class KlipperScreenConfig:
|
||||||
config = None
|
config = None
|
||||||
configfile_name = "KlipperScreen.conf"
|
configfile_name = "KlipperScreen.conf"
|
||||||
@ -103,10 +105,10 @@ class KlipperScreenConfig:
|
|||||||
_n = self.lang.ngettext
|
_n = self.lang.ngettext
|
||||||
|
|
||||||
self.configurable_options = [
|
self.configurable_options = [
|
||||||
{"language": {"section": "main", "name": _("Language"), "type": "dropdown", "value": "system_lang",
|
{"language": {
|
||||||
"callback": screen.restart_warning, "options": [
|
"section": "main", "name": _("Language"), "type": "dropdown", "value": "system_lang",
|
||||||
{"name": _("System") + " " + _("(default)"), "value": "system_lang"}
|
"callback": screen.restart_warning, "options": [
|
||||||
]}},
|
{"name": _("System") + " " + _("(default)"), "value": "system_lang"}]}},
|
||||||
{"theme": {
|
{"theme": {
|
||||||
"section": "main", "name": _("Icon Theme"), "type": "dropdown",
|
"section": "main", "name": _("Icon Theme"), "type": "dropdown",
|
||||||
"value": "z-bolt", "callback": screen.restart_warning, "options": [
|
"value": "z-bolt", "callback": screen.restart_warning, "options": [
|
||||||
@ -177,11 +179,11 @@ class KlipperScreenConfig:
|
|||||||
index = self.configurable_options.index(
|
index = self.configurable_options.index(
|
||||||
[i for i in self.configurable_options if list(i)[0] == "screen_blanking"][0])
|
[i for i in self.configurable_options if list(i)[0] == "screen_blanking"][0])
|
||||||
for num in SCREEN_BLANKING_OPTIONS:
|
for num in SCREEN_BLANKING_OPTIONS:
|
||||||
hour = int(int(num)/3600)
|
hour = int(int(num) / 3600)
|
||||||
if hour > 0:
|
if hour > 0:
|
||||||
name = str(hour) + " " + _n("hour", "hours", hour)
|
name = str(hour) + " " + _n("hour", "hours", hour)
|
||||||
else:
|
else:
|
||||||
name = str(int(int(num)/60)) + " " + _("minutes")
|
name = str(int(int(num) / 60)) + " " + _("minutes")
|
||||||
self.configurable_options[index]['screen_blanking']['options'].append({
|
self.configurable_options[index]['screen_blanking']['options'].append({
|
||||||
"name": name,
|
"name": name,
|
||||||
"value": num
|
"value": num
|
||||||
@ -258,7 +260,7 @@ class KlipperScreenConfig:
|
|||||||
user_def.append(line.replace('\n', ''))
|
user_def.append(line.replace('\n', ''))
|
||||||
else:
|
else:
|
||||||
if line.startswith(self.do_not_edit_prefix):
|
if line.startswith(self.do_not_edit_prefix):
|
||||||
saved_def.append(line[(len(self.do_not_edit_prefix)+1):])
|
saved_def.append(line[(len(self.do_not_edit_prefix) + 1):])
|
||||||
return ["\n".join(user_def), None if saved_def is None else "\n".join(saved_def)]
|
return ["\n".join(user_def), None if saved_def is None else "\n".join(saved_def)]
|
||||||
|
|
||||||
def get_config_file_location(self, file):
|
def get_config_file_location(self, file):
|
||||||
@ -312,7 +314,6 @@ class KlipperScreenConfig:
|
|||||||
return False
|
return False
|
||||||
return self.config[name].get('name')
|
return self.config[name].get('name')
|
||||||
|
|
||||||
|
|
||||||
def get_preheat_options(self):
|
def get_preheat_options(self):
|
||||||
index = "preheat "
|
index = "preheat "
|
||||||
items = [i[len(index):] for i in self.config.sections() if i.startswith(index)]
|
items = [i[len(index):] for i in self.config.sections() if i.startswith(index)]
|
||||||
|
@ -2,10 +2,12 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
class KlippyFiles():
|
|
||||||
|
class KlippyFiles:
|
||||||
def __init__(self, screen):
|
def __init__(self, screen):
|
||||||
self._screen = screen
|
self._screen = screen
|
||||||
self.callbacks = []
|
self.callbacks = []
|
||||||
@ -177,7 +179,7 @@ class KlippyFiles():
|
|||||||
self.run_callbacks(deletedfiles=[filename])
|
self.run_callbacks(deletedfiles=[filename])
|
||||||
|
|
||||||
def ret_file_data(self, filename):
|
def ret_file_data(self, filename):
|
||||||
print("Getting file info for %s" % (filename))
|
print("Getting file info for %s" % filename)
|
||||||
self._screen._ws.klippy.get_file_metadata(filename, self._callback)
|
self._screen._ws.klippy.get_file_metadata(filename, self._callback)
|
||||||
|
|
||||||
def run_callbacks(self, newfiles=[], deletedfiles=[], mods=[]):
|
def run_callbacks(self, newfiles=[], deletedfiles=[], mods=[]):
|
||||||
|
@ -17,6 +17,7 @@ try:
|
|||||||
ctypes.cdll.LoadLibrary('libXext.so.6')
|
ctypes.cdll.LoadLibrary('libXext.so.6')
|
||||||
libXext = ctypes.CDLL('libXext.so.6')
|
libXext = ctypes.CDLL('libXext.so.6')
|
||||||
|
|
||||||
|
|
||||||
class DPMS_State:
|
class DPMS_State:
|
||||||
Fail = -1
|
Fail = -1
|
||||||
On = 0
|
On = 0
|
||||||
@ -24,6 +25,7 @@ try:
|
|||||||
Suspend = 2
|
Suspend = 2
|
||||||
Off = 3
|
Off = 3
|
||||||
|
|
||||||
|
|
||||||
def get_DPMS_state(display_name_in_byte_string=b':0'):
|
def get_DPMS_state(display_name_in_byte_string=b':0'):
|
||||||
state = DPMS_State.Fail
|
state = DPMS_State.Fail
|
||||||
if not isinstance(display_name_in_byte_string, bytes):
|
if not isinstance(display_name_in_byte_string, bytes):
|
||||||
@ -35,8 +37,8 @@ try:
|
|||||||
dummy1_i_p = ctypes.create_string_buffer(8)
|
dummy1_i_p = ctypes.create_string_buffer(8)
|
||||||
dummy2_i_p = ctypes.create_string_buffer(8)
|
dummy2_i_p = ctypes.create_string_buffer(8)
|
||||||
if display.value:
|
if display.value:
|
||||||
if libXext.DPMSQueryExtension(display, dummy1_i_p, dummy2_i_p)\
|
if libXext.DPMSQueryExtension(display, dummy1_i_p, dummy2_i_p) \
|
||||||
and libXext.DPMSCapable(display):
|
and libXext.DPMSCapable(display):
|
||||||
onoff_p = ctypes.create_string_buffer(1)
|
onoff_p = ctypes.create_string_buffer(1)
|
||||||
state_p = ctypes.create_string_buffer(2)
|
state_p = ctypes.create_string_buffer(2)
|
||||||
if libXext.DPMSInfo(display, state_p, onoff_p):
|
if libXext.DPMSInfo(display, state_p, onoff_p):
|
||||||
@ -45,14 +47,18 @@ try:
|
|||||||
state = struct.unpack('H', state_p.raw)[0]
|
state = struct.unpack('H', state_p.raw)[0]
|
||||||
libXext.XCloseDisplay(display)
|
libXext.XCloseDisplay(display)
|
||||||
return state
|
return state
|
||||||
|
|
||||||
|
|
||||||
dpms_loaded = True
|
dpms_loaded = True
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def get_network_interfaces():
|
def get_network_interfaces():
|
||||||
stream = os.popen("ip addr | grep ^'[0-9]' | cut -d ' ' -f 2 | grep -o '[a-zA-Z0-9\\.]*'")
|
stream = os.popen("ip addr | grep ^'[0-9]' | cut -d ' ' -f 2 | grep -o '[a-zA-Z0-9\\.]*'")
|
||||||
return [i for i in stream.read().strip().split('\n') if not i.startswith('lo')]
|
return [i for i in stream.read().strip().split('\n') if not i.startswith('lo')]
|
||||||
|
|
||||||
|
|
||||||
def get_wireless_interfaces():
|
def get_wireless_interfaces():
|
||||||
p = subprocess.Popen(["which", "iwconfig"], stdout=subprocess.PIPE)
|
p = subprocess.Popen(["which", "iwconfig"], stdout=subprocess.PIPE)
|
||||||
|
|
||||||
@ -76,6 +82,7 @@ def get_wireless_interfaces():
|
|||||||
|
|
||||||
return interfaces
|
return interfaces
|
||||||
|
|
||||||
|
|
||||||
def get_software_version():
|
def get_software_version():
|
||||||
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always',
|
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always',
|
||||||
'--tags', '--long', '--dirty')
|
'--tags', '--long', '--dirty')
|
||||||
@ -95,6 +102,7 @@ def get_software_version():
|
|||||||
logging.exception("Error runing git describe")
|
logging.exception("Error runing git describe")
|
||||||
return "?"
|
return "?"
|
||||||
|
|
||||||
|
|
||||||
def patch_threading_excepthook():
|
def patch_threading_excepthook():
|
||||||
"""Installs our exception handler into the threading modules Thread object
|
"""Installs our exception handler into the threading modules Thread object
|
||||||
Inspired by https://bugs.python.org/issue1230540
|
Inspired by https://bugs.python.org/issue1230540
|
||||||
@ -112,15 +120,18 @@ def patch_threading_excepthook():
|
|||||||
raise
|
raise
|
||||||
except Exception:
|
except Exception:
|
||||||
sys.excepthook(*sys.exc_info(), thread_identifier=threading.get_ident())
|
sys.excepthook(*sys.exc_info(), thread_identifier=threading.get_ident())
|
||||||
|
|
||||||
self.run = run_with_excepthook
|
self.run = run_with_excepthook
|
||||||
|
|
||||||
threading.Thread.__init__ = new_init
|
threading.Thread.__init__ = new_init
|
||||||
|
|
||||||
|
|
||||||
# Timed rotating file handler based on Klipper and Moonraker's implementation
|
# Timed rotating file handler based on Klipper and Moonraker's implementation
|
||||||
class KlipperScreenLoggingHandler(logging.handlers.TimedRotatingFileHandler):
|
class KlipperScreenLoggingHandler(logging.handlers.TimedRotatingFileHandler):
|
||||||
def __init__(self, software_version, filename, **kwargs):
|
def __init__(self, software_version, filename, **kwargs):
|
||||||
super(KlipperScreenLoggingHandler, self).__init__(filename, **kwargs)
|
super(KlipperScreenLoggingHandler, self).__init__(filename, **kwargs)
|
||||||
self.rollover_info = {
|
self.rollover_info = {
|
||||||
'header': f"{'-'*20}KlipperScreen Log Start{'-'*20}",
|
'header': f"{'-' * 20}KlipperScreen Log Start{'-' * 20}",
|
||||||
'version': f"Git Version: {software_version}",
|
'version': f"Git Version: {software_version}",
|
||||||
}
|
}
|
||||||
lines = [line for line in self.rollover_info.values() if line]
|
lines = [line for line in self.rollover_info.values() if line]
|
||||||
@ -136,6 +147,7 @@ class KlipperScreenLoggingHandler(logging.handlers.TimedRotatingFileHandler):
|
|||||||
if self.stream is not None:
|
if self.stream is not None:
|
||||||
self.stream.write("\n".join(lines) + "\n")
|
self.stream.write("\n".join(lines) + "\n")
|
||||||
|
|
||||||
|
|
||||||
# Logging based on Arksine's logging setup
|
# Logging based on Arksine's logging setup
|
||||||
def setup_logging(log_file, software_version):
|
def setup_logging(log_file, software_version):
|
||||||
root_logger = logging.getLogger()
|
root_logger = logging.getLogger()
|
||||||
@ -165,6 +177,7 @@ def setup_logging(log_file, software_version):
|
|||||||
def logging_exception_handler(type, value, tb, thread_identifier=None):
|
def logging_exception_handler(type, value, tb, thread_identifier=None):
|
||||||
logging.exception(
|
logging.exception(
|
||||||
"Uncaught exception %s: %s\nTraceback: %s" % (type, value, "\n".join(traceback.format_tb(tb))))
|
"Uncaught exception %s: %s\nTraceback: %s" % (type, value, "\n".join(traceback.format_tb(tb))))
|
||||||
|
|
||||||
sys.excepthook = logging_exception_handler
|
sys.excepthook = logging_exception_handler
|
||||||
logging.captureWarnings(True)
|
logging.captureWarnings(True)
|
||||||
|
|
||||||
|
@ -209,11 +209,6 @@ class Printer:
|
|||||||
return self.config[section]
|
return self.config[section]
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_config_section(self, section):
|
|
||||||
if section not in self.config:
|
|
||||||
return False
|
|
||||||
return self.config[section]
|
|
||||||
|
|
||||||
def get_data(self):
|
def get_data(self):
|
||||||
return self.data
|
return self.data
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ from gi.repository import Gtk
|
|||||||
|
|
||||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||||
|
|
||||||
|
|
||||||
class ScreenPanel:
|
class ScreenPanel:
|
||||||
|
|
||||||
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
|
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
|
||||||
@ -42,7 +43,7 @@ class ScreenPanel:
|
|||||||
if temp <= 0:
|
if temp <= 0:
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
return ("(%s)" % str(int(temp)))
|
return "(%s)" % str(int(temp))
|
||||||
|
|
||||||
def format_temp(self, temp, places=1):
|
def format_temp(self, temp, places=1):
|
||||||
if places == 0:
|
if places == 0:
|
||||||
|
@ -91,7 +91,6 @@ class HeaterGraph(Gtk.DrawingArea):
|
|||||||
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
|
||||||
|
|
||||||
|
|
||||||
d_height_scale = self.graph_lines(ctx, gsize, max_num)
|
d_height_scale = self.graph_lines(ctx, gsize, max_num)
|
||||||
self.graph_time(ctx, gsize, points_per_pixel)
|
self.graph_time(ctx, gsize, points_per_pixel)
|
||||||
|
|
||||||
@ -115,10 +114,10 @@ class HeaterGraph(Gtk.DrawingArea):
|
|||||||
ctx.set_dash([1, 0])
|
ctx.set_dash([1, 0])
|
||||||
d_len = len(data) - 1
|
d_len = len(data) - 1
|
||||||
for d in data:
|
for d in data:
|
||||||
p_x = i*swidth + gsize[0][0] if i != d_len else gsize[1][0] - 1
|
p_x = i * swidth + gsize[0][0] if i != d_len else gsize[1][0] - 1
|
||||||
p_y = gsize[1][1] - 1 - (d*hscale)
|
p_y = gsize[1][1] - 1 - (d * hscale)
|
||||||
if i == 0:
|
if i == 0:
|
||||||
ctx.move_to(gsize[0][0]+1, p_y)
|
ctx.move_to(gsize[0][0] + 1, p_y)
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
ctx.line_to(p_x, p_y)
|
ctx.line_to(p_x, p_y)
|
||||||
@ -139,15 +138,15 @@ class HeaterGraph(Gtk.DrawingArea):
|
|||||||
while (max_num / nscale) > 5:
|
while (max_num / nscale) > 5:
|
||||||
nscale += 10
|
nscale += 10
|
||||||
# nscale = math.floor((max_num / 10) / 4) * 10
|
# nscale = math.floor((max_num / 10) / 4) * 10
|
||||||
r = int(max_num/nscale) + 1
|
r = int(max_num / nscale) + 1
|
||||||
hscale = (gsize[1][1] - gsize[0][1]) / (r * nscale)
|
hscale = (gsize[1][1] - gsize[0][1]) / (r * nscale)
|
||||||
|
|
||||||
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(6, lheight + 3)
|
ctx.move_to(6, lheight + 3)
|
||||||
ctx.set_font_size(self.font_size)
|
ctx.set_font_size(self.font_size)
|
||||||
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)
|
||||||
ctx.move_to(gsize[0][0], lheight)
|
ctx.move_to(gsize[0][0], lheight)
|
||||||
|
@ -9,10 +9,12 @@ from threading import Thread
|
|||||||
from queue import Queue
|
from queue import Queue
|
||||||
|
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
gi.require_version("Gtk", "3.0")
|
gi.require_version("Gtk", "3.0")
|
||||||
from gi.repository import GLib, Gdk
|
from gi.repository import GLib, Gdk
|
||||||
|
|
||||||
class WifiManager():
|
|
||||||
|
class WifiManager:
|
||||||
networks_in_supplicant = []
|
networks_in_supplicant = []
|
||||||
connected = False
|
connected = False
|
||||||
_stop_loop = False
|
_stop_loop = False
|
||||||
@ -77,7 +79,7 @@ class WifiManager():
|
|||||||
# TODO: Add wpa_cli error checking
|
# TODO: Add wpa_cli error checking
|
||||||
network_id = self.wpa_cli("ADD_NETWORK")
|
network_id = self.wpa_cli("ADD_NETWORK")
|
||||||
commands = [
|
commands = [
|
||||||
'ENABLE_NETWORK %s' % (network_id),
|
'ENABLE_NETWORK %s' % network_id,
|
||||||
'SET_NETWORK %s ssid "%s"' % (network_id, ssid.replace('"', '\"')),
|
'SET_NETWORK %s ssid "%s"' % (network_id, ssid.replace('"', '\"')),
|
||||||
'SET_NETWORK %s psk "%s"' % (network_id, psk.replace('"', '\"'))
|
'SET_NETWORK %s psk "%s"' % (network_id, psk.replace('"', '\"'))
|
||||||
]
|
]
|
||||||
@ -365,117 +367,117 @@ class WifiChannels:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def lookup(freq):
|
def lookup(freq):
|
||||||
if freq == "2412":
|
if freq == "2412":
|
||||||
return ("2.4", "1")
|
return "2.4", "1"
|
||||||
if freq == "2417":
|
if freq == "2417":
|
||||||
return ("2.4", "2")
|
return "2.4", "2"
|
||||||
if freq == "2422":
|
if freq == "2422":
|
||||||
return ("2.4", "3")
|
return "2.4", "3"
|
||||||
if freq == "2427":
|
if freq == "2427":
|
||||||
return ("2.4", "4")
|
return "2.4", "4"
|
||||||
if freq == "2432":
|
if freq == "2432":
|
||||||
return ("2.4", "5")
|
return "2.4", "5"
|
||||||
if freq == "2437":
|
if freq == "2437":
|
||||||
return ("2.4", "6")
|
return "2.4", "6"
|
||||||
if freq == "2442":
|
if freq == "2442":
|
||||||
return ("2.4", "7")
|
return "2.4", "7"
|
||||||
if freq == "2447":
|
if freq == "2447":
|
||||||
return ("2.4", "8")
|
return "2.4", "8"
|
||||||
if freq == "2452":
|
if freq == "2452":
|
||||||
return ("2.4", "9")
|
return "2.4", "9"
|
||||||
if freq == "2457":
|
if freq == "2457":
|
||||||
return ("2.4", "10")
|
return "2.4", "10"
|
||||||
if freq == "2462":
|
if freq == "2462":
|
||||||
return ("2.4", "11")
|
return "2.4", "11"
|
||||||
if freq == "2467":
|
if freq == "2467":
|
||||||
return ("2.4", "12")
|
return "2.4", "12"
|
||||||
if freq == "2472":
|
if freq == "2472":
|
||||||
return ("2.4", "13")
|
return "2.4", "13"
|
||||||
if freq == "2484":
|
if freq == "2484":
|
||||||
return ("2.4", "14")
|
return "2.4", "14"
|
||||||
if freq == "5035":
|
if freq == "5035":
|
||||||
return ("5", "7")
|
return "5", "7"
|
||||||
if freq == "5040":
|
if freq == "5040":
|
||||||
return ("5", "8")
|
return "5", "8"
|
||||||
if freq == "5045":
|
if freq == "5045":
|
||||||
return ("5", "9")
|
return "5", "9"
|
||||||
if freq == "5055":
|
if freq == "5055":
|
||||||
return ("5", "11")
|
return "5", "11"
|
||||||
if freq == "5060":
|
if freq == "5060":
|
||||||
return ("5", "12")
|
return "5", "12"
|
||||||
if freq == "5080":
|
if freq == "5080":
|
||||||
return ("5", "16")
|
return "5", "16"
|
||||||
if freq == "5170":
|
if freq == "5170":
|
||||||
return ("5", "34")
|
return "5", "34"
|
||||||
if freq == "5180":
|
if freq == "5180":
|
||||||
return ("5", "36")
|
return "5", "36"
|
||||||
if freq == "5190":
|
if freq == "5190":
|
||||||
return ("5", "38")
|
return "5", "38"
|
||||||
if freq == "5200":
|
if freq == "5200":
|
||||||
return ("5", "40")
|
return "5", "40"
|
||||||
if freq == "5210":
|
if freq == "5210":
|
||||||
return ("5", "42")
|
return "5", "42"
|
||||||
if freq == "5220":
|
if freq == "5220":
|
||||||
return ("5", "44")
|
return "5", "44"
|
||||||
if freq == "5230":
|
if freq == "5230":
|
||||||
return ("5", "46")
|
return "5", "46"
|
||||||
if freq == "5240":
|
if freq == "5240":
|
||||||
return ("5", "48")
|
return "5", "48"
|
||||||
if freq == "5260":
|
if freq == "5260":
|
||||||
return ("5", "52")
|
return "5", "52"
|
||||||
if freq == "5280":
|
if freq == "5280":
|
||||||
return ("5", "56")
|
return "5", "56"
|
||||||
if freq == "5300":
|
if freq == "5300":
|
||||||
return ("5", "60")
|
return "5", "60"
|
||||||
if freq == "5320":
|
if freq == "5320":
|
||||||
return ("5", "64")
|
return "5", "64"
|
||||||
if freq == "5500":
|
if freq == "5500":
|
||||||
return ("5", "100")
|
return "5", "100"
|
||||||
if freq == "5520":
|
if freq == "5520":
|
||||||
return ("5", "104")
|
return "5", "104"
|
||||||
if freq == "5540":
|
if freq == "5540":
|
||||||
return ("5", "108")
|
return "5", "108"
|
||||||
if freq == "5560":
|
if freq == "5560":
|
||||||
return ("5", "112")
|
return "5", "112"
|
||||||
if freq == "5580":
|
if freq == "5580":
|
||||||
return ("5", "116")
|
return "5", "116"
|
||||||
if freq == "5600":
|
if freq == "5600":
|
||||||
return ("5", "120")
|
return "5", "120"
|
||||||
if freq == "5620":
|
if freq == "5620":
|
||||||
return ("5", "124")
|
return "5", "124"
|
||||||
if freq == "5640":
|
if freq == "5640":
|
||||||
return ("5", "128")
|
return "5", "128"
|
||||||
if freq == "5660":
|
if freq == "5660":
|
||||||
return ("5", "132")
|
return "5", "132"
|
||||||
if freq == "5680":
|
if freq == "5680":
|
||||||
return ("5", "136")
|
return "5", "136"
|
||||||
if freq == "5700":
|
if freq == "5700":
|
||||||
return ("5", "140")
|
return "5", "140"
|
||||||
if freq == "5720":
|
if freq == "5720":
|
||||||
return ("5", "144")
|
return "5", "144"
|
||||||
if freq == "5745":
|
if freq == "5745":
|
||||||
return ("5", "149")
|
return "5", "149"
|
||||||
if freq == "5765":
|
if freq == "5765":
|
||||||
return ("5", "153")
|
return "5", "153"
|
||||||
if freq == "5785":
|
if freq == "5785":
|
||||||
return ("5", "157")
|
return "5", "157"
|
||||||
if freq == "5805":
|
if freq == "5805":
|
||||||
return ("5", "161")
|
return "5", "161"
|
||||||
if freq == "5825":
|
if freq == "5825":
|
||||||
return ("5", "165")
|
return "5", "165"
|
||||||
if freq == "4915":
|
if freq == "4915":
|
||||||
return ("5", "183")
|
return "5", "183"
|
||||||
if freq == "4920":
|
if freq == "4920":
|
||||||
return ("5", "184")
|
return "5", "184"
|
||||||
if freq == "4925":
|
if freq == "4925":
|
||||||
return ("5", "185")
|
return "5", "185"
|
||||||
if freq == "4935":
|
if freq == "4935":
|
||||||
return ("5", "187")
|
return "5", "187"
|
||||||
if freq == "4940":
|
if freq == "4940":
|
||||||
return ("5", "188")
|
return "5", "188"
|
||||||
if freq == "4945":
|
if freq == "4945":
|
||||||
return ("5", "189")
|
return "5", "189"
|
||||||
if freq == "4960":
|
if freq == "4960":
|
||||||
return ("5", "192")
|
return "5", "192"
|
||||||
if freq == "4980":
|
if freq == "4980":
|
||||||
return ("5", "196")
|
return "5", "196"
|
||||||
return None
|
return None
|
||||||
|
@ -9,6 +9,7 @@ from jinja2 import Environment
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
class BasePanel(ScreenPanel):
|
class BasePanel(ScreenPanel):
|
||||||
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
|
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
|
||||||
super().__init__(screen, title, back, action_bar, printer_name)
|
super().__init__(screen, title, back, action_bar, printer_name)
|
||||||
@ -85,7 +86,6 @@ class BasePanel(ScreenPanel):
|
|||||||
self.titlelbl.set_hexpand(True)
|
self.titlelbl.set_hexpand(True)
|
||||||
self.titlelbl.set_vexpand(True)
|
self.titlelbl.set_vexpand(True)
|
||||||
self.titlelbl.set_halign(Gtk.Align.CENTER)
|
self.titlelbl.set_halign(Gtk.Align.CENTER)
|
||||||
self.titlelbl.set_ellipsize(True)
|
|
||||||
self.titlelbl.set_ellipsize(Pango.EllipsizeMode.END)
|
self.titlelbl.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
self.set_title(title)
|
self.set_title(title)
|
||||||
|
|
||||||
@ -129,7 +129,6 @@ class BasePanel(ScreenPanel):
|
|||||||
self.layout.put(self.titlebar, action_bar_width, 0)
|
self.layout.put(self.titlebar, action_bar_width, 0)
|
||||||
self.layout.put(self.content, action_bar_width + self.hmargin, self.title_spacing)
|
self.layout.put(self.content, action_bar_width + self.hmargin, self.title_spacing)
|
||||||
|
|
||||||
|
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
self.update_time()
|
self.update_time()
|
||||||
return
|
return
|
||||||
@ -138,14 +137,13 @@ class BasePanel(ScreenPanel):
|
|||||||
for child in self.control['temp_box'].get_children():
|
for child in self.control['temp_box'].get_children():
|
||||||
self.control['temp_box'].remove(child)
|
self.control['temp_box'].remove(child)
|
||||||
|
|
||||||
if (not show or self._screen.printer.get_temp_store_devices() is None):
|
if not show or self._screen.printer.get_temp_store_devices() is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
for device in self._screen.printer.get_temp_store_devices():
|
for device in self._screen.printer.get_temp_store_devices():
|
||||||
logging.info(device)
|
logging.info(device)
|
||||||
self.labels[device + '_box'] = Gtk.Box(spacing=0)
|
self.labels[device + '_box'] = Gtk.Box(spacing=0)
|
||||||
self.labels[device] = Gtk.Label(label="100º")
|
self.labels[device] = Gtk.Label(label="100º")
|
||||||
self.labels[device].set_ellipsize(True)
|
|
||||||
self.labels[device].set_ellipsize(Pango.EllipsizeMode.START)
|
self.labels[device].set_ellipsize(Pango.EllipsizeMode.START)
|
||||||
if device.startswith("extruder"):
|
if device.startswith("extruder"):
|
||||||
if self._screen.printer.extrudercount > 1:
|
if self._screen.printer.extrudercount > 1:
|
||||||
@ -269,7 +267,6 @@ class BasePanel(ScreenPanel):
|
|||||||
self.control['temp_box'].reorder_child(self.labels["%s_box" % self.current_extruder], 0)
|
self.control['temp_box'].reorder_child(self.labels["%s_box" % self.current_extruder], 0)
|
||||||
self.control['temp_box'].show_all()
|
self.control['temp_box'].show_all()
|
||||||
|
|
||||||
|
|
||||||
def remove(self, widget):
|
def remove(self, widget):
|
||||||
self.content.remove(widget)
|
self.content.remove(widget)
|
||||||
|
|
||||||
|
@ -8,9 +8,11 @@ from gi.repository import Gtk
|
|||||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return BedLevelPanel(*args)
|
return BedLevelPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class BedLevelPanel(ScreenPanel):
|
class BedLevelPanel(ScreenPanel):
|
||||||
x_offset = 0
|
x_offset = 0
|
||||||
y_offset = 0
|
y_offset = 0
|
||||||
@ -47,19 +49,19 @@ class BedLevelPanel(ScreenPanel):
|
|||||||
logging.debug("%d bed_screws not supported: calculating 4 locations", nscrews)
|
logging.debug("%d bed_screws not supported: calculating 4 locations", nscrews)
|
||||||
xconf = self._screen.printer.get_config_section("stepper_x")
|
xconf = self._screen.printer.get_config_section("stepper_x")
|
||||||
yconf = self._screen.printer.get_config_section("stepper_y")
|
yconf = self._screen.printer.get_config_section("stepper_y")
|
||||||
x = int(int(xconf['position_max'])/4)
|
x = int(int(xconf['position_max']) / 4)
|
||||||
y = int(int(yconf['position_max'])/4)
|
y = int(int(yconf['position_max']) / 4)
|
||||||
self.screws = [
|
self.screws = [
|
||||||
[x, y],
|
[x, y],
|
||||||
[x*3, y],
|
[x * 3, y],
|
||||||
[x, y*3],
|
[x, y * 3],
|
||||||
[x*3, y*3],
|
[x * 3, y * 3],
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
self.screws = screws
|
self.screws = screws
|
||||||
|
|
||||||
if (("bltouch" in self._screen.printer.get_config_section_list() or
|
if (("bltouch" in self._screen.printer.get_config_section_list() or
|
||||||
"probe" in self._screen.printer.get_config_section_list()) and
|
"probe" in self._screen.printer.get_config_section_list()) and
|
||||||
config_section_name == "screws_tilt_adjust"):
|
config_section_name == "screws_tilt_adjust"):
|
||||||
if "bltouch" in self._screen.printer.get_config_section_list():
|
if "bltouch" in self._screen.printer.get_config_section_list():
|
||||||
bltouch = self._screen.printer.get_config_section("bltouch")
|
bltouch = self._screen.printer.get_config_section("bltouch")
|
||||||
@ -307,7 +309,7 @@ class BedLevelPanel(ScreenPanel):
|
|||||||
self.labels[key].set_label(result.group(5))
|
self.labels[key].set_label(result.group(5))
|
||||||
break
|
break
|
||||||
self.response_count += 1
|
self.response_count += 1
|
||||||
if self.response_count >= len(self.screws)-1:
|
if self.response_count >= len(self.screws) - 1:
|
||||||
self.labels['screws'].set_sensitive(True)
|
self.labels['screws'].set_sensitive(True)
|
||||||
else:
|
else:
|
||||||
result = re.match(
|
result = re.match(
|
||||||
|
@ -15,9 +15,11 @@ from matplotlib.ticker import LinearLocator
|
|||||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return BedMeshPanel(*args)
|
return BedMeshPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class BedMeshPanel(ScreenPanel):
|
class BedMeshPanel(ScreenPanel):
|
||||||
active_mesh = None
|
active_mesh = None
|
||||||
graphs = {}
|
graphs = {}
|
||||||
@ -37,7 +39,6 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
self.labels['profiles'] = Gtk.Grid()
|
self.labels['profiles'] = Gtk.Grid()
|
||||||
scroll.add(self.labels['profiles'])
|
scroll.add(self.labels['profiles'])
|
||||||
|
|
||||||
|
|
||||||
addprofile = self._gtk.ButtonImage("increase", " %s" % _("Add bed mesh profile"),
|
addprofile = self._gtk.ButtonImage("increase", " %s" % _("Add bed mesh profile"),
|
||||||
"color1", .5, Gtk.PositionType.LEFT, False)
|
"color1", .5, Gtk.PositionType.LEFT, False)
|
||||||
addprofile.connect("clicked", self.show_create_profile)
|
addprofile.connect("clicked", self.show_create_profile)
|
||||||
@ -92,7 +93,7 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
frame = Gtk.Frame()
|
frame = Gtk.Frame()
|
||||||
|
|
||||||
name = Gtk.Label()
|
name = Gtk.Label()
|
||||||
name.set_markup("<big><b>%s</b></big>" % (profile))
|
name.set_markup("<big><b>%s</b></big>" % profile)
|
||||||
name.set_hexpand(True)
|
name.set_hexpand(True)
|
||||||
name.set_vexpand(True)
|
name.set_vexpand(True)
|
||||||
name.set_halign(Gtk.Align.START)
|
name.set_halign(Gtk.Align.START)
|
||||||
@ -177,7 +178,7 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
if "default" in pl:
|
if "default" in pl:
|
||||||
pl.remove('default')
|
pl.remove('default')
|
||||||
profiles = sorted(pl)
|
profiles = sorted(pl)
|
||||||
pos = profiles.index(profile)+1 if profile != "default" else 0
|
pos = profiles.index(profile) + 1 if profile != "default" else 0
|
||||||
|
|
||||||
self.labels['profiles'].insert_row(pos)
|
self.labels['profiles'].insert_row(pos)
|
||||||
self.labels['profiles'].attach(self.profiles[profile]['row'], 0, pos, 1, 1)
|
self.labels['profiles'].attach(self.profiles[profile]['row'], 0, pos, 1, 1)
|
||||||
@ -240,7 +241,7 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
if "default" in pl:
|
if "default" in pl:
|
||||||
pl.remove('default')
|
pl.remove('default')
|
||||||
profiles = sorted(pl)
|
profiles = sorted(pl)
|
||||||
pos = profiles.index(profile)+1 if profile != "default" else 0
|
pos = profiles.index(profile) + 1 if profile != "default" else 0
|
||||||
self.labels['profiles'].remove_row(pos)
|
self.labels['profiles'].remove_row(pos)
|
||||||
del self.profiles[profile]
|
del self.profiles[profile]
|
||||||
|
|
||||||
@ -287,7 +288,6 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
save.set_hexpand(False)
|
save.set_hexpand(False)
|
||||||
save.connect("clicked", self.create_profile)
|
save.connect("clicked", self.create_profile)
|
||||||
|
|
||||||
|
|
||||||
self.labels['profile_name'] = entry
|
self.labels['profile_name'] = entry
|
||||||
box.pack_start(pl, False, False, 5)
|
box.pack_start(pl, False, False, 5)
|
||||||
box.pack_start(entry, True, True, 5)
|
box.pack_start(entry, True, True, 5)
|
||||||
@ -324,19 +324,19 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
maxz_mesh = 0.5
|
maxz_mesh = 0.5
|
||||||
z_range = [minz_mesh, maxz_mesh]
|
z_range = [minz_mesh, maxz_mesh]
|
||||||
counts = [len(abm['mesh_matrix'][0]), len(abm['mesh_matrix'])]
|
counts = [len(abm['mesh_matrix'][0]), len(abm['mesh_matrix'])]
|
||||||
deltas = [(x_range[1] - x_range[0]) / (counts[0]-1), (y_range[1] - y_range[0]) / (counts[1]-1)]
|
deltas = [(x_range[1] - x_range[0]) / (counts[0] - 1), (y_range[1] - y_range[0]) / (counts[1] - 1)]
|
||||||
x = [(i*deltas[0])+x_range[0] for i in range(counts[0])]
|
x = [(i * deltas[0]) + x_range[0] for i in range(counts[0])]
|
||||||
y = [(i*deltas[0])+y_range[0] for i in range(counts[1])]
|
y = [(i * deltas[0]) + y_range[0] for i in range(counts[1])]
|
||||||
x, y = np.meshgrid(x, y)
|
x, y = np.meshgrid(x, y)
|
||||||
z = np.asarray(abm['mesh_matrix'])
|
z = np.asarray(abm['mesh_matrix'])
|
||||||
else:
|
else:
|
||||||
x_range = [int(bm['min_x']), int(bm['max_x'])]
|
x_range = [int(bm['min_x']), int(bm['max_x'])]
|
||||||
y_range = [int(bm['min_y']), int(bm['max_y'])]
|
y_range = [int(bm['min_y']), int(bm['max_y'])]
|
||||||
z_range = [min(min(bm['points'])), max(max(bm['points']))]
|
z_range = [min(min(bm['points'])), max(max(bm['points']))]
|
||||||
deltas = [(x_range[1] - x_range[0]) / (int(bm['x_count'])-1),
|
deltas = [(x_range[1] - x_range[0]) / (int(bm['x_count']) - 1),
|
||||||
(y_range[1] - y_range[0]) / (int(bm['y_count'])-1)]
|
(y_range[1] - y_range[0]) / (int(bm['y_count']) - 1)]
|
||||||
x = [(i*deltas[0])+x_range[0] for i in range(bm['x_count'])]
|
x = [(i * deltas[0]) + x_range[0] for i in range(bm['x_count'])]
|
||||||
y = [(i*deltas[0])+y_range[0] for i in range(bm['y_count'])]
|
y = [(i * deltas[0]) + y_range[0] for i in range(bm['y_count'])]
|
||||||
x, y = np.meshgrid(x, y)
|
x, y = np.meshgrid(x, y)
|
||||||
z = np.asarray(bm['points'])
|
z = np.asarray(bm['points'])
|
||||||
|
|
||||||
@ -349,8 +349,8 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
fig.add_axes(ax)
|
fig.add_axes(ax)
|
||||||
surf = ax.plot_surface(x, y, z, cmap=cm.coolwarm, vmin=-0.1, vmax=0.1)
|
surf = ax.plot_surface(x, y, z, cmap=cm.coolwarm, vmin=-0.1, vmax=0.1)
|
||||||
|
|
||||||
chartBox = ax.get_position()
|
chartbox = ax.get_position()
|
||||||
ax.set_position([chartBox.x0, chartBox.y0+0.1, chartBox.width*.92, chartBox.height])
|
ax.set_position([chartbox.x0, chartbox.y0 + 0.1, chartbox.width * .92, chartbox.height])
|
||||||
|
|
||||||
ax.set_zlim(z_range[0], z_range[1])
|
ax.set_zlim(z_range[0], z_range[1])
|
||||||
ax.zaxis.set_major_locator(LinearLocator(5))
|
ax.zaxis.set_major_locator(LinearLocator(5))
|
||||||
@ -381,7 +381,7 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
|
|
||||||
alloc = canvas_box.get_allocation()
|
alloc = canvas_box.get_allocation()
|
||||||
canvas = FigureCanvas(fig)
|
canvas = FigureCanvas(fig)
|
||||||
canvas.set_size_request(alloc.width, self._screen.height/3*2)
|
canvas.set_size_request(alloc.width, self._screen.height / 3 * 2)
|
||||||
canvas_box.add(canvas)
|
canvas_box.add(canvas)
|
||||||
canvas_box.show_all()
|
canvas_box.show_all()
|
||||||
# Remove the "matplotlib-canvas" class which forces a white background.
|
# Remove the "matplotlib-canvas" class which forces a white background.
|
||||||
@ -390,6 +390,5 @@ class BedMeshPanel(ScreenPanel):
|
|||||||
for css_class in style_ctx.list_classes():
|
for css_class in style_ctx.list_classes():
|
||||||
style_ctx.remove_class(css_class)
|
style_ctx.remove_class(css_class)
|
||||||
|
|
||||||
|
|
||||||
def _close_dialog(self, widget, response):
|
def _close_dialog(self, widget, response):
|
||||||
widget.destroy()
|
widget.destroy()
|
||||||
|
@ -9,6 +9,7 @@ from gi.repository import Gtk
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return ConsolePanel(*args)
|
return ConsolePanel(*args)
|
||||||
|
|
||||||
@ -21,6 +22,7 @@ COLORS = {
|
|||||||
"warning": "#c9c9c9"
|
"warning": "#c9c9c9"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ConsolePanel(ScreenPanel):
|
class ConsolePanel(ScreenPanel):
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
@ -32,16 +34,16 @@ class ConsolePanel(ScreenPanel):
|
|||||||
o1_lbl = Gtk.Label(_("Auto-scroll"))
|
o1_lbl = Gtk.Label(_("Auto-scroll"))
|
||||||
o1_lbl.set_halign(Gtk.Align.END)
|
o1_lbl.set_halign(Gtk.Align.END)
|
||||||
o1_switch = Gtk.Switch()
|
o1_switch = Gtk.Switch()
|
||||||
o1_switch.set_property("width-request", round(self._gtk.get_font_size()*5))
|
o1_switch.set_property("width-request", round(self._gtk.get_font_size() * 5))
|
||||||
o1_switch.set_property("height-request", round(self._gtk.get_font_size()*2.5))
|
o1_switch.set_property("height-request", round(self._gtk.get_font_size() * 2.5))
|
||||||
o1_switch.set_active(self.autoscroll)
|
o1_switch.set_active(self.autoscroll)
|
||||||
o1_switch.connect("notify::active", self.set_autoscroll)
|
o1_switch.connect("notify::active", self.set_autoscroll)
|
||||||
|
|
||||||
o2_lbl = Gtk.Label(_("Hide temp."))
|
o2_lbl = Gtk.Label(_("Hide temp."))
|
||||||
o2_lbl.set_halign(Gtk.Align.END)
|
o2_lbl.set_halign(Gtk.Align.END)
|
||||||
o2_switch = Gtk.Switch()
|
o2_switch = Gtk.Switch()
|
||||||
o2_switch.set_property("width-request", round(self._gtk.get_font_size()*5))
|
o2_switch.set_property("width-request", round(self._gtk.get_font_size() * 5))
|
||||||
o2_switch.set_property("height-request", round(self._gtk.get_font_size()*2.5))
|
o2_switch.set_property("height-request", round(self._gtk.get_font_size() * 2.5))
|
||||||
o2_switch.set_active(self.hidetemps)
|
o2_switch.set_active(self.hidetemps)
|
||||||
o2_switch.connect("notify::active", self.hide_temps)
|
o2_switch.connect("notify::active", self.hide_temps)
|
||||||
|
|
||||||
@ -85,7 +87,6 @@ class ConsolePanel(ScreenPanel):
|
|||||||
enter.set_hexpand(False)
|
enter.set_hexpand(False)
|
||||||
enter.connect("clicked", self._send_command)
|
enter.connect("clicked", self._send_command)
|
||||||
|
|
||||||
|
|
||||||
ebox.add(entry)
|
ebox.add(entry)
|
||||||
ebox.add(enter)
|
ebox.add(enter)
|
||||||
|
|
||||||
|
@ -5,9 +5,11 @@ from gi.repository import Gtk
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return ExamplePanel(*args)
|
return ExamplePanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class ExamplePanel(ScreenPanel):
|
class ExamplePanel(ScreenPanel):
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
|
@ -7,9 +7,11 @@ from gi.repository import Gtk, Pango
|
|||||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return ExtrudePanel(*args)
|
return ExtrudePanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class ExtrudePanel(ScreenPanel):
|
class ExtrudePanel(ScreenPanel):
|
||||||
distance = 5
|
distance = 5
|
||||||
distances = ['5', '10', '15', '25']
|
distances = ['5', '10', '15', '25']
|
||||||
@ -56,40 +58,40 @@ class ExtrudePanel(ScreenPanel):
|
|||||||
if i < limit:
|
if i < limit:
|
||||||
extgrid.attach(self.labels[extruder], i, 0, 1, 1)
|
extgrid.attach(self.labels[extruder], i, 0, 1, 1)
|
||||||
if i < (limit - 1):
|
if i < (limit - 1):
|
||||||
extgrid.attach(self.labels['temperature'], i+1, 0, 1, 1)
|
extgrid.attach(self.labels['temperature'], i + 1, 0, 1, 1)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
distgrid = Gtk.Grid()
|
distgrid = Gtk.Grid()
|
||||||
j = 0
|
j = 0
|
||||||
for i in self.distances:
|
for i in self.distances:
|
||||||
self.labels["dist"+str(i)] = self._gtk.ToggleButton(i)
|
self.labels["dist" + str(i)] = self._gtk.ToggleButton(i)
|
||||||
self.labels["dist"+str(i)].connect("clicked", self.change_distance, i)
|
self.labels["dist" + str(i)].connect("clicked", self.change_distance, i)
|
||||||
ctx = self.labels["dist"+str(i)].get_style_context()
|
ctx = self.labels["dist" + str(i)].get_style_context()
|
||||||
if ((self._screen.lang_ltr is True and j == 0) or
|
if ((self._screen.lang_ltr is True and j == 0) or
|
||||||
(self._screen.lang_ltr is False and j == len(self.distances)-1)):
|
(self._screen.lang_ltr is False and j == len(self.distances) - 1)):
|
||||||
ctx.add_class("distbutton_top")
|
ctx.add_class("distbutton_top")
|
||||||
elif ((self._screen.lang_ltr is False and j == 0) or
|
elif ((self._screen.lang_ltr is False and j == 0) or
|
||||||
(self._screen.lang_ltr is True and j == len(self.distances)-1)):
|
(self._screen.lang_ltr is True and j == len(self.distances) - 1)):
|
||||||
ctx.add_class("distbutton_bottom")
|
ctx.add_class("distbutton_bottom")
|
||||||
else:
|
else:
|
||||||
ctx.add_class("distbutton")
|
ctx.add_class("distbutton")
|
||||||
if i == "5":
|
if i == "5":
|
||||||
ctx.add_class("distbutton_active")
|
ctx.add_class("distbutton_active")
|
||||||
distgrid.attach(self.labels["dist"+str(i)], j, 0, 1, 1)
|
distgrid.attach(self.labels["dist" + str(i)], j, 0, 1, 1)
|
||||||
j += 1
|
j += 1
|
||||||
self.labels["dist5"].set_active(True)
|
self.labels["dist5"].set_active(True)
|
||||||
|
|
||||||
speedgrid = Gtk.Grid()
|
speedgrid = Gtk.Grid()
|
||||||
j = 0
|
j = 0
|
||||||
for i in self.speeds:
|
for i in self.speeds:
|
||||||
self.labels["speed"+str(i)] = self._gtk.ToggleButton(_(i))
|
self.labels["speed" + str(i)] = self._gtk.ToggleButton(_(i))
|
||||||
self.labels["speed"+str(i)].connect("clicked", self.change_speed, i)
|
self.labels["speed" + str(i)].connect("clicked", self.change_speed, i)
|
||||||
ctx = self.labels["speed"+str(i)].get_style_context()
|
ctx = self.labels["speed" + str(i)].get_style_context()
|
||||||
if ((self._screen.lang_ltr is True and j == 0) or
|
if ((self._screen.lang_ltr is True and j == 0) or
|
||||||
(self._screen.lang_ltr is False and j == len(self.speeds)-1)):
|
(self._screen.lang_ltr is False and j == len(self.speeds) - 1)):
|
||||||
ctx.add_class("distbutton_top")
|
ctx.add_class("distbutton_top")
|
||||||
elif ((self._screen.lang_ltr is False and j == 0) or
|
elif ((self._screen.lang_ltr is False and j == 0) or
|
||||||
(self._screen.lang_ltr is True and j == len(self.speeds)-1)):
|
(self._screen.lang_ltr is True and j == len(self.speeds) - 1)):
|
||||||
ctx.add_class("distbutton_bottom")
|
ctx.add_class("distbutton_bottom")
|
||||||
else:
|
else:
|
||||||
ctx.add_class("distbutton")
|
ctx.add_class("distbutton")
|
||||||
@ -116,7 +118,7 @@ class ExtrudePanel(ScreenPanel):
|
|||||||
sensors.set_halign(Gtk.Align.CENTER)
|
sensors.set_halign(Gtk.Align.CENTER)
|
||||||
sensors.set_valign(Gtk.Align.CENTER)
|
sensors.set_valign(Gtk.Align.CENTER)
|
||||||
for s, x in enumerate(filament_sensors):
|
for s, x in enumerate(filament_sensors):
|
||||||
if s > (limit):
|
if s > limit:
|
||||||
break
|
break
|
||||||
name = x[23:].strip()
|
name = x[23:].strip()
|
||||||
self.labels[x] = {
|
self.labels[x] = {
|
||||||
@ -126,9 +128,8 @@ class ExtrudePanel(ScreenPanel):
|
|||||||
}
|
}
|
||||||
self.labels[x]['label'].set_halign(Gtk.Align.CENTER)
|
self.labels[x]['label'].set_halign(Gtk.Align.CENTER)
|
||||||
self.labels[x]['label'].set_hexpand(True)
|
self.labels[x]['label'].set_hexpand(True)
|
||||||
self.labels[x]['label'].set_ellipsize(True)
|
|
||||||
self.labels[x]['label'].set_ellipsize(Pango.EllipsizeMode.END)
|
self.labels[x]['label'].set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
self.labels[x]['switch'].set_property("width-request", round(self._gtk.get_font_size()*2))
|
self.labels[x]['switch'].set_property("width-request", round(self._gtk.get_font_size() * 2))
|
||||||
self.labels[x]['switch'].set_property("height-request", round(self._gtk.get_font_size()))
|
self.labels[x]['switch'].set_property("height-request", round(self._gtk.get_font_size()))
|
||||||
self.labels[x]['switch'].set_active(self._printer.get_dev_stat(x, "enabled"))
|
self.labels[x]['switch'].set_active(self._printer.get_dev_stat(x, "enabled"))
|
||||||
self.labels[x]['switch'].connect("notify::active", self.enable_disable_fs, name, x)
|
self.labels[x]['switch'].connect("notify::active", self.enable_disable_fs, name, x)
|
||||||
@ -206,16 +207,16 @@ class ExtrudePanel(ScreenPanel):
|
|||||||
return
|
return
|
||||||
logging.info("### Distance " + str(distance))
|
logging.info("### Distance " + str(distance))
|
||||||
|
|
||||||
ctx = self.labels["dist"+str(self.distance)].get_style_context()
|
ctx = self.labels["dist" + str(self.distance)].get_style_context()
|
||||||
ctx.remove_class("distbutton_active")
|
ctx.remove_class("distbutton_active")
|
||||||
|
|
||||||
self.distance = distance
|
self.distance = distance
|
||||||
ctx = self.labels["dist"+self.distance].get_style_context()
|
ctx = self.labels["dist" + self.distance].get_style_context()
|
||||||
ctx.add_class("distbutton_active")
|
ctx.add_class("distbutton_active")
|
||||||
for i in self.distances:
|
for i in self.distances:
|
||||||
if i == self.distance:
|
if i == self.distance:
|
||||||
continue
|
continue
|
||||||
self.labels["dist"+str(i)].set_active(False)
|
self.labels["dist" + str(i)].set_active(False)
|
||||||
|
|
||||||
def change_extruder(self, widget, extruder):
|
def change_extruder(self, widget, extruder):
|
||||||
if extruder == self.current_extruder:
|
if extruder == self.current_extruder:
|
||||||
|
@ -7,12 +7,14 @@ from gi.repository import Gtk, Gdk, GLib, Pango
|
|||||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return FanPanel(*args)
|
return FanPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
CHANGEABLE_FANS = ["fan", "fan_generic"]
|
CHANGEABLE_FANS = ["fan", "fan_generic"]
|
||||||
|
|
||||||
|
|
||||||
class FanPanel(ScreenPanel):
|
class FanPanel(ScreenPanel):
|
||||||
fan_speed = {}
|
fan_speed = {}
|
||||||
user_selecting = False
|
user_selecting = False
|
||||||
@ -41,7 +43,7 @@ class FanPanel(ScreenPanel):
|
|||||||
self.content.add(box)
|
self.content.add(box)
|
||||||
|
|
||||||
def process_update(self, action, data):
|
def process_update(self, action, data):
|
||||||
if (action != "notify_status_update"):
|
if action != "notify_status_update":
|
||||||
return
|
return
|
||||||
|
|
||||||
for fan in self.devices:
|
for fan in self.devices:
|
||||||
@ -80,7 +82,7 @@ class FanPanel(ScreenPanel):
|
|||||||
fan_name = "Part Fan"
|
fan_name = "Part Fan"
|
||||||
else:
|
else:
|
||||||
fan_name = " ".join(fan.split(" ")[1:])
|
fan_name = " ".join(fan.split(" ")[1:])
|
||||||
name.set_markup("<big><b>%s</b></big>" % (fan_name))
|
name.set_markup("<big><b>%s</b></big>" % fan_name)
|
||||||
name.set_hexpand(True)
|
name.set_hexpand(True)
|
||||||
name.set_vexpand(True)
|
name.set_vexpand(True)
|
||||||
name.set_halign(Gtk.Align.START)
|
name.set_halign(Gtk.Align.START)
|
||||||
@ -150,7 +152,7 @@ class FanPanel(ScreenPanel):
|
|||||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.set_fan_speed(value))
|
self._screen._ws.klippy.gcode_script(KlippyGcodes.set_fan_speed(value))
|
||||||
else:
|
else:
|
||||||
f = " ".join(fan.split(" ")[1:])
|
f = " ".join(fan.split(" ")[1:])
|
||||||
self._screen._ws.klippy.gcode_script("SET_FAN_SPEED FAN=%s SPEED=%s" % (f, float(value)/100))
|
self._screen._ws.klippy.gcode_script("SET_FAN_SPEED FAN=%s SPEED=%s" % (f, float(value) / 100))
|
||||||
# Check the speed in case it wasn't applied
|
# Check the speed in case it wasn't applied
|
||||||
GLib.timeout_add_seconds(1, self.check_fan_speed, fan)
|
GLib.timeout_add_seconds(1, self.check_fan_speed, fan)
|
||||||
|
|
||||||
|
@ -8,9 +8,11 @@ from gi.repository import Gtk
|
|||||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return FineTunePanel(*args)
|
return FineTunePanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class FineTunePanel(ScreenPanel):
|
class FineTunePanel(ScreenPanel):
|
||||||
user_selecting = False
|
user_selecting = False
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ class FineTunePanel(ScreenPanel):
|
|||||||
ctx = self.labels[i].get_style_context()
|
ctx = self.labels[i].get_style_context()
|
||||||
if j == 0:
|
if j == 0:
|
||||||
ctx.add_class("distbutton_top")
|
ctx.add_class("distbutton_top")
|
||||||
elif j == len(self.bs_deltas)-1:
|
elif j == len(self.bs_deltas) - 1:
|
||||||
ctx.add_class("distbutton_bottom")
|
ctx.add_class("distbutton_bottom")
|
||||||
else:
|
else:
|
||||||
ctx.add_class("distbutton")
|
ctx.add_class("distbutton")
|
||||||
@ -65,7 +67,7 @@ class FineTunePanel(ScreenPanel):
|
|||||||
ctx = self.labels[i].get_style_context()
|
ctx = self.labels[i].get_style_context()
|
||||||
if j == 0:
|
if j == 0:
|
||||||
ctx.add_class("distbutton_top")
|
ctx.add_class("distbutton_top")
|
||||||
elif j == len(self.percent_deltas)-1:
|
elif j == len(self.percent_deltas) - 1:
|
||||||
ctx.add_class("distbutton_bottom")
|
ctx.add_class("distbutton_bottom")
|
||||||
else:
|
else:
|
||||||
ctx.add_class("distbutton")
|
ctx.add_class("distbutton")
|
||||||
@ -156,10 +158,10 @@ class FineTunePanel(ScreenPanel):
|
|||||||
if "homing_origin" in data["gcode_move"]:
|
if "homing_origin" in data["gcode_move"]:
|
||||||
self.labels['zoffset'].set_label(" %.2fmm" % data["gcode_move"]["homing_origin"][2])
|
self.labels['zoffset'].set_label(" %.2fmm" % data["gcode_move"]["homing_origin"][2])
|
||||||
if "extrude_factor" in data["gcode_move"]:
|
if "extrude_factor" in data["gcode_move"]:
|
||||||
self.extrusion = int(round(data["gcode_move"]["extrude_factor"]*100))
|
self.extrusion = int(round(data["gcode_move"]["extrude_factor"] * 100))
|
||||||
self.labels['extrudefactor'].set_label(" %3d%%" % self.extrusion)
|
self.labels['extrudefactor'].set_label(" %3d%%" % self.extrusion)
|
||||||
if "speed_factor" in data["gcode_move"]:
|
if "speed_factor" in data["gcode_move"]:
|
||||||
self.speed = int(round(data["gcode_move"]["speed_factor"]*100))
|
self.speed = int(round(data["gcode_move"]["speed_factor"] * 100))
|
||||||
self.labels['speedfactor'].set_label(" %3d%%" % self.speed)
|
self.labels['speedfactor'].set_label(" %3d%%" % self.speed)
|
||||||
|
|
||||||
def change_babystepping(self, widget, dir):
|
def change_babystepping(self, widget, dir):
|
||||||
|
@ -6,9 +6,11 @@ from gi.repository import Gdk, Gtk, GLib, Pango
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return MacroPanel(*args)
|
return MacroPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class MacroPanel(ScreenPanel):
|
class MacroPanel(ScreenPanel):
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
@ -55,7 +57,7 @@ class MacroPanel(ScreenPanel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
name = Gtk.Label()
|
name = Gtk.Label()
|
||||||
name.set_markup("<big><b>%s</b></big>" % (macro))
|
name.set_markup("<big><b>%s</b></big>" % macro)
|
||||||
name.set_hexpand(True)
|
name.set_hexpand(True)
|
||||||
name.set_vexpand(True)
|
name.set_vexpand(True)
|
||||||
name.set_halign(Gtk.Align.START)
|
name.set_halign(Gtk.Align.START)
|
||||||
@ -158,8 +160,8 @@ class MacroPanel(ScreenPanel):
|
|||||||
switch.set_vexpand(False)
|
switch.set_vexpand(False)
|
||||||
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name, fallback=True))
|
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name, fallback=True))
|
||||||
switch.connect("notify::active", self.switch_config_option, option['section'], opt_name)
|
switch.connect("notify::active", self.switch_config_option, option['section'], opt_name)
|
||||||
switch.set_property("width-request", round(self._gtk.get_font_size()*7))
|
switch.set_property("width-request", round(self._gtk.get_font_size() * 7))
|
||||||
switch.set_property("height-request", round(self._gtk.get_font_size()*3.5))
|
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
|
||||||
box.add(switch)
|
box.add(switch)
|
||||||
|
|
||||||
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
|
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
|
||||||
|
@ -7,6 +7,7 @@ from gi.repository import Gtk, Pango
|
|||||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return InputShaperPanel(*args)
|
return InputShaperPanel(*args)
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ XY_FREQ = [
|
|||||||
]
|
]
|
||||||
SHAPERS = ['zv', 'mzv', 'zvd', 'ei', '2hump_ei', '3hump_ei']
|
SHAPERS = ['zv', 'mzv', 'zvd', 'ei', '2hump_ei', '3hump_ei']
|
||||||
|
|
||||||
|
|
||||||
class InputShaperPanel(ScreenPanel):
|
class InputShaperPanel(ScreenPanel):
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
|
@ -9,9 +9,11 @@ from gi.repository import GLib, Gtk, Pango
|
|||||||
from numpy import sqrt, pi, dot, array, median
|
from numpy import sqrt, pi, dot, array, median
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return JobStatusPanel(*args)
|
return JobStatusPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class JobStatusPanel(ScreenPanel):
|
class JobStatusPanel(ScreenPanel):
|
||||||
is_paused = False
|
is_paused = False
|
||||||
filename = state_timeout = prev_pos = prev_gpos = vel_timeout = animation_timeout = None
|
filename = state_timeout = prev_pos = prev_gpos = vel_timeout = animation_timeout = None
|
||||||
@ -85,10 +87,9 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
|
|
||||||
for label in self.labels:
|
for label in self.labels:
|
||||||
self.labels[label].set_halign(Gtk.Align.START)
|
self.labels[label].set_halign(Gtk.Align.START)
|
||||||
self.labels[label].set_ellipsize(True)
|
|
||||||
self.labels[label].set_ellipsize(Pango.EllipsizeMode.END)
|
self.labels[label].set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
|
|
||||||
fi_box = Gtk.VBox(spacing=0)
|
fi_box = Gtk.VBox()
|
||||||
fi_box.add(self.labels['file'])
|
fi_box.add(self.labels['file'])
|
||||||
fi_box.add(self.labels['status'])
|
fi_box.add(self.labels['status'])
|
||||||
fi_box.add(self.labels['lcdmessage'])
|
fi_box.add(self.labels['lcdmessage'])
|
||||||
@ -109,9 +110,9 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
|
|
||||||
self.labels['thumbnail'] = self._gtk.Image("file", 2)
|
self.labels['thumbnail'] = self._gtk.Image("file", 2)
|
||||||
if self._screen.vertical_mode:
|
if self._screen.vertical_mode:
|
||||||
self.labels['thumbnail'].set_size_request(0, self._screen.height/4)
|
self.labels['thumbnail'].set_size_request(0, self._screen.height / 4)
|
||||||
else:
|
else:
|
||||||
self.labels['thumbnail'].set_size_request(self._screen.width/3, 0)
|
self.labels['thumbnail'].set_size_request(self._screen.width / 3, 0)
|
||||||
|
|
||||||
self.labels['info_grid'] = Gtk.Grid()
|
self.labels['info_grid'] = Gtk.Grid()
|
||||||
self.labels['info_grid'].attach(self.labels['thumbnail'], 0, 0, 1, 1)
|
self.labels['info_grid'].attach(self.labels['thumbnail'], 0, 0, 1, 1)
|
||||||
@ -245,8 +246,7 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
szfe.attach(self.extrusion_button, 0, 1, 1, 1)
|
szfe.attach(self.extrusion_button, 0, 1, 1, 1)
|
||||||
szfe.attach(self.fan_button, 1, 1, 1, 1)
|
szfe.attach(self.fan_button, 1, 1, 1, 1)
|
||||||
|
|
||||||
|
info = Gtk.VBox()
|
||||||
info = Gtk.VBox(spacing=0)
|
|
||||||
info.get_style_context().add_class("printing-info")
|
info.get_style_context().add_class("printing-info")
|
||||||
info.add(self.labels['temp_grid'])
|
info.add(self.labels['temp_grid'])
|
||||||
info.add(szfe)
|
info.add(szfe)
|
||||||
@ -345,15 +345,15 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
def on_draw(self, da, ctx):
|
def on_draw(self, da, ctx):
|
||||||
w = da.get_allocated_width()
|
w = da.get_allocated_width()
|
||||||
h = da.get_allocated_height()
|
h = da.get_allocated_height()
|
||||||
r = min(w, h)*.42
|
r = min(w, h) * .42
|
||||||
|
|
||||||
ctx.set_source_rgb(0.13, 0.13, 0.13)
|
ctx.set_source_rgb(0.13, 0.13, 0.13)
|
||||||
ctx.set_line_width(self._gtk.get_font_size() * .75)
|
ctx.set_line_width(self._gtk.get_font_size() * .75)
|
||||||
ctx.translate(w / 2, h / 2)
|
ctx.translate(w / 2, h / 2)
|
||||||
ctx.arc(0, 0, r, 0, 2*pi)
|
ctx.arc(0, 0, r, 0, 2 * pi)
|
||||||
ctx.stroke()
|
ctx.stroke()
|
||||||
ctx.set_source_rgb(0.718, 0.110, 0.110)
|
ctx.set_source_rgb(0.718, 0.110, 0.110)
|
||||||
ctx.arc(0, 0, r, 3/2*pi, 3/2*pi+(self.progress*2*pi))
|
ctx.arc(0, 0, r, 3 / 2 * pi, 3 / 2 * pi + (self.progress * 2 * pi))
|
||||||
ctx.stroke()
|
ctx.stroke()
|
||||||
|
|
||||||
def activate(self):
|
def activate(self):
|
||||||
@ -391,23 +391,23 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
def save_offset(self, widget, device):
|
def save_offset(self, widget, device):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
|
|
||||||
save_offset = "?"
|
saved_z_offset = 0
|
||||||
if self._printer.config_section_exists("probe"):
|
if self._printer.config_section_exists("probe"):
|
||||||
saved_z_offset = float(self._screen.printer.get_config_section("probe")['z_offset'])
|
saved_z_offset = float(self._screen.printer.get_config_section("probe")['z_offset'])
|
||||||
elif self._printer.config_section_exists("bltouch"):
|
elif self._printer.config_section_exists("bltouch"):
|
||||||
saved_z_offset = float(self._screen.printer.get_config_section("bltouch")['z_offset'])
|
saved_z_offset = float(self._screen.printer.get_config_section("bltouch")['z_offset'])
|
||||||
|
|
||||||
if self.zoffset > 0:
|
if self.zoffset > 0:
|
||||||
sign = "-"
|
|
||||||
else:
|
|
||||||
sign = "+"
|
sign = "+"
|
||||||
|
else:
|
||||||
|
sign = "-"
|
||||||
|
label = Gtk.Label()
|
||||||
if device == "probe":
|
if device == "probe":
|
||||||
label = Gtk.Label(_("Apply %s%.2f offset to Probe?") % (sign, abs(self.zoffset))
|
label.set_text(_("Apply %s%.2f offset to Probe?") % (sign, abs(self.zoffset))
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ _("Saved offset: %s") % (saved_z_offset))
|
+ _("Saved offset: %s") % saved_z_offset)
|
||||||
if device == "endstop":
|
elif device == "endstop":
|
||||||
label = Gtk.Label(_("Apply %.2f offset to Endstop?") % (self.zoffset))
|
label.set_text(_("Apply %.2f offset to Endstop?") % self.zoffset)
|
||||||
label.set_hexpand(True)
|
label.set_hexpand(True)
|
||||||
label.set_halign(Gtk.Align.CENTER)
|
label.set_halign(Gtk.Align.CENTER)
|
||||||
label.set_vexpand(True)
|
label.set_vexpand(True)
|
||||||
@ -615,7 +615,7 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
|
|
||||||
for fan in self.fans:
|
for fan in self.fans:
|
||||||
if fan in data and "speed" in data[fan]:
|
if fan in data and "speed" in data[fan]:
|
||||||
fan_speed = int(round(self._printer.get_fan_speed(fan, data[fan]["speed"]), 2)*100)
|
fan_speed = int(round(self._printer.get_fan_speed(fan, data[fan]["speed"]), 2) * 100)
|
||||||
self.fans[fan]['speed'] = ("%3d%%" % fan_speed)
|
self.fans[fan]['speed'] = ("%3d%%" % fan_speed)
|
||||||
fan_label = ""
|
fan_label = ""
|
||||||
for fan in self.fans:
|
for fan in self.fans:
|
||||||
@ -686,6 +686,9 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
slicer_time = (self.file_metadata['estimated_time'] * slicer_correction) / spdcomp
|
slicer_time = (self.file_metadata['estimated_time'] * slicer_correction) / spdcomp
|
||||||
if slicer_time < duration:
|
if slicer_time < duration:
|
||||||
slicer_time = None
|
slicer_time = None
|
||||||
|
self.update_text("slicer_time", "-")
|
||||||
|
else:
|
||||||
|
self.update_text("slicer_time", str(self._gtk.formatTimeString(slicer_time)))
|
||||||
|
|
||||||
if "filament_total" in self.file_metadata:
|
if "filament_total" in self.file_metadata:
|
||||||
if self.file_metadata['filament_total'] > 0 and filament_used > 0:
|
if self.file_metadata['filament_total'] > 0 and filament_used > 0:
|
||||||
@ -693,9 +696,15 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
filament_time = duration / (filament_used / self.file_metadata['filament_total'])
|
filament_time = duration / (filament_used / self.file_metadata['filament_total'])
|
||||||
if filament_time < duration:
|
if filament_time < duration:
|
||||||
filament_time = None
|
filament_time = None
|
||||||
|
self.update_text("filament_time", "-")
|
||||||
|
else:
|
||||||
|
self.update_text("filament_time", str(self._gtk.formatTimeString(slicer_time)))
|
||||||
|
|
||||||
if self.progress > 0:
|
if self.progress > 0:
|
||||||
file_time = duration / self.progress
|
file_time = duration / self.progress
|
||||||
|
self.update_text("file_time", str(self._gtk.formatTimeString(file_time)))
|
||||||
|
else:
|
||||||
|
self.update_text("file_time", "-")
|
||||||
|
|
||||||
if timeleft_type == "file" and file_time is not None:
|
if timeleft_type == "file" and file_time is not None:
|
||||||
total_duration = file_time
|
total_duration = file_time
|
||||||
@ -717,16 +726,11 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
else:
|
else:
|
||||||
total_duration = file_time
|
total_duration = file_time
|
||||||
|
|
||||||
if total_duration is None:
|
if total_duration is not None:
|
||||||
|
self.update_text("est_time", str(self._gtk.formatTimeString(total_duration)))
|
||||||
|
return str(self._gtk.formatTimeString((total_duration - duration)))
|
||||||
|
else:
|
||||||
return "-"
|
return "-"
|
||||||
self.update_text("est_time", str(self._gtk.formatTimeString(total_duration)))
|
|
||||||
if slicer_time is not None:
|
|
||||||
self.update_text("slicer_time", str(self._gtk.formatTimeString(slicer_time)))
|
|
||||||
if file_time is not None:
|
|
||||||
self.update_text("file_time", str(self._gtk.formatTimeString(file_time)))
|
|
||||||
if filament_time is not None:
|
|
||||||
self.update_text("filament_time", str(self._gtk.formatTimeString(filament_time)))
|
|
||||||
return str(self._gtk.formatTimeString((total_duration - duration)))
|
|
||||||
|
|
||||||
def state_check(self):
|
def state_check(self):
|
||||||
ps = self._printer.get_stat("print_stats")
|
ps = self._printer.get_stat("print_stats")
|
||||||
@ -794,7 +798,6 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
self.state = state
|
self.state = state
|
||||||
self.show_buttons_for_state()
|
self.show_buttons_for_state()
|
||||||
|
|
||||||
|
|
||||||
def show_buttons_for_state(self):
|
def show_buttons_for_state(self):
|
||||||
self.buttons['button_grid'].remove_row(0)
|
self.buttons['button_grid'].remove_row(0)
|
||||||
self.buttons['button_grid'].insert_row(0)
|
self.buttons['button_grid'].insert_row(0)
|
||||||
@ -818,7 +821,7 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
self.buttons['button_grid'].attach(self.buttons["save_offset_endstop"], 0, 0, 1, 1)
|
self.buttons['button_grid'].attach(self.buttons["save_offset_endstop"], 0, 0, 1, 1)
|
||||||
else:
|
else:
|
||||||
self.buttons['button_grid'].attach(Gtk.Label(""), 0, 0, 1, 1)
|
self.buttons['button_grid'].attach(Gtk.Label(""), 0, 0, 1, 1)
|
||||||
if (self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch")):
|
if self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch"):
|
||||||
self.buttons['button_grid'].attach(self.buttons["save_offset_probe"], 1, 0, 1, 1)
|
self.buttons['button_grid'].attach(self.buttons["save_offset_probe"], 1, 0, 1, 1)
|
||||||
else:
|
else:
|
||||||
self.buttons['button_grid'].attach(Gtk.Label(""), 1, 0, 1, 1)
|
self.buttons['button_grid'].attach(Gtk.Label(""), 1, 0, 1, 1)
|
||||||
@ -888,7 +891,7 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
if "first_layer_height" in self.file_metadata:
|
if "first_layer_height" in self.file_metadata:
|
||||||
self.f_layer_h = self.file_metadata['first_layer_height']
|
self.f_layer_h = self.file_metadata['first_layer_height']
|
||||||
else:
|
else:
|
||||||
self.f_layer_h = layer_h
|
self.f_layer_h = self.layer_h
|
||||||
self.labels['total_layers'].set_label(str(int((self.height - self.f_layer_h) / self.layer_h) + 1))
|
self.labels['total_layers'].set_label(str(int((self.height - self.f_layer_h) / self.layer_h) + 1))
|
||||||
if "filament_total" in self.file_metadata:
|
if "filament_total" in self.file_metadata:
|
||||||
filament_total = float(self.file_metadata['filament_total']) / 1000
|
filament_total = float(self.file_metadata['filament_total']) / 1000
|
||||||
@ -908,8 +911,8 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
|
|
||||||
if "gcode_start_byte" in self.file_metadata:
|
if "gcode_start_byte" in self.file_metadata:
|
||||||
progress = (max(self._printer.get_stat('virtual_sdcard', 'file_position') -
|
progress = (max(self._printer.get_stat('virtual_sdcard', 'file_position') -
|
||||||
self.file_metadata['gcode_start_byte'], 0) / (self.file_metadata['gcode_end_byte'] -
|
self.file_metadata['gcode_start_byte'], 0) / (self.file_metadata['gcode_end_byte'] -
|
||||||
self.file_metadata['gcode_start_byte']))
|
self.file_metadata['gcode_start_byte']))
|
||||||
else:
|
else:
|
||||||
progress = self._printer.get_stat('virtual_sdcard', 'progress')
|
progress = self._printer.get_stat('virtual_sdcard', 'progress')
|
||||||
|
|
||||||
@ -924,7 +927,7 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
|
|
||||||
def update_progress(self):
|
def update_progress(self):
|
||||||
if self.progress < 1:
|
if self.progress < 1:
|
||||||
self.labels['progress_text'].set_text("%s%%" % (str((int(self.progress*100)))))
|
self.labels['progress_text'].set_text("%s%%" % (str((int(self.progress * 100)))))
|
||||||
else:
|
else:
|
||||||
self.labels['progress_text'].set_text("100")
|
self.labels['progress_text'].set_text("100")
|
||||||
|
|
||||||
@ -938,4 +941,4 @@ class JobStatusPanel(ScreenPanel):
|
|||||||
if target > 0:
|
if target > 0:
|
||||||
self.labels[x].set_label("%3d/%3d°" % (temp, target))
|
self.labels[x].set_label("%3d/%3d°" % (temp, target))
|
||||||
else:
|
else:
|
||||||
self.labels[x].set_label("%3d°" % (temp))
|
self.labels[x].set_label("%3d°" % temp)
|
||||||
|
@ -6,6 +6,7 @@ from gi.repository import Gdk, Gtk, Pango
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return LimitsPanel(*args)
|
return LimitsPanel(*args)
|
||||||
|
|
||||||
@ -30,14 +31,14 @@ class LimitsPanel(ScreenPanel):
|
|||||||
conf = self._printer.get_config_section("printer")
|
conf = self._printer.get_config_section("printer")
|
||||||
self.options = [
|
self.options = [
|
||||||
{"name": _("Max Acceleration"), "units": _("mm/s^2"), "option": "max_accel",
|
{"name": _("Max Acceleration"), "units": _("mm/s^2"), "option": "max_accel",
|
||||||
"max": self.stn(conf['max_accel'])},
|
"max": self.stn(conf['max_accel'])},
|
||||||
{"name": _("Max Acceleration to Deceleration"), "units": _("mm/s^2"), "option": "max_accel_to_decel",
|
{"name": _("Max Acceleration to Deceleration"), "units": _("mm/s^2"), "option": "max_accel_to_decel",
|
||||||
"max": self.stn(conf['max_accel_to_decel']) if "max_accel_to_decel" in conf else
|
"max": self.stn(conf['max_accel_to_decel']) if "max_accel_to_decel" in conf else
|
||||||
round(self.stn(conf['max_accel'])/2)},
|
round(self.stn(conf['max_accel']) / 2)},
|
||||||
{"name": _("Max Velocity"), "units": _("mm/s"), "option": "max_velocity",
|
{"name": _("Max Velocity"), "units": _("mm/s"), "option": "max_velocity",
|
||||||
"max": self.stn(conf["max_velocity"])},
|
"max": self.stn(conf["max_velocity"])},
|
||||||
{"name": _("Square Corner Velocity"), "units": _("mm/s"), "option": "square_corner_velocity",
|
{"name": _("Square Corner Velocity"), "units": _("mm/s"), "option": "square_corner_velocity",
|
||||||
"max": self.stn(conf['square_corner_velocity']) if "square_corner_velocity" in conf else 5}
|
"max": self.stn(conf['square_corner_velocity']) if "square_corner_velocity" in conf else 5}
|
||||||
]
|
]
|
||||||
|
|
||||||
for opt in self.options:
|
for opt in self.options:
|
||||||
@ -50,7 +51,7 @@ class LimitsPanel(ScreenPanel):
|
|||||||
return int(float(str))
|
return int(float(str))
|
||||||
|
|
||||||
def process_update(self, action, data):
|
def process_update(self, action, data):
|
||||||
if (action != "notify_status_update"):
|
if action != "notify_status_update":
|
||||||
return
|
return
|
||||||
|
|
||||||
for opt in self.limits:
|
for opt in self.limits:
|
||||||
@ -132,10 +133,10 @@ class LimitsPanel(ScreenPanel):
|
|||||||
value = self.limits[opt]['scale'].get_value()
|
value = self.limits[opt]['scale'].get_value()
|
||||||
|
|
||||||
if opt == "max_accel":
|
if opt == "max_accel":
|
||||||
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT ACCEL=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT ACCEL=%s" % value)
|
||||||
elif opt == "max_accel_to_decel":
|
elif opt == "max_accel_to_decel":
|
||||||
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT ACCEL_TO_DECEL=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT ACCEL_TO_DECEL=%s" % value)
|
||||||
elif opt == "max_velocity":
|
elif opt == "max_velocity":
|
||||||
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT VELOCITY=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT VELOCITY=%s" % value)
|
||||||
elif opt == "square_corner_velocity":
|
elif opt == "square_corner_velocity":
|
||||||
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY=%s" % value)
|
||||||
|
@ -8,9 +8,11 @@ from panels.menu import MenuPanel
|
|||||||
from ks_includes.widgets.graph import HeaterGraph
|
from ks_includes.widgets.graph import HeaterGraph
|
||||||
from ks_includes.widgets.keypad import Keypad
|
from ks_includes.widgets.keypad import Keypad
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return MainPanel(*args)
|
return MainPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class MainPanel(MenuPanel):
|
class MainPanel(MenuPanel):
|
||||||
def __init__(self, screen, title, back=False):
|
def __init__(self, screen, title, back=False):
|
||||||
super().__init__(screen, title, False)
|
super().__init__(screen, title, False)
|
||||||
@ -135,7 +137,6 @@ class MainPanel(MenuPanel):
|
|||||||
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 = name.get_children()[0].get_children()[0].get_children()[1]
|
||||||
child.set_ellipsize(True)
|
|
||||||
child.set_ellipsize(Pango.EllipsizeMode.END)
|
child.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
|
|
||||||
temp = self._gtk.Button("")
|
temp = self._gtk.Button("")
|
||||||
@ -225,7 +226,6 @@ class MainPanel(MenuPanel):
|
|||||||
box.add(scroll)
|
box.add(scroll)
|
||||||
box.add(self.labels['da'])
|
box.add(self.labels['da'])
|
||||||
|
|
||||||
|
|
||||||
self.labels['graph_settemp'] = self._gtk.Button(label=_("Set Temp"))
|
self.labels['graph_settemp'] = self._gtk.Button(label=_("Set Temp"))
|
||||||
self.labels['graph_settemp'].connect("clicked", self.show_numpad)
|
self.labels['graph_settemp'].connect("clicked", self.show_numpad)
|
||||||
self.labels['graph_hide'] = self._gtk.Button(label=_("Hide"))
|
self.labels['graph_hide'] = self._gtk.Button(label=_("Hide"))
|
||||||
|
@ -7,12 +7,15 @@ from jinja2 import Environment, Template
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return MenuPanel(*args)
|
return MenuPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class MenuPanel(ScreenPanel):
|
class MenuPanel(ScreenPanel):
|
||||||
i = 0
|
i = 0
|
||||||
j2_data = None
|
j2_data = None
|
||||||
|
|
||||||
def initialize(self, panel_name, display_name, items):
|
def initialize(self, panel_name, display_name, items):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
|
|
||||||
@ -57,15 +60,15 @@ class MenuPanel(ScreenPanel):
|
|||||||
if length <= 4:
|
if length <= 4:
|
||||||
# Arrange 2 x 2
|
# Arrange 2 x 2
|
||||||
columns = 2
|
columns = 2
|
||||||
elif length > 4 and length <= 6:
|
elif 4 < length <= 6:
|
||||||
# Arrange 3 x 2
|
# Arrange 3 x 2
|
||||||
columns = 3
|
columns = 3
|
||||||
|
|
||||||
col = i % columns
|
col = i % columns
|
||||||
row = int(i/columns)
|
row = int(i / columns)
|
||||||
|
|
||||||
width = height = 1
|
width = height = 1
|
||||||
if expandLast is True and i+1 == length and length % 2 == 1:
|
if expandLast is True and i + 1 == length and length % 2 == 1:
|
||||||
width = 2
|
width = 2
|
||||||
|
|
||||||
self.grid.attach(self.labels[key], col, row, width, height)
|
self.grid.attach(self.labels[key], col, row, width, height)
|
||||||
@ -84,7 +87,7 @@ class MenuPanel(ScreenPanel):
|
|||||||
parsed_name = j2_temp.render()
|
parsed_name = j2_temp.render()
|
||||||
|
|
||||||
b = self._gtk.ButtonImage(
|
b = self._gtk.ButtonImage(
|
||||||
item['icon'], parsed_name, "color"+str((i % 4)+1)
|
item['icon'], parsed_name, "color" + str((i % 4) + 1)
|
||||||
)
|
)
|
||||||
if item['panel'] is not False:
|
if item['panel'] is not False:
|
||||||
b.connect("clicked", self.menu_item_clicked, item['panel'], item)
|
b.connect("clicked", self.menu_item_clicked, item['panel'], item)
|
||||||
|
@ -11,14 +11,15 @@ AXIS_X = "X"
|
|||||||
AXIS_Y = "Y"
|
AXIS_Y = "Y"
|
||||||
AXIS_Z = "Z"
|
AXIS_Z = "Z"
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return MovePanel(*args)
|
return MovePanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class MovePanel(ScreenPanel):
|
class MovePanel(ScreenPanel):
|
||||||
distance = 1
|
distance = 1
|
||||||
distances = ['.1', '.5', '1', '5', '10', '25', '50']
|
distances = ['.1', '.5', '1', '5', '10', '25', '50']
|
||||||
|
|
||||||
|
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
self.settings = {}
|
self.settings = {}
|
||||||
@ -103,9 +104,9 @@ class MovePanel(ScreenPanel):
|
|||||||
self.labels[i].set_direction(Gtk.TextDirection.LTR)
|
self.labels[i].set_direction(Gtk.TextDirection.LTR)
|
||||||
self.labels[i].connect("clicked", self.change_distance, i)
|
self.labels[i].connect("clicked", self.change_distance, i)
|
||||||
ctx = self.labels[i].get_style_context()
|
ctx = self.labels[i].get_style_context()
|
||||||
if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances)-1):
|
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")
|
ctx.add_class("distbutton_top")
|
||||||
elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and 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")
|
ctx.add_class("distbutton_bottom")
|
||||||
else:
|
else:
|
||||||
ctx.add_class("distbutton")
|
ctx.add_class("distbutton")
|
||||||
@ -229,7 +230,7 @@ class MovePanel(ScreenPanel):
|
|||||||
|
|
||||||
self._screen._ws.klippy.gcode_script(
|
self._screen._ws.klippy.gcode_script(
|
||||||
"%s\n%s %s%s F%s%s" % (
|
"%s\n%s %s%s F%s%s" % (
|
||||||
KlippyGcodes.MOVE_RELATIVE, KlippyGcodes.MOVE, axis, dist, speed*60,
|
KlippyGcodes.MOVE_RELATIVE, KlippyGcodes.MOVE, axis, dist, speed * 60,
|
||||||
"\nG90" if self._printer.get_stat("gcode_move", "absolute_coordinates") is True else ""
|
"\nG90" if self._printer.get_stat("gcode_move", "absolute_coordinates") is True else ""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -258,19 +259,19 @@ class MovePanel(ScreenPanel):
|
|||||||
switch.set_vexpand(False)
|
switch.set_vexpand(False)
|
||||||
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name))
|
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name))
|
||||||
switch.connect("notify::active", self.switch_config_option, option['section'], opt_name)
|
switch.connect("notify::active", self.switch_config_option, option['section'], opt_name)
|
||||||
switch.set_property("width-request", round(self._gtk.get_font_size()*7))
|
switch.set_property("width-request", round(self._gtk.get_font_size() * 7))
|
||||||
switch.set_property("height-request", round(self._gtk.get_font_size()*3.5))
|
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
|
||||||
box.add(switch)
|
box.add(switch)
|
||||||
dev.add(box)
|
dev.add(box)
|
||||||
elif option['type'] == "scale":
|
elif option['type'] == "scale":
|
||||||
dev.set_orientation(Gtk.Orientation.VERTICAL)
|
dev.set_orientation(Gtk.Orientation.VERTICAL)
|
||||||
val = int(self._config.get_config().get(option['section'], opt_name, fallback=option['value']))
|
val = int(self._config.get_config().get(option['section'], opt_name, fallback=option['value']))
|
||||||
adj = Gtk.Adjustment(val, option['range'][0], option['range'][1], option['step'], option['step']*5)
|
adj = Gtk.Adjustment(val, option['range'][0], option['range'][1], option['step'], option['step'] * 5)
|
||||||
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
|
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
|
||||||
scale.set_hexpand(True)
|
scale.set_hexpand(True)
|
||||||
scale.set_digits(0)
|
scale.set_digits(0)
|
||||||
scale.connect("button-release-event", self.scale_moved, option['section'], opt_name)
|
scale.connect("button-release-event", self.scale_moved, option['section'], opt_name)
|
||||||
scale.set_property("width-request", round(self._screen.width/2.2))
|
scale.set_property("width-request", round(self._screen.width / 2.2))
|
||||||
dev.add(scale)
|
dev.add(scale)
|
||||||
|
|
||||||
frame = Gtk.Frame()
|
frame = Gtk.Frame()
|
||||||
|
@ -8,9 +8,11 @@ gi.require_version("Gtk", "3.0")
|
|||||||
from gi.repository import Gtk, Gdk, GLib, Pango
|
from gi.repository import Gtk, Gdk, GLib, Pango
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return NetworkPanel(*args)
|
return NetworkPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class NetworkPanel(ScreenPanel):
|
class NetworkPanel(ScreenPanel):
|
||||||
initialized = False
|
initialized = False
|
||||||
|
|
||||||
@ -38,7 +40,7 @@ class NetworkPanel(ScreenPanel):
|
|||||||
ints = netifaces.interfaces()
|
ints = netifaces.interfaces()
|
||||||
if 'lo' in ints:
|
if 'lo' in ints:
|
||||||
ints.pop(ints.index('lo'))
|
ints.pop(ints.index('lo'))
|
||||||
if (len(ints) > 0):
|
if len(ints) > 0:
|
||||||
self.interface = ints[0]
|
self.interface = ints[0]
|
||||||
else:
|
else:
|
||||||
self.interface = 'lo'
|
self.interface = 'lo'
|
||||||
@ -69,7 +71,6 @@ class NetworkPanel(ScreenPanel):
|
|||||||
sbox.add(self.labels['ip'])
|
sbox.add(self.labels['ip'])
|
||||||
sbox.add(reload_networks)
|
sbox.add(reload_networks)
|
||||||
|
|
||||||
|
|
||||||
scroll = Gtk.ScrolledWindow()
|
scroll = Gtk.ScrolledWindow()
|
||||||
scroll.set_property("overlay-scrolling", False)
|
scroll.set_property("overlay-scrolling", False)
|
||||||
scroll.set_vexpand(True)
|
scroll.set_vexpand(True)
|
||||||
@ -151,7 +152,7 @@ class NetworkPanel(ScreenPanel):
|
|||||||
display_name += " (" + _("Connected") + ")"
|
display_name += " (" + _("Connected") + ")"
|
||||||
|
|
||||||
name = Gtk.Label("")
|
name = Gtk.Label("")
|
||||||
name.set_markup("<big><b>%s</b></big>" % (display_name))
|
name.set_markup("<big><b>%s</b></big>" % display_name)
|
||||||
name.set_hexpand(True)
|
name.set_hexpand(True)
|
||||||
name.set_halign(Gtk.Align.START)
|
name.set_halign(Gtk.Align.START)
|
||||||
name.set_line_wrap(True)
|
name.set_line_wrap(True)
|
||||||
@ -372,7 +373,6 @@ class NetworkPanel(ScreenPanel):
|
|||||||
save.set_hexpand(False)
|
save.set_hexpand(False)
|
||||||
save.connect("clicked", self.add_new_network, ssid, True)
|
save.connect("clicked", self.add_new_network, ssid, True)
|
||||||
|
|
||||||
|
|
||||||
self.labels['network_psk'] = entry
|
self.labels['network_psk'] = entry
|
||||||
box.pack_start(label, False, False, 5)
|
box.pack_start(label, False, False, 5)
|
||||||
box.pack_start(entry, True, True, 5)
|
box.pack_start(entry, True, True, 5)
|
||||||
@ -428,7 +428,7 @@ class NetworkPanel(ScreenPanel):
|
|||||||
lvl = netinfo['signal_level_dBm'] + " " + _("dBm")
|
lvl = netinfo['signal_level_dBm'] + " " + _("dBm")
|
||||||
|
|
||||||
self.labels['networks'][ssid]['info'].set_markup("%s <small>%s %s %s %s</small>" % (
|
self.labels['networks'][ssid]['info'].set_markup("%s <small>%s %s %s %s</small>" % (
|
||||||
info, encr, freq, chan, lvl))
|
info, encr, freq, chan, lvl))
|
||||||
self.labels['networks'][ssid]['info'].show_all()
|
self.labels['networks'][ssid]['info'].show_all()
|
||||||
|
|
||||||
def update_single_network_info(self):
|
def update_single_network_info(self):
|
||||||
|
@ -6,9 +6,11 @@ from gi.repository import Gdk, Gtk, Pango
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return PowerPanel(*args)
|
return PowerPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class PowerPanel(ScreenPanel):
|
class PowerPanel(ScreenPanel):
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
@ -47,7 +49,7 @@ class PowerPanel(ScreenPanel):
|
|||||||
frame.get_style_context().add_class("frame-item")
|
frame.get_style_context().add_class("frame-item")
|
||||||
|
|
||||||
name = Gtk.Label()
|
name = Gtk.Label()
|
||||||
name.set_markup("<big><b>%s</b></big>" % (device))
|
name.set_markup("<big><b>%s</b></big>" % device)
|
||||||
name.set_hexpand(True)
|
name.set_hexpand(True)
|
||||||
name.set_vexpand(True)
|
name.set_vexpand(True)
|
||||||
name.set_halign(Gtk.Align.START)
|
name.set_halign(Gtk.Align.START)
|
||||||
@ -59,8 +61,8 @@ class PowerPanel(ScreenPanel):
|
|||||||
switch.set_hexpand(False)
|
switch.set_hexpand(False)
|
||||||
switch.set_active(True if self._screen.printer.get_power_device_status(device) == "on" else False)
|
switch.set_active(True if self._screen.printer.get_power_device_status(device) == "on" else False)
|
||||||
switch.connect("notify::active", self.on_switch, device)
|
switch.connect("notify::active", self.on_switch, device)
|
||||||
switch.set_property("width-request", round(self._gtk.get_font_size()*7))
|
switch.set_property("width-request", round(self._gtk.get_font_size() * 7))
|
||||||
switch.set_property("height-request", round(self._gtk.get_font_size()*3.5))
|
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
|
||||||
|
|
||||||
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
labels.add(name)
|
labels.add(name)
|
||||||
|
@ -9,9 +9,11 @@ from datetime import datetime
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return PrintPanel(*args)
|
return PrintPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class PrintPanel(ScreenPanel):
|
class PrintPanel(ScreenPanel):
|
||||||
cur_directory = "gcodes"
|
cur_directory = "gcodes"
|
||||||
dir_panels = {}
|
dir_panels = {}
|
||||||
@ -167,13 +169,13 @@ class PrintPanel(ScreenPanel):
|
|||||||
filename = filepath.split('/')[-1]
|
filename = filepath.split('/')[-1]
|
||||||
for i in range(1, len(dir)):
|
for i in range(1, len(dir)):
|
||||||
curdir = "/".join(dir[0:i])
|
curdir = "/".join(dir[0:i])
|
||||||
newdir = "/".join(dir[0:i+1])
|
newdir = "/".join(dir[0:i + 1])
|
||||||
if newdir not in self.filelist[curdir]['directories']:
|
if newdir not in self.filelist[curdir]['directories']:
|
||||||
self.add_directory(newdir)
|
self.add_directory(newdir)
|
||||||
|
|
||||||
if filename not in self.filelist[directory]['files']:
|
if filename not in self.filelist[directory]['files']:
|
||||||
for i in range(1, len(dir)):
|
for i in range(1, len(dir)):
|
||||||
curdir = "/".join(dir[0:i+1])
|
curdir = "/".join(dir[0:i + 1])
|
||||||
if curdir != "gcodes" and fileinfo['modified'] > self.filelist[curdir]['modified']:
|
if curdir != "gcodes" and fileinfo['modified'] > self.filelist[curdir]['modified']:
|
||||||
self.filelist[curdir]['modified'] = fileinfo['modified']
|
self.filelist[curdir]['modified'] = fileinfo['modified']
|
||||||
self.labels['directories'][curdir]['info'].set_markup(
|
self.labels['directories'][curdir]['info'].set_markup(
|
||||||
@ -290,7 +292,7 @@ class PrintPanel(ScreenPanel):
|
|||||||
]
|
]
|
||||||
|
|
||||||
label = Gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_markup("<b>%s</b>\n" % (filename))
|
label.set_markup("<b>%s</b>\n" % filename)
|
||||||
label.set_hexpand(True)
|
label.set_hexpand(True)
|
||||||
label.set_halign(Gtk.Align.CENTER)
|
label.set_halign(Gtk.Align.CENTER)
|
||||||
label.set_vexpand(True)
|
label.set_vexpand(True)
|
||||||
@ -319,7 +321,7 @@ class PrintPanel(ScreenPanel):
|
|||||||
if response_id == Gtk.ResponseType.CANCEL:
|
if response_id == Gtk.ResponseType.CANCEL:
|
||||||
return
|
return
|
||||||
|
|
||||||
logging.info("Starting print: %s" % (filename))
|
logging.info("Starting print: %s" % filename)
|
||||||
self._screen._ws.klippy.print_start(filename)
|
self._screen._ws.klippy.print_start(filename)
|
||||||
|
|
||||||
def delete_file(self, filename):
|
def delete_file(self, filename):
|
||||||
@ -370,7 +372,7 @@ class PrintPanel(ScreenPanel):
|
|||||||
for i, suffix in enumerate(suffixes, start=2):
|
for i, suffix in enumerate(suffixes, start=2):
|
||||||
unit = 1024 ** i
|
unit = 1024 ** i
|
||||||
if size < unit:
|
if size < unit:
|
||||||
return ("%.1f %s") % ((1024 * size / unit), suffix)
|
return "%.1f %s" % ((1024 * size / unit), suffix)
|
||||||
|
|
||||||
def get_print_time(self, filename):
|
def get_print_time(self, filename):
|
||||||
fileinfo = self._screen.files.get_file_info(filename)
|
fileinfo = self._screen.files.get_file_info(filename)
|
||||||
@ -382,16 +384,16 @@ class PrintPanel(ScreenPanel):
|
|||||||
print_str = ""
|
print_str = ""
|
||||||
|
|
||||||
# Figure out how many days
|
# Figure out how many days
|
||||||
print_val = int(print_time/86400)
|
print_val = int(print_time / 86400)
|
||||||
if print_val > 0:
|
if print_val > 0:
|
||||||
print_str = "%sd " % print_val
|
print_str = "%sd " % print_val
|
||||||
|
|
||||||
# Take remainder from days and divide by hours
|
# Take remainder from days and divide by hours
|
||||||
print_val = int((print_time % 86400)/3600)
|
print_val = int((print_time % 86400) / 3600)
|
||||||
if print_val > 0:
|
if print_val > 0:
|
||||||
print_str = "%s%sh " % (print_str, print_val)
|
print_str = "%s%sh " % (print_str, print_val)
|
||||||
|
|
||||||
print_val = int(((print_time % 86400) % 3600)/60)
|
print_val = int(((print_time % 86400) % 3600) / 60)
|
||||||
print_str = "%s%sm" % (print_str, print_val)
|
print_str = "%s%sm" % (print_str, print_val)
|
||||||
return print_str
|
return print_str
|
||||||
return "Unavailable"
|
return "Unavailable"
|
||||||
|
@ -7,9 +7,11 @@ from ks_includes.screen_panel import ScreenPanel
|
|||||||
|
|
||||||
logger = logging.getLogger("KlipperScreen.PrinterSelect")
|
logger = logging.getLogger("KlipperScreen.PrinterSelect")
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return PrinterSelect(*args)
|
return PrinterSelect(*args)
|
||||||
|
|
||||||
|
|
||||||
class PrinterSelect(ScreenPanel):
|
class PrinterSelect(ScreenPanel):
|
||||||
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
|
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
|
||||||
super().__init__(screen, title, False, False, False)
|
super().__init__(screen, title, False, False, False)
|
||||||
@ -32,7 +34,7 @@ class PrinterSelect(ScreenPanel):
|
|||||||
if length == 4:
|
if length == 4:
|
||||||
# Arrange 2 x 2
|
# Arrange 2 x 2
|
||||||
columns = 2
|
columns = 2
|
||||||
elif length > 4 and length <= 6:
|
elif 4 < length <= 6:
|
||||||
# Arrange 3 x 2
|
# Arrange 3 x 2
|
||||||
columns = 3
|
columns = 3
|
||||||
else:
|
else:
|
||||||
@ -44,8 +46,8 @@ class PrinterSelect(ScreenPanel):
|
|||||||
self.labels[name].connect("clicked", self._screen.connect_printer_widget, name)
|
self.labels[name].connect("clicked", self._screen.connect_printer_widget, name)
|
||||||
if self._screen.vertical_mode:
|
if self._screen.vertical_mode:
|
||||||
row = i % columns
|
row = i % columns
|
||||||
col = int(i/columns)
|
col = int(i / columns)
|
||||||
else:
|
else:
|
||||||
col = i % columns
|
col = i % columns
|
||||||
row = int(i/columns)
|
row = int(i / columns)
|
||||||
grid.attach(self.labels[name], col, row, 1, 1)
|
grid.attach(self.labels[name], col, row, 1, 1)
|
||||||
|
@ -7,6 +7,7 @@ from gi.repository import Gdk, Gtk, Pango
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return FWRetractionPanel(*args)
|
return FWRetractionPanel(*args)
|
||||||
|
|
||||||
@ -26,26 +27,26 @@ class FWRetractionPanel(ScreenPanel):
|
|||||||
"units": _("mm"),
|
"units": _("mm"),
|
||||||
"option": "retract_length",
|
"option": "retract_length",
|
||||||
"value": float(conf['retract_length']) if 'retract_length' in conf else 0,
|
"value": float(conf['retract_length']) if 'retract_length' in conf else 0,
|
||||||
"digits":2,
|
"digits": 2,
|
||||||
"maxval":4},
|
"maxval": 4},
|
||||||
{"name": _("Retraction Speed"),
|
{"name": _("Retraction Speed"),
|
||||||
"units": _("mm/s"),
|
"units": _("mm/s"),
|
||||||
"option": "retract_speed",
|
"option": "retract_speed",
|
||||||
"value": int(float((conf['retract_speed']))) if 'retract_speed' in conf else 20,
|
"value": int(float((conf['retract_speed']))) if 'retract_speed' in conf else 20,
|
||||||
"digits":0,
|
"digits": 0,
|
||||||
"maxval":100},
|
"maxval": 100},
|
||||||
{"name": _("Unretract Extra Length"),
|
{"name": _("Unretract Extra Length"),
|
||||||
"units": _("mm"),
|
"units": _("mm"),
|
||||||
"option": "unretract_extra_length",
|
"option": "unretract_extra_length",
|
||||||
"value": float(conf['unretract_extra_length']) if 'unretract_extra_length' in conf else 0,
|
"value": float(conf['unretract_extra_length']) if 'unretract_extra_length' in conf else 0,
|
||||||
"digits":2,
|
"digits": 2,
|
||||||
"maxval":15},
|
"maxval": 15},
|
||||||
{"name": _("Unretract Speed"),
|
{"name": _("Unretract Speed"),
|
||||||
"units": _("mm/s"),
|
"units": _("mm/s"),
|
||||||
"option": "unretract_speed",
|
"option": "unretract_speed",
|
||||||
"value": int(float((conf['unretract_speed']))) if 'unretract_speed' in conf else 10,
|
"value": int(float((conf['unretract_speed']))) if 'unretract_speed' in conf else 10,
|
||||||
"digits":0,
|
"digits": 0,
|
||||||
"maxval":60}
|
"maxval": 60}
|
||||||
]
|
]
|
||||||
|
|
||||||
for opt in self.options:
|
for opt in self.options:
|
||||||
@ -152,10 +153,10 @@ class FWRetractionPanel(ScreenPanel):
|
|||||||
value = self.list[opt]['scale'].get_value()
|
value = self.list[opt]['scale'].get_value()
|
||||||
|
|
||||||
if opt == "retract_speed":
|
if opt == "retract_speed":
|
||||||
self._screen._ws.klippy.gcode_script("SET_RETRACTION RETRACT_SPEED=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_RETRACTION RETRACT_SPEED=%s" % value)
|
||||||
elif opt == "retract_length":
|
elif opt == "retract_length":
|
||||||
self._screen._ws.klippy.gcode_script("SET_RETRACTION RETRACT_LENGTH=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_RETRACTION RETRACT_LENGTH=%s" % value)
|
||||||
elif opt == "unretract_extra_length":
|
elif opt == "unretract_extra_length":
|
||||||
self._screen._ws.klippy.gcode_script("SET_RETRACTION UNRETRACT_EXTRA_LENGTH=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_RETRACTION UNRETRACT_EXTRA_LENGTH=%s" % value)
|
||||||
elif opt == "unretract_speed":
|
elif opt == "unretract_speed":
|
||||||
self._screen._ws.klippy.gcode_script("SET_RETRACTION UNRETRACT_SPEED=%s" % (value))
|
self._screen._ws.klippy.gcode_script("SET_RETRACTION UNRETRACT_SPEED=%s" % value)
|
||||||
|
@ -6,9 +6,11 @@ from gi.repository import Gdk, Gtk, Pango
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return SettingsPanel(*args)
|
return SettingsPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class SettingsPanel(ScreenPanel):
|
class SettingsPanel(ScreenPanel):
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
@ -113,8 +115,8 @@ class SettingsPanel(ScreenPanel):
|
|||||||
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name))
|
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name))
|
||||||
switch.connect("notify::active", self.switch_config_option, option['section'], opt_name,
|
switch.connect("notify::active", self.switch_config_option, option['section'], opt_name,
|
||||||
option['callback'] if "callback" in option else None)
|
option['callback'] if "callback" in option else None)
|
||||||
switch.set_property("width-request", round(self._gtk.get_font_size()*7))
|
switch.set_property("width-request", round(self._gtk.get_font_size() * 7))
|
||||||
switch.set_property("height-request", round(self._gtk.get_font_size()*3.5))
|
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
|
||||||
box.add(switch)
|
box.add(switch)
|
||||||
dev.add(box)
|
dev.add(box)
|
||||||
elif option['type'] == "dropdown":
|
elif option['type'] == "dropdown":
|
||||||
@ -131,12 +133,12 @@ class SettingsPanel(ScreenPanel):
|
|||||||
dev.add(dropdown)
|
dev.add(dropdown)
|
||||||
elif option['type'] == "scale":
|
elif option['type'] == "scale":
|
||||||
val = int(self._config.get_config().get(option['section'], opt_name, fallback=option['value']))
|
val = int(self._config.get_config().get(option['section'], opt_name, fallback=option['value']))
|
||||||
adj = Gtk.Adjustment(val, option['range'][0], option['range'][1], option['step'], option['step']*5)
|
adj = Gtk.Adjustment(val, option['range'][0], option['range'][1], option['step'], option['step'] * 5)
|
||||||
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
|
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
|
||||||
scale.set_hexpand(True)
|
scale.set_hexpand(True)
|
||||||
scale.set_digits(0)
|
scale.set_digits(0)
|
||||||
scale.connect("button-release-event", self.scale_moved, option['section'], opt_name)
|
scale.connect("button-release-event", self.scale_moved, option['section'], opt_name)
|
||||||
scale.set_property("width-request", round(self._screen.width/2.2))
|
scale.set_property("width-request", round(self._screen.width / 2.2))
|
||||||
dev.add(scale)
|
dev.add(scale)
|
||||||
elif option['type'] == "printer":
|
elif option['type'] == "printer":
|
||||||
logging.debug("Option: %s" % option)
|
logging.debug("Option: %s" % option)
|
||||||
|
@ -7,9 +7,11 @@ from gi.repository import Gdk, Gtk, Pango
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return SplashScreenPanel(*args)
|
return SplashScreenPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class SplashScreenPanel(ScreenPanel):
|
class SplashScreenPanel(ScreenPanel):
|
||||||
box = None
|
box = None
|
||||||
|
|
||||||
@ -129,7 +131,6 @@ class SplashScreenPanel(ScreenPanel):
|
|||||||
def restart(self, widget):
|
def restart(self, widget):
|
||||||
self._screen._ws.klippy.restart()
|
self._screen._ws.klippy.restart()
|
||||||
|
|
||||||
|
|
||||||
def shutdown(self, widget):
|
def shutdown(self, widget):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
if self._screen._ws.is_connected():
|
if self._screen._ws.is_connected():
|
||||||
|
@ -8,12 +8,14 @@ from datetime import datetime
|
|||||||
|
|
||||||
from ks_includes.screen_panel import ScreenPanel
|
from ks_includes.screen_panel import ScreenPanel
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return SystemPanel(*args)
|
return SystemPanel(*args)
|
||||||
|
|
||||||
|
|
||||||
ALLOWED_SERVICES = ["KlipperScreen", "MoonCord", "klipper", "moonraker"]
|
ALLOWED_SERVICES = ["KlipperScreen", "MoonCord", "klipper", "moonraker"]
|
||||||
|
|
||||||
|
|
||||||
class SystemPanel(ScreenPanel):
|
class SystemPanel(ScreenPanel):
|
||||||
def initialize(self, panel_name):
|
def initialize(self, panel_name):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
@ -74,7 +76,6 @@ class SystemPanel(ScreenPanel):
|
|||||||
logging.info("Updating program: %s " % prog)
|
logging.info("Updating program: %s " % prog)
|
||||||
self.update_program_info(prog)
|
self.update_program_info(prog)
|
||||||
|
|
||||||
|
|
||||||
infogrid.attach(self.labels[prog], 1, i, 1, 1)
|
infogrid.attach(self.labels[prog], 1, i, 1, 1)
|
||||||
self.labels[prog].get_style_context().add_class('updater-item')
|
self.labels[prog].get_style_context().add_class('updater-item')
|
||||||
i = i + 1
|
i = i + 1
|
||||||
@ -116,7 +117,6 @@ class SystemPanel(ScreenPanel):
|
|||||||
if 'application' in data:
|
if 'application' in data:
|
||||||
self.labels['update_progress'].set_text(self.labels['update_progress'].get_text().strip() + "\n" +
|
self.labels['update_progress'].set_text(self.labels['update_progress'].get_text().strip() + "\n" +
|
||||||
data['message'] + "\n")
|
data['message'] + "\n")
|
||||||
self.labels['update_progress'].set_ellipsize(True)
|
|
||||||
self.labels['update_progress'].set_ellipsize(Pango.EllipsizeMode.END)
|
self.labels['update_progress'].set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
adjustment = self.labels['update_scroll'].get_vadjustment()
|
adjustment = self.labels['update_scroll'].get_vadjustment()
|
||||||
adjustment.set_value(adjustment.get_upper() - adjustment.get_page_size())
|
adjustment.set_value(adjustment.get_upper() - adjustment.get_page_size())
|
||||||
@ -199,7 +199,7 @@ class SystemPanel(ScreenPanel):
|
|||||||
grid.attach(label, 0, i, 1, 1)
|
grid.attach(label, 0, i, 1, 1)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
details = Gtk.Label(label=c['message']+"\n\n\n")
|
details = Gtk.Label(label=c['message'] + "\n\n\n")
|
||||||
details.set_line_wrap(True)
|
details.set_line_wrap(True)
|
||||||
details.set_halign(Gtk.Align.START)
|
details.set_halign(Gtk.Align.START)
|
||||||
grid.attach(details, 0, i, 1, 1)
|
grid.attach(details, 0, i, 1, 1)
|
||||||
@ -216,12 +216,11 @@ class SystemPanel(ScreenPanel):
|
|||||||
label = Gtk.Label()
|
label = Gtk.Label()
|
||||||
label.set_markup(" %s " % c)
|
label.set_markup(" %s " % c)
|
||||||
label.set_halign(Gtk.Align.START)
|
label.set_halign(Gtk.Align.START)
|
||||||
label.set_ellipsize(True)
|
|
||||||
label.set_ellipsize(Pango.EllipsizeMode.END)
|
label.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
pos = (j % 3)
|
pos = (j % 3)
|
||||||
grid.attach(label, pos, i, 1, 1)
|
grid.attach(label, pos, i, 1, 1)
|
||||||
j = j + 1
|
j = j + 1
|
||||||
if (pos == 2):
|
if pos == 2:
|
||||||
i = i + 1
|
i = i + 1
|
||||||
elif "full" in info:
|
elif "full" in info:
|
||||||
label.set_markup("<b>" + _("Perform a full upgrade?") + "</b>")
|
label.set_markup("<b>" + _("Perform a full upgrade?") + "</b>")
|
||||||
|
@ -8,9 +8,11 @@ from ks_includes.screen_panel import ScreenPanel
|
|||||||
from ks_includes.widgets.graph import HeaterGraph
|
from ks_includes.widgets.graph import HeaterGraph
|
||||||
from ks_includes.widgets.keypad import Keypad
|
from ks_includes.widgets.keypad import Keypad
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return TemperaturePanel(*args)
|
return TemperaturePanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class TemperaturePanel(ScreenPanel):
|
class TemperaturePanel(ScreenPanel):
|
||||||
graph_update = None
|
graph_update = None
|
||||||
active_heater = None
|
active_heater = None
|
||||||
@ -84,9 +86,9 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
self.labels["preheat_grid"] = self._gtk.HomogeneousGrid()
|
self.labels["preheat_grid"] = self._gtk.HomogeneousGrid()
|
||||||
for i, option in enumerate(self.preheat_options):
|
for i, option in enumerate(self.preheat_options):
|
||||||
if option != "cooldown":
|
if option != "cooldown":
|
||||||
self.labels[option] = self._gtk.Button(option, "color%d" % ((i % 4)+1))
|
self.labels[option] = self._gtk.Button(option, "color%d" % ((i % 4) + 1))
|
||||||
self.labels[option].connect("clicked", self.set_temperature, option)
|
self.labels[option].connect("clicked", self.set_temperature, option)
|
||||||
self.labels['preheat_grid'].attach(self.labels[option], (i % 2), int(i/2), 1, 1)
|
self.labels['preheat_grid'].attach(self.labels[option], (i % 2), int(i / 2), 1, 1)
|
||||||
scroll = Gtk.ScrolledWindow()
|
scroll = Gtk.ScrolledWindow()
|
||||||
scroll.set_property("overlay-scrolling", False)
|
scroll.set_property("overlay-scrolling", False)
|
||||||
scroll.set_hexpand(True)
|
scroll.set_hexpand(True)
|
||||||
@ -116,7 +118,7 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
ctx = self.labels['deg' + i].get_style_context()
|
ctx = self.labels['deg' + i].get_style_context()
|
||||||
if j == 0:
|
if j == 0:
|
||||||
ctx.add_class("distbutton_top")
|
ctx.add_class("distbutton_top")
|
||||||
elif j == len(self.tempdeltas)-1:
|
elif j == len(self.tempdeltas) - 1:
|
||||||
ctx.add_class("distbutton_bottom")
|
ctx.add_class("distbutton_bottom")
|
||||||
else:
|
else:
|
||||||
ctx.add_class("distbutton")
|
ctx.add_class("distbutton")
|
||||||
@ -343,7 +345,6 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
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 = name.get_children()[0].get_children()[0].get_children()[1]
|
||||||
child.set_ellipsize(True)
|
|
||||||
child.set_ellipsize(Pango.EllipsizeMode.END)
|
child.set_ellipsize(Pango.EllipsizeMode.END)
|
||||||
|
|
||||||
temp = self._gtk.Button("")
|
temp = self._gtk.Button("")
|
||||||
@ -435,7 +436,6 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
box.add(scroll)
|
box.add(scroll)
|
||||||
box.add(self.labels['da'])
|
box.add(self.labels['da'])
|
||||||
|
|
||||||
|
|
||||||
self.labels['graph_settemp'] = self._gtk.Button(label=_("Set Temp"))
|
self.labels['graph_settemp'] = self._gtk.Button(label=_("Set Temp"))
|
||||||
self.labels['graph_settemp'].connect("clicked", self.show_numpad)
|
self.labels['graph_settemp'].connect("clicked", self.show_numpad)
|
||||||
self.labels['graph_hide'] = self._gtk.Button(label=_("Hide"))
|
self.labels['graph_hide'] = self._gtk.Button(label=_("Hide"))
|
||||||
@ -461,7 +461,6 @@ class TemperaturePanel(ScreenPanel):
|
|||||||
self.labels['da'].set_size_request(0, graph_height)
|
self.labels['da'].set_size_request(0, graph_height)
|
||||||
return box
|
return box
|
||||||
|
|
||||||
|
|
||||||
def graph_show_device(self, widget, show=True):
|
def graph_show_device(self, widget, show=True):
|
||||||
logging.info("Graph show: %s %s" % (self.popover_device, show))
|
logging.info("Graph show: %s %s" % (self.popover_device, show))
|
||||||
self.labels['da'].set_showing(self.popover_device, show)
|
self.labels['da'].set_showing(self.popover_device, show)
|
||||||
|
@ -8,9 +8,11 @@ from ks_includes.screen_panel import ScreenPanel
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
def create_panel(*args):
|
def create_panel(*args):
|
||||||
return ZCalibratePanel(*args)
|
return ZCalibratePanel(*args)
|
||||||
|
|
||||||
|
|
||||||
class ZCalibratePanel(ScreenPanel):
|
class ZCalibratePanel(ScreenPanel):
|
||||||
_screen = None
|
_screen = None
|
||||||
widgets = {}
|
widgets = {}
|
||||||
@ -65,7 +67,7 @@ class ZCalibratePanel(ScreenPanel):
|
|||||||
else:
|
else:
|
||||||
functions.remove("endstop")
|
functions.remove("endstop")
|
||||||
|
|
||||||
if (self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch")):
|
if self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch"):
|
||||||
probe = self._gtk.Button(label="Probe")
|
probe = self._gtk.Button(label="Probe")
|
||||||
probe.connect("clicked", self.start_calibration, "probe")
|
probe.connect("clicked", self.start_calibration, "probe")
|
||||||
pobox.pack_start(probe, True, True, 5)
|
pobox.pack_start(probe, True, True, 5)
|
||||||
@ -81,7 +83,7 @@ class ZCalibratePanel(ScreenPanel):
|
|||||||
functions.remove("mesh")
|
functions.remove("mesh")
|
||||||
|
|
||||||
if "delta" in self._screen.printer.get_config_section("printer")['kinematics']:
|
if "delta" in self._screen.printer.get_config_section("printer")['kinematics']:
|
||||||
if (self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch")):
|
if self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch"):
|
||||||
delta = self._gtk.Button(label="Delta Automatic")
|
delta = self._gtk.Button(label="Delta Automatic")
|
||||||
delta.connect("clicked", self.start_calibration, "delta")
|
delta.connect("clicked", self.start_calibration, "delta")
|
||||||
pobox.pack_start(delta, True, True, 5)
|
pobox.pack_start(delta, True, True, 5)
|
||||||
@ -112,9 +114,9 @@ class ZCalibratePanel(ScreenPanel):
|
|||||||
self.widgets[i].set_direction(Gtk.TextDirection.LTR)
|
self.widgets[i].set_direction(Gtk.TextDirection.LTR)
|
||||||
self.widgets[i].connect("clicked", self.change_distance, i)
|
self.widgets[i].connect("clicked", self.change_distance, i)
|
||||||
ctx = self.widgets[i].get_style_context()
|
ctx = self.widgets[i].get_style_context()
|
||||||
if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances)-1):
|
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")
|
ctx.add_class("distbutton_top")
|
||||||
elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and 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")
|
ctx.add_class("distbutton_bottom")
|
||||||
else:
|
else:
|
||||||
ctx.add_class("distbutton")
|
ctx.add_class("distbutton")
|
||||||
@ -184,8 +186,8 @@ class ZCalibratePanel(ScreenPanel):
|
|||||||
self._screen._ws.klippy.gcode_script('G0 X%d Y%d F3000' % (0, 0))
|
self._screen._ws.klippy.gcode_script('G0 X%d Y%d F3000' % (0, 0))
|
||||||
else:
|
else:
|
||||||
logging.debug("Position not configured, probing the middle of the bed")
|
logging.debug("Position not configured, probing the middle of the bed")
|
||||||
x_position = int(int(self._screen.printer.get_config_section("stepper_x")['position_max'])/2)
|
x_position = int(int(self._screen.printer.get_config_section("stepper_x")['position_max']) / 2)
|
||||||
y_position = int(int(self._screen.printer.get_config_section("stepper_y")['position_max'])/2)
|
y_position = int(int(self._screen.printer.get_config_section("stepper_y")['position_max']) / 2)
|
||||||
|
|
||||||
# Find probe offset
|
# Find probe offset
|
||||||
klipper_cfg = self._screen.printer.get_config_section_list()
|
klipper_cfg = self._screen.printer.get_config_section_list()
|
||||||
|
17
screen.py
17
screen.py
@ -51,6 +51,7 @@ PRINTER_BASE_STATUS_OBJECTS = [
|
|||||||
|
|
||||||
klipperscreendir = pathlib.Path(__file__).parent.resolve()
|
klipperscreendir = pathlib.Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
class KlipperScreen(Gtk.Window):
|
class KlipperScreen(Gtk.Window):
|
||||||
""" Class for creating a screen for Klipper via HDMI """
|
""" Class for creating a screen for Klipper via HDMI """
|
||||||
_cur_panels = []
|
_cur_panels = []
|
||||||
@ -440,7 +441,6 @@ class KlipperScreen(Gtk.Window):
|
|||||||
widget.destroy()
|
widget.destroy()
|
||||||
|
|
||||||
def init_style(self):
|
def init_style(self):
|
||||||
style_provider = Gtk.CssProvider()
|
|
||||||
css = open(os.path.join(klipperscreendir, "styles", "base.css"))
|
css = open(os.path.join(klipperscreendir, "styles", "base.css"))
|
||||||
css_data = css.read()
|
css_data = css.read()
|
||||||
css.close()
|
css.close()
|
||||||
@ -475,17 +475,17 @@ class KlipperScreen(Gtk.Window):
|
|||||||
)
|
)
|
||||||
for i in range(len(style_options['graph_colors']['bed']['colors'])):
|
for i in range(len(style_options['graph_colors']['bed']['colors'])):
|
||||||
css_data += "\n.graph_label_heater_bed%s {border-left-color: #%s}" % (
|
css_data += "\n.graph_label_heater_bed%s {border-left-color: #%s}" % (
|
||||||
"" if i+1 == 1 else i+1,
|
"" if i + 1 == 1 else i + 1,
|
||||||
style_options['graph_colors']['bed']['colors'][i]
|
style_options['graph_colors']['bed']['colors'][i]
|
||||||
)
|
)
|
||||||
for i in range(len(style_options['graph_colors']['fan']['colors'])):
|
for i in range(len(style_options['graph_colors']['fan']['colors'])):
|
||||||
css_data += "\n.graph_label_fan_%s {border-left-color: #%s}" % (
|
css_data += "\n.graph_label_fan_%s {border-left-color: #%s}" % (
|
||||||
i+1,
|
i + 1,
|
||||||
style_options['graph_colors']['fan']['colors'][i]
|
style_options['graph_colors']['fan']['colors'][i]
|
||||||
)
|
)
|
||||||
for i in range(len(style_options['graph_colors']['sensor']['colors'])):
|
for i in range(len(style_options['graph_colors']['sensor']['colors'])):
|
||||||
css_data += "\n.graph_label_sensor_%s {border-left-color: #%s}" % (
|
css_data += "\n.graph_label_sensor_%s {border-left-color: #%s}" % (
|
||||||
i+1,
|
i + 1,
|
||||||
style_options['graph_colors']['sensor']['colors'][i]
|
style_options['graph_colors']['sensor']['colors'][i]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -943,7 +943,7 @@ class KlipperScreen(Gtk.Window):
|
|||||||
if state['result']['klippy_connected'] is False:
|
if state['result']['klippy_connected'] is False:
|
||||||
self.panels['splash_screen'].update_text(
|
self.panels['splash_screen'].update_text(
|
||||||
_("Moonraker: connected") +
|
_("Moonraker: connected") +
|
||||||
("\n\nKlipper: %s\n\n") % state['result']['klippy_state'] +
|
"\n\nKlipper: %s\n\n" % state['result']['klippy_state'] +
|
||||||
_("Retry #%s") % self.reinit_count)
|
_("Retry #%s") % self.reinit_count)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -979,7 +979,7 @@ class KlipperScreen(Gtk.Window):
|
|||||||
)
|
)
|
||||||
|
|
||||||
data = self.apiclient.send_request("printer/objects/query?" + "&".join(PRINTER_BASE_STATUS_OBJECTS +
|
data = self.apiclient.send_request("printer/objects/query?" + "&".join(PRINTER_BASE_STATUS_OBJECTS +
|
||||||
extra_items))
|
extra_items))
|
||||||
if data is False:
|
if data is False:
|
||||||
msg = "Error getting printer object data with extra items"
|
msg = "Error getting printer object data with extra items"
|
||||||
logging.info(msg)
|
logging.info(msg)
|
||||||
@ -1002,7 +1002,7 @@ class KlipperScreen(Gtk.Window):
|
|||||||
def printer_ready(self):
|
def printer_ready(self):
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
self.close_popup_message()
|
self.close_popup_message()
|
||||||
# Force update to printer webhooks state in case the update is missed due to websocket subscribe not yet sent
|
# Force an update to printer webhooks state in case the update is missed due to websocket subscribe not yet sent
|
||||||
self.printer.process_update({"webhooks": {"state": "ready", "state_message": "Printer is ready"}})
|
self.printer.process_update({"webhooks": {"state": "ready", "state_message": "Printer is ready"}})
|
||||||
self.show_panel('main_panel', "main_menu", _("Home"), 2,
|
self.show_panel('main_panel', "main_menu", _("Home"), 2,
|
||||||
items=self._config.get_menu_items("__main"), extrudercount=self.printer.get_extruder_count())
|
items=self._config.get_menu_items("__main"), extrudercount=self.printer.get_extruder_count())
|
||||||
@ -1073,8 +1073,8 @@ class KlipperScreen(Gtk.Window):
|
|||||||
os.system("xsetroot -cursor ks_includes/emptyCursor.xbm ks_includes/emptyCursor.xbm")
|
os.system("xsetroot -cursor ks_includes/emptyCursor.xbm ks_includes/emptyCursor.xbm")
|
||||||
return
|
return
|
||||||
|
|
||||||
def main():
|
|
||||||
|
|
||||||
|
def main():
|
||||||
version = functions.get_software_version()
|
version = functions.get_software_version()
|
||||||
parser = argparse.ArgumentParser(description="KlipperScreen - A GUI for Klipper")
|
parser = argparse.ArgumentParser(description="KlipperScreen - A GUI for Klipper")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -1096,7 +1096,6 @@ def main():
|
|||||||
|
|
||||||
logging.info("KlipperScreen version: %s" % version)
|
logging.info("KlipperScreen version: %s" % version)
|
||||||
|
|
||||||
|
|
||||||
win = KlipperScreen(args, version)
|
win = KlipperScreen(args, version)
|
||||||
win.connect("destroy", Gtk.main_quit)
|
win.connect("destroy", Gtk.main_quit)
|
||||||
win.show_all()
|
win.show_all()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user