Compare commits

...
36 Commits
Author SHA1 Message Date
dependabot[bot] 6b432c167f build(deps): bump pygobject from 3.42.0 to 3.42.1 (#589)
Bumps [pygobject](https://pygobject.readthedocs.io) from 3.42.0 to 3.42.1.

---
updated-dependencies:
- dependency-name: pygobject
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-31 11:43:43 -03:00
dependabot[bot] 9d25836df4 build(deps): bump jinja2 from 3.1.1 to 3.1.2 (#605)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.1...3.1.2)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-31 11:43:25 -03:00
alfrix 54fc0458e0 KlippyGtk: fix style arguments 2022-05-31 11:14:42 -03:00
alfrix 3361c243b7 docs: hardware fix links 2022-05-31 11:14:42 -03:00
alfrix 2da5a4df32 docs: improve install instructions 2022-05-31 11:14:42 -03:00
alfrix 0f4f56bb9f Fix paused state
close #607
fix #611
2022-05-31 11:14:42 -03:00
alfrix 33195f203f Simplify code 2022-05-31 11:14:42 -03:00
alfrix 3889fdbe4c console: remove // 2022-05-31 11:14:42 -03:00
alfrix 7b4a24d079 job_status: simplify timeouts because sometimes it didn't work, also do not autoclose by default because there may be offsets to be saved 2022-05-31 11:14:42 -03:00
alfrix c91deda220 settings: wider scale slider 2022-05-31 11:14:42 -03:00
alfrix cc755edeb2 wider scrollbar because it's hard to use on small screens 2022-05-31 11:14:42 -03:00
alfrix 5a36729b76 PEP8, typos and warnings fixes 2022-05-31 11:14:42 -03:00
alfrix fd2a717ece settings: remove options that are directly on the panels 2022-05-31 11:14:42 -03:00
alfrix 48860159e9 move: add options to the panel 2022-05-31 11:14:42 -03:00
alfrix 4ff63798c8 job_status: ask for confirmation, and show saved offset 2022-05-31 11:14:42 -03:00
alfrix ea3e7ad3d1 splash_screen: use moonraker for actions if connected, hide system panel if it isn't connected
use systemctl if moonraker isn't available close #615
2022-05-31 11:14:42 -03:00
alfrix 562e49b8d2 logging: exceptions can log more info 2022-05-31 11:14:42 -03:00
alfrix 7c8d4ea4d7 extrude: add filament sensor support 2022-05-31 11:14:42 -03:00
alfrix b77b7c0976 job_status: M117 without text clears the label fix #614 2022-05-31 11:14:42 -03:00
alfrix 8550cbcab6 retraction: add reset 2022-05-31 11:14:42 -03:00
alfrix ade8911ba6 limits: add reset, allow to set above the configured maximum but turn the slider red 2022-05-31 11:14:42 -03:00
alfrix b9036901e7 job_status: animate filename if it's too long 2022-05-31 11:14:42 -03:00
alfrix f88a5c8440 macros: put the hide options on the panel 2022-05-31 11:14:42 -03:00
alfrix 53bc6f25ff macros: allow reverse sorting 2022-05-31 11:14:42 -03:00
alfrix 21633b9302 files: fix local thumbnails 2022-05-31 11:14:42 -03:00
alfrix a0a222c386 print: use the smaller thumb for the list if available 2022-05-31 11:14:42 -03:00
Mikko Gozaloandalfrix fa0d696120 Add Input Shaper panel
Original panel by Mikko Gozalo

Modified layour to fit 16:9 screens
Auto-home
Ability to measure X and Y independently
Get the current active values not the values from the config
Ask for save
Other minor tweaks

close #301

Co-authored-by: alfrix <alfredomonclus@gmail.com>
2022-05-31 11:14:42 -03:00
alfrix 7e988b3f35 zcalibrate: show the saved offset and offset to be saved 2022-05-31 11:14:42 -03:00
alfrix f98ac0bfe4 Move korean fonts to the optional category 2022-05-31 11:13:56 -03:00
NStevenU a29da7e76c Add Korean language support (#625)
* Add Korean language support

* Add Korean Language Support Font Installation
2022-05-31 11:12:20 -03:00
Ruslan Sayfutdinov 794dbea14e Allow setting 0 in preheat options (#612) 2022-05-31 11:10:27 -03:00
Selim 432b12d67e Turkish Language (#610) 2022-05-16 18:39:14 -03:00
alfrix 8accce00a9 job_status: fix thumbnail issue #608 2022-05-04 09:56:24 -03:00
alfrix 35381beeb6 limits: fix typo in label 2022-05-03 08:38:58 -03:00
alfrix 1eaa82ba2d config: fix print estimate default 2022-05-02 14:08:03 -03:00
alfrix 35c4136bd5 Job_status: fix speed label, fix estimate default 2022-05-02 12:09:12 -03:00
53 changed files with 2562 additions and 724 deletions

No files matched your search

+5 -5
View File
@@ -20,11 +20,11 @@ invert_x: False
invert_y: False
invert_z: False
# Time (seconds) before the Job Status page reverts to main menu after a successful job
job_complete_timeout: 30
# Time in seconds before the Job Status page closes itself after a successful job/print
# 0 means disabled
job_complete_timeout: 0
# Time (seconds) before the Job Status page reverts to main menu after a successful job.
# If this option is 0, the user must click on a button to go back to the main menu.
# Time in seconds before the Job Status closes itself if an error is encountered
job_error_timeout: 0
# Specify the language
@@ -106,7 +106,7 @@ temperature_fan: 40
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:
```
+2 -2
View File
@@ -64,5 +64,5 @@ ACTION=="add", ATTRS{name}=="<device name>", ENV{LIBINPUT_CALIBRATION_MATRIX}="<
```
More info about input transformation can be found in:
* [Ubuntu wiki InputCoordinateTransformation]("https://wiki.ubuntu.com/X/InputCoordinateTransformation")
* [Libinput docs]("https://wayland.freedesktop.org/libinput/doc/1.9.0/absolute_axes.html")
* [Ubuntu wiki InputCoordinateTransformation](https://wiki.ubuntu.com/X/InputCoordinateTransformation)
* [Libinput docs](https://wayland.freedesktop.org/libinput/doc/1.9.0/absolute_axes.html)
+37 -12
View File
@@ -1,31 +1,57 @@
# Installation
#### First steps
Install the screen, following the instructions provided by the manufacturer, Some screens don't neeed extra software but some need to be installed with a script.
It's strongly recommended to test it and ensure your hardware is working with Raspbian, Ubuntu or any distro you like.
Once you stablished that the screen is working, then proceed installing KlipperScreen.
#### Setup Raspberry Pi
This install process is meant for Raspbian non-desktop version aka Raspbian Lite.
This install process is meant for Raspbian non-desktop version aka Raspbian Lite, but it works on other versions.
If you have installed it on the GUI version, then use `sudo raspi-config` to set boot to console by choosing the following options in order:
If you want to use it on Raspbian desktop (GUI version), then use `sudo raspi-config` to set boot to console by choosing the following options in order:
* 1 System Options
* S5 Boot / Auto Login
* B1 Console
```
1System Options
└──S5 Boot / Auto Login
└──B1 Console
```
Note: Other distros will be different on how to boot to console.
### Auto install
#### Installing KlipperScreen with KIAUH
[KIAUH](https://github.com/th33xitus/kiauh) is a tool that helps you install or upgrade Klipper, Moonraker, Mainsail, and other extensions.
![Screenshot](img/install/KIAUH.png)
You can visit [KIAUH on GitHub](https://github.com/th33xitus/kiauh) to learn more and view its documentation.
### Manual Install
#### Klipper and Moonraker Installation
Follow the instructions to install Klipper and Moonraker.
* klipper: https://www.klipper3d.org/Installation.html
* moonraker: https://moonraker.readthedocs.io/en/latest/installation/
In moonraker.conf ensure that 127.0.0.1 is a trusted client for moonraker, such as in this example:
#### Moonraker configuration
In moonraker.conf ensure that 127.0.0.1 is a trusted client:
```
[authorization]
trusted_clients:
127.0.0.1
```
Note: `force_logins: true` requires the moonraker api key in [KlipperScreen.conf](Configuration.md)
If you wish to use the update manager feature of moonraker for KlipperScreen, add the following block into the moonraker
configuration:
If you wish to use the update manager feature of moonraker for KlipperScreen, add the following block to the moonraker.conf:
```
[update_manager KlipperScreen]
type: git_repo
@@ -35,9 +61,11 @@ env: ~/.KlipperScreen-env/bin/python
requirements: scripts/KlipperScreen-requirements.txt
install_script: scripts/KlipperScreen-install.sh
```
Note: you may receive warnings in other UIs since KlipperScreen is not installed yet, you can safely ignore them at this point.
#### KlipperScreen Installation
Execute the following commands:
```
cd ~/
git clone https://github.com/jordanruthe/KlipperScreen.git
@@ -51,7 +79,4 @@ This script will install packages that are listed under manual install, create a
If you need a custom location for the configuration file, you can add -c or --configfile to the systemd file and specify
the location of your configuration file.
If your screen needs additional software, proceed with the manufacturer instructions if they are provided
and check out the [hardware page](Hardware.md)
At this point KlipperScreen should be working, if it doesn't start then go to the [troubleshooting page](Troubleshooting.md)
+1 -1
View File
@@ -1,6 +1,6 @@
## 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.
This guide will refer to `language designation`. This can be found from running `echo $LANG` on your pi, as long as you
+1 -1
View File
@@ -47,7 +47,7 @@ If you have another fb, try changing it:
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
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+1 -1
View File
@@ -1,2 +1,2 @@
jinja2<3.1
jinja2<3.2
mkdocs
+1 -3
View File
@@ -1,5 +1,4 @@
class KlippyGcodes:
HOME = "G28"
HOME_X = "G28 X"
HOME_Y = "G28 Y"
@@ -33,7 +32,6 @@ class KlippyGcodes:
RESTART = "RESTART"
FIRMWARE_RESTART = "FIRMWARE_RESTART"
@staticmethod
def set_bed_temp(temp):
return "%s S%s" % (KlippyGcodes.SET_BED_TEMP, str(temp))
@@ -52,7 +50,7 @@ class KlippyGcodes:
@staticmethod
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)
@staticmethod
+30 -24
View File
@@ -7,6 +7,7 @@ import pathlib
gi.require_version("Gtk", "3.0")
from gi.repository import Gdk, GdkPixbuf, Gio, Gtk, Pango
class KlippyGtk:
labels = {}
keyboard_ratio = .22
@@ -29,7 +30,7 @@ class KlippyGtk:
))
if fontsize_type == "small":
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.header_size = int(round((self.width / self.width_ratio) / 1.33))
self.img_width = int(round(self.width / self.width_ratio))
@@ -46,7 +47,7 @@ class KlippyGtk:
for key in self.color_list:
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
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']
self.color_list[device]['state'] += 1
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))
else:
colors = self.color_list[device]['colors']
if self.color_list[device]['state'] >= len(colors):
self.color_list[device]['state'] = 0
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
# logging.debug("Assigning color: %s %s %s" % (device, rgb, color))
@@ -106,14 +107,13 @@ class KlippyGtk:
for key in self.color_list:
self.color_list[key]['state'] = 0
def Label(self, label, style=None):
la = Gtk.Label(label)
if style is not None and style is not False:
if style is not None:
la.get_style_context().add_class(style)
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")
if os.path.exists(filename):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename,
@@ -125,14 +125,14 @@ class KlippyGtk:
logging.error("Unable to find image %s", filename)
return Gtk.Image()
def PixbufFromFile(self, filename, style=False, width_scale=1, height_scale=1):
def PixbufFromFile(self, filename, width_scale=1, height_scale=1):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename,
int(round(self.img_width * width_scale)),
int(round(self.img_height * height_scale)),
True)
return pixbuf
def PixbufFromHttp(self, resource, style=False, width_scale=1, height_scale=1):
def PixbufFromHttp(self, resource, width_scale=1, height_scale=1):
response = self.screen.apiclient.get_thumbnail_stream(resource)
if response is False:
return None
@@ -143,10 +143,10 @@ class KlippyGtk:
True)
return pixbuf
def ProgressBar(self, style=False):
def ProgressBar(self, style=None):
bar = Gtk.ProgressBar()
if style is not False:
if style is not None:
ctx = bar.get_style_context()
ctx.add_class(style)
@@ -201,7 +201,7 @@ class KlippyGtk:
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(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.get_style_context().add_class("dialog")
@@ -222,8 +222,7 @@ class KlippyGtk:
return dialog
def ToggleButtonImage(self, image_name, label, style=False, scale=1.38):
def ToggleButtonImage(self, image_name, label, style=None, scale=1.38):
b = Gtk.ToggleButton(label=label)
b.set_hexpand(True)
@@ -233,7 +232,7 @@ class KlippyGtk:
b.set_image_position(Gtk.PositionType.TOP)
b.set_always_show_image(True)
if style is not False:
if style is not None:
ctx = b.get_style_context()
ctx.add_class(style)
@@ -256,6 +255,14 @@ class KlippyGtk:
b.connect("clicked", self.screen.reset_screensaver_timeout)
return b
def ScrolledWindow(self):
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
return scroll
def formatFileName(self, name):
name = name.split('/')[-1] if "/" in name else name
name = name.split('.gcod')[0] if ".gcode" in name else name
@@ -263,21 +270,20 @@ class KlippyGtk:
return name[0:25] + "\n" + name[25:50]
return name
def formatTimeString(self, seconds):
time = int(seconds)
text = ""
if int(time/86400) != 0:
text += str(int(time/86400))+"d "
if int(time/3600) != 0:
text += str(int(time/3600) % 24)+"h "
if int(time/60) != 0:
text += str(int(time/60) % 60)+"m "
if int(time / 86400) != 0:
text += str(int(time / 86400)) + "d "
if int(time / 3600) != 0:
text += str(int(time / 3600) % 24) + "h "
if int(time / 60) != 0:
text += str(int(time / 60) % 60) + "m "
else:
text = str(time % 60)+"s"
text = str(time % 60) + "s"
return text
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)) + " °C\n(" + str(round(target)) + ")"
+5 -2
View File
@@ -2,6 +2,7 @@ import json
import requests
import logging
class KlippyRest:
def __init__(self, ip, port=7125, api_key=False):
self.ip = ip
@@ -34,7 +35,8 @@ class KlippyRest:
headers = {} if self.api_key is False else {"x-api-key": self.api_key}
try:
r = requests.get(url, headers=headers)
except Exception:
except Exception as e:
logging.critical(e, exc_info=True)
return False
if r.status_code != 200:
return False
@@ -42,7 +44,8 @@ class KlippyRest:
# TODO: Try/except
try:
data = json.loads(r.content)
except Exception:
except Exception as e:
logging.critical(e, exc_info=True)
logging.exception("Unable to parse response from moonraker:\n %s" % r.content)
return False
+7 -3
View File
@@ -26,6 +26,7 @@ api = {
}
}
class KlippyWebsocket(threading.Thread):
_req_id = 0
connected = False
@@ -70,11 +71,12 @@ class KlippyWebsocket(threading.Thread):
if self.reconnect_count > 3:
self._screen.panels['splash_screen'].update_text(
_("Cannot connect to Moonraker") +
("\n\n%s\n\n") % self._url +
"\n\n%s\n\n" % self._url +
_("Retry #%s") % self.reconnect_count)
return False
token = self._screen.apiclient.get_oneshot_token()
except Exception:
except Exception as e:
logging.critical(e, exc_info=True)
logging.debug("Unable to get oneshot token")
return False
@@ -86,7 +88,8 @@ class KlippyWebsocket(threading.Thread):
try:
logging.debug("Starting websocket thread")
self._wst.start()
except Exception:
except Exception as e:
logging.critical(e, exc_info=True)
logging.debug("Error starting web socket")
def close(self):
@@ -193,6 +196,7 @@ class KlippyWebsocket(threading.Thread):
def on_error(self, ws, error):
logging.debug("Websocket error: %s" % error)
class MoonrakerApi:
def __init__(self, ws):
self._ws = ws
+38 -34
View File
@@ -12,19 +12,21 @@ from io import StringIO
from os import path
SCREEN_BLANKING_OPTIONS = [
"300", # 5 Minutes
"900", # 15 Minutes
"1800", # 30 Minutes
"3600", # 1 Hour
"7200", # 2 Hours
"300", # 5 Minutes
"900", # 15 Minutes
"1800", # 30 Minutes
"3600", # 1 Hour
"7200", # 2 Hours
"14400", # 4 Hours
]
klipperscreendir = pathlib.Path(__file__).parent.resolve().parent
class ConfigError(Exception):
pass
class KlipperScreenConfig:
config = None
configfile_name = "KlipperScreen.conf"
@@ -103,23 +105,17 @@ class KlipperScreenConfig:
_n = self.lang.ngettext
self.configurable_options = [
{"invert_x": {"section": "main", "name": _("Invert X"), "type": "binary", "value": "False"}},
{"invert_y": {"section": "main", "name": _("Invert Y"), "type": "binary", "value": "False"}},
{"invert_z": {"section": "main", "name": _("Invert Z"), "type": "binary", "value": "False"}},
{"language": {"section": "main", "name": _("Language"), "type": "dropdown", "value": "system_lang",
"callback": screen.restart_warning, "options": [
{"name": _("System") + " " + _("(default)"), "value": "system_lang"}
]}},
{"move_speed_xy": {
"section": "main", "name": _("XY Move Speed (mm/s)"), "type": "scale", "value": "20",
"range": [5, 200], "step": 1}},
{"move_speed_z": {
"section": "main", "name": _("Z Move Speed (mm/s)"), "type": "scale", "value": "20",
"range": [5, 200], "step": 1}},
{"print_sort_dir": {"section": "main", "type": None, "value": "name_asc"}},
{"language": {
"section": "main", "name": _("Language"), "type": "dropdown", "value": "system_lang",
"callback": screen.restart_warning, "options": [
{"name": _("System") + " " + _("(default)"), "value": "system_lang"}]}},
{"theme": {
"section": "main", "name": _("Icon Theme"), "type": "dropdown",
"value": "z-bolt", "callback": screen.restart_warning, "options": [
{"name": "Z-bolt" + " " + _("(default)"), "value": "z-bolt"}]}},
{"print_estimate_method": {
"section": "main", "name": _("Estimated Time Method"), "type": "dropdown",
"value": "file", "options": [
"value": "auto", "options": [
{"name": _("Auto") + " " + _("(default)"), "value": "auto"},
{"name": _("File"), "value": "file"},
{"name": _("Filament Used"), "value": "filament"},
@@ -129,10 +125,6 @@ class KlipperScreenConfig:
"value": "3600", "callback": screen.set_screenblanking_timeout, "options": [
{"name": _("Off"), "value": "off"}]
}},
{"theme": {
"section": "main", "name": _("Icon Theme"), "type": "dropdown",
"value": "z-bolt", "callback": screen.restart_warning, "options": [
{"name": "Z-bolt" + " " + _("(default)"), "value": "z-bolt"}]}},
{"24htime": {"section": "main", "name": _("24 Hour Time"), "type": "binary", "value": "True"}},
{"side_macro_shortcut": {
"section": "main", "name": _("Macro shortcut on sidebar"), "type": "binary",
@@ -152,13 +144,26 @@ class KlipperScreenConfig:
{"print_estimate_compensation": {
"section": "main", "name": _("Slicer Time correction (%)"), "type": "scale", "value": "100",
"range": [50, 150], "step": 1}},
# {"": {"section": "main", "name": _(""), "type": ""}}
]
# Options that are in panels and shouldn't be added to the main settings
panel_options = [
{"invert_x": {"section": "main", "name": _("Invert X"), "type": None, "value": "False"}},
{"invert_y": {"section": "main", "name": _("Invert Y"), "type": None, "value": "False"}},
{"invert_z": {"section": "main", "name": _("Invert Z"), "type": None, "value": "False"}},
{"move_speed_xy": {"section": "main", "name": _("XY Move Speed (mm/s)"), "type": None, "value": "50"}},
{"move_speed_z": {"section": "main", "name": _("Z Move Speed (mm/s)"), "type": None, "value": "10"}},
{"print_sort_dir": {"section": "main", "type": None, "value": "name_asc"}},
]
self.configurable_options.extend(panel_options)
lang_path = os.path.join(klipperscreendir, "ks_includes", "locales")
langs = [d for d in os.listdir(lang_path) if not os.path.isfile(os.path.join(lang_path, d))]
langs.sort()
lang_opt = self.configurable_options[3]['language']['options']
lang_opt = self.configurable_options[0]['language']['options']
for lang in langs:
lang_opt.append({"name": lang, "value": lang})
@@ -166,7 +171,7 @@ class KlipperScreenConfig:
t_path = os.path.join(klipperscreendir, 'styles')
themes = [d for d in os.listdir(t_path) if (not os.path.isfile(os.path.join(t_path, d)) and d != "z-bolt")]
themes.sort()
theme_opt = self.configurable_options[9]['theme']['options']
theme_opt = self.configurable_options[1]['theme']['options']
for theme in themes:
theme_opt.append({"name": theme, "value": theme})
@@ -174,11 +179,11 @@ class KlipperScreenConfig:
index = self.configurable_options.index(
[i for i in self.configurable_options if list(i)[0] == "screen_blanking"][0])
for num in SCREEN_BLANKING_OPTIONS:
hour = int(int(num)/3600)
hour = int(int(num) / 3600)
if hour > 0:
name = str(hour) + " " + _n("hour", "hours", hour)
else:
name = str(int(int(num)/60)) + " " + _("minutes")
name = str(int(int(num) / 60)) + " " + _("minutes")
self.configurable_options[index]['screen_blanking']['options'].append({
"name": name,
"value": num
@@ -255,7 +260,7 @@ class KlipperScreenConfig:
user_def.append(line.replace('\n', ''))
else:
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)]
def get_config_file_location(self, file):
@@ -309,7 +314,6 @@ class KlipperScreenConfig:
return False
return self.config[name].get('name')
def get_preheat_options(self):
index = "preheat "
items = [i[len(index):] for i in self.config.sections() if i.startswith(index)]
@@ -443,10 +447,10 @@ class KlipperScreenConfig:
return False
cfg = self.config[name]
item = {
"extruder": cfg.getint("extruder", 0),
"bed": cfg.getint("bed", 0),
"heater_generic": cfg.getint("heater_generic", 0),
"temperature_fan": cfg.getint("temperature_fan", 0),
"extruder": cfg.getint("extruder", None),
"bed": cfg.getint("bed", None),
"heater_generic": cfg.getint("heater_generic", None),
"temperature_fan": cfg.getint("temperature_fan", None),
"gcode": cfg.get("gcode", None)
}
return item
+14 -1
View File
@@ -171,7 +171,7 @@ icon: complete
method: printer.gcode.script
params: {"script":"SAVE_CONFIG"}
confirm:
{{ gettext('Save configuration') }}
{{ gettext('Save configuration?') }}
{{ gettext('Klipper will reboot') }}
@@ -180,6 +180,12 @@ name: {{ gettext('Settings') }}
icon: settings
panel: settings
[menu __main config input_shaper]
name: {{ gettext('Input Shaper') }}
icon: move
panel: input_shaper
enable: {{ printer.input_shaper }}
[menu __print]
name: {{ gettext('Print Control') }}
@@ -195,6 +201,12 @@ icon: fan
panel: fan
enable: {{ printer.fans.count > 0 }}
[menu __print move]
name: {{ gettext('Move') }}
icon: move
panel: move
enable: {{ (printer.pause_resume.is_paused == True) }}
[menu __print extrude]
name: {{ gettext('Extrude') }}
icon: filament
@@ -262,6 +274,7 @@ panel: network
name: {{ gettext('System') }}
icon: info
panel: system
enable: {{ moonraker_connected }}
[menu __splashscreen settings]
name: {{ gettext('Settings') }}
+9 -20
View File
@@ -2,20 +2,17 @@ import logging
import os
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GLib
class KlippyFiles():
class KlippyFiles:
def __init__(self, screen):
self._screen = screen
self.callbacks = []
self.files = {}
self.filelist = []
self.thumbnail_dir = "/tmp/.KS-thumbnails"
if not os.path.exists(self.thumbnail_dir):
os.makedirs(self.thumbnail_dir)
self.gcodes_path = None
def initialize(self):
@@ -23,7 +20,7 @@ class KlippyFiles():
if "virtual_sdcard" in self._screen.printer.get_config_section_list():
vsd = self._screen.printer.get_config_section("virtual_sdcard")
if "path" in vsd:
self.gcodes_path = vsd['path']
self.gcodes_path = os.path.expanduser(vsd['path'])
logging.info("Gcodes path: %s" % self.gcodes_path)
def reset(self):
@@ -31,7 +28,6 @@ class KlippyFiles():
self.callbacks = None
self.files = None
self.filelist = None
self.thumbnail_dir = None
self.gcodes_path = None
self._screen = None
@@ -150,22 +146,15 @@ class KlippyFiles():
return True
return False
def get_thumbnail_location(self, filename):
def get_thumbnail_location(self, filename, small=False):
thumb = self.files[filename]['thumbnails'][0]
if small and len(self.files[filename]['thumbnails']) > 1:
if self.files[filename]['thumbnails'][0]['width'] > self.files[filename]['thumbnails'][1]['width']:
thumb = self.files[filename]['thumbnails'][1]
if thumb['local'] is False:
return ['http', thumb['path']]
return ['file', thumb['path']]
def get_thumbnail_scale(self, filename):
width = self.files[filename]['thumbnails'][0]['width']
height = self.files[filename]['thumbnails'][0]['height']
logging.info("Thumb size: %d %d" % (width, height))
w = 400 / width
h = 300 / height
factor = min(w, h)
logging.info("Thumb scale w:%.2f h:%.2f final:%.2f" % (w, h, factor))
return factor
def has_thumbnail(self, filename):
if filename not in self.files:
return False
@@ -190,7 +179,7 @@ class KlippyFiles():
self.run_callbacks(deletedfiles=[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)
def run_callbacks(self, newfiles=[], deletedfiles=[], mods=[]):
+18 -4
View File
@@ -17,6 +17,7 @@ try:
ctypes.cdll.LoadLibrary('libXext.so.6')
libXext = ctypes.CDLL('libXext.so.6')
class DPMS_State:
Fail = -1
On = 0
@@ -24,6 +25,7 @@ try:
Suspend = 2
Off = 3
def get_DPMS_state(display_name_in_byte_string=b':0'):
state = DPMS_State.Fail
if not isinstance(display_name_in_byte_string, bytes):
@@ -35,8 +37,8 @@ try:
dummy1_i_p = ctypes.create_string_buffer(8)
dummy2_i_p = ctypes.create_string_buffer(8)
if display.value:
if libXext.DPMSQueryExtension(display, dummy1_i_p, dummy2_i_p)\
and libXext.DPMSCapable(display):
if libXext.DPMSQueryExtension(display, dummy1_i_p, dummy2_i_p) \
and libXext.DPMSCapable(display):
onoff_p = ctypes.create_string_buffer(1)
state_p = ctypes.create_string_buffer(2)
if libXext.DPMSInfo(display, state_p, onoff_p):
@@ -45,14 +47,18 @@ try:
state = struct.unpack('H', state_p.raw)[0]
libXext.XCloseDisplay(display)
return state
dpms_loaded = True
except Exception:
pass
def get_network_interfaces():
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')]
def get_wireless_interfaces():
p = subprocess.Popen(["which", "iwconfig"], stdout=subprocess.PIPE)
@@ -64,7 +70,8 @@ def get_wireless_interfaces():
try:
p = subprocess.Popen(["iwconfig"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = p.stdout.read().decode('ascii').split('\n')
except Exception:
except Exception as e:
logging.critical(e, exc_info=True)
logging.info("Error with running iwconfig command")
return None
interfaces = []
@@ -75,6 +82,7 @@ def get_wireless_interfaces():
return interfaces
def get_software_version():
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always',
'--tags', '--long', '--dirty')
@@ -94,6 +102,7 @@ def get_software_version():
logging.exception("Error runing git describe")
return "?"
def patch_threading_excepthook():
"""Installs our exception handler into the threading modules Thread object
Inspired by https://bugs.python.org/issue1230540
@@ -111,15 +120,18 @@ def patch_threading_excepthook():
raise
except Exception:
sys.excepthook(*sys.exc_info(), thread_identifier=threading.get_ident())
self.run = run_with_excepthook
threading.Thread.__init__ = new_init
# Timed rotating file handler based on Klipper and Moonraker's implementation
class KlipperScreenLoggingHandler(logging.handlers.TimedRotatingFileHandler):
def __init__(self, software_version, filename, **kwargs):
super(KlipperScreenLoggingHandler, self).__init__(filename, **kwargs)
self.rollover_info = {
'header': f"{'-'*20}KlipperScreen Log Start{'-'*20}",
'header': f"{'-' * 20}KlipperScreen Log Start{'-' * 20}",
'version': f"Git Version: {software_version}",
}
lines = [line for line in self.rollover_info.values() if line]
@@ -135,6 +147,7 @@ class KlipperScreenLoggingHandler(logging.handlers.TimedRotatingFileHandler):
if self.stream is not None:
self.stream.write("\n".join(lines) + "\n")
# Logging based on Arksine's logging setup
def setup_logging(log_file, software_version):
root_logger = logging.getLogger()
@@ -164,6 +177,7 @@ def setup_logging(log_file, software_version):
def logging_exception_handler(type, value, tb, thread_identifier=None):
logging.exception(
"Uncaught exception %s: %s\nTraceback: %s" % (type, value, "\n".join(traceback.format_tb(tb))))
sys.excepthook = logging_exception_handler
logging.captureWarnings(True)
+1 -1
View File
@@ -323,7 +323,7 @@ msgstr ""
msgid "Main Menu"
msgstr ""
msgid "Max Accelation"
msgid "Max Acceleration"
msgstr ""
msgid "Max Acceleration to Deceleration"
@@ -0,0 +1,633 @@
msgid ""
msgstr ""
"Project-Id-Version: KlipperScreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-31 11:25-0300\n"
"PO-Revision-Date: \n"
"Last-Translator: NSteven\n"
"Language-Team: NSteven\n"
"Language: ko_KR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.0.1\n"
#, python-format
msgid "%s will be updated to version"
msgstr "%s 버전으로 업데이트될 것입니다"
msgid "(default)"
msgstr "(기본)"
msgid "24 Hour Time"
msgstr "24시간제"
msgid "A FIRMWARE_RESTART may fix the issue."
msgstr "펌웨어 재시작을 사용하여 문제를 해결할 수 있습니다."
msgid "Abort"
msgstr "중단"
msgid "Accept"
msgstr "수락"
msgid "Actions"
msgstr "동작"
msgid "Add Printer"
msgstr "프린터 추가"
msgid "Add bed mesh profile"
msgstr "배드 메시 프로필 추가"
msgid "Are you sure you want to run Emergency Stop?"
msgstr "비상정지를 실행하시겠습니까?"
msgid "Are you sure you wish to cancel this print?"
msgstr "이 출력을 취소하시겠습니까?"
msgid "Are you sure you wish to disable motors?"
msgstr "모터를 비활성화하시겠습니까?"
msgid "Are you sure you wish to reboot the system?"
msgstr "시스템을 재시작하시겠습니까?"
msgid "Are you sure you wish to shutdown the system?"
msgstr "시스템을 종료하시겠습니까?"
msgid "Auto"
msgstr "자동"
msgid "Auto-scroll"
msgstr "자동스크롤"
msgid "Bed Level"
msgstr "배드 레벨"
msgid "Bed Mesh"
msgstr "배드 메시"
msgid "Bltouch found applied offset"
msgstr "Bltouch가 오프셋을 찾음"
msgid "Calibrate"
msgstr "교정"
msgid "Calibrated, save configuration to make it permanent"
msgstr "교정됨, 설정을 영구적으로 저장합니다"
msgid "Can't set above the maximum:"
msgstr "최대값보다 높게 설정할 수 없습니다:"
msgid "Cancel"
msgstr "취소"
msgid "Cancel Print"
msgstr "출력 취소"
msgid "Cancelled"
msgstr "취소됨"
msgid "Cancelling"
msgstr "취소중"
msgid "Cannot connect to Moonraker"
msgstr "Moonraker에 연결할 수 없음"
msgid "Channel"
msgstr "채널"
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"자세한 내용은 /tmp/KlipperScreen.log를 참조하십시오.\n"
"GitHub에 현재 발생한 이슈를 제출하여 도움을 요청하십시오."
msgid "Close"
msgstr "닫기"
msgid "Complete"
msgstr "완료"
msgid "Configuration"
msgstr "환경설정"
msgid "Confirm Emergency Stop"
msgstr "비상정지 확인"
msgid "Connected"
msgstr "연결됨"
#, python-format
msgid "Connecting to %s"
msgstr "%s에 연결중"
msgid "Console"
msgstr "콘솔"
msgid "Continue"
msgstr "계속"
msgid "Cooldown"
msgstr "냉각"
msgid "Date"
msgstr "날짜"
msgid "Decrease"
msgstr "감소"
msgid "Delete"
msgstr "삭제"
msgid "Deselect"
msgstr "선택해제"
msgid "Disable Motors"
msgstr "모터 비활성화"
msgid "Disable XY"
msgstr "XY 비활성화"
msgid "Displayed Macros"
msgstr "표시할 매크로"
msgid "Distance (mm)"
msgstr "거리 (mm)"
#, python-format
msgid "Do you want to recover %s?"
msgstr "%s을(를) 복구하시겠습니까?"
msgid "Elapsed:"
msgstr "경과:"
msgid "Error"
msgstr "오류"
msgid "Estimated Time Method"
msgstr "예상시간 표기"
msgid "Extrude"
msgstr "압출"
msgid "Extrusion +"
msgstr "압출 +"
msgid "Extrusion -"
msgstr "압출 -"
msgid "Failed, adjust position first"
msgstr "실패, 먼저 위치를 조정하십시오."
msgid "Fan"
msgstr "팬"
msgid "Filament Used"
msgstr "필라멘트 사용된 양"
msgid "File"
msgstr "파일"
msgid "Fine Tuning"
msgstr "미세 조정"
msgid "Finish"
msgstr "완료됨"
msgid ""
"Firmware\n"
"Restart"
msgstr ""
"펌웨어\n"
"재시작"
msgid "Font Size"
msgstr "폰트 크기"
msgid ""
"Full\n"
"Update"
msgstr ""
"전체\n"
"업데이트"
msgid "Go Back"
msgstr "뒤로"
msgid "Hidden"
msgstr "숨김"
msgid "Hide"
msgstr "가리기"
msgid "Hide sensors in Temp."
msgstr "온도에서 센서들 가리기"
msgid "Home"
msgstr "홈"
msgid "Home All"
msgstr "전체 홈"
msgid "Home X"
msgstr "X축 홈"
msgid "Home XY"
msgstr "XY축 홈"
msgid "Home Y"
msgstr "Y축 홈"
msgid "Home Z"
msgstr "Z축 홈"
msgid "Homing"
msgstr "호밍"
msgid "Hostname"
msgstr "호스트 이름"
msgid "Icon Theme"
msgstr "아이콘 테마"
msgid "Increase"
msgstr "증가"
msgid "Initializing"
msgstr "초기화중"
msgid "Initializing printer..."
msgstr "프린터 초기화중…"
msgid "Interface"
msgstr "인터페이스"
msgid "Invalid"
msgstr "올바르지 않음"
msgid "Invert X"
msgstr "X축 반전"
msgid "Invert Y"
msgstr "Y축 반전"
msgid "Invert Z"
msgstr "Z축 반전"
msgid ""
"Klipper\n"
"Restart"
msgstr ""
"Klipper\n"
"재시작"
msgid "Klipper has disconnected"
msgstr "Klipper와 연결이 끊어졌습니다"
msgid "Klipper has encountered an error."
msgstr "Klipper에 오류가 발생했습니다."
msgid "Klipper has shutdown"
msgstr "Klipper가 종료되었습니다"
msgid "Klipper is attempting to start"
msgstr "Klipper 시작하는 중"
msgid "Klipper will reboot"
msgstr "Klipper를 다시 시작합니다"
msgid "Language"
msgstr "언어"
msgid "Large"
msgstr "크게"
msgid "Left:"
msgstr "남음:"
msgid "Limits"
msgstr "제한"
msgid "Load"
msgstr "로드"
msgid "Lower Nozzle"
msgstr "노즐 낮춤"
msgid "Macro shortcut on sidebar"
msgstr "사이드바 매크로 바로가기"
msgid "Macros"
msgstr "매크로"
msgid "Main Menu"
msgstr "메인메뉴"
msgid "Max Accelation"
msgstr "최대 가속"
msgid "Max Acceleration to Deceleration"
msgstr "최대 가속에서 감속까지"
msgid "Max Velocity"
msgstr "최대 속도"
msgid "Medium"
msgstr "중간"
msgid "Menu"
msgstr "메뉴"
msgid "Modified"
msgstr "수정됨"
msgid "Moonraker: connected"
msgstr "Moonraker: 연결됨"
msgid "Move"
msgstr "이동"
msgid "Move Distance (mm)"
msgstr "이동 거리 (mm)"
msgid "Name"
msgstr "이름"
msgid "Network"
msgstr "네트워크"
msgid "Nothing selected"
msgstr "아무것도 선택되지않음"
msgid "Off"
msgstr "끔"
#, python-format
msgid "Outdated by %d"
msgstr "%d에 의해 오래된 커밋"
msgid "PSK for"
msgstr "PSK 비번:"
msgid "Package will be updated"
msgid_plural "Packages will be updated"
msgstr[0] "패키지가 업데이트됩니다"
msgid "Password saved"
msgstr "비번 저장됨"
msgid "Pause"
msgstr "일시정지"
msgid "Paused"
msgstr "일시정지됨"
msgid "Perform a full upgrade?"
msgstr "전체 업그레이드를 수행하겠습니까?"
msgid "Please recompile and flash the micro-controller."
msgstr "마이크로 컨트롤러를 다시 컴파일하고 플래시하십시오."
msgid "Power"
msgstr "전"
msgid "Power On Printer"
msgstr "프린터 전원 켜기"
msgid "Print"
msgstr "출력"
msgid "Print Control"
msgstr "출력 제어"
msgid "Print Time"
msgstr "출력 시간"
msgid "Printer Connections"
msgstr "프린터 연결"
msgid "Printing"
msgstr "출력중"
msgid "Probe found applied offset"
msgstr "프로브가 오프셋을 찾았습니다"
msgid "Profile Name:"
msgstr "프로파일 이름:"
msgid "Quad Gantry Level"
msgstr "쿼드 갠트리 레벨"
msgid "Raise Nozzle"
msgstr "노즐 높임"
msgid "Recover Hard"
msgstr "하드하게 복원"
msgid "Recover Soft"
msgstr "부드럽게 복원"
msgid "Reference"
msgstr "레퍼런스"
msgid "Restart"
msgstr "재시작"
msgid "Resume"
msgstr "재개"
msgid "Retract"
msgstr "철회"
#, python-format
msgid "Retry #%s"
msgstr "재시도 #%s"
msgid "Save"
msgstr "저장"
msgid "Save Config"
msgstr "설정 저장"
msgid "Save configuration"
msgstr "설\b정을 저장합니다"
msgid "Screen DPMS"
msgstr "화면 DPMS"
msgid "Screen Power Off Time"
msgstr "화면이 꺼지는 시간"
msgid "Screws Adjust"
msgstr "스크류 조정"
msgid "Select"
msgstr "선택"
msgid "Send"
msgstr "보내기"
#, python-format
msgid "Sending Power ON signal to: %s"
msgstr "전원 켜기 신호를 보내는 중: %s"
msgid "Set Temp"
msgstr "온도 설정"
msgid "Settings"
msgstr "설정"
msgid "Show"
msgstr "보기"
msgid "Size"
msgstr "크기"
msgid "Slicer"
msgstr "슬라이서"
msgid "Slicer Time correction (%)"
msgstr "슬라이서 시간 보정(%)"
msgid "Small"
msgstr "작은"
msgid "Sort by: "
msgstr "분류 기준:"
msgid "Speed (mm/s)"
msgstr "속도 (mm/s)"
msgid "Speed +"
msgstr "속도 +"
msgid "Speed -"
msgstr "속도 -"
msgid "Square Corner Velocity"
msgstr "사각 모서리 속도"
msgid "Start"
msgstr "시작"
msgid "Starting WiFi Association"
msgstr "WiFi 연결을 시작하는 중"
msgid "Starting recovery for"
msgstr "복구 시작 중:"
msgid "Starting update for"
msgstr "업데이트 시작 중:"
msgid "System"
msgstr "시스템"
msgid ""
"System\n"
"Restart"
msgstr ""
"시스템\n"
"재시작"
msgid ""
"System\n"
"Shutdown"
msgstr ""
"시스템\n"
"종료"
msgid "Temp (°C)"
msgstr "온도 (°C)"
msgid "Temperature"
msgstr "온도"
#, python-format
msgid "To apply %s KlipperScreen needs to be restarted"
msgstr "%s을(를) 적용하려면 KlipperScreen을(를) 다시 시작해야 합니다."
msgid "Tool"
msgstr "툴"
msgid "Total:"
msgstr "총:"
msgid "Unknown Heater"
msgstr "알 수 없는 히터"
msgid "Unload"
msgstr "언로드"
msgid "Up To Date"
msgstr "최신버전"
msgid "Update"
msgstr "업데이트"
msgid "Updating"
msgstr "업데이트중"
msgid "Uploaded"
msgstr "업로드됨"
msgid "View Mesh"
msgstr "메쉬 보기"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "XY Move Speed (mm/s)"
msgstr "XY 이동 속도 (mm/s)"
msgid "Y+"
msgstr "Y+"
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "Z 교정"
msgid "Z Move Speed (mm/s)"
msgstr "Z 이동 속도 (mm/s)"
msgid "Z Position"
msgstr "Z 위치"
msgid "Z Tilt"
msgstr "Z 기울기"
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "commit"
msgid_plural "commits"
msgstr[0] "결정"
msgid "dBm"
msgstr "dBm"
msgid "hour"
msgid_plural "hours"
msgstr[0] "시간"
msgid "minutes"
msgstr "분"
msgid "mm"
msgstr "mm"
msgid "mm/s"
msgstr "mm/s"
msgid "mm/s^2"
msgstr "mm/s^2"
@@ -0,0 +1,641 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-03-31 11:25-0300\n"
"PO-Revision-Date: 2022-05-06 21:48+0300\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: tr_TR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0.1\n"
#, python-format
msgid "%s will be updated to version"
msgstr "%s sürüme güncellenecektir"
msgid "(default)"
msgstr "(varsayılan)"
msgid "24 Hour Time"
msgstr "24 Saat Zaman"
msgid "A FIRMWARE_RESTART may fix the issue."
msgstr "Bir FIRMWARE_RESTART sorunu çözebilir."
msgid "Abort"
msgstr "İptal et"
msgid "Accept"
msgstr "Kabul et"
msgid "Actions"
msgstr "Eylemler"
msgid "Add Printer"
msgstr "Yazıcı Ekle"
msgid "Add bed mesh profile"
msgstr "Yatak Örgüsü profili ekle"
msgid "Are you sure you want to run Emergency Stop?"
msgstr "Acil Durdurma'yı çalıştırmak istediğinizden emin misiniz?"
msgid "Are you sure you wish to cancel this print?"
msgstr "Bu baskıyı iptal etmek istediğinizden emin misiniz?"
msgid "Are you sure you wish to disable motors?"
msgstr "Motorları devre dışı bırakmak istediğinizden emin misiniz?"
msgid "Are you sure you wish to reboot the system?"
msgstr "Sistemi yeniden başlatmak istediğinizden emin misiniz?"
msgid "Are you sure you wish to shutdown the system?"
msgstr "Sistemi kapatmak istediğinizden emin misiniz?"
msgid "Auto"
msgstr "Otomatik"
msgid "Auto-scroll"
msgstr "Otomatik kaydırma"
msgid "Bed Level"
msgstr "Yatak Ayarı"
msgid "Bed Mesh"
msgstr "Yatak Örgüsü"
msgid "Bltouch found applied offset"
msgstr "Bltouch uygulanmış ofseti buldu"
msgid "Calibrate"
msgstr "Kalibre et"
msgid "Calibrated, save configuration to make it permanent"
msgstr "Kalibre edildi, kalıcı hale getirmek için yapılandırmayı kaydedin"
msgid "Can't set above the maximum:"
msgstr "Maksimumun üzerine ayarlanamaz:"
msgid "Cancel"
msgstr "İptal"
msgid "Cancel Print"
msgstr "Baskıyı iptal et"
msgid "Cancelled"
msgstr "İptal edildi"
msgid "Cancelling"
msgstr "İptal ediliyor"
msgid "Cannot connect to Moonraker"
msgstr "Moonraker'a bağlanılamıyor"
msgid "Channel"
msgstr "Kanal"
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"Daha fazla bilgi için /tmp/KlipperScreen.log'a bakın.\n"
"Lütfen yardım için GitHub'da bir sorun gönderin."
msgid "Close"
msgstr "Kapat"
msgid "Complete"
msgstr "Tamamlandı"
msgid "Configuration"
msgstr "Yapılandırma"
msgid "Confirm Emergency Stop"
msgstr "Acil Durdurmayı Onaylayın"
msgid "Connected"
msgstr "Bağlandı"
#, python-format
msgid "Connecting to %s"
msgstr "%s'e Bağlanılıyor"
msgid "Console"
msgstr "Konsol"
msgid "Continue"
msgstr "Devam et"
msgid "Cooldown"
msgstr "Soğutma"
msgid "Date"
msgstr "Tarih"
msgid "Decrease"
msgstr "Azalt"
msgid "Delete"
msgstr "Sil"
msgid "Deselect"
msgstr "Seçimi kaldır"
msgid "Disable Motors"
msgstr "Motorları Devre Dışı Bırak"
msgid "Disable XY"
msgstr "XY Devre dışı bırak"
msgid "Displayed Macros"
msgstr "Görüntülenen Makrolar"
msgid "Distance (mm)"
msgstr "Uzaklık (mm)"
#, python-format
msgid "Do you want to recover %s?"
msgstr "%s Kurtarmak istiyor musunuz?"
msgid "Elapsed:"
msgstr "Geçen:"
msgid "Error"
msgstr "Hata"
msgid "Estimated Time Method"
msgstr "Tahmini Zaman Metodu"
msgid "Extrude"
msgstr "Ekstrüzyon"
msgid "Extrusion +"
msgstr "Ekstrüzyon +"
msgid "Extrusion -"
msgstr "Ekstrüzyon -"
msgid "Failed, adjust position first"
msgstr "Başarısız, önce konumu ayarlayın"
msgid "Fan"
msgstr "Fan"
msgid "Filament Used"
msgstr "Kullanılan Filament"
msgid "File"
msgstr "Dosya"
msgid "Fine Tuning"
msgstr "İnce Ayar"
msgid "Finish"
msgstr "Bitir"
msgid ""
"Firmware\n"
"Restart"
msgstr ""
"Firmware\n"
"Yeniden Başlat"
msgid "Font Size"
msgstr "Yazı boyutu"
msgid ""
"Full\n"
"Update"
msgstr ""
"Tam\n"
"Güncelleme"
msgid "Go Back"
msgstr "Geri git"
msgid "Hidden"
msgstr "Gizli"
msgid "Hide"
msgstr "Gizle"
msgid "Hide sensors in Temp."
msgstr "Sıcaklıktaki sensörleri gizleyin."
msgid "Home"
msgstr "Ana Ekran"
msgid "Home All"
msgstr "Eksenleri Sıfırla"
msgid "Home X"
msgstr "X Sıfırla"
msgid "Home XY"
msgstr "XY Sıfırla"
msgid "Home Y"
msgstr "Y Sıfırla"
msgid "Home Z"
msgstr "Z Sıfırla"
msgid "Homing"
msgstr "Eksen Sıfırlama"
msgid "Hostname"
msgstr "Ana bilgisayar adı"
msgid "Icon Theme"
msgstr "Simge Teması"
msgid "Increase"
msgstr "Artır"
msgid "Initializing"
msgstr "Başlatılıyor"
msgid "Initializing printer..."
msgstr "Yazıcı başlatılıyor..."
msgid "Interface"
msgstr "Arayüz"
msgid "Invalid"
msgstr "Geçersiz"
msgid "Invert X"
msgstr "X Ters çevir"
msgid "Invert Y"
msgstr "Y Ters çevir"
msgid "Invert Z"
msgstr "Z Ters çevir"
msgid ""
"Klipper\n"
"Restart"
msgstr ""
"Klipper\n"
"Yeniden başlat"
msgid "Klipper has disconnected"
msgstr "Klipper bağlantısı kesildi"
msgid "Klipper has encountered an error."
msgstr "Klipper bir hatayla karşılaştı."
msgid "Klipper has shutdown"
msgstr "Klipper Kapandı"
msgid "Klipper is attempting to start"
msgstr "Klipper başlatılmaya çalışılıyor"
msgid "Klipper will reboot"
msgstr "Klipper yeniden başlayacak"
msgid "Language"
msgstr "Dil"
msgid "Large"
msgstr "Büyük"
msgid "Left:"
msgstr "Kalan:"
msgid "Limits"
msgstr "Limitler"
msgid "Load"
msgstr "Yükle"
msgid "Lower Nozzle"
msgstr "Nozzle düşür"
msgid "Macro shortcut on sidebar"
msgstr "Kenar çubuğunda makro kısayolu"
msgid "Macros"
msgstr "Makrolar"
msgid "Main Menu"
msgstr "Ana Menü"
msgid "Max Accelation"
msgstr "Maksimum Hızlanma"
msgid "Max Acceleration to Deceleration"
msgstr "Maksimum Hızlanma ve Yavaşlama"
msgid "Max Velocity"
msgstr "Maksimum Hız"
msgid "Medium"
msgstr "Orta"
msgid "Menu"
msgstr "Menü"
msgid "Modified"
msgstr "Değiştirilmiş"
msgid "Moonraker: connected"
msgstr "Moonraker: bağlandı"
msgid "Move"
msgstr "Hareket"
msgid "Move Distance (mm)"
msgstr "Hareket Mesafesi (mm)"
msgid "Name"
msgstr "İsim"
msgid "Network"
msgstr "Ağ"
msgid "Nothing selected"
msgstr "Hiçbir şey seçilmedi"
msgid "Off"
msgstr "Kapa"
#, python-format
msgid "Outdated by %d"
msgstr "Güncelliğini yitiren %d"
msgid "PSK for"
msgstr "PSK için"
msgid "Package will be updated"
msgid_plural "Packages will be updated"
msgstr[0] "Paket yükseltilecek"
msgstr[1] "Paketler yükseltilecek"
msgid "Password saved"
msgstr "Şifre kaydedildi"
msgid "Pause"
msgstr "Duraklat"
msgid "Paused"
msgstr "Duraklatıldı"
msgid "Perform a full upgrade?"
msgstr "Tam yükseltme yap?"
msgid "Please recompile and flash the micro-controller."
msgstr "Lütfen mikro denetleyiciyi yeniden derleyin ve flaşlayın."
msgid "Power"
msgstr "Güç"
msgid "Power On Printer"
msgstr "Yazıcıya Güç Ver (aç)"
msgid "Print"
msgstr "Yazdır"
msgid "Print Control"
msgstr "Yazdırma Kontrolü"
msgid "Print Time"
msgstr "Yazdırma Süresi"
msgid "Printer Connections"
msgstr "Yazıcı Bağlantıları"
msgid "Printing"
msgstr "Yazdırılıyor"
msgid "Probe found applied offset"
msgstr "Prob uygulanmış ofset bulundu"
msgid "Profile Name:"
msgstr "Profil ismi:"
msgid "Quad Gantry Level"
msgstr "Dörtlü Köprü Seviyesi"
msgid "Raise Nozzle"
msgstr "Nozzle yükselt"
msgid "Recover Hard"
msgstr "Zorla Kurtar"
msgid "Recover Soft"
msgstr "Yumuşak Kurtar"
msgid "Reference"
msgstr "Referans"
msgid "Restart"
msgstr "Yeniden Başlat"
msgid "Resume"
msgstr "Devam Et"
msgid "Retract"
msgstr "Geri çek"
#, python-format
msgid "Retry #%s"
msgstr "Yeniden Dene #%s"
msgid "Save"
msgstr "Kaydet"
msgid "Save Config"
msgstr "Yapılandırma Kayıt"
msgid "Save configuration"
msgstr "Yapılandırmayı kaydet"
msgid "Screen DPMS"
msgstr "Ekran DPMS"
msgid "Screen Power Off Time"
msgstr "Ekran kapatma zamanı"
msgid "Screws Adjust"
msgstr "Vida Ayarı"
msgid "Select"
msgstr "Seç"
msgid "Send"
msgstr "Gönder"
#, python-format
msgid "Sending Power ON signal to: %s"
msgstr "Güç AÇ sinyalı gönderilen: %s"
msgid "Set Temp"
msgstr "Sıcaklık Ayarla"
msgid "Settings"
msgstr "Ayarlar"
msgid "Show"
msgstr "Göster"
msgid "Size"
msgstr "Boyut"
msgid "Slicer"
msgstr "Dilimleme"
msgid "Slicer Time correction (%)"
msgstr "Dilimleme Zamanı doğrulama (%)"
msgid "Small"
msgstr "Küçük"
msgid "Sort by: "
msgstr "Sırala: "
msgid "Speed (mm/s)"
msgstr "Hız (mm/s)"
msgid "Speed +"
msgstr "Hız +"
msgid "Speed -"
msgstr "Hız -"
msgid "Square Corner Velocity"
msgstr "Kare Köşe Hızı"
msgid "Start"
msgstr "Başlat"
msgid "Starting WiFi Association"
msgstr "WiFi Bağlantısı başlatılıyor"
msgid "Starting recovery for"
msgstr "Kurtarma başlatılıyor"
msgid "Starting update for"
msgstr "Güncelleme başlatılıyor"
msgid "System"
msgstr "Sistem"
msgid ""
"System\n"
"Restart"
msgstr ""
"Sistem\n"
"Yeniden Başlat"
msgid ""
"System\n"
"Shutdown"
msgstr ""
"Sistem\n"
"Kapat"
msgid "Temp (°C)"
msgstr "Sıcaklık (°C)"
msgid "Temperature"
msgstr "Sıcaklık"
#, python-format
msgid "To apply %s KlipperScreen needs to be restarted"
msgstr "Uygulamak için %s KlipperScreen yeniden başlatılmalı"
msgid "Tool"
msgstr "Araç"
msgid "Total:"
msgstr "Toplam:"
msgid "Unknown Heater"
msgstr "Bilinmeyen Isıtıcı"
msgid "Unload"
msgstr "Boşalt"
msgid "Up To Date"
msgstr "Güncel"
msgid "Update"
msgstr "Güncelle"
msgid "Updating"
msgstr "Yükleniyor"
msgid "Uploaded"
msgstr "Yüklendi"
msgid "View Mesh"
msgstr "Örgüyü Görüntüle"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "XY Move Speed (mm/s)"
msgstr "XY Hareket hızı (mm/s)"
msgid "Y+"
msgstr "Y+"
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "Z Kalibrasyonu"
msgid "Z Move Speed (mm/s)"
msgstr "Z Hareket hızı (mm/s)"
msgid "Z Position"
msgstr "Z Pozisyonu"
msgid "Z Tilt"
msgstr "Z Eğim"
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "commit"
msgid_plural "commits"
msgstr[0] "commit"
msgstr[1] "commits"
msgid "dBm"
msgstr "dBm"
msgid "hour"
msgid_plural "hours"
msgstr[0] "saat"
msgstr[1] "saatler"
msgid "minutes"
msgstr "dakika"
msgid "mm"
msgstr "mm"
msgid "mm/s"
msgstr "mm/s"
msgid "mm/s^2"
msgstr "mm/s^2"
+18 -10
View File
@@ -125,7 +125,7 @@ class Printer:
'motion_report'
]
for x in (self.get_tools() + self.get_heaters()):
for x in (self.get_tools() + self.get_heaters() + self.get_filament_sensors()):
if x in data:
for i in data[x]:
self.set_dev_stat(x, i, data[x][i])
@@ -137,7 +137,7 @@ class Printer:
self.data[x] = {}
self.data[x].update(data[x])
if "webhooks" in data or "idle_timeout" in data or "print_stats" in data:
if "webhooks" in data or "idle_timeout" in data or "print_stats" in data or "pause_resume" in data:
self.evaluate_state()
def get_updates(self):
@@ -150,7 +150,9 @@ class Printer:
if wh_state == "ready":
new_state = "ready"
if self.data['print_stats']:
if self.data['pause_resume']['is_paused']:
new_state = "paused"
elif self.data['print_stats']:
print_state = self.data['print_stats']['state'].lower() # complete, error, paused, printing, standby
if print_state == "paused":
new_state = "paused"
@@ -209,11 +211,6 @@ class Printer:
return self.config[section]
return False
def get_config_section(self, section):
if section not in self.config:
return False
return self.config[section]
def get_data(self):
return self.data
@@ -242,6 +239,14 @@ class Printer:
heaters.append(h)
return heaters
def get_filament_sensors(self):
sensors = []
for s in self.get_config_section_list("filament_switch_sensor "):
sensors.append(s)
for s in self.get_config_section_list("filament_motion_sensor "):
sensors.append(s)
return sensors
def get_printer_status_data(self):
data = {
"printer": {
@@ -259,12 +264,15 @@ class Printer:
"count": len(self.get_gcode_macros())
},
"idle_timeout": self.get_stat("idle_timeout").copy(),
"pause_resume": self.get_stat("pause_resume").copy(),
"pause_resume": {
"is_paused": True if self.state == "paused" else False
},
"power_devices": {
"count": len(self.get_power_devices())
},
"probe": self.config_section_exists("probe"),
"firmware_retraction": self.config_section_exists("firmware_retraction")
"firmware_retraction": self.config_section_exists("firmware_retraction"),
"input_shaper": self.config_section_exists("input_shaper")
}
}
+56 -5
View File
@@ -1,10 +1,12 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from ks_includes.KlippyGcodes import KlippyGcodes
class ScreenPanel:
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
@@ -42,7 +44,7 @@ class ScreenPanel:
if temp <= 0:
return ""
else:
return ("(%s)" % str(int(temp)))
return "(%s)" % str(int(temp))
def format_temp(self, temp, places=1):
if places == 0:
@@ -57,17 +59,17 @@ class ScreenPanel:
def get_content(self):
return self.content
def get_file_image(self, filename, width=1.6, height=1.6):
def get_file_image(self, filename, width=1, height=1, small=False):
if not self._files.has_thumbnail(filename):
return None
loc = self._files.get_thumbnail_location(filename)
loc = self._files.get_thumbnail_location(filename, small)
if loc is None:
return None
if loc[0] == "file":
return self._gtk.PixbufFromFile(loc[1], None, width, height)
return self._gtk.PixbufFromFile(loc[1], width, height)
if loc[0] == "http":
return self._gtk.PixbufFromHttp(loc[1], None, width, height)
return self._gtk.PixbufFromHttp(loc[1], width, height)
return None
def get_title(self):
@@ -116,3 +118,52 @@ class ScreenPanel:
self.labels[dev].set_label(self._gtk.formatTemperatureString(temp, target))
else:
self.labels[dev].set_label("%s\n%s" % (name, self._gtk.formatTemperatureString(temp, target)))
def load_menu(self, widget, name):
if ("%s_menu" % name) not in self.labels:
return
for child in self.content.get_children():
self.content.remove(child)
self.menu.append('%s_menu' % name)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def unload_menu(self, widget=None):
logging.debug("self.menu: %s" % self.menu)
if len(self.menu) <= 1 or self.menu[-2] not in self.labels:
return
self.menu.pop()
for child in self.content.get_children():
self.content.remove(child)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def on_dropdown_change(self, combo, section, option, callback=None):
tree_iter = combo.get_active_iter()
if tree_iter is not None:
model = combo.get_model()
value = model[tree_iter][1]
logging.debug("[%s] %s changed to %s" % (section, option, value))
self._config.set(section, option, value)
self._config.save_user_config_options()
if callback is not None:
callback(value)
def scale_moved(self, widget, event, section, option):
logging.debug("[%s] %s changed to %s" % (section, option, widget.get_value()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)
self._config.set(section, option, str(int(widget.get_value())))
self._config.save_user_config_options()
def switch_config_option(self, switch, gparam, section, option, callback=None):
logging.debug("[%s] %s toggled %s" % (section, option, switch.get_active()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)
self._config.set(section, option, "True" if switch.get_active() else "False")
self._config.save_user_config_options()
if callback is not None:
callback(switch.get_active())
+6 -7
View File
@@ -91,7 +91,6 @@ class HeaterGraph(Gtk.DrawingArea):
max_num = math.ceil(self.get_max_num(data_points) * 1.1 / 10) * 10
d_width = 1 / points_per_pixel
d_height_scale = self.graph_lines(ctx, gsize, max_num)
self.graph_time(ctx, gsize, points_per_pixel)
@@ -115,10 +114,10 @@ class HeaterGraph(Gtk.DrawingArea):
ctx.set_dash([1, 0])
d_len = len(data) - 1
for d in data:
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_x = i * swidth + gsize[0][0] if i != d_len else gsize[1][0] - 1
p_y = gsize[1][1] - 1 - (d * hscale)
if i == 0:
ctx.move_to(gsize[0][0]+1, p_y)
ctx.move_to(gsize[0][0] + 1, p_y)
i += 1
continue
ctx.line_to(p_x, p_y)
@@ -139,15 +138,15 @@ class HeaterGraph(Gtk.DrawingArea):
while (max_num / nscale) > 5:
nscale += 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)
for i in range(r):
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.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.set_source_rgba(.5, .5, .5, .2)
ctx.move_to(gsize[0][0], lheight)
+66 -62
View File
@@ -9,10 +9,12 @@ from threading import Thread
from queue import Queue
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GLib, Gdk
class WifiManager():
class WifiManager:
networks_in_supplicant = []
connected = False
_stop_loop = False
@@ -50,8 +52,9 @@ class WifiManager():
self.soc = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
self.soc.bind(KS_SOCKET_FILE)
self.soc.connect("/var/run/wpa_supplicant/%s" % interface)
except Exception:
logging.info("Error connecting to wifi socket: %s" % interface)
except Exception as e:
logging.critical(e, exc_info=True)
logging.error("Error connecting to wifi socket: %s" % interface)
return
self.wpa_thread = WpaSocket(self, self.queue, self.callback)
@@ -76,7 +79,7 @@ class WifiManager():
# TODO: Add wpa_cli error checking
network_id = self.wpa_cli("ADD_NETWORK")
commands = [
'ENABLE_NETWORK %s' % (network_id),
'ENABLE_NETWORK %s' % network_id,
'SET_NETWORK %s ssid "%s"' % (network_id, ssid.replace('"', '\"')),
'SET_NETWORK %s psk "%s"' % (network_id, psk.replace('"', '\"'))
]
@@ -324,7 +327,8 @@ class WpaSocket(Thread):
while self._stop_loop is False:
try:
msg = self.soc.recv(4096).decode().strip()
except Exception:
except Exception as e:
logging.critical(e, exc_info=True)
# TODO: Socket error
continue
if msg.startswith("<"):
@@ -363,117 +367,117 @@ class WifiChannels:
@staticmethod
def lookup(freq):
if freq == "2412":
return ("2.4", "1")
return "2.4", "1"
if freq == "2417":
return ("2.4", "2")
return "2.4", "2"
if freq == "2422":
return ("2.4", "3")
return "2.4", "3"
if freq == "2427":
return ("2.4", "4")
return "2.4", "4"
if freq == "2432":
return ("2.4", "5")
return "2.4", "5"
if freq == "2437":
return ("2.4", "6")
return "2.4", "6"
if freq == "2442":
return ("2.4", "7")
return "2.4", "7"
if freq == "2447":
return ("2.4", "8")
return "2.4", "8"
if freq == "2452":
return ("2.4", "9")
return "2.4", "9"
if freq == "2457":
return ("2.4", "10")
return "2.4", "10"
if freq == "2462":
return ("2.4", "11")
return "2.4", "11"
if freq == "2467":
return ("2.4", "12")
return "2.4", "12"
if freq == "2472":
return ("2.4", "13")
return "2.4", "13"
if freq == "2484":
return ("2.4", "14")
return "2.4", "14"
if freq == "5035":
return ("5", "7")
return "5", "7"
if freq == "5040":
return ("5", "8")
return "5", "8"
if freq == "5045":
return ("5", "9")
return "5", "9"
if freq == "5055":
return ("5", "11")
return "5", "11"
if freq == "5060":
return ("5", "12")
return "5", "12"
if freq == "5080":
return ("5", "16")
return "5", "16"
if freq == "5170":
return ("5", "34")
return "5", "34"
if freq == "5180":
return ("5", "36")
return "5", "36"
if freq == "5190":
return ("5", "38")
return "5", "38"
if freq == "5200":
return ("5", "40")
return "5", "40"
if freq == "5210":
return ("5", "42")
return "5", "42"
if freq == "5220":
return ("5", "44")
return "5", "44"
if freq == "5230":
return ("5", "46")
return "5", "46"
if freq == "5240":
return ("5", "48")
return "5", "48"
if freq == "5260":
return ("5", "52")
return "5", "52"
if freq == "5280":
return ("5", "56")
return "5", "56"
if freq == "5300":
return ("5", "60")
return "5", "60"
if freq == "5320":
return ("5", "64")
return "5", "64"
if freq == "5500":
return ("5", "100")
return "5", "100"
if freq == "5520":
return ("5", "104")
return "5", "104"
if freq == "5540":
return ("5", "108")
return "5", "108"
if freq == "5560":
return ("5", "112")
return "5", "112"
if freq == "5580":
return ("5", "116")
return "5", "116"
if freq == "5600":
return ("5", "120")
return "5", "120"
if freq == "5620":
return ("5", "124")
return "5", "124"
if freq == "5640":
return ("5", "128")
return "5", "128"
if freq == "5660":
return ("5", "132")
return "5", "132"
if freq == "5680":
return ("5", "136")
return "5", "136"
if freq == "5700":
return ("5", "140")
return "5", "140"
if freq == "5720":
return ("5", "144")
return "5", "144"
if freq == "5745":
return ("5", "149")
return "5", "149"
if freq == "5765":
return ("5", "153")
return "5", "153"
if freq == "5785":
return ("5", "157")
return "5", "157"
if freq == "5805":
return ("5", "161")
return "5", "161"
if freq == "5825":
return ("5", "165")
return "5", "165"
if freq == "4915":
return ("5", "183")
return "5", "183"
if freq == "4920":
return ("5", "184")
return "5", "184"
if freq == "4925":
return ("5", "185")
return "5", "185"
if freq == "4935":
return ("5", "187")
return "5", "187"
if freq == "4940":
return ("5", "188")
return "5", "188"
if freq == "4945":
return ("5", "189")
return "5", "189"
if freq == "4960":
return ("5", "192")
return "5", "192"
if freq == "4980":
return ("5", "196")
return "5", "196"
return None
+2 -5
View File
@@ -9,6 +9,7 @@ from jinja2 import Environment
from ks_includes.screen_panel import ScreenPanel
class BasePanel(ScreenPanel):
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
super().__init__(screen, title, back, action_bar, printer_name)
@@ -85,7 +86,6 @@ class BasePanel(ScreenPanel):
self.titlelbl.set_hexpand(True)
self.titlelbl.set_vexpand(True)
self.titlelbl.set_halign(Gtk.Align.CENTER)
self.titlelbl.set_ellipsize(True)
self.titlelbl.set_ellipsize(Pango.EllipsizeMode.END)
self.set_title(title)
@@ -129,7 +129,6 @@ class BasePanel(ScreenPanel):
self.layout.put(self.titlebar, action_bar_width, 0)
self.layout.put(self.content, action_bar_width + self.hmargin, self.title_spacing)
def initialize(self, panel_name):
self.update_time()
return
@@ -138,14 +137,13 @@ class BasePanel(ScreenPanel):
for child in self.control['temp_box'].get_children():
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
for device in self._screen.printer.get_temp_store_devices():
logging.info(device)
self.labels[device + '_box'] = Gtk.Box(spacing=0)
self.labels[device] = Gtk.Label(label="100º")
self.labels[device].set_ellipsize(True)
self.labels[device].set_ellipsize(Pango.EllipsizeMode.START)
if device.startswith("extruder"):
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'].show_all()
def remove(self, widget):
self.content.remove(widget)
+9 -7
View File
@@ -8,9 +8,11 @@ from gi.repository import Gtk
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return BedLevelPanel(*args)
class BedLevelPanel(ScreenPanel):
x_offset = 0
y_offset = 0
@@ -47,19 +49,19 @@ class BedLevelPanel(ScreenPanel):
logging.debug("%d bed_screws not supported: calculating 4 locations", nscrews)
xconf = self._screen.printer.get_config_section("stepper_x")
yconf = self._screen.printer.get_config_section("stepper_y")
x = int(int(xconf['position_max'])/4)
y = int(int(yconf['position_max'])/4)
x = int(int(xconf['position_max']) / 4)
y = int(int(yconf['position_max']) / 4)
self.screws = [
[x, y],
[x*3, y],
[x, y*3],
[x*3, y*3],
[x * 3, y],
[x, y * 3],
[x * 3, y * 3],
]
else:
self.screws = screws
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"):
if "bltouch" in self._screen.printer.get_config_section_list():
bltouch = self._screen.printer.get_config_section("bltouch")
@@ -307,7 +309,7 @@ class BedLevelPanel(ScreenPanel):
self.labels[key].set_label(result.group(5))
break
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)
else:
result = re.match(
+16 -21
View File
@@ -15,9 +15,11 @@ from matplotlib.ticker import LinearLocator
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return BedMeshPanel(*args)
class BedMeshPanel(ScreenPanel):
active_mesh = None
graphs = {}
@@ -27,17 +29,12 @@ class BedMeshPanel(ScreenPanel):
self.show_create = False
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
# Create a grid for all profiles
self.labels['profiles'] = Gtk.Grid()
scroll.add(self.labels['profiles'])
addprofile = self._gtk.ButtonImage("increase", " %s" % _("Add bed mesh profile"),
"color1", .5, Gtk.PositionType.LEFT, False)
addprofile.connect("clicked", self.show_create_profile)
@@ -92,7 +89,7 @@ class BedMeshPanel(ScreenPanel):
frame = Gtk.Frame()
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_vexpand(True)
name.set_halign(Gtk.Align.START)
@@ -177,7 +174,7 @@ class BedMeshPanel(ScreenPanel):
if "default" in pl:
pl.remove('default')
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'].attach(self.profiles[profile]['row'], 0, pos, 1, 1)
@@ -240,7 +237,7 @@ class BedMeshPanel(ScreenPanel):
if "default" in pl:
pl.remove('default')
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)
del self.profiles[profile]
@@ -287,7 +284,6 @@ class BedMeshPanel(ScreenPanel):
save.set_hexpand(False)
save.connect("clicked", self.create_profile)
self.labels['profile_name'] = entry
box.pack_start(pl, False, False, 5)
box.pack_start(entry, True, True, 5)
@@ -324,19 +320,19 @@ class BedMeshPanel(ScreenPanel):
maxz_mesh = 0.5
z_range = [minz_mesh, maxz_mesh]
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)]
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])]
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])]
y = [(i * deltas[0]) + y_range[0] for i in range(counts[1])]
x, y = np.meshgrid(x, y)
z = np.asarray(abm['mesh_matrix'])
else:
x_range = [int(bm['min_x']), int(bm['max_x'])]
y_range = [int(bm['min_y']), int(bm['max_y'])]
z_range = [min(min(bm['points'])), max(max(bm['points']))]
deltas = [(x_range[1] - x_range[0]) / (int(bm['x_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'])]
y = [(i*deltas[0])+y_range[0] for i in range(bm['y_count'])]
deltas = [(x_range[1] - x_range[0]) / (int(bm['x_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'])]
y = [(i * deltas[0]) + y_range[0] for i in range(bm['y_count'])]
x, y = np.meshgrid(x, y)
z = np.asarray(bm['points'])
@@ -349,8 +345,8 @@ class BedMeshPanel(ScreenPanel):
fig.add_axes(ax)
surf = ax.plot_surface(x, y, z, cmap=cm.coolwarm, vmin=-0.1, vmax=0.1)
chartBox = ax.get_position()
ax.set_position([chartBox.x0, chartBox.y0+0.1, chartBox.width*.92, chartBox.height])
chartbox = ax.get_position()
ax.set_position([chartbox.x0, chartbox.y0 + 0.1, chartbox.width * .92, chartbox.height])
ax.set_zlim(z_range[0], z_range[1])
ax.zaxis.set_major_locator(LinearLocator(5))
@@ -381,7 +377,7 @@ class BedMeshPanel(ScreenPanel):
alloc = canvas_box.get_allocation()
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.show_all()
# Remove the "matplotlib-canvas" class which forces a white background.
@@ -390,6 +386,5 @@ class BedMeshPanel(ScreenPanel):
for css_class in style_ctx.list_classes():
style_ctx.remove_class(css_class)
def _close_dialog(self, widget, response):
widget.destroy()
+8 -6
View File
@@ -9,6 +9,7 @@ from gi.repository import Gtk
from datetime import datetime
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return ConsolePanel(*args)
@@ -21,6 +22,7 @@ COLORS = {
"warning": "#c9c9c9"
}
class ConsolePanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
@@ -32,16 +34,16 @@ class ConsolePanel(ScreenPanel):
o1_lbl = Gtk.Label(_("Auto-scroll"))
o1_lbl.set_halign(Gtk.Align.END)
o1_switch = Gtk.Switch()
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("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_active(self.autoscroll)
o1_switch.connect("notify::active", self.set_autoscroll)
o2_lbl = Gtk.Label(_("Hide temp."))
o2_lbl.set_halign(Gtk.Align.END)
o2_switch = Gtk.Switch()
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("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_active(self.hidetemps)
o2_switch.connect("notify::active", self.hide_temps)
@@ -85,7 +87,6 @@ class ConsolePanel(ScreenPanel):
enter.set_hexpand(False)
enter.connect("clicked", self._send_command)
ebox.add(entry)
ebox.add(enter)
@@ -108,11 +109,12 @@ class ConsolePanel(ScreenPanel):
def add_gcode(self, type, time, message):
if type == "command":
color = COLORS['command']
message = '$ %s' % message
elif message.startswith("!!"):
color = COLORS['error']
message = message.replace("!! ", "")
elif message.startswith("//"):
color = COLORS['warning']
message = message.replace("// ", "")
elif self.hidetemps and re.match('^(?:ok\\s+)?(B|C|T\\d*):', message):
return
else:
+2
View File
@@ -5,9 +5,11 @@ from gi.repository import Gtk
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return ExamplePanel(*args)
class ExamplePanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
+95 -33
View File
@@ -2,14 +2,16 @@ import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from gi.repository import Gtk, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return ExtrudePanel(*args)
class ExtrudePanel(ScreenPanel):
distance = 5
distances = ['5', '10', '15', '25']
@@ -22,8 +24,6 @@ class ExtrudePanel(ScreenPanel):
self.speed = 1
self.speeds = ['1', '2', '5', '25']
grid = Gtk.Grid()
self.labels['extrude'] = self._gtk.ButtonImage("extrude", _("Extrude"), "color4")
self.labels['extrude'].connect("clicked", self.extrude, "+")
if not self.load_filament:
@@ -58,52 +58,40 @@ class ExtrudePanel(ScreenPanel):
if i < limit:
extgrid.attach(self.labels[extruder], i, 0, 1, 1)
if i < (limit - 1):
extgrid.attach(self.labels['temperature'], i+1, 0, 1, 1)
grid.attach(extgrid, 0, 0, 4, 1)
if self._screen.vertical_mode:
grid.attach(self.labels['extrude'], 0, 1, 2, 1)
grid.attach(self.labels['retract'], 2, 1, 2, 1)
grid.attach(self.labels['load'], 0, 2, 2, 1)
grid.attach(self.labels['unload'], 2, 2, 2, 1)
else:
grid.attach(self.labels['extrude'], 0, 1, 1, 1)
grid.attach(self.labels['load'], 1, 1, 1, 1)
grid.attach(self.labels['unload'], 2, 1, 1, 1)
grid.attach(self.labels['retract'], 3, 1, 1, 1)
extgrid.attach(self.labels['temperature'], i + 1, 0, 1, 1)
i += 1
distgrid = Gtk.Grid()
j = 0
for i in self.distances:
self.labels["dist"+str(i)] = self._gtk.ToggleButton(i)
self.labels["dist"+str(i)].connect("clicked", self.change_distance, i)
ctx = self.labels["dist"+str(i)].get_style_context()
self.labels["dist" + str(i)] = self._gtk.ToggleButton(i)
self.labels["dist" + str(i)].connect("clicked", self.change_distance, i)
ctx = self.labels["dist" + str(i)].get_style_context()
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")
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")
else:
ctx.add_class("distbutton")
if i == "5":
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
self.labels["dist5"].set_active(True)
speedgrid = Gtk.Grid()
j = 0
for i in self.speeds:
self.labels["speed"+str(i)] = self._gtk.ToggleButton(_(i))
self.labels["speed"+str(i)].connect("clicked", self.change_speed, i)
ctx = self.labels["speed"+str(i)].get_style_context()
self.labels["speed" + str(i)] = self._gtk.ToggleButton(_(i))
self.labels["speed" + str(i)].connect("clicked", self.change_speed, i)
ctx = self.labels["speed" + str(i)].get_style_context()
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")
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")
else:
ctx.add_class("distbutton")
@@ -122,13 +110,61 @@ class ExtrudePanel(ScreenPanel):
speedbox.pack_start(self.labels['extrude_speed'], True, True, 0)
speedbox.add(speedgrid)
filament_sensors = self._printer.get_filament_sensors()
if len(filament_sensors) > 0:
sensors = Gtk.Grid()
sensors.set_column_spacing(5)
sensors.set_row_spacing(5)
sensors.set_halign(Gtk.Align.CENTER)
sensors.set_valign(Gtk.Align.CENTER)
for s, x in enumerate(filament_sensors):
if s > limit:
break
name = x[23:].strip()
self.labels[x] = {
'label': Gtk.Label(name.capitalize().replace('_', ' ')),
'switch': Gtk.Switch(),
'box': Gtk.Box()
}
self.labels[x]['label'].set_halign(Gtk.Align.CENTER)
self.labels[x]['label'].set_hexpand(True)
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("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'].connect("notify::active", self.enable_disable_fs, name, x)
self.labels[x]['box'].pack_start(self.labels[x]['label'], True, True, 5)
self.labels[x]['box'].pack_start(self.labels[x]['switch'], False, False, 5)
self.labels[x]['box'].get_style_context().add_class("filament_sensor")
self.labels[x]['box'].set_hexpand(True)
if self._printer.get_dev_stat(x, "filament_detected"):
self.labels[x]['box'].get_style_context().add_class("filament_sensor_detected")
else:
self.labels[x]['box'].get_style_context().add_class("filament_sensor_empty")
sensors.attach(self.labels[x]['box'], s, 0, 1, 1)
grid = Gtk.Grid()
grid.set_column_homogeneous(True)
grid.attach(extgrid, 0, 0, 4, 1)
if self._screen.vertical_mode:
grid.attach(self.labels['extrude'], 0, 1, 2, 1)
grid.attach(self.labels['retract'], 2, 1, 2, 1)
grid.attach(self.labels['load'], 0, 2, 2, 1)
grid.attach(self.labels['unload'], 2, 2, 2, 1)
grid.attach(distbox, 0, 3, 4, 1)
grid.attach(speedbox, 0, 4, 4, 1)
if len(filament_sensors) > 0:
grid.attach(sensors, 0, 5, 4, 1)
else:
grid.attach(distbox, 0, 2, 2, 1)
grid.attach(speedbox, 2, 2, 2, 1)
grid.attach(self.labels['extrude'], 0, 2, 1, 1)
grid.attach(self.labels['load'], 1, 2, 1, 1)
grid.attach(self.labels['unload'], 2, 2, 1, 1)
grid.attach(self.labels['retract'], 3, 2, 1, 1)
grid.attach(distbox, 0, 3, 2, 1)
grid.attach(speedbox, 2, 3, 2, 1)
if len(filament_sensors) > 0:
grid.attach(sensors, 0, 4, 4, 1)
self.content.add(grid)
@@ -150,21 +186,37 @@ class ExtrudePanel(ScreenPanel):
self.current_extruder = data["toolhead"]["extruder"]
self.labels[self.current_extruder].get_style_context().add_class("button_active")
for x in self._printer.get_filament_sensors():
if x in data:
if 'enabled' in data[x]:
self._printer.set_dev_stat(x, "enabled", data[x]['enabled'])
self.labels[x]['switch'].set_active(data[x]['enabled'])
logging.info("%s Enabled: %s" % (x, data[x]['enabled']))
if 'filament_detected' in data[x]:
self._printer.set_dev_stat(x, "filament_detected", data[x]['filament_detected'])
if data[x]['filament_detected']:
self.labels[x]['box'].get_style_context().remove_class("filament_sensor_empty")
self.labels[x]['box'].get_style_context().add_class("filament_sensor_detected")
else:
self.labels[x]['box'].get_style_context().remove_class("filament_sensor_detected")
self.labels[x]['box'].get_style_context().add_class("filament_sensor_empty")
logging.info("%s: Filament detected: %s" % (x, data[x]['filament_detected']))
def change_distance(self, widget, distance):
if self.distance == distance:
return
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")
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")
for i in self.distances:
if i == self.distance:
continue
self.labels["dist"+str(i)].set_active(False)
self.labels["dist" + str(i)].set_active(False)
def change_extruder(self, widget, extruder):
if extruder == self.current_extruder:
@@ -217,3 +269,13 @@ class ExtrudePanel(ScreenPanel):
if macro == "UNLOAD_FILAMENT":
logging.info("Found %s" % macro)
self.unload_filament = True
def enable_disable_fs(self, switch, gparams, name, x):
if switch.get_active():
self._printer.set_dev_stat(x, "enabled", True)
self._screen._ws.klippy.gcode_script("SET_FILAMENT_SENSOR SENSOR=" + name + " ENABLE=1")
else:
self._printer.set_dev_stat(x, "enabled", False)
self._screen._ws.klippy.gcode_script("SET_FILAMENT_SENSOR SENSOR=" + name + " ENABLE=0")
self.labels[x]['box'].get_style_context().remove_class("filament_sensor_empty")
self.labels[x]['box'].get_style_context().remove_class("filament_sensor_detected")
+6 -8
View File
@@ -7,12 +7,14 @@ from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return FanPanel(*args)
CHANGEABLE_FANS = ["fan", "fan_generic"]
class FanPanel(ScreenPanel):
fan_speed = {}
user_selecting = False
@@ -21,11 +23,7 @@ class FanPanel(ScreenPanel):
_ = self.lang.gettext
self.devices = {}
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
# Create a grid for all devices
self.labels['devices'] = Gtk.Grid()
@@ -41,7 +39,7 @@ class FanPanel(ScreenPanel):
self.content.add(box)
def process_update(self, action, data):
if (action != "notify_status_update"):
if action != "notify_status_update":
return
for fan in self.devices:
@@ -80,7 +78,7 @@ class FanPanel(ScreenPanel):
fan_name = "Part Fan"
else:
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_vexpand(True)
name.set_halign(Gtk.Align.START)
@@ -150,7 +148,7 @@ class FanPanel(ScreenPanel):
self._screen._ws.klippy.gcode_script(KlippyGcodes.set_fan_speed(value))
else:
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
GLib.timeout_add_seconds(1, self.check_fan_speed, fan)
+6 -4
View File
@@ -8,9 +8,11 @@ from gi.repository import Gtk
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return FineTunePanel(*args)
class FineTunePanel(ScreenPanel):
user_selecting = False
@@ -47,7 +49,7 @@ class FineTunePanel(ScreenPanel):
ctx = self.labels[i].get_style_context()
if j == 0:
ctx.add_class("distbutton_top")
elif j == len(self.bs_deltas)-1:
elif j == len(self.bs_deltas) - 1:
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
@@ -65,7 +67,7 @@ class FineTunePanel(ScreenPanel):
ctx = self.labels[i].get_style_context()
if j == 0:
ctx.add_class("distbutton_top")
elif j == len(self.percent_deltas)-1:
elif j == len(self.percent_deltas) - 1:
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
@@ -156,10 +158,10 @@ class FineTunePanel(ScreenPanel):
if "homing_origin" in data["gcode_move"]:
self.labels['zoffset'].set_label(" %.2fmm" % data["gcode_move"]["homing_origin"][2])
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)
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)
def change_babystepping(self, widget, dir):
+131 -42
View File
@@ -2,50 +2,66 @@ import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gdk, Gtk, Pango
from gi.repository import Gdk, Gtk, GLib, Pango
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return MacroPanel(*args)
class MacroPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.macros = {}
self.loaded_macros = []
self.sort_char = [" ↑", " ↓"]
self.sort_reverse = False
self.menu = ['macros_menu']
# Create a scroll window for the macros
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
sort = Gtk.Label(_("Sort:"))
sort.set_hexpand(False)
self.sort_lbl = _("Name")
self.sort_btn = self._gtk.Button(self.sort_lbl + self.sort_char[0], "color1")
self.sort_btn.connect("clicked", self.change_sort)
self.sort_btn.set_hexpand(True)
adjust = self._gtk.ButtonImage("settings", None, "color2", 1, Gtk.PositionType.LEFT, False)
adjust.connect("clicked", self.load_menu, 'options')
adjust.set_hexpand(False)
# Create a grid for all macros
sbox = Gtk.HBox()
sbox.set_vexpand(False)
sbox.pack_start(sort, False, False, 5)
sbox.pack_start(self.sort_btn, True, True, 5)
sbox.pack_start(adjust, True, True, 5)
self.labels['macros_list'] = self._gtk.ScrolledWindow()
self.labels['macros'] = Gtk.Grid()
scroll.add(self.labels['macros'])
self.labels['macros_list'].add(self.labels['macros'])
# Create a box to contain all of the above
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
box.pack_start(scroll, True, True, 0)
self.labels['macros_menu'] = Gtk.VBox()
self.labels['macros_menu'].set_vexpand(True)
self.labels['macros_menu'].pack_start(sbox, False, False, 0)
self.labels['macros_menu'].pack_start(self.labels['macros_list'], True, True, 0)
self.content.add(box)
self.content.add(self.labels['macros_menu'])
self.labels['options_menu'] = self._gtk.ScrolledWindow()
self.labels['options'] = Gtk.Grid()
self.labels['options_menu'].add(self.labels['options'])
def activate(self):
self.unload_gcode_macros()
self.load_gcode_macros()
while len(self.menu) > 1:
self.unload_menu()
self.reload_macros()
def add_gcode_macro(self, macro):
# Support for hiding macros by name
if macro.startswith("_"):
return
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
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_vexpand(True)
name.set_halign(Gtk.Align.START)
@@ -53,33 +69,53 @@ class MacroPanel(ScreenPanel):
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
open = self._gtk.ButtonImage("resume", None, "color3")
open.connect("clicked", self.run_gcode_macro, macro)
open.set_hexpand(False)
open.set_halign(Gtk.Align.END)
btn = self._gtk.ButtonImage("resume", None, "color3")
btn.connect("clicked", self.run_gcode_macro, macro)
btn.set_hexpand(False)
btn.set_halign(Gtk.Align.END)
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels = Gtk.VBox()
labels.add(name)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev = Gtk.HBox(spacing=5)
dev.add(labels)
dev.add(open)
dev.add(btn)
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
frame.add(dev)
self.macros[macro] = {
"row": frame
}
macros = sorted(self.macros)
macros = sorted(self.macros, reverse=self.sort_reverse, key=str.casefold)
pos = macros.index(macro)
self.loaded_macros.append(macro)
self.labels['macros'].insert_row(pos)
self.labels['macros'].attach(self.macros[macro]['row'], 0, pos, 1, 1)
self.labels['macros'].show_all()
def run_gcode_macro(self, widget, macro):
self._screen._ws.klippy.gcode_script(macro)
def change_sort(self, widget):
self.sort_reverse ^= True
if self.sort_reverse:
self.sort_btn.set_label(self.sort_lbl + self.sort_char[1])
else:
self.sort_btn.set_label(self.sort_lbl + self.sort_char[0])
self.sort_btn.show()
GLib.idle_add(self.reload_macros)
def reload_macros(self):
self.labels['macros'].remove_column(0)
self.macros = {}
self.loaded_macros = []
self.allmacros = {}
self.labels['options'].remove_column(0)
self.load_gcode_macros()
def load_gcode_macros(self):
macros = self._screen.printer.get_gcode_macros()
@@ -96,15 +132,68 @@ class MacroPanel(ScreenPanel):
self._config.get_config().getboolean(section_name, macro.lower(), fallback=True)):
self.add_gcode_macro(macro)
def run_gcode_macro(self, widget, macro):
self._screen._ws.klippy.gcode_script(macro)
for macro in self._printer.get_config_section_list("gcode_macro "):
macro = macro[12:]
# Support for hiding macros by name
if macro.startswith("_"):
continue
def unload_gcode_macros(self):
section_name = "displayed_macros %s" % self._screen.connected_printer
for macro in self.loaded_macros:
if (section_name in self._config.get_config().sections() and
not self._config.get_config().getboolean(section_name, macro.lower(), fallback=True)):
macros = sorted(self.macros)
pos = macros.index(macro)
self.labels['macros'].remove_row(pos)
self.labels['macros'].show_all()
self.allmacros[macro] = {
"name": macro,
"section": "displayed_macros %s" % self._screen.connected_printer,
}
for macro in list(self.allmacros):
self.add_option('options', self.allmacros, macro, self.allmacros[macro])
self.labels['macros'].show_all()
def add_option(self, boxname, opt_array, opt_name, option):
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big>" % (option['name']))
name.set_hexpand(True)
name.set_vexpand(True)
name.set_halign(Gtk.Align.START)
name.set_valign(Gtk.Align.CENTER)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
box = Gtk.Box()
box.set_vexpand(False)
switch = Gtk.Switch()
switch.set_hexpand(False)
switch.set_vexpand(False)
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.set_property("width-request", round(self._gtk.get_font_size() * 7))
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
box.add(switch)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.set_valign(Gtk.Align.CENTER)
dev.add(name)
dev.add(box)
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
frame.add(dev)
frame.show_all()
opt_array[opt_name] = {
"name": option['name'],
"row": frame
}
opts = sorted(self.allmacros, key=str.casefold)
pos = opts.index(opt_name)
self.labels[boxname].insert_row(pos)
self.labels[boxname].attach(opt_array[opt_name]['row'], 0, pos, 1, 1)
self.labels[boxname].show_all()
def back(self):
if len(self.menu) > 1:
self.unload_menu()
self.reload_macros()
return True
return False
+200
View File
@@ -0,0 +1,200 @@
import gi
import re
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return InputShaperPanel(*args)
# X and Y frequencies
XY_FREQ = [
{'name': 'X', 'config': 'shaper_freq_x', 'min': 0, 'max': 133},
{'name': 'Y', 'config': 'shaper_freq_y', 'min': 0, 'max': 133},
]
SHAPERS = ['zv', 'mzv', 'zvd', 'ei', '2hump_ei', '3hump_ei']
class InputShaperPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.has_sensor = False
self.calibrating_axis = None
auto_calibration_label = Gtk.Label()
auto_calibration_label.set_markup('<big><b>Auto Calibration</b></big>')
auto_calibration_label.set_hexpand(True)
self.calibrate_btn = self._gtk.ButtonImage("move", _('Finding ADXL'), "color1", word_wrap=False)
self.calibrate_btn.connect("clicked", self.on_popover_clicked)
self.calibrate_btn.set_sensitive(False)
auto_grid = Gtk.Grid()
auto_grid.attach(auto_calibration_label, 0, 0, 1, 1)
auto_grid.attach(self.calibrate_btn, 1, 0, 1, 1)
manual_calibration_label = Gtk.Label()
manual_calibration_label.set_markup('<big><b>Manual Calibration</b></big>')
manual_calibration_label.set_vexpand(True)
disclaimer = Gtk.Label()
disclaimer.set_markup('<small>NOTE: Edit your printer.cfg to save manual calibration changes.</small>')
disclaimer.set_line_wrap(True)
disclaimer.set_halign(Gtk.Align.CENTER)
input_grid = Gtk.Grid()
input_grid.attach(manual_calibration_label, 0, 0, 3, 1)
input_grid.attach(disclaimer, 0, 1, 3, 1)
self.freq_xy_adj = {}
self.freq_xy_combo = {}
for i, dim_freq in enumerate(XY_FREQ):
axis_lbl = Gtk.Label()
axis_lbl.set_markup("<b>{}</b>".format(dim_freq['name']))
axis_lbl.set_hexpand(False)
axis_lbl.set_vexpand(True)
axis_lbl.set_halign(Gtk.Align.START)
axis_lbl.set_valign(Gtk.Align.CENTER)
axis_lbl.set_line_wrap(True)
self.freq_xy_adj[dim_freq['config']] = Gtk.Adjustment(0, dim_freq['min'], dim_freq['max'], 0.1)
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=self.freq_xy_adj[dim_freq['config']])
scale.set_digits(1)
scale.set_hexpand(True)
scale.set_valign(Gtk.Align.END)
scale.set_has_origin(True)
scale.get_style_context().add_class("option_slider")
scale.connect("button-release-event", self.set_opt_value, dim_freq['config'])
shaper_slug = dim_freq['config'].replace('_freq_', '_type_')
self.freq_xy_combo[shaper_slug] = Gtk.ComboBoxText()
for shaper in SHAPERS:
self.freq_xy_combo[shaper_slug].append(shaper, shaper)
self.freq_xy_combo[shaper_slug].set_active(0)
input_grid.attach(axis_lbl, 0, i + 2, 1, 1)
input_grid.attach(scale, 1, i + 2, 1, 1)
input_grid.attach(self.freq_xy_combo[shaper_slug], 2, i + 2, 1, 1)
self.status = Gtk.Label("")
self.status.set_hexpand(True)
self.status.set_vexpand(False)
self.status.set_halign(Gtk.Align.START)
self.status.set_ellipsize(Pango.EllipsizeMode.END)
box = Gtk.VBox()
box.add(auto_grid)
box.add(input_grid)
box.add(self.status)
self.content.add(box)
pobox = Gtk.VBox()
test_x = self._gtk.Button(_("Measure X"))
test_x.connect("clicked", self.start_calibration, "x")
pobox.pack_start(test_x, True, True, 5)
test_y = self._gtk.Button(_("Measure Y"))
test_y.connect("clicked", self.start_calibration, "y")
pobox.pack_start(test_y, True, True, 5)
test_both = self._gtk.Button(_("Measure Both"))
test_both.connect("clicked", self.start_calibration, "both")
pobox.pack_start(test_both, True, True, 5)
self.labels['popover'] = Gtk.Popover()
self.labels['popover'].add(pobox)
self.labels['popover'].set_position(Gtk.PositionType.LEFT)
def on_popover_clicked(self, widget):
self.labels['popover'].set_relative_to(widget)
self.labels['popover'].show_all()
def start_calibration(self, widget, method):
self.labels['popover'].popdown()
if self._screen.printer.get_stat("toolhead", "homed_axes") != "xyz":
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
self.calibrating_axis = method
if method == "x":
self._screen._ws.klippy.gcode_script('SHAPER_CALIBRATE AXIS=X')
if method == "y":
self._screen._ws.klippy.gcode_script('SHAPER_CALIBRATE AXIS=Y')
if method == "both":
self._screen._ws.klippy.gcode_script('SHAPER_CALIBRATE')
self.calibrate_btn.set_label(self.lang.gettext('Calibrating...'))
self.calibrate_btn.set_sensitive(False)
def set_opt_value(self, widget, opt, *args):
shaper_freq_x = self.freq_xy_adj['shaper_freq_x'].get_value()
shaper_freq_y = self.freq_xy_adj['shaper_freq_y'].get_value()
shaper_type_x = self.freq_xy_combo['shaper_type_x'].get_active_text()
shaper_type_y = self.freq_xy_combo['shaper_type_y'].get_active_text()
self._screen._ws.klippy.gcode_script(
'SET_INPUT_SHAPER SHAPER_FREQ_X={} SHAPER_TYPE_X={} SHAPER_FREQ_Y={} SHAPER_TYPE_Y={}'.format(
shaper_freq_x, shaper_type_x, shaper_freq_y, shaper_type_y
)
)
def save_config(self):
_ = self.lang.gettext
script = {"script": "SAVE_CONFIG"}
self._screen._confirm_send_action(
None,
_("Save configuration?") + "\n\n" + _("Klipper will reboot"),
"printer.gcode.script",
script
)
def activate(self):
# This will return the current values
self._screen._ws.klippy.gcode_script(
'SET_INPUT_SHAPER'
)
# Check for the accelerometer
self._screen._ws.klippy.gcode_script(
'ACCELEROMETER_QUERY'
)
# Send at least two commands, with my accelerometer the first command after a reboot will fail
self._screen._ws.klippy.gcode_script(
'MEASURE_AXES_NOISE'
)
def process_update(self, action, data):
_ = self.lang.gettext
if action == "notify_gcode_response":
self.status.set_text('{}'.format(data.replace('shaper_', '').replace('damping_', '')))
data = data.lower()
if 'got 0' in data:
self.calibrate_btn.set_label(_('Check ADXL Wiring'))
self.calibrate_btn.set_sensitive(False)
if 'unknown command:"accelerometer_query"' in data:
self.calibrate_btn.set_label(_('ADXL Not Configured'))
self.calibrate_btn.set_sensitive(False)
if 'adxl345 values' in data or 'axes noise' in data:
self.has_sensor = True
self.calibrate_btn.set_sensitive(True)
self.calibrate_btn.set_label(_('Auto-calibrate'))
# Recommended shaper_type_y = ei, shaper_freq_y = 48.4 Hz
if 'recommended shaper_type_' in data:
results = re.search(r'shaper_type_(?P<axis>[xy])\s*=\s*(?P<shaper_type>.*?), shaper_freq_.\s*=\s*('
r'?P<shaper_freq>[0-9.]+)', data).groupdict()
self.freq_xy_adj['shaper_freq_' + results['axis']].set_value(float(results['shaper_freq']))
self.freq_xy_combo['shaper_type_' + results['axis']].set_active(SHAPERS.index(results['shaper_type']))
if self.calibrating_axis == results['axis']:
self.calibrate_btn.set_sensitive(True)
self.calibrate_btn.set_label(_('Calibrated'))
self.save_config()
elif self.calibrating_axis == "both" and results['axis'] == 'y':
self.calibrate_btn.set_sensitive(True)
self.calibrate_btn.set_label(_('Calibrated'))
self.save_config()
# shaper_type_y:ei shaper_freq_y:48.400 damping_ratio_y:0.100000
if 'shaper_type_' in data:
results = re.search(r'shaper_type_(?P<axis>[xy]):(?P<shaper_type>.*?) shaper_freq_.:('
r'?P<shaper_freq>[0-9.]+)', data).groupdict()
self.freq_xy_adj['shaper_freq_' + results['axis']].set_value(float(results['shaper_freq']))
self.freq_xy_combo['shaper_type_' + results['axis']].set_active(SHAPERS.index(results['shaper_type']))
+116 -52
View File
@@ -9,18 +9,20 @@ from gi.repository import GLib, Gtk, Pango
from numpy import sqrt, pi, dot, array, median
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return JobStatusPanel(*args)
class JobStatusPanel(ScreenPanel):
is_paused = False
filename = state_timeout = prev_pos = prev_gpos = vel_timeout = None
filename = state_timeout = prev_pos = prev_gpos = vel_timeout = animation_timeout = close_timeout = None
file_metadata = labels = {}
state = "standby"
timeleft_type = "file"
timeleft_type = "auto"
progress = zoffset = flowrate = vel = 0
main_status_displayed = True
close_timeouts = velstore = flowstore = []
velstore = flowstore = []
def __init__(self, screen, title, back=False):
super().__init__(screen, title, False)
@@ -85,10 +87,9 @@ class JobStatusPanel(ScreenPanel):
for label in self.labels:
self.labels[label].set_halign(Gtk.Align.START)
self.labels[label].set_ellipsize(True)
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['status'])
fi_box.add(self.labels['lcdmessage'])
@@ -109,9 +110,9 @@ class JobStatusPanel(ScreenPanel):
self.labels['thumbnail'] = self._gtk.Image("file", 2)
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:
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'].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.fan_button, 1, 1, 1, 1)
info = Gtk.VBox(spacing=0)
info = Gtk.VBox()
info.get_style_context().add_class("printing-info")
info.add(self.labels['temp_grid'])
info.add(szfe)
@@ -345,15 +345,15 @@ class JobStatusPanel(ScreenPanel):
def on_draw(self, da, ctx):
w = da.get_allocated_width()
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_line_width(self._gtk.get_font_size() * .75)
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.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()
def activate(self):
@@ -385,16 +385,52 @@ class JobStatusPanel(ScreenPanel):
self.buttons['pause'].connect("clicked", self.pause)
self.buttons['restart'].connect("clicked", self.restart)
self.buttons['resume'].connect("clicked", self.resume)
self.buttons['save_offset_probe'].connect("clicked", self.save_offset_probe)
self.buttons['save_offset_endstop'].connect("clicked", self.save_offset_endstop)
self.buttons['save_offset_probe'].connect("clicked", self.save_offset, "probe")
self.buttons['save_offset_endstop'].connect("clicked", self.save_offset, "endstop")
def save_offset_probe(self, widget):
self._screen._ws.klippy.gcode_script("Z_OFFSET_APPLY_PROBE")
self._screen._ws.klippy.gcode_script("SAVE_CONFIG")
def save_offset(self, widget, device):
_ = self.lang.gettext
def save_offset_endstop(self, widget):
self._screen._ws.klippy.gcode_script("Z_OFFSET_APPLY_ENDSTOP")
self._screen._ws.klippy.gcode_script("SAVE_CONFIG")
saved_z_offset = 0
if self._printer.config_section_exists("probe"):
saved_z_offset = float(self._screen.printer.get_config_section("probe")['z_offset'])
elif self._printer.config_section_exists("bltouch"):
saved_z_offset = float(self._screen.printer.get_config_section("bltouch")['z_offset'])
if self.zoffset > 0:
sign = "+"
else:
sign = "-"
label = Gtk.Label()
if device == "probe":
label.set_text(_("Apply %s%.2f offset to Probe?") % (sign, abs(self.zoffset))
+ "\n\n"
+ _("Saved offset: %s") % saved_z_offset)
elif device == "endstop":
label.set_text(_("Apply %.2f offset to Endstop?") % self.zoffset)
label.set_hexpand(True)
label.set_halign(Gtk.Align.CENTER)
label.set_vexpand(True)
label.set_valign(Gtk.Align.CENTER)
label.set_line_wrap(True)
label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
grid = self._gtk.HomogeneousGrid()
grid.attach(label, 0, 0, 1, 1)
buttons = [
{"name": _("Apply"), "response": Gtk.ResponseType.APPLY},
{"name": _("Cancel"), "response": Gtk.ResponseType.CANCEL}
]
self._gtk.Dialog(self._screen, buttons, grid, self.save_confirm, device)
def save_confirm(self, widget, response_id, device):
if response_id == Gtk.ResponseType.APPLY:
if device == "probe":
self._screen._ws.klippy.gcode_script("Z_OFFSET_APPLY_PROBE")
if device == "endstop":
self._screen._ws.klippy.gcode_script("Z_OFFSET_APPLY_ENDSTOP")
self._screen._ws.klippy.gcode_script("SAVE_CONFIG")
widget.destroy()
def restart(self, widget):
if self.filename != "none":
@@ -454,9 +490,9 @@ class JobStatusPanel(ScreenPanel):
return False
def remove_close_timeout(self):
for to in self.close_timeouts:
GLib.source_remove(to)
self.close_timeouts.remove(to)
if self.close_timeout is not None:
GLib.source_remove(self.close_timeout)
self.close_timeout = None
def enable_button(self, *args):
for arg in args:
@@ -553,7 +589,6 @@ class JobStatusPanel(ScreenPanel):
self.labels['speed_factor'].set_text("%3d%%" % self.speed)
if "speed" in data["gcode_move"]:
self.req_speed = int(round(data["gcode_move"]["speed"] / 60 * self.speed_factor))
self.labels['req_speed'].set_text("%d mm/s" % self.req_speed)
if "homing_origin" in data["gcode_move"]:
self.zoffset = data["gcode_move"]["homing_origin"][2]
self.labels['zoffset'].set_text("%.2f" % self.zoffset)
@@ -580,7 +615,7 @@ class JobStatusPanel(ScreenPanel):
for fan in self.fans:
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)
fan_label = ""
for fan in self.fans:
@@ -625,12 +660,13 @@ class JobStatusPanel(ScreenPanel):
def update_velocity(self):
if len(self.velstore) > 0:
self.vel = (self.vel + median(array(self.velstore))) / 2
self.labels['req_speed'].set_text("%d/%d mm/s" % (self.vel, self.req_speed))
self.velstore = []
if len(self.flowstore) > 0:
self.flowrate = (self.flowrate + median(array(self.flowstore))) / 2
self.labels['flowrate'].set_label("%.1f mm3/s" % self.flowrate)
self.flowstore = []
self.labels['flowrate'].set_label("%.1f mm3/s" % self.flowrate)
self.labels['req_speed'].set_text("%d/%d mm/s" % (self.vel, self.req_speed))
if self.main_status_displayed:
self.speed_button.set_label("%3d%% %5d mm/s" % (self.speed, self.vel))
self.extrusion_button.set_label("%3d%% %5.1f mm3/s" % (self.extrusion, self.flowrate))
@@ -650,6 +686,9 @@ class JobStatusPanel(ScreenPanel):
slicer_time = (self.file_metadata['estimated_time'] * slicer_correction) / spdcomp
if slicer_time < duration:
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 self.file_metadata['filament_total'] > 0 and filament_used > 0:
@@ -657,9 +696,15 @@ class JobStatusPanel(ScreenPanel):
filament_time = duration / (filament_used / self.file_metadata['filament_total'])
if filament_time < duration:
filament_time = None
self.update_text("filament_time", "-")
else:
self.update_text("filament_time", str(self._gtk.formatTimeString(slicer_time)))
if self.progress > 0:
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:
total_duration = file_time
@@ -681,16 +726,11 @@ class JobStatusPanel(ScreenPanel):
else:
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 "-"
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):
ps = self._printer.get_stat("print_stats")
@@ -710,9 +750,9 @@ class JobStatusPanel(ScreenPanel):
self.set_state("complete")
self._screen.wake_screen()
self.remove_close_timeout()
timeout = self._config.get_main_config().getint("job_complete_timeout", 30)
timeout = self._config.get_main_config().getint("job_complete_timeout", 0)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add_seconds(timeout, self.close_panel))
self.close_timeout = GLib.timeout_add_seconds(timeout, self.close_panel)
return False
elif ps['state'] == "error":
logging.debug("Error!")
@@ -723,7 +763,7 @@ class JobStatusPanel(ScreenPanel):
self.remove_close_timeout()
timeout = self._config.get_main_config().getint("job_error_timeout", 0)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add_seconds(timeout, self.close_panel))
self.close_timeout = GLib.timeout_add_seconds(timeout, self.close_panel)
return False
elif ps['state'] == "cancelled":
# Print was cancelled
@@ -732,7 +772,7 @@ class JobStatusPanel(ScreenPanel):
self.remove_close_timeout()
timeout = self._config.get_main_config().getint("job_cancelled_timeout", 0)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add_seconds(timeout, self.close_panel))
self.close_timeout = GLib.timeout_add_seconds(timeout, self.close_panel)
return False
elif ps['state'] == "paused":
self.set_state("paused")
@@ -758,7 +798,6 @@ class JobStatusPanel(ScreenPanel):
self.state = state
self.show_buttons_for_state()
def show_buttons_for_state(self):
self.buttons['button_grid'].remove_row(0)
self.buttons['button_grid'].insert_row(0)
@@ -782,7 +821,7 @@ class JobStatusPanel(ScreenPanel):
self.buttons['button_grid'].attach(self.buttons["save_offset_endstop"], 0, 0, 1, 1)
else:
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)
else:
self.buttons['button_grid'].attach(Gtk.Label(""), 1, 0, 1, 1)
@@ -797,17 +836,41 @@ class JobStatusPanel(ScreenPanel):
def show_file_thumbnail(self):
if self._files.has_thumbnail(self.filename):
scale = 5 * self._files.get_thumbnail_scale(self.filename)
pixbuf = self.get_file_image(self.filename, scale, scale)
pixbuf = self.get_file_image(self.filename, 5, 5)
if pixbuf is not None:
self.labels['thumbnail'].set_from_pixbuf(pixbuf)
def update_filename(self):
self.filename = self._printer.get_stat('print_stats', 'filename')
self.update_text("file", os.path.splitext(self._printer.get_stat('print_stats', 'filename'))[0])
self.update_text("file", os.path.splitext(self.filename)[0])
self.filename_label = {
"complete": self.labels['file'].get_label(),
"current": self.labels['file'].get_label(),
"position": 0,
"limit": 24,
"length": len(self.labels['file'].get_label())
}
if self.animation_timeout is None:
# if self.labels['file'].is_ellipsized(): <- currently this doesn't work
if (self.filename_label['length'] - self.filename_label['limit']) > 0:
self.animation_timeout = GLib.timeout_add_seconds(1, self.animate_label)
self.update_percent_complete()
self.update_file_metadata()
def animate_label(self):
pos = self.filename_label['position']
current = self.filename_label['current']
complete = self.filename_label['complete']
if pos > (self.filename_label['length'] - self.filename_label['limit']):
self.filename_label['position'] = 0
self.labels['file'].set_label(complete)
else:
self.labels['file'].set_label(current[pos:self.filename_label['length']])
self.filename_label['position'] += 1
return True
def update_file_metadata(self):
if self._files.file_metadata_exists(self.filename):
self.file_metadata = self._files.get_file_info(self.filename)
@@ -828,7 +891,7 @@ class JobStatusPanel(ScreenPanel):
if "first_layer_height" in self.file_metadata:
self.f_layer_h = self.file_metadata['first_layer_height']
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))
if "filament_total" in self.file_metadata:
filament_total = float(self.file_metadata['filament_total']) / 1000
@@ -848,8 +911,8 @@ class JobStatusPanel(ScreenPanel):
if "gcode_start_byte" in self.file_metadata:
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']))
self.file_metadata['gcode_start_byte'], 0) / (self.file_metadata['gcode_end_byte'] -
self.file_metadata['gcode_start_byte']))
else:
progress = self._printer.get_stat('virtual_sdcard', 'progress')
@@ -864,17 +927,18 @@ class JobStatusPanel(ScreenPanel):
def update_progress(self):
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:
self.labels['progress_text'].set_text("100")
def update_message(self):
msg = self._printer.get_stat("display_status", "message")
if type(msg) == str:
self.labels['lcdmessage'].set_text(msg)
if msg is None:
msg = " "
self.labels['lcdmessage'].set_text(str(msg))
def update_temp(self, x, temp, target):
if target > 0:
self.labels[x].set_label("%3d/%3d°" % (temp, target))
else:
self.labels[x].set_label("%3d°" % (temp))
self.labels[x].set_label("%3d°" % temp)
+56 -52
View File
@@ -6,6 +6,7 @@ from gi.repository import Gdk, Gtk, Pango
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return LimitsPanel(*args)
@@ -15,71 +16,65 @@ class LimitsPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.devices = {}
self.limits = {}
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
# Create a grid for all devices
self.labels['devices'] = Gtk.Grid()
scroll.add(self.labels['devices'])
# Create a box to contain all of the above
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
box.pack_start(scroll, True, True, 0)
# Create a grid for all limits
self.grid = Gtk.Grid()
scroll.add(self.grid)
conf = self._printer.get_config_section("printer")
self.options = [
{"name": _("Max Accelation"), "units": _("mm/s^2"), "option": "max_accel",
"value": self.stn(conf['max_accel'])},
{"name": _("Max Acceleration"), "units": _("mm/s^2"), "option": "max_accel",
"max": self.stn(conf['max_accel'])},
{"name": _("Max Acceleration to Deceleration"), "units": _("mm/s^2"), "option": "max_accel_to_decel",
"value": self.stn(conf['max_accel_to_decel']) if "max_accel_to_decel" in conf else
round(self.stn(conf['max_accel'])/2)},
"max": self.stn(conf['max_accel_to_decel']) if "max_accel_to_decel" in conf else
round(self.stn(conf['max_accel']) / 2)},
{"name": _("Max Velocity"), "units": _("mm/s"), "option": "max_velocity",
"value": self.stn(conf["max_velocity"])},
"max": self.stn(conf["max_velocity"])},
{"name": _("Square Corner Velocity"), "units": _("mm/s"), "option": "square_corner_velocity",
"value": 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:
self.add_option(opt['option'], opt['name'], opt['units'], opt['value'])
self.add_option(opt['option'], opt['name'], opt['units'], opt['max'])
self.content.add(box)
self.content.add(scroll)
self.content.show_all()
def stn(self, str):
return int(float(str))
def process_update(self, action, data):
if (action != "notify_status_update"):
if action != "notify_status_update":
return
for opt in self.devices:
for opt in self.limits:
if "toolhead" in data and opt in data["toolhead"]:
self.update_option(opt, data["toolhead"][opt])
def update_option(self, option, value):
if option not in self.devices:
if option not in self.limits:
return
if self.devices[option]['scale'].has_grab():
if self.limits[option]['scale'].has_grab():
return
self.values[option] = int(value)
self.devices[option]['scale'].disconnect_by_func(self.set_opt_value)
self.devices[option]['scale'].set_value(self.values[option])
self.devices[option]['scale'].connect("button-release-event", self.set_opt_value, option)
self.limits[option]['scale'].disconnect_by_func(self.set_opt_value)
self.limits[option]['scale'].set_value(self.values[option])
for opt in self.options:
if opt["option"] == option:
if self.values[option] > opt["max"]:
self.limits[option]['scale'].get_style_context().add_class("option_slider_max")
else:
self.limits[option]['scale'].get_style_context().remove_class("option_slider_max")
self.limits[option]['scale'].connect("button-release-event", self.set_opt_value, option)
def add_option(self, option, optname, units, value):
logging.info("Adding option: %s" % option)
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big> (%s)" % (optname, units))
name.set_hexpand(True)
@@ -89,7 +84,7 @@ class LimitsPanel(ScreenPanel):
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
adj = Gtk.Adjustment(0, 0, value, 1, 5, 0)
adj = Gtk.Adjustment(0, 1, (value * 1.5), 1, 5, 0)
self.values[option] = value
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
scale.set_value(self.values[option])
@@ -99,36 +94,45 @@ class LimitsPanel(ScreenPanel):
scale.get_style_context().add_class("option_slider")
scale.connect("button-release-event", self.set_opt_value, option)
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
labels.add(scale)
reset = self._gtk.ButtonImage("refresh", None, "color1")
reset.connect("clicked", self.reset_value, option)
reset.set_hexpand(False)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.add(labels)
frame.add(dev)
item = Gtk.Grid()
item.attach(name, 0, 0, 2, 1)
item.attach(scale, 0, 1, 1, 1)
item.attach(reset, 1, 1, 1, 1)
self.devices[option] = {
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
frame.add(item)
self.limits[option] = {
"row": frame,
"scale": scale,
}
devices = sorted(self.devices)
pos = devices.index(option)
limits = sorted(self.limits)
pos = limits.index(option)
self.labels['devices'].insert_row(pos)
self.labels['devices'].attach(self.devices[option]['row'], 0, pos, 1, 1)
self.labels['devices'].show_all()
self.grid.insert_row(pos)
self.grid.attach(self.limits[option]['row'], 0, pos, 1, 1)
self.grid.show_all()
def reset_value(self, widget, option):
for x in self.options:
if x["option"] == option:
self.update_option(option, x["max"])
self.set_opt_value(None, None, option)
def set_opt_value(self, widget, event, opt):
value = self.devices[opt]['scale'].get_value()
value = self.limits[opt]['scale'].get_value()
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":
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":
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":
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)
+3 -8
View File
@@ -8,9 +8,11 @@ from panels.menu import MenuPanel
from ks_includes.widgets.graph import HeaterGraph
from ks_includes.widgets.keypad import Keypad
def create_panel(*args):
return MainPanel(*args)
class MainPanel(MenuPanel):
def __init__(self, screen, title, back=False):
super().__init__(screen, title, False)
@@ -135,7 +137,6 @@ class MainPanel(MenuPanel):
name.set_alignment(0, .5)
name.get_style_context().add_class(class_name)
child = name.get_children()[0].get_children()[0].get_children()[1]
child.set_ellipsize(True)
child.set_ellipsize(Pango.EllipsizeMode.END)
temp = self._gtk.Button("")
@@ -211,12 +212,7 @@ class MainPanel(MenuPanel):
da.set_vexpand(True)
self.labels['da'] = da
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_hexpand(True)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scroll.add(self.labels['devices'])
@@ -225,7 +221,6 @@ class MainPanel(MenuPanel):
box.add(scroll)
box.add(self.labels['da'])
self.labels['graph_settemp'] = self._gtk.Button(label=_("Set Temp"))
self.labels['graph_settemp'].connect("clicked", self.show_numpad)
self.labels['graph_hide'] = self._gtk.Button(label=_("Hide"))
+14 -12
View File
@@ -7,12 +7,15 @@ from jinja2 import Environment, Template
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return MenuPanel(*args)
class MenuPanel(ScreenPanel):
i = 0
j2_data = None
def initialize(self, panel_name, display_name, items):
_ = self.lang.gettext
@@ -21,18 +24,14 @@ class MenuPanel(ScreenPanel):
self.grid = self._gtk.HomogeneousGrid()
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_hexpand(True)
scroll.set_vexpand(True)
scroll = self._gtk.ScrolledWindow()
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scroll.add(self.grid)
self.content.add(scroll)
def activate(self):
if not self.j2_data:
self.j2_data = self._printer.get_printer_status_data()
self.j2_data = self._printer.get_printer_status_data()
self.j2_data.update({
'moonraker_connected': self._screen._ws.is_connected()
})
@@ -57,15 +56,15 @@ class MenuPanel(ScreenPanel):
if length <= 4:
# Arrange 2 x 2
columns = 2
elif length > 4 and length <= 6:
elif 4 < length <= 6:
# Arrange 3 x 2
columns = 3
col = i % columns
row = int(i/columns)
row = int(i / columns)
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
self.grid.attach(self.labels[key], col, row, width, height)
@@ -84,7 +83,7 @@ class MenuPanel(ScreenPanel):
parsed_name = j2_temp.render()
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:
b.connect("clicked", self.menu_item_clicked, item['panel'], item)
@@ -104,8 +103,11 @@ class MenuPanel(ScreenPanel):
if enable is False:
return False
if not self.j2_data:
self.j2_data = self._printer.get_printer_status_data()
if enable == "{{ moonraker_connected }}":
logging.info("moonraker is_connected %s", self._screen._ws.is_connected())
return self._screen._ws.is_connected()
self.j2_data = self._printer.get_printer_status_data()
try:
logging.debug("Template: '%s'" % enable)
logging.debug("Data: %s" % self.j2_data)
+112 -14
View File
@@ -2,7 +2,7 @@ import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from gi.repository import Gdk, Gtk, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
@@ -11,16 +11,19 @@ AXIS_X = "X"
AXIS_Y = "Y"
AXIS_Z = "Z"
def create_panel(*args):
return MovePanel(*args)
class MovePanel(ScreenPanel):
distance = 1
distances = ['.1', '.5', '1', '5', '10', '25', '50']
def initialize(self, panel_name):
_ = self.lang.gettext
self.settings = {}
self.menu = ['move_menu']
grid = self._gtk.HomogeneousGrid()
@@ -102,9 +105,9 @@ class MovePanel(ScreenPanel):
self.labels[i].set_direction(Gtk.TextDirection.LTR)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if (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")
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")
else:
ctx.add_class("distbutton")
@@ -115,23 +118,55 @@ class MovePanel(ScreenPanel):
self.labels["1"].set_active(True)
bottomgrid = self._gtk.HomogeneousGrid()
bottomgrid.set_direction(Gtk.TextDirection.LTR)
self.labels['pos_x'] = Gtk.Label("X: 0")
self.labels['pos_y'] = Gtk.Label("Y: 0")
self.labels['pos_z'] = Gtk.Label("Z: 0")
adjust = self._gtk.ButtonImage("settings", None, "color2", 1, Gtk.PositionType.LEFT, False)
adjust.connect("clicked", self.load_menu, 'options')
adjust.set_hexpand(False)
self.labels['move_dist'] = Gtk.Label(_("Move Distance (mm)"))
bottomgrid = self._gtk.HomogeneousGrid()
bottomgrid.set_direction(Gtk.TextDirection.LTR)
bottomgrid.attach(self.labels['pos_x'], 0, 0, 1, 1)
bottomgrid.attach(self.labels['pos_y'], 1, 0, 1, 1)
bottomgrid.attach(self.labels['pos_z'], 2, 0, 1, 1)
self.labels['move_dist'] = Gtk.Label(_("Move Distance (mm)"))
bottomgrid.attach(self.labels['move_dist'], 0, 1, 3, 1)
bottomgrid.attach(adjust, 3, 0, 1, 2)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box.pack_start(grid, True, True, 0)
box.pack_start(bottomgrid, True, True, 0)
box.pack_start(self.labels['move_dist'], True, True, 0)
box.pack_start(distgrid, True, True, 0)
self.labels['move_menu'] = Gtk.VBox()
self.labels['move_menu'].set_vexpand(True)
self.labels['move_menu'].pack_start(grid, True, True, 0)
self.labels['move_menu'].pack_start(bottomgrid, True, True, 0)
self.labels['move_menu'].pack_start(distgrid, True, True, 0)
self.content.add(box)
self.content.add(self.labels['move_menu'])
printer_cfg = self._printer.get_config_section("printer")
max_velocity = int(float(printer_cfg["max_velocity"]))
if "max_z_velocity" in printer_cfg:
max_z_velocity = int(float(printer_cfg["max_z_velocity"]))
else:
max_z_velocity = max_velocity
configurable_options = [
{"invert_x": {"section": "main", "name": _("Invert X"), "type": "binary", "value": "False"}},
{"invert_y": {"section": "main", "name": _("Invert Y"), "type": "binary", "value": "False"}},
{"invert_z": {"section": "main", "name": _("Invert Z"), "type": "binary", "value": "False"}},
{"move_speed_xy": {
"section": "main", "name": _("XY Speed (mm/s)"), "type": "scale", "value": "50",
"range": [1, max_velocity], "step": 1}},
{"move_speed_z": {
"section": "main", "name": _("Z Speed (mm/s)"), "type": "scale", "value": "10",
"range": [1, max_z_velocity], "step": 1}}
]
self.labels['options_menu'] = self._gtk.ScrolledWindow()
self.labels['options'] = Gtk.Grid()
self.labels['options_menu'].add(self.labels['options'])
for option in configurable_options:
name = list(option)[0]
self.add_option('options', self.settings, name, option[name])
def process_update(self, action, data):
if action != "notify_status_update":
@@ -196,7 +231,70 @@ class MovePanel(ScreenPanel):
self._screen._ws.klippy.gcode_script(
"%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 ""
)
)
def add_option(self, boxname, opt_array, opt_name, option):
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big>" % (option['name']))
name.set_hexpand(True)
name.set_vexpand(True)
name.set_halign(Gtk.Align.START)
name.set_valign(Gtk.Align.CENTER)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.set_valign(Gtk.Align.CENTER)
dev.add(name)
if option['type'] == "binary":
box = Gtk.Box()
box.set_vexpand(False)
switch = Gtk.Switch()
switch.set_hexpand(False)
switch.set_vexpand(False)
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.set_property("width-request", round(self._gtk.get_font_size() * 7))
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
box.add(switch)
dev.add(box)
elif option['type'] == "scale":
dev.set_orientation(Gtk.Orientation.VERTICAL)
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)
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
scale.set_hexpand(True)
scale.set_digits(0)
scale.connect("button-release-event", self.scale_moved, option['section'], opt_name)
scale.set_property("width-request", round(self._screen.width / 2.2))
dev.add(scale)
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
frame.add(dev)
frame.show_all()
opt_array[opt_name] = {
"name": option['name'],
"row": frame
}
opts = sorted(opt_array)
opts = sorted(list(opt_array), key=lambda x: opt_array[x]['name'])
pos = opts.index(opt_name)
self.labels[boxname].insert_row(pos)
self.labels[boxname].attach(opt_array[opt_name]['row'], 0, pos, 1, 1)
self.labels[boxname].show_all()
def back(self):
if len(self.menu) > 1:
self.unload_menu()
return True
return False
+6 -10
View File
@@ -8,9 +8,11 @@ gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return NetworkPanel(*args)
class NetworkPanel(ScreenPanel):
initialized = False
@@ -38,7 +40,7 @@ class NetworkPanel(ScreenPanel):
ints = netifaces.interfaces()
if 'lo' in ints:
ints.pop(ints.index('lo'))
if (len(ints) > 0):
if len(ints) > 0:
self.interface = ints[0]
else:
self.interface = 'lo'
@@ -69,12 +71,7 @@ class NetworkPanel(ScreenPanel):
sbox.add(self.labels['ip'])
sbox.add(reload_networks)
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
@@ -151,7 +148,7 @@ class NetworkPanel(ScreenPanel):
display_name += " (" + _("Connected") + ")"
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_halign(Gtk.Align.START)
name.set_line_wrap(True)
@@ -372,7 +369,6 @@ class NetworkPanel(ScreenPanel):
save.set_hexpand(False)
save.connect("clicked", self.add_new_network, ssid, True)
self.labels['network_psk'] = entry
box.pack_start(label, False, False, 5)
box.pack_start(entry, True, True, 5)
@@ -428,7 +424,7 @@ class NetworkPanel(ScreenPanel):
lvl = netinfo['signal_level_dBm'] + " " + _("dBm")
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()
def update_single_network_info(self):
+6 -8
View File
@@ -6,20 +6,18 @@ from gi.repository import Gdk, Gtk, Pango
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return PowerPanel(*args)
class PowerPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.devices = {}
# Create a scroll window for the power devices
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
# Create a grid for all devices
self.labels['devices'] = Gtk.Grid()
@@ -47,7 +45,7 @@ class PowerPanel(ScreenPanel):
frame.get_style_context().add_class("frame-item")
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_vexpand(True)
name.set_halign(Gtk.Align.START)
@@ -59,8 +57,8 @@ class PowerPanel(ScreenPanel):
switch.set_hexpand(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.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("width-request", round(self._gtk.get_font_size() * 7))
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
+12 -14
View File
@@ -9,9 +9,11 @@ from datetime import datetime
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return PrintPanel(*args)
class PrintPanel(ScreenPanel):
cur_directory = "gcodes"
dir_panels = {}
@@ -33,11 +35,7 @@ class PrintPanel(ScreenPanel):
sortdir = ["name", "asc"]
self.sort_current = [sortdir[0], 0 if sortdir[1] == "asc" else 1] # 0 for asc, 1 for desc
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
sort = Gtk.Label()
sort.set_text(_("Sort by: "))
@@ -167,13 +165,13 @@ class PrintPanel(ScreenPanel):
filename = filepath.split('/')[-1]
for i in range(1, len(dir)):
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']:
self.add_directory(newdir)
if filename not in self.filelist[directory]['files']:
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']:
self.filelist[curdir]['modified'] = fileinfo['modified']
self.labels['directories'][curdir]['info'].set_markup(
@@ -212,7 +210,7 @@ class PrintPanel(ScreenPanel):
file.set_vexpand(False)
icon = Gtk.Image()
pixbuf = self.get_file_image(filepath)
pixbuf = self.get_file_image(filepath, small=True)
if pixbuf is not None:
icon.set_from_pixbuf(pixbuf)
else:
@@ -290,7 +288,7 @@ class PrintPanel(ScreenPanel):
]
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_halign(Gtk.Align.CENTER)
label.set_vexpand(True)
@@ -319,7 +317,7 @@ class PrintPanel(ScreenPanel):
if response_id == Gtk.ResponseType.CANCEL:
return
logging.info("Starting print: %s" % (filename))
logging.info("Starting print: %s" % filename)
self._screen._ws.klippy.print_start(filename)
def delete_file(self, filename):
@@ -370,7 +368,7 @@ class PrintPanel(ScreenPanel):
for i, suffix in enumerate(suffixes, start=2):
unit = 1024 ** i
if size < unit:
return ("%.1f %s") % ((1024 * size / unit), suffix)
return "%.1f %s" % ((1024 * size / unit), suffix)
def get_print_time(self, filename):
fileinfo = self._screen.files.get_file_info(filename)
@@ -382,16 +380,16 @@ class PrintPanel(ScreenPanel):
print_str = ""
# Figure out how many days
print_val = int(print_time/86400)
print_val = int(print_time / 86400)
if print_val > 0:
print_str = "%sd " % print_val
# 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:
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)
return print_str
return "Unavailable"
+6 -7
View File
@@ -7,9 +7,11 @@ from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.PrinterSelect")
def create_panel(*args):
return PrinterSelect(*args)
class PrinterSelect(ScreenPanel):
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
super().__init__(screen, title, False, False, False)
@@ -20,10 +22,7 @@ class PrinterSelect(ScreenPanel):
printers = self._config.get_printers()
grid = self._gtk.HomogeneousGrid()
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_hexpand(True)
scroll.set_vexpand(True)
scroll = self._gtk.ScrolledWindow()
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scroll.add(grid)
self.content.add(scroll)
@@ -32,7 +31,7 @@ class PrinterSelect(ScreenPanel):
if length == 4:
# Arrange 2 x 2
columns = 2
elif length > 4 and length <= 6:
elif 4 < length <= 6:
# Arrange 3 x 2
columns = 3
else:
@@ -44,8 +43,8 @@ class PrinterSelect(ScreenPanel):
self.labels[name].connect("clicked", self._screen.connect_printer_widget, name)
if self._screen.vertical_mode:
row = i % columns
col = int(i/columns)
col = int(i / columns)
else:
col = i % columns
row = int(i/columns)
row = int(i / columns)
grid.attach(self.labels[name], col, row, 1, 1)
+35 -31
View File
@@ -7,6 +7,7 @@ from gi.repository import Gdk, Gtk, Pango
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return FWRetractionPanel(*args)
@@ -26,36 +27,32 @@ class FWRetractionPanel(ScreenPanel):
"units": _("mm"),
"option": "retract_length",
"value": float(conf['retract_length']) if 'retract_length' in conf else 0,
"digits":2,
"maxval":4},
"digits": 2,
"maxval": 4},
{"name": _("Retraction Speed"),
"units": _("mm/s"),
"option": "retract_speed",
"value": int(float((conf['retract_speed']))) if 'retract_speed' in conf else 20,
"digits":0,
"maxval":100},
"digits": 0,
"maxval": 100},
{"name": _("Unretract Extra Length"),
"units": _("mm"),
"option": "unretract_extra_length",
"value": float(conf['unretract_extra_length']) if 'unretract_extra_length' in conf else 0,
"digits":2,
"maxval":15},
"digits": 2,
"maxval": 15},
{"name": _("Unretract Speed"),
"units": _("mm/s"),
"option": "unretract_speed",
"value": int(float((conf['unretract_speed']))) if 'unretract_speed' in conf else 10,
"digits":0,
"maxval":60}
"digits": 0,
"maxval": 60}
]
for opt in self.options:
self.add_option(opt['option'], opt['name'], opt['units'], opt['value'], opt['digits'], opt["maxval"])
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll = self._gtk.ScrolledWindow()
scroll.add(self.grid)
self.content.add(scroll)
@@ -70,7 +67,6 @@ class FWRetractionPanel(ScreenPanel):
if opt in data["firmware_retraction"]:
self.update_option(opt, data["firmware_retraction"][opt])
elif action == "notify_gcode_response":
logging.info("data")
# // RETRACT_LENGTH=0.00000 RETRACT_SPEED=20.00000 UNRETRACT_EXTRA_LENGTH=0.00000 UNRETRACT_SPEED=10.00000
result = re.match(
"^// [RETRACT_LENGTH= ]+([\\-0-9\\.]+)" +
@@ -99,8 +95,6 @@ class FWRetractionPanel(ScreenPanel):
def add_option(self, option, optname, units, value, digits, maxval):
logging.info("Adding option: %s" % option)
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big> (%s)" % (optname, units))
@@ -110,11 +104,12 @@ class FWRetractionPanel(ScreenPanel):
name.set_valign(Gtk.Align.CENTER)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
adj = Gtk.Adjustment(0, 0, value, 1, 5, 0)
if option in ["retract_speed", "unretract_speed"]:
adj = Gtk.Adjustment(0, 1, maxval, 1, 5, 0)
else:
adj = Gtk.Adjustment(0, 0, maxval, 1, 5, 0)
self.values[option] = value
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
scale.set_range(0, maxval)
scale.set_value(self.values[option])
scale.set_digits(digits)
scale.set_hexpand(True)
@@ -122,15 +117,18 @@ class FWRetractionPanel(ScreenPanel):
scale.get_style_context().add_class("option_slider")
scale.connect("button-release-event", self.set_opt_value, option)
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
labels.add(scale)
reset = self._gtk.ButtonImage("refresh", None, "color1")
reset.connect("clicked", self.reset_value, option)
reset.set_hexpand(False)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.add(labels)
frame.add(dev)
item = Gtk.Grid()
item.attach(name, 0, 0, 2, 1)
item.attach(scale, 0, 1, 1, 1)
item.attach(reset, 1, 1, 1, 1)
frame = Gtk.Frame()
frame.get_style_context().add_class("frame-item")
frame.add(item)
self.list[option] = {
"row": frame,
@@ -141,14 +139,20 @@ class FWRetractionPanel(ScreenPanel):
self.grid.attach(self.list[option]['row'], 0, pos, 1, 1)
self.grid.show_all()
def reset_value(self, widget, option):
for x in self.options:
if x["option"] == option:
self.update_option(option, x["value"])
self.set_opt_value(None, None, option)
def set_opt_value(self, widget, event, opt):
value = self.list[opt]['scale'].get_value()
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":
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":
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":
self._screen._ws.klippy.gcode_script("SET_RETRACTION UNRETRACT_SPEED=%s" % (value))
self._screen._ws.klippy.gcode_script("SET_RETRACTION UNRETRACT_SPEED=%s" % value)
+18 -119
View File
@@ -6,55 +6,36 @@ from gi.repository import Gdk, Gtk, Pango
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return SettingsPanel(*args)
class SettingsPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.settings = {}
self.macros = {}
self.menu_cur = 'main_box'
self.menu = ['main_box']
self.menu = ['settings_menu']
self.labels['main_box'] = self.create_box('main')
self.labels['macros_box'] = self.create_box('macros')
printbox = Gtk.Box(spacing=0)
printbox.set_vexpand(False)
self.labels['add_printer_button'] = self._gtk.Button(_("Add Printer"), "color1")
self.labels['printers_box'] = self.create_box('printers', printbox)
options = self._config.get_configurable_options().copy()
options.append({"macros": {
"name": _("Displayed Macros"),
"type": "menu",
"menu": "macros"}
})
options.append({"printers": {
"name": _("Printer Connections"),
"type": "menu",
"menu": "printers"
}})
self.labels['settings_menu'] = self._gtk.ScrolledWindow()
self.labels['settings'] = Gtk.Grid()
self.labels['settings_menu'].add(self.labels['settings'])
for option in options:
name = list(option)[0]
self.add_option('main', self.settings, name, option[name])
for macro in self._printer.get_config_section_list("gcode_macro "):
macro = macro[12:]
# Support for hiding macros by name
if macro.startswith("_"):
continue
self.macros[macro] = {
"name": macro,
"section": "displayed_macros %s" % self._screen.connected_printer,
"type": "macro"
}
for macro in list(self.macros):
self.add_option('macros', self.macros, macro, self.macros[macro])
self.add_option('settings', self.settings, name, option[name])
self.labels['printers_menu'] = self._gtk.ScrolledWindow()
self.labels['printers'] = Gtk.Grid()
self.labels['printers_menu'].add(self.labels['printers'])
self.printers = {}
for printer in self._config.get_printers():
logging.debug("Printer: %s" % printer)
@@ -68,7 +49,7 @@ class SettingsPanel(ScreenPanel):
}
self.add_option("printers", self.printers, pname, self.printers[pname])
self.content.add(self.labels['main_box'])
self.content.add(self.labels['settings_menu'])
def activate(self):
while len(self.menu) > 1:
@@ -80,26 +61,6 @@ class SettingsPanel(ScreenPanel):
return True
return False
def create_box(self, name, insert=None):
# Create a scroll window for the macros
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
# Create a grid for all macros
self.labels[name] = Gtk.Grid()
scroll.add(self.labels[name])
# Create a box to contain all of the above
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
if insert is not None:
box.pack_start(insert, False, False, 0)
box.pack_start(scroll, True, True, 0)
return box
def add_option(self, boxname, opt_array, opt_name, option):
if option['type'] is None:
return
@@ -125,20 +86,17 @@ class SettingsPanel(ScreenPanel):
dev.set_valign(Gtk.Align.CENTER)
dev.add(labels)
if option['type'] == "binary" or option['type'] == "macro":
if option['type'] == "binary":
box = Gtk.Box()
box.set_vexpand(False)
switch = Gtk.Switch()
switch.set_hexpand(False)
switch.set_vexpand(False)
if option['type'] == "macro":
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name, fallback=True))
else:
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,
option['callback'] if "callback" in option else None)
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("width-request", round(self._gtk.get_font_size() * 7))
switch.set_property("height-request", round(self._gtk.get_font_size() * 3.5))
box.add(switch)
dev.add(box)
elif option['type'] == "dropdown":
@@ -154,13 +112,14 @@ class SettingsPanel(ScreenPanel):
dropdown.set_entry_text_column(0)
dev.add(dropdown)
elif option['type'] == "scale":
dev.set_orientation(Gtk.Orientation.VERTICAL)
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.set_hexpand(True)
scale.set_digits(0)
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)
elif option['type'] == "printer":
logging.debug("Option: %s" % option)
@@ -193,63 +152,3 @@ class SettingsPanel(ScreenPanel):
self.labels[boxname].insert_row(pos)
self.labels[boxname].attach(opt_array[opt_name]['row'], 0, pos, 1, 1)
self.labels[boxname].show_all()
def load_menu(self, widget, name):
if ("%s_box" % name) not in self.labels:
return
for child in self.content.get_children():
self.content.remove(child)
self.menu.append('%s_box' % name)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def unload_menu(self, widget=None):
logging.debug("self.menu: %s" % self.menu)
if len(self.menu) <= 1 or self.menu[-2] not in self.labels:
return
self.menu.pop()
for child in self.content.get_children():
self.content.remove(child)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def on_dropdown_change(self, combo, section, option, callback=None):
tree_iter = combo.get_active_iter()
if tree_iter is not None:
model = combo.get_model()
value = model[tree_iter][1]
logging.debug("[%s] %s changed to %s" % (section, option, value))
self._config.set(section, option, value)
self._config.save_user_config_options()
if callback is not None:
callback(value)
def scale_moved(self, widget, event, section, option):
logging.debug("[%s] %s changed to %s" % (section, option, widget.get_value()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)
self._config.set(section, option, str(int(widget.get_value())))
self._config.save_user_config_options()
def switch_config_option(self, switch, gparam, section, option, callback=None):
logging.debug("[%s] %s toggled %s" % (section, option, switch.get_active()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)
self._config.set(section, option, "True" if switch.get_active() else "False")
self._config.save_user_config_options()
if callback is not None:
callback(switch.get_active())
def add_gcode_option(self):
macros = self._screen.printer.get_gcode_macros()
for x in macros:
self.add_gcode_macro("macros", self.macros, x, {
"name": x[12:],
"type": binary
})
def run_gcode_macro(self, widget, macro):
self._screen._ws.klippy.gcode_script(macro)
+18 -3
View File
@@ -7,9 +7,11 @@ from gi.repository import Gdk, Gtk, Pango
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return SplashScreenPanel(*args)
class SplashScreenPanel(ScreenPanel):
box = None
@@ -129,9 +131,22 @@ class SplashScreenPanel(ScreenPanel):
def restart(self, widget):
self._screen._ws.klippy.restart()
def shutdown(self, widget):
os.system("sudo shutdown -P now")
_ = self.lang.gettext
if self._screen._ws.is_connected():
self._screen._confirm_send_action(widget,
_("Are you sure you wish to shutdown the system?"),
"machine.shutdown")
else:
logging.info("OS Shutdown")
os.system("systemctl poweroff")
def restart_system(self, widget):
os.system("sudo reboot now")
_ = self.lang.gettext
if self._screen._ws.is_connected():
self._screen._confirm_send_action(widget,
_("Are you sure you wish to reboot the system?"),
"machine.reboot")
else:
logging.info("OS Reboot")
os.system("systemctl reboot")
+5 -10
View File
@@ -8,12 +8,14 @@ from datetime import datetime
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return SystemPanel(*args)
ALLOWED_SERVICES = ["KlipperScreen", "MoonCord", "klipper", "moonraker"]
class SystemPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
@@ -37,12 +39,8 @@ class SystemPanel(ScreenPanel):
_("Are you sure you wish to shutdown the system?"), "machine.shutdown")
shutdown.set_vexpand(False)
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll = self._gtk.ScrolledWindow()
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
infogrid = Gtk.Grid()
infogrid.get_style_context().add_class("system-program-grid")
@@ -74,7 +72,6 @@ class SystemPanel(ScreenPanel):
logging.info("Updating program: %s " % prog)
self.update_program_info(prog)
infogrid.attach(self.labels[prog], 1, i, 1, 1)
self.labels[prog].get_style_context().add_class('updater-item')
i = i + 1
@@ -116,7 +113,6 @@ class SystemPanel(ScreenPanel):
if 'application' in data:
self.labels['update_progress'].set_text(self.labels['update_progress'].get_text().strip() + "\n" +
data['message'] + "\n")
self.labels['update_progress'].set_ellipsize(True)
self.labels['update_progress'].set_ellipsize(Pango.EllipsizeMode.END)
adjustment = self.labels['update_scroll'].get_vadjustment()
adjustment.set_value(adjustment.get_upper() - adjustment.get_page_size())
@@ -199,7 +195,7 @@ class SystemPanel(ScreenPanel):
grid.attach(label, 0, i, 1, 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_halign(Gtk.Align.START)
grid.attach(details, 0, i, 1, 1)
@@ -216,12 +212,11 @@ class SystemPanel(ScreenPanel):
label = Gtk.Label()
label.set_markup(" %s " % c)
label.set_halign(Gtk.Align.START)
label.set_ellipsize(True)
label.set_ellipsize(Pango.EllipsizeMode.END)
pos = (j % 3)
grid.attach(label, pos, i, 1, 1)
j = j + 1
if (pos == 2):
if pos == 2:
i = i + 1
elif "full" in info:
label.set_markup("<b>" + _("Perform a full upgrade?") + "</b>")
+14 -18
View File
@@ -8,9 +8,11 @@ from ks_includes.screen_panel import ScreenPanel
from ks_includes.widgets.graph import HeaterGraph
from ks_includes.widgets.keypad import Keypad
def create_panel(*args):
return TemperaturePanel(*args)
class TemperaturePanel(ScreenPanel):
graph_update = None
active_heater = None
@@ -84,16 +86,11 @@ class TemperaturePanel(ScreenPanel):
self.labels["preheat_grid"] = self._gtk.HomogeneousGrid()
for i, option in enumerate(self.preheat_options):
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['preheat_grid'].attach(self.labels[option], (i % 2), int(i/2), 1, 1)
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_hexpand(True)
scroll.set_vexpand(True)
self.labels['preheat_grid'].attach(self.labels[option], (i % 2), int(i / 2), 1, 1)
scroll = self._gtk.ScrolledWindow()
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
scroll.add_events(Gdk.EventMask.TOUCH_MASK)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
scroll.add(self.labels["preheat_grid"])
return scroll
@@ -116,7 +113,7 @@ class TemperaturePanel(ScreenPanel):
ctx = self.labels['deg' + i].get_style_context()
if j == 0:
ctx.add_class("distbutton_top")
elif j == len(self.tempdeltas)-1:
elif j == len(self.tempdeltas) - 1:
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
@@ -232,26 +229,28 @@ class TemperaturePanel(ScreenPanel):
MAX_TEMP = int(float(self._printer.get_config_section(heater)['max_temp']))
if heater.startswith('extruder'):
target = self.preheat_options[setting]["extruder"]
if target > 0 and target <= MAX_TEMP:
if target is not None and target >= 0 and target <= MAX_TEMP:
self._screen._ws.klippy.set_tool_temp(self._printer.get_tool_number(heater), target)
elif heater.startswith('heater_bed'):
target = self.preheat_options[setting]["bed"]
if target > 0 and target <= MAX_TEMP:
if target is not None and target >= 0 and target <= MAX_TEMP:
self._screen._ws.klippy.set_bed_temp(target)
elif heater.startswith('heater_generic '):
target = self.preheat_options[setting]["heater_generic"]
if target > 0 and target <= MAX_TEMP:
if target is not None and target >= 0 and target <= MAX_TEMP:
self._screen._ws.klippy.set_heater_temp(" ".join(heater.split(" ")[1:]), target)
elif heater.startswith('temperature_fan '):
target = self.preheat_options[setting]["temperature_fan"]
if target > 0 and target <= MAX_TEMP:
if target is not None and target >= 0 and target <= MAX_TEMP:
self._screen._ws.klippy.set_temp_fan_temp(" ".join(heater.split(" ")[1:]), target)
else:
logging.info("Unknown heater: %s" % heater)
self._screen.show_popup_message(_("Unknown Heater") + " " + heater)
if target is None:
continue
if target <= MAX_TEMP:
if target > 0:
self._printer.set_dev_stat(heater, "target", int(target))
if target >= 0:
self._printer.set_dev_stat(heater, "target", target)
logging.info("Setting %s to %d" % (heater, target))
else:
self._screen.show_popup_message(_("Can't set above the maximum:") + (" %s" % MAX_TEMP))
@@ -341,7 +340,6 @@ class TemperaturePanel(ScreenPanel):
name.set_alignment(0, .5)
name.get_style_context().add_class(class_name)
child = name.get_children()[0].get_children()[0].get_children()[1]
child.set_ellipsize(True)
child.set_ellipsize(Pango.EllipsizeMode.END)
temp = self._gtk.Button("")
@@ -433,7 +431,6 @@ class TemperaturePanel(ScreenPanel):
box.add(scroll)
box.add(self.labels['da'])
self.labels['graph_settemp'] = self._gtk.Button(label=_("Set Temp"))
self.labels['graph_settemp'].connect("clicked", self.show_numpad)
self.labels['graph_hide'] = self._gtk.Button(label=_("Hide"))
@@ -459,7 +456,6 @@ class TemperaturePanel(ScreenPanel):
self.labels['da'].set_size_request(0, graph_height)
return box
def graph_show_device(self, widget, show=True):
logging.info("Graph show: %s %s" % (self.popover_device, show))
self.labels['da'].set_showing(self.popover_device, show)
+40 -21
View File
@@ -8,9 +8,11 @@ from ks_includes.screen_panel import ScreenPanel
import logging
def create_panel(*args):
return ZCalibratePanel(*args)
class ZCalibratePanel(ScreenPanel):
_screen = None
widgets = {}
@@ -22,15 +24,27 @@ class ZCalibratePanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
grid = Gtk.Grid()
pos_label = Gtk.Label(_("Z Position") + ": \n")
self.widgets['zposition'] = Gtk.Label("?")
pos = Gtk.VBox()
pos.set_vexpand(False)
pos.set_valign(Gtk.Align.CENTER)
pos.add(pos_label)
pos.add(self.widgets['zposition'])
if self._printer.config_section_exists("probe"):
self.z_offset = self._screen.printer.get_config_section("probe")['z_offset']
elif self._printer.config_section_exists("bltouch"):
self.z_offset = self._screen.printer.get_config_section("bltouch")['z_offset']
elif self._printer.config_section_exists("smart_effector"):
self.z_offset = self._screen.printer.get_config_section("smart_effector")['z_offset']
else:
self.z_offset = None
self.widgets['zposition'] = Gtk.Label("Z: ?")
pos = self._gtk.HomogeneousGrid()
pos.attach(self.widgets['zposition'], 0, 1, 2, 1)
if self.z_offset is not None:
self.widgets['zoffset'] = Gtk.Label("?")
pos.attach(Gtk.Label(_("Probe Offset") + ": "), 0, 2, 2, 1)
pos.attach(Gtk.Label(_("Saved")), 0, 3, 1, 1)
pos.attach(Gtk.Label(_("New")), 1, 3, 1, 1)
pos.attach(Gtk.Label(str(round(float(self.z_offset), 2))), 0, 4, 1, 1)
pos.attach(self.widgets['zoffset'], 1, 4, 1, 1)
self.widgets['zpos'] = self._gtk.ButtonImage('z-farther', _("Raise Nozzle"), 'color4')
self.widgets['zpos'].connect("clicked", self.move, "+")
@@ -53,7 +67,7 @@ class ZCalibratePanel(ScreenPanel):
else:
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.connect("clicked", self.start_calibration, "probe")
pobox.pack_start(probe, True, True, 5)
@@ -69,7 +83,7 @@ class ZCalibratePanel(ScreenPanel):
functions.remove("mesh")
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.connect("clicked", self.start_calibration, "delta")
pobox.pack_start(delta, True, True, 5)
@@ -100,9 +114,9 @@ class ZCalibratePanel(ScreenPanel):
self.widgets[i].set_direction(Gtk.TextDirection.LTR)
self.widgets[i].connect("clicked", self.change_distance, i)
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")
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")
else:
ctx.add_class("distbutton")
@@ -118,6 +132,7 @@ class ZCalibratePanel(ScreenPanel):
distances.pack_start(self.widgets['move_dist'], True, True, 0)
distances.pack_start(distgrid, True, True, 0)
grid = Gtk.Grid()
grid.set_column_homogeneous(True)
if self._screen.vertical_mode:
grid.attach(self.widgets['zpos'], 0, 1, 1, 1)
@@ -171,8 +186,8 @@ class ZCalibratePanel(ScreenPanel):
self._screen._ws.klippy.gcode_script('G0 X%d Y%d F3000' % (0, 0))
else:
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)
y_position = int(int(self._screen.printer.get_config_section("stepper_y")['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)
# Find probe offset
klipper_cfg = self._screen.printer.get_config_section_list()
@@ -214,27 +229,31 @@ class ZCalibratePanel(ScreenPanel):
if action == "notify_status_update":
if self._screen.printer.get_stat("toolhead", "homed_axes") != "xyz":
self.widgets['zposition'].set_text("?")
self.widgets['zposition'].set_text("Z: ?")
elif "toolhead" in data and "position" in data['toolhead']:
self.updatePosition(data['toolhead']['position'])
elif action == "notify_gcode_response":
if "unknown" in data.lower():
data = data.lower()
logging.info(data)
if "unknown" in data:
self.buttons_not_calibrating()
elif "save_config" in data.lower():
elif "save_config" in data:
self.buttons_not_calibrating()
self._screen.show_popup_message(_("Calibrated, save configuration to make it permanent"), level=1)
elif "out of range" in data.lower():
elif "out of range" in data:
self._screen.show_popup_message("%s" % data)
self.buttons_not_calibrating()
elif "fail" in data.lower() and "use testz" in data.lower():
elif "fail" in data and "use testz" in data:
self._screen.show_popup_message(_("Failed, adjust position first"))
self.buttons_not_calibrating()
elif "use testz" in data.lower() or "use abort" in data.lower() or "z position" in data.lower():
elif "use testz" in data or "use abort" in data or "z position" in data:
self.buttons_calibrating()
return
def updatePosition(self, position):
self.widgets['zposition'].set_text(str(round(position[2], 2)))
self.widgets['zposition'].set_text("Z: " + str(round(position[2], 2)))
if self.z_offset is not None:
self.widgets['zoffset'].set_text(str(round(position[2] + float(self.z_offset), 2)))
def change_distance(self, widget, distance):
if self.distance == distance:
+15 -16
View File
@@ -51,6 +51,7 @@ PRINTER_BASE_STATUS_OBJECTS = [
klipperscreendir = pathlib.Path(__file__).parent.resolve()
class KlipperScreen(Gtk.Window):
""" Class for creating a screen for Klipper via HDMI """
_cur_panels = []
@@ -269,6 +270,8 @@ class KlipperScreen(Gtk.Window):
requested_updates['objects'][h] = ["target", "temperature"]
for f in self.printer.get_fans():
requested_updates['objects'][f] = ["speed"]
for f in self.printer.get_filament_sensors():
requested_updates['objects'][f] = ["enabled", "filament_detected"]
self._ws.klippy.object_subscription(requested_updates)
@@ -438,7 +441,6 @@ class KlipperScreen(Gtk.Window):
widget.destroy()
def init_style(self):
style_provider = Gtk.CssProvider()
css = open(os.path.join(klipperscreendir, "styles", "base.css"))
css_data = css.read()
css.close()
@@ -473,17 +475,17 @@ class KlipperScreen(Gtk.Window):
)
for i in range(len(style_options['graph_colors']['bed']['colors'])):
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]
)
for i in range(len(style_options['graph_colors']['fan']['colors'])):
css_data += "\n.graph_label_fan_%s {border-left-color: #%s}" % (
i+1,
i + 1,
style_options['graph_colors']['fan']['colors'][i]
)
for i in range(len(style_options['graph_colors']['sensor']['colors'])):
css_data += "\n.graph_label_sensor_%s {border-left-color: #%s}" % (
i+1,
i + 1,
style_options['graph_colors']['sensor']['colors'][i]
)
@@ -941,7 +943,7 @@ class KlipperScreen(Gtk.Window):
if state['result']['klippy_connected'] is False:
self.panels['splash_screen'].update_text(
_("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)
return False
@@ -970,16 +972,14 @@ class KlipperScreen(Gtk.Window):
self.printer.reinit(printer_info['result'], config['result']['status'])
self.ws_subscribe()
extra_items = []
for extruder in self.printer.get_tools():
extra_items.append(extruder)
for h in self.printer.get_heaters():
extra_items.append(h)
for f in self.printer.get_fans():
extra_items.append(f)
extra_items = (self.printer.get_tools()
+ self.printer.get_heaters()
+ self.printer.get_fans()
+ self.printer.get_filament_sensors()
)
data = self.apiclient.send_request("printer/objects/query?" + "&".join(PRINTER_BASE_STATUS_OBJECTS +
extra_items))
extra_items))
if data is False:
msg = "Error getting printer object data with extra items"
logging.info(msg)
@@ -1002,7 +1002,7 @@ class KlipperScreen(Gtk.Window):
def printer_ready(self):
_ = self.lang.gettext
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.show_panel('main_panel', "main_menu", _("Home"), 2,
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")
return
def main():
def main():
version = functions.get_software_version()
parser = argparse.ArgumentParser(description="KlipperScreen - A GUI for Klipper")
parser.add_argument(
@@ -1096,7 +1096,6 @@ def main():
logging.info("KlipperScreen version: %s" % version)
win = KlipperScreen(args, version)
win.connect("destroy", Gtk.main_quit)
win.show_all()
+1 -1
View File
@@ -10,7 +10,7 @@ FBDEV="xserver-xorg-video-fbdev"
PYTHON="python3-virtualenv virtualenv python3-distutils"
PYGOBJECT="libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0"
MISC="libopenjp2-7 libatlas-base-dev fonts-freefont-ttf matchbox-keyboard wireless-tools"
OPTIONAL="xserver-xorg-legacy"
OPTIONAL="xserver-xorg-legacy fonts-nanum"
Red='\033[0;31m'
Green='\033[0;32m'
+2 -2
View File
@@ -1,8 +1,8 @@
numpy==1.21.4
jinja2==3.1.1
jinja2==3.1.2
matplotlib==3.5.0
netifaces==0.11.0
requests==2.27.1
websocket-client==1.3.2
pycairo==1.21.0
PyGObject==3.42.0
PyGObject==3.42.1
+18 -2
View File
@@ -160,7 +160,7 @@ scrollbar, scrollbar button, scrollbar trough {
}
scrollbar slider {
min-width: 1.5em;
min-width: 2em;
border-radius: .7em;
background-color: #404E57;
}
@@ -175,7 +175,7 @@ textview .time {
}
trough {
margin: .5em 1em;
margin: .5em .5em;
}
.popup {
@@ -361,6 +361,7 @@ trough {
margin-right: .25em;
}
.printing-info button {
margin: .15em;
background-color: rgba(0, 0, 0, 0.1);
border-radius: .5em;
}
@@ -472,6 +473,21 @@ popover button {
background-color: rgba(0, 0, 0, 0.5);
}
.option_slider_max trough highlight, trough progress {
background-color: darkred;
}
.filament_sensor {
border-radius: 3em;
}
.filament_sensor_detected {
background-color: darkgreen;
}
.filament_sensor_empty {
background-color: darkred;
}
/* Hardcoded values until creation of dynamic CSS updates */
.graph_label_hidden {padding-left: .9em;} /* .4em on top of normal button padding */
.graph_label_extruder {border-left-width: .4em; border-left-style: solid;}