Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d12addbba | ||
|
|
92e899cf56 | ||
|
|
6cb18816e2 | ||
|
|
6ca35ffab0 | ||
|
|
7ca37c56b6 | ||
|
|
675f28b318 | ||
|
|
cfa35ba8e4 | ||
|
|
380df961e5 | ||
|
|
8dc12bea2c | ||
|
|
5215c8f985 | ||
|
|
45b172f85c | ||
|
|
2c30bdeddf | ||
|
|
09f992d3b5 | ||
|
|
128fee5e96 | ||
|
|
529b111fce | ||
|
|
d55bc160ac | ||
|
|
7a71fa75f7 | ||
|
|
1db6388798 | ||
|
|
bdafb31522 | ||
|
|
bd82d211f5 | ||
|
|
45ab86204b | ||
|
|
972a09df41 | ||
|
|
9b1b9593e8 | ||
|
|
dd33ee04bb | ||
|
|
04f3c5b7a5 | ||
|
|
18d8f835a9 | ||
|
|
b68cfa40fd | ||
|
|
86c52dece8 | ||
|
|
4272109a27 | ||
|
|
c5fe8b02a4 | ||
|
|
fdf13102fe | ||
|
|
e1ea41f147 | ||
|
|
6b1fd23e35 | ||
|
|
9020d0b0ea | ||
|
|
022954918c | ||
|
|
e4ff009ef6 | ||
|
|
f7cbff3ed8 | ||
|
|
f80c2687c5 | ||
|
|
0bfbe90dcd | ||
|
|
04e060c43c | ||
|
|
6083248dfa | ||
|
|
df401d4924 | ||
|
|
731a78b2f2 | ||
|
|
1e6a9ec8ae | ||
|
|
300eed4d29 | ||
|
|
7bef1d45c8 | ||
|
|
2aec78ff4c | ||
|
|
4d0edf3c0b | ||
|
|
a695c68a25 | ||
|
|
6ca80baea8 | ||
|
|
260d4b16e5 | ||
|
|
67dc2c9fdf | ||
|
|
8b55d2f2b1 | ||
|
|
f05cbe9f0b | ||
|
|
3bbefd8bd5 | ||
|
|
b8e819629a | ||
|
|
f5b8ae1002 | ||
|
|
78f76d659c | ||
|
|
ce6158ad91 | ||
|
|
0ca410acba | ||
|
|
02c043eece | ||
|
|
88461910c9 | ||
|
|
19506292b5 | ||
|
|
1dc3433e02 | ||
|
|
ca7143f776 | ||
|
|
26d10a949b | ||
|
|
8855d9b98f | ||
|
|
df195a0135 | ||
|
|
23b64b1625 | ||
|
|
44623b44d1 | ||
|
|
6e4d0ff962 | ||
|
|
2fef5660cb | ||
|
|
3be65a686a | ||
|
|
9c4f4c5fe7 | ||
|
|
ba392d75b9 | ||
|
|
39b786c198 | ||
|
|
e36cf78e40 | ||
|
|
11dd95b939 | ||
|
|
e0950247d2 | ||
|
|
8d1ca4eba1 | ||
|
|
6c66ccada7 | ||
|
|
01fde5a1e9 | ||
|
|
64745c8578 | ||
|
|
b77321ce28 | ||
|
|
f4a0b0f8b1 | ||
|
|
7ee162092c | ||
|
|
2fc01c07b6 | ||
|
|
73e4645df0 | ||
|
|
5e4760771d | ||
|
|
38d006c8a7 | ||
|
|
79c858ded6 | ||
|
|
03e4681aa6 | ||
|
|
5154e41fed | ||
|
|
371968b458 | ||
|
|
c3128ef508 | ||
|
|
09ccd46528 | ||
|
|
874212e166 | ||
|
|
f749969c07 |
No files matched your search
Symlink
+1
@@ -0,0 +1 @@
|
||||
screen.py
|
||||
+12
-3
@@ -28,7 +28,7 @@ search "how to enable android debugging on device-model-and-brand"
|
||||
|
||||
```bash
|
||||
cd ~/KlipperScreen/scripts
|
||||
cp android-adb.sh launch_KlipperScreen.sh
|
||||
cp sample-android-adb.sh launch_KlipperScreen.sh
|
||||
chmod +x launch_KlipperScreen.sh
|
||||
```
|
||||
|
||||
@@ -45,9 +45,9 @@ chmod +x launch_KlipperScreen.sh
|
||||
nano launch_KlipperScreen.sh
|
||||
```
|
||||
|
||||
* Paste this into the script (edit the IP for example: 192.168.1.2:0)
|
||||
* Paste this into the script (replace the example IP)
|
||||
```bash
|
||||
DISPLAY=(ip address from blue screen):0 $KS_XCLIENT
|
||||
DISPLAY=192.168.150.122:0 $KS_XCLIENT
|
||||
```
|
||||
|
||||
!!! important
|
||||
@@ -73,6 +73,15 @@ sudo service KlipperScreen stop
|
||||
sudo service KlipperScreen start
|
||||
```
|
||||
|
||||
## Stop Screen Blanking in Xserver-XSDL
|
||||
|
||||
Even after enabling the "Stay Awake" option in the Developer/USB Debugging options of your Android device, the Xserver-XSDL may still go to a black screen but keep the backlight of your device on. To keep the screen always active, upon start up of Xserver-XSDL app, select the `Change Device Configuration` at the top of the splash screen and then select the `Command line parameters, one argument per line` option. Append the following argument (must be on seperate lines):
|
||||
```
|
||||
-s
|
||||
0
|
||||
```
|
||||
This will disable the screen-saver in Xserver and keep KlipperScreen always active.
|
||||
|
||||
## Migration from other tutorials
|
||||
|
||||
KlipperScreen says error option "service" is not supported anymore.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Configuration
|
||||
|
||||
Usually you don't need to create a configuration file, but if you need to change something that is not changeable in the UI
|
||||
create a blank file in `~/klipper_config/KlipperScreen.conf`, if the file already exist then just edit it.
|
||||
create a blank file in `~/printer_data/config/KlipperScreen.conf`, if the file already exist then just edit it.
|
||||
|
||||
Write in the file only the options that need to be changed, and restart KlipperScreen.
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ There are no recommended screens, but the minimum supported resolution is 480x32
|
||||
#### Hardware known to work
|
||||
|
||||
* [BTT PI TFT50](https://www.biqu.equipment/collections/lcd/products/bigtreetech-pi-tft50-v1-0-tft-display-for-raspberry-pi-3d-printer-part)
|
||||
* [BTT HDMI5/7](https://biqu.equipment/products/bigtreetech-hdmi5-v1-0-hdmi7-v1-0)
|
||||
* [Raspberry PI 7" Touchscreen](https://www.raspberrypi.org/products/raspberry-pi-touch-display/)
|
||||
* [Hyperpixel 4](https://shop.pimoroni.com/products/hyperpixel-4)
|
||||
* [3.5" Elegoo](https://www.elegoo.com/de/products/elegoo-3-5-inch-tft-lcd-screen)
|
||||
|
||||
+14
-9
@@ -5,12 +5,22 @@ This page will have common problems and common solutions to those problems.
|
||||
|
||||
The first step to troubleshooting any problem is getting the cause of the error.
|
||||
|
||||
* Check for the file `/tmp/KlipperScreen.log`
|
||||
* Find KlipperScreen.log:
|
||||
|
||||
look at the contents by running `cat /tmp/KlipperScreen.log` or grab the file over WinSCP or another sftp program.
|
||||
This is the most important file, and should be provided if you ask for support.
|
||||
!!! important
|
||||
This log file should be provided if you ask for support.
|
||||
|
||||
If that file is non-existent, run `journalctl -xe -u KlipperScreen`
|
||||
Depending on your setup the file could be accesible from the web interface alongside other logs
|
||||
|
||||
Mainsail | Fluidd
|
||||
:-:|:-:
|
||||
 | 
|
||||
|
||||
if you can't find it in the web interface, use sftp to grab the log (for example Filezilla, WinSCP)
|
||||
Located at `~/printer_data/logs`or in `/tmp/` if the former doesn't exists.
|
||||
|
||||
If KlipperScreen.log doesn't exist, run `systemctl status KlipperScreen`<br>
|
||||
(or `journalctl -xe -u KlipperScreen`)
|
||||
|
||||
Check the file `/var/log/Xorg.0.log` where you can find issues with the X server.
|
||||
|
||||
@@ -33,11 +43,6 @@ usermod -a -G tty pi
|
||||
```
|
||||
(if your username is not 'pi' change 'pi' to your username)
|
||||
|
||||
You may also need:
|
||||
```sh
|
||||
sudo apt install xserver-xorg-legacy
|
||||
```
|
||||
|
||||
Restart KlipperScreen:
|
||||
```sh
|
||||
sudo service KlipperScreen restart
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -213,9 +213,11 @@ class KlippyGtk:
|
||||
dialog.show_all()
|
||||
# Change cursor to blank
|
||||
if self.cursor:
|
||||
dialog.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.ARROW))
|
||||
dialog.get_window().set_cursor(
|
||||
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.ARROW))
|
||||
else:
|
||||
dialog.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.BLANK_CURSOR))
|
||||
dialog.get_window().set_cursor(
|
||||
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.BLANK_CURSOR))
|
||||
|
||||
self.screen.dialogs.append(dialog)
|
||||
return dialog
|
||||
@@ -224,23 +226,6 @@ class KlippyGtk:
|
||||
logging.info("Removing Dialog")
|
||||
self.screen.dialogs.remove(dialog)
|
||||
|
||||
def ToggleButtonImage(self, image_name, label, style=None, width=None, height=None):
|
||||
|
||||
b = Gtk.ToggleButton(label=label)
|
||||
b.set_hexpand(True)
|
||||
b.set_vexpand(True)
|
||||
b.set_can_focus(False)
|
||||
b.set_image(self.Image(image_name, width, height))
|
||||
b.set_image_position(Gtk.PositionType.TOP)
|
||||
b.set_always_show_image(True)
|
||||
|
||||
if style is not None:
|
||||
ctx = b.get_style_context()
|
||||
ctx.add_class(style)
|
||||
|
||||
b.connect("clicked", self.screen.reset_screensaver_timeout)
|
||||
return b
|
||||
|
||||
@staticmethod
|
||||
def HomogeneousGrid(width=None, height=None):
|
||||
g = Gtk.Grid()
|
||||
|
||||
@@ -44,17 +44,15 @@ class KlippyRest:
|
||||
try:
|
||||
r = requests.get(url, headers=headers)
|
||||
except Exception as e:
|
||||
logging.critical(e, exc_info=True)
|
||||
logging.error(e)
|
||||
return False
|
||||
if r.status_code != 200:
|
||||
return False
|
||||
|
||||
# TODO: Try/except
|
||||
try:
|
||||
data = json.loads(r.content)
|
||||
except Exception as e:
|
||||
logging.critical(e, exc_info=True)
|
||||
logging.exception(f"Unable to parse response from moonraker:\n {r.content}")
|
||||
logging.error(f"Unable to parse response from moonraker:\n {r.content}")
|
||||
return False
|
||||
|
||||
return data
|
||||
@@ -8,7 +8,7 @@ import websocket
|
||||
import logging
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import GLib, Gdk
|
||||
from gi.repository import GLib
|
||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||
|
||||
api_key = ""
|
||||
@@ -30,9 +30,10 @@ api = {
|
||||
class KlippyWebsocket(threading.Thread):
|
||||
_req_id = 0
|
||||
connected = False
|
||||
connecting = True
|
||||
callback_table = {}
|
||||
reconnect_timeout = None
|
||||
reconnect_count = 0
|
||||
max_retries = 4
|
||||
|
||||
def __init__(self, screen, callback, host, port):
|
||||
threading.Thread.__init__(self)
|
||||
@@ -53,34 +54,30 @@ class KlippyWebsocket(threading.Thread):
|
||||
|
||||
@property
|
||||
def ws_proto(self):
|
||||
if int(self.port) == 443:
|
||||
if int(self.port) in {443, 7130}:
|
||||
return "wss"
|
||||
return "ws"
|
||||
|
||||
def retry(self):
|
||||
self.reconnect_count = 0
|
||||
self.connecting = True
|
||||
self.initial_connect()
|
||||
|
||||
def initial_connect(self):
|
||||
# Enable a timeout so that way if moonraker is not running, it will attempt to reconnect
|
||||
if self.reconnect_timeout is None:
|
||||
self.reconnect_timeout = GLib.timeout_add_seconds(6, self.reconnect)
|
||||
self.connect()
|
||||
if self.connecting:
|
||||
GLib.timeout_add_seconds(6, self.reconnect)
|
||||
|
||||
def connect(self):
|
||||
def ws_on_close(ws, a=None, b=None):
|
||||
self.on_close(ws)
|
||||
|
||||
def ws_on_error(ws, msg):
|
||||
self.on_error(ws, msg)
|
||||
|
||||
def ws_on_message(ws, msg):
|
||||
self.on_message(ws, msg)
|
||||
|
||||
def ws_on_open(ws):
|
||||
self.on_open(ws)
|
||||
|
||||
if self.connected:
|
||||
return
|
||||
self.reconnect_count += 1
|
||||
try:
|
||||
state = self._screen.apiclient.get_server_info()
|
||||
if state is False:
|
||||
if self.reconnect_count > 3:
|
||||
self._screen.panels['splash_screen'].update_text(
|
||||
if self.reconnect_count > 2:
|
||||
self._screen.printer_initializing(
|
||||
_("Cannot connect to Moonraker")
|
||||
+ f'\n\n{self._url}\n\n'
|
||||
+ _("Retrying") + f' #{self.reconnect_count}'
|
||||
@@ -94,8 +91,9 @@ class KlippyWebsocket(threading.Thread):
|
||||
|
||||
self.ws_url = f"{self.ws_proto}://{self._url}/websocket?token={token}"
|
||||
self.ws = websocket.WebSocketApp(
|
||||
self.ws_url, on_close=ws_on_close, on_error=ws_on_error, on_message=ws_on_message, on_open=ws_on_open)
|
||||
|
||||
self.ws_url,
|
||||
on_close=self.on_close, on_error=self.on_error, on_message=self.on_message, on_open=self.on_open
|
||||
)
|
||||
self._wst = threading.Thread(target=self.ws.run_forever, daemon=True)
|
||||
try:
|
||||
logging.debug("Starting websocket thread")
|
||||
@@ -106,40 +104,32 @@ class KlippyWebsocket(threading.Thread):
|
||||
|
||||
def close(self):
|
||||
self.closing = True
|
||||
self.connecting = False
|
||||
if self.ws is not None:
|
||||
logging.debug("Closing websocket")
|
||||
self.ws.close()
|
||||
|
||||
def is_connected(self):
|
||||
return self.connected
|
||||
|
||||
def on_message(self, ws, message):
|
||||
response = json.loads(message)
|
||||
if "id" in response and response['id'] in self.callback_table:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_HIGH_IDLE,
|
||||
self.callback_table[response['id']][0],
|
||||
response,
|
||||
self.callback_table[response['id']][1],
|
||||
self.callback_table[response['id']][2],
|
||||
*self.callback_table[response['id']][3]
|
||||
)
|
||||
args = (response,
|
||||
self.callback_table[response['id']][1],
|
||||
self.callback_table[response['id']][2],
|
||||
*self.callback_table[response['id']][3])
|
||||
GLib.idle_add(self.callback_table[response['id']][0], *args)
|
||||
self.callback_table.pop(response['id'])
|
||||
return
|
||||
|
||||
if "method" in response and "on_message" in self._callback:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_HIGH_IDLE,
|
||||
self._callback['on_message'],
|
||||
response['method'],
|
||||
response['params'][0] if "params" in response else {}
|
||||
)
|
||||
args = response['method'], response['params'][0] if "params" in response else {}
|
||||
GLib.idle_add(self._callback['on_message'], *args)
|
||||
return
|
||||
|
||||
def send_method(self, method, params=None, callback=None, *args):
|
||||
if not self.connected:
|
||||
return False
|
||||
if params is None:
|
||||
params = {}
|
||||
if self.is_connected() is False:
|
||||
return False
|
||||
|
||||
self._req_id += 1
|
||||
if callback is not None:
|
||||
@@ -156,53 +146,35 @@ class KlippyWebsocket(threading.Thread):
|
||||
|
||||
def on_open(self, ws):
|
||||
logging.info("Moonraker Websocket Open")
|
||||
logging.info(f"Self.connected = {self.is_connected()}")
|
||||
self.connected = True
|
||||
self.reconnect_count = 0
|
||||
if self.reconnect_timeout is not None:
|
||||
GLib.source_remove(self.reconnect_timeout)
|
||||
self.reconnect_timeout = None
|
||||
if "on_connect" in self._callback:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_HIGH_IDLE,
|
||||
self._callback['on_connect']
|
||||
)
|
||||
GLib.idle_add(self._callback['on_connect'])
|
||||
|
||||
def on_close(self, ws):
|
||||
if self.is_connected() is False:
|
||||
def on_close(self, ws, status, message):
|
||||
if message is not None:
|
||||
logging.info(f"{status} {message}")
|
||||
if not self.connected:
|
||||
logging.debug("Connection already closed")
|
||||
if self.reconnect_timeout is not None:
|
||||
GLib.source_remove(self.reconnect_timeout)
|
||||
self.reconnect_timeout = None
|
||||
return
|
||||
|
||||
if self.closing is True:
|
||||
logging.debug("Closing websocket")
|
||||
self.ws.keep_running = False
|
||||
self.close()
|
||||
self.closing = False
|
||||
return
|
||||
if "on_close" in self._callback:
|
||||
GLib.idle_add(self._callback['on_close'], "Lost Connection to Moonraker")
|
||||
|
||||
logging.info("Moonraker Websocket Closed")
|
||||
self.connected = False
|
||||
if self.reconnect_timeout is None:
|
||||
self.reconnect_timeout = GLib.timeout_add_seconds(9, self.reconnect)
|
||||
|
||||
if "on_close" in self._callback:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_HIGH_IDLE,
|
||||
self._callback['on_close'],
|
||||
"Lost Connection to Moonraker",
|
||||
True
|
||||
)
|
||||
|
||||
def reconnect(self):
|
||||
if self.is_connected():
|
||||
logging.debug("Reconnected")
|
||||
if self.connected:
|
||||
return False
|
||||
if self.reconnect_count > self.max_retries:
|
||||
logging.debug("Stopping reconnections")
|
||||
self.connecting = False
|
||||
self._screen.printer_initializing(
|
||||
_("Cannot connect to Moonraker")
|
||||
+ f'\n\n{self._url}')
|
||||
return False
|
||||
|
||||
logging.debug("Attempting to reconnect")
|
||||
self.reconnect_count += 1
|
||||
self.connect()
|
||||
return True
|
||||
|
||||
@@ -257,7 +229,7 @@ class MoonrakerApi:
|
||||
)
|
||||
|
||||
def object_subscription(self, updates):
|
||||
logging.debug(f"Sending printer.objects.subscribe: {updates}")
|
||||
logging.debug("Sending printer.objects.subscribe")
|
||||
return self._ws.send_method(
|
||||
"printer.objects.subscribe",
|
||||
updates
|
||||
|
||||
+17
-16
@@ -34,6 +34,7 @@ class KlipperScreenConfig:
|
||||
do_not_edit_prefix = "#~#"
|
||||
|
||||
def __init__(self, configfile, screen=None):
|
||||
self.lang_list = None
|
||||
self.errors = []
|
||||
self.default_config_path = os.path.join(klipperscreendir, "ks_includes", "defaults.conf")
|
||||
self.config = configparser.ConfigParser()
|
||||
@@ -110,7 +111,6 @@ class KlipperScreenConfig:
|
||||
lang_path = os.path.join(klipperscreendir, "ks_includes", "locales")
|
||||
self.lang_list = [d for d in os.listdir(lang_path) if not os.path.isfile(os.path.join(lang_path, d))]
|
||||
self.lang_list.sort()
|
||||
logging.info(f"Available lang list {self.lang_list}")
|
||||
for lng in self.lang_list:
|
||||
self.langs[lng] = gettext.translation('KlipperScreen', localedir=lang_path, languages=[lng], fallback=True)
|
||||
|
||||
@@ -126,8 +126,8 @@ class KlipperScreenConfig:
|
||||
lang = language
|
||||
if lang not in self.lang_list:
|
||||
logging.error(f"lang: {lang} not found")
|
||||
logging.info(f"Available lang list {self.lang_list}")
|
||||
lang = "en"
|
||||
return
|
||||
logging.info(f"Using lang {lang}")
|
||||
self.lang = self.langs[lang]
|
||||
self.lang.install(names=['gettext', 'ngettext'])
|
||||
@@ -230,7 +230,7 @@ class KlipperScreenConfig:
|
||||
{"screen_blanking": {
|
||||
"section": "main", "name": _("Screen Power Off Time"), "type": "dropdown",
|
||||
"value": "3600", "callback": screen.set_screenblanking_timeout, "options": [
|
||||
{"name": _("Off"), "value": "off"}]
|
||||
{"name": _("Never"), "value": "off"}]
|
||||
}},
|
||||
{"24htime": {"section": "main", "name": _("24 Hour Time"), "type": "binary", "value": "True"}},
|
||||
{"side_macro_shortcut": {
|
||||
@@ -351,7 +351,7 @@ class KlipperScreenConfig:
|
||||
saved_def = []
|
||||
found_saved = False
|
||||
if not path.exists(config_path):
|
||||
return [None, None]
|
||||
return ["", None]
|
||||
with open(config_path) as file:
|
||||
for line in file:
|
||||
line = line.replace('\n', '')
|
||||
@@ -443,9 +443,6 @@ class KlipperScreenConfig:
|
||||
|
||||
return None if name not in self.config else self.config[name]
|
||||
|
||||
def get_printer_power_name(self):
|
||||
return self.config['settings'].get("printer_power_name", "printer")
|
||||
|
||||
def get_printers(self):
|
||||
return self.printers
|
||||
|
||||
@@ -485,16 +482,20 @@ class KlipperScreenConfig:
|
||||
else:
|
||||
user_def, saved_def = self.separate_saved_config(self.config_path)
|
||||
|
||||
extra_lb = "\n" if saved_def is not None else ""
|
||||
contents = "%s\n%s%s\n%s\n%s\n%s\n" % (
|
||||
user_def, self.do_not_edit_line, extra_lb, self.do_not_edit_prefix, "\n".join(save_output),
|
||||
self.do_not_edit_prefix)
|
||||
contents = (f"{user_def}\n"
|
||||
f"{self.do_not_edit_line}\n"
|
||||
f"{self.do_not_edit_prefix}\n"
|
||||
+ '\n'.join(save_output) + f"\n"
|
||||
f"{self.do_not_edit_prefix}\n")
|
||||
|
||||
if self.config_path != self.default_config_path:
|
||||
filepath = self.config_path
|
||||
else:
|
||||
filepath = os.path.expanduser("~/")
|
||||
klipper_config = os.path.join(filepath, "klipper_config")
|
||||
if os.path.exists(klipper_config):
|
||||
filepath = os.path.join(klipper_config, "KlipperScreen.conf")
|
||||
klipper_config = os.path.join(filepath, "printer_data", "config")
|
||||
if os.path.exists(klipper_config):
|
||||
filepath = os.path.join(klipper_config, "KlipperScreen.conf")
|
||||
else:
|
||||
@@ -535,11 +536,11 @@ class KlipperScreenConfig:
|
||||
cfg = self.config[name]
|
||||
item = {
|
||||
"name": cfg.get("name"),
|
||||
"icon": cfg.get("icon"),
|
||||
"panel": cfg.get("panel", False),
|
||||
"method": cfg.get("method", False),
|
||||
"confirm": cfg.get("confirm", False),
|
||||
"enable": cfg.get("enable", True)
|
||||
"icon": cfg.get("icon", None),
|
||||
"panel": cfg.get("panel", None),
|
||||
"method": cfg.get("method", None),
|
||||
"confirm": cfg.get("confirm", None),
|
||||
"enable": cfg.get("enable", "True")
|
||||
}
|
||||
|
||||
try:
|
||||
|
||||
@@ -16,7 +16,6 @@ class KlippyFiles:
|
||||
self.gcodes_path = None
|
||||
|
||||
def initialize(self):
|
||||
self.gcodes_path = None
|
||||
if "virtual_sdcard" in self._screen.printer.get_config_section_list():
|
||||
vsd = self._screen.printer.get_config_section("virtual_sdcard")
|
||||
if "path" in vsd:
|
||||
@@ -24,7 +23,11 @@ class KlippyFiles:
|
||||
logging.info(f"Gcodes path: {self.gcodes_path}")
|
||||
|
||||
def reset(self):
|
||||
self.__init__(self._screen)
|
||||
self._screen = None
|
||||
self.callbacks = None
|
||||
self.files = None
|
||||
self.filelist = None
|
||||
self.gcodes_path = None
|
||||
|
||||
def _callback(self, result, method, params):
|
||||
if method == "server.files.list":
|
||||
@@ -92,7 +95,8 @@ class KlippyFiles:
|
||||
if filename in self.filelist:
|
||||
logging.info(f"File already exists: {filename}")
|
||||
self.request_metadata(filename)
|
||||
GLib.timeout_add_seconds(1, self.run_callbacks, mods=[filename])
|
||||
args = None, None, [filename]
|
||||
GLib.idle_add(self.run_callbacks, *args)
|
||||
return
|
||||
|
||||
self.filelist.append(filename)
|
||||
@@ -172,10 +176,6 @@ class KlippyFiles:
|
||||
if notify is True:
|
||||
self.run_callbacks(deletedfiles=[filename])
|
||||
|
||||
def ret_file_data(self, filename):
|
||||
logging.info(f"Getting file info for {filename}")
|
||||
self._screen._ws.klippy.get_file_metadata(filename, self._callback)
|
||||
|
||||
def run_callbacks(self, newfiles=None, deletedfiles=None, mods=None):
|
||||
if mods is None:
|
||||
mods = []
|
||||
@@ -186,7 +186,8 @@ class KlippyFiles:
|
||||
if len(self.callbacks) <= 0:
|
||||
return False
|
||||
for cb in self.callbacks:
|
||||
GLib.idle_add(cb, newfiles, deletedfiles, mods)
|
||||
args = newfiles, deletedfiles, mods
|
||||
GLib.idle_add(cb, *args)
|
||||
return False
|
||||
|
||||
def get_file_list(self):
|
||||
|
||||
+18
-15
@@ -47,8 +47,8 @@ try:
|
||||
return state
|
||||
|
||||
dpms_loaded = True
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as msg:
|
||||
logging.error(f"Couldn't load DPMS: {msg}")
|
||||
|
||||
|
||||
def get_network_interfaces():
|
||||
@@ -123,8 +123,8 @@ def patch_threading_excepthook():
|
||||
threading.Thread.__init__ = new_init
|
||||
|
||||
|
||||
# Timed rotating file handler based on Klipper and Moonraker's implementation
|
||||
class KlipperScreenLoggingHandler(logging.handlers.TimedRotatingFileHandler):
|
||||
# Rotating file handler based on Klipper and Moonraker's implementation
|
||||
class KlipperScreenLoggingHandler(logging.handlers.RotatingFileHandler):
|
||||
def __init__(self, software_version, filename, **kwargs):
|
||||
super(KlipperScreenLoggingHandler, self).__init__(filename, **kwargs)
|
||||
self.rollover_info = {
|
||||
@@ -157,18 +157,21 @@ def setup_logging(log_file, software_version):
|
||||
stdout_fmt = logging.Formatter(
|
||||
'%(asctime)s [%(filename)s:%(funcName)s()] - %(message)s')
|
||||
stdout_hdlr.setFormatter(stdout_fmt)
|
||||
|
||||
fh = None
|
||||
if log_file:
|
||||
fh = KlipperScreenLoggingHandler(software_version, log_file, when='midnight', backupCount=2)
|
||||
formatter = logging.Formatter(
|
||||
'%(asctime)s [%(filename)s:%(funcName)s()] - %(message)s')
|
||||
fh = listener = None
|
||||
try:
|
||||
fh = KlipperScreenLoggingHandler(software_version, log_file, maxBytes=4194304, backupCount=1)
|
||||
formatter = logging.Formatter('%(asctime)s [%(filename)s:%(funcName)s()] - %(message)s')
|
||||
fh.setFormatter(formatter)
|
||||
listener = logging.handlers.QueueListener(
|
||||
queue, fh, stdout_hdlr)
|
||||
else:
|
||||
listener = logging.handlers.QueueListener(
|
||||
queue, stdout_hdlr)
|
||||
listener = logging.handlers.QueueListener(queue, fh, stdout_hdlr)
|
||||
except Exception as e:
|
||||
print(
|
||||
f"Unable to create log file at '{os.path.normpath(log_file)}'.\n"
|
||||
f"Make sure that the folder '{os.path.dirname(log_file)}' exists\n"
|
||||
f"and KlipperScreen has Read/Write access to the folder.\n"
|
||||
f"{e}\n"
|
||||
)
|
||||
if listener is None:
|
||||
listener = logging.handlers.QueueListener(queue, stdout_hdlr)
|
||||
listener.start()
|
||||
|
||||
def logging_exception_handler(ex_type, value, tb, thread_identifier=None):
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -181,9 +181,6 @@ msgstr ""
|
||||
msgid "Decrease"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr ""
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr ""
|
||||
|
||||
msgid "Home All"
|
||||
msgstr ""
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr ""
|
||||
msgid "Menu"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr ""
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr ""
|
||||
msgid "Network"
|
||||
msgstr ""
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
@@ -451,9 +451,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr ""
|
||||
|
||||
msgid "Off"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr ""
|
||||
@@ -559,6 +556,9 @@ msgstr ""
|
||||
msgid "Retraction Speed"
|
||||
msgstr ""
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr ""
|
||||
@@ -713,9 +713,6 @@ msgstr ""
|
||||
msgid "Uploaded"
|
||||
msgstr ""
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr ""
|
||||
|
||||
msgid "X+"
|
||||
msgstr ""
|
||||
|
||||
|
||||
Binary file not shown.
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: SRBJ\n"
|
||||
"Language-Team: \n"
|
||||
@@ -176,9 +176,6 @@ msgstr "Dato"
|
||||
msgid "Decrease"
|
||||
msgstr "Formindsk"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Slet"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -285,9 +282,6 @@ msgstr "Skjul sensorer i Temp."
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Home"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Home alle"
|
||||
|
||||
@@ -417,6 +411,9 @@ msgstr "Mellem"
|
||||
msgid "Menu"
|
||||
msgstr "Menu"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Ændret"
|
||||
|
||||
@@ -435,6 +432,9 @@ msgstr "Navn"
|
||||
msgid "Network"
|
||||
msgstr "Netværk"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "Ny"
|
||||
|
||||
@@ -446,9 +446,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Intet valgt"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Sluk"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Forældet med %d"
|
||||
@@ -554,6 +551,9 @@ msgstr ""
|
||||
msgid "Retraction Speed"
|
||||
msgstr ""
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Prøv igen #%s"
|
||||
@@ -708,9 +708,6 @@ msgstr "Opdatering"
|
||||
msgid "Uploaded"
|
||||
msgstr "Uploadet"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Vis mesh"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -775,6 +772,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Slet"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Home"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Sluk"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Vis mesh"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "Sortér efter: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-03-31 10:43-0300\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@@ -181,9 +181,6 @@ msgstr "Datum"
|
||||
msgid "Decrease"
|
||||
msgstr "Verringern"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Löschen"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr "Sensoren in Temp ausblenden."
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Grundposition"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Alle Achsen zurücksetzen"
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr "Mittel"
|
||||
msgid "Menu"
|
||||
msgstr "Menü"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Modifiziert"
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr "Name"
|
||||
msgid "Network"
|
||||
msgstr "Netzwerk"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "Neu"
|
||||
|
||||
@@ -451,9 +451,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Nichts ausgewählt"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Aus"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Veraltet von %d"
|
||||
@@ -559,6 +556,9 @@ msgstr "Rückzugslänge"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "Rückzugsgeschwindigkeit"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Wiederholen #%s"
|
||||
@@ -715,9 +715,6 @@ msgstr "Aktualisierung"
|
||||
msgid "Uploaded"
|
||||
msgstr "Hochgeladen"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Mesh anzeigen"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -782,6 +779,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Löschen"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Grundposition"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Aus"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Mesh anzeigen"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "Sortierung: "
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@@ -176,9 +176,6 @@ msgstr ""
|
||||
msgid "Decrease"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -285,9 +282,6 @@ msgstr ""
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr ""
|
||||
|
||||
msgid "Home All"
|
||||
msgstr ""
|
||||
|
||||
@@ -417,6 +411,9 @@ msgstr ""
|
||||
msgid "Menu"
|
||||
msgstr ""
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr ""
|
||||
|
||||
@@ -435,6 +432,9 @@ msgstr ""
|
||||
msgid "Network"
|
||||
msgstr ""
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
@@ -446,9 +446,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr ""
|
||||
|
||||
msgid "Off"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr ""
|
||||
@@ -554,6 +551,9 @@ msgstr ""
|
||||
msgid "Retraction Speed"
|
||||
msgstr ""
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr ""
|
||||
@@ -708,9 +708,6 @@ msgstr ""
|
||||
msgid "Uploaded"
|
||||
msgstr ""
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr ""
|
||||
|
||||
msgid "X+"
|
||||
msgstr ""
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"PO-Revision-Date: 2022-10-27 23:24-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-11-12 11:20-0300\n"
|
||||
"Last-Translator: alfrix\n"
|
||||
"Language-Team: \n"
|
||||
"Language: es\n"
|
||||
@@ -181,9 +181,6 @@ msgstr "Fecha"
|
||||
msgid "Decrease"
|
||||
msgstr "Disminuir"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Borrar"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr "¿Borrar archivo?"
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr "Ocultar sensores en Temp."
|
||||
msgid "Hide temp."
|
||||
msgstr "Ocultar temp."
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Inicio"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Origen XYZ"
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr "Medio"
|
||||
msgid "Menu"
|
||||
msgstr "Menú"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr "Calibrar Malla"
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Modificado"
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr "Nombre"
|
||||
msgid "Network"
|
||||
msgstr "Red"
|
||||
|
||||
msgid "Never"
|
||||
msgstr "Nunca"
|
||||
|
||||
msgid "New"
|
||||
msgstr "Nuevo"
|
||||
|
||||
@@ -453,9 +453,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Nada seleccionado"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Apagar"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Desactualizado por %d"
|
||||
@@ -561,6 +558,9 @@ msgstr "Largo de Retracción"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "Velocidad de Retracción"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr "Reintentar"
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Intento #%s"
|
||||
@@ -715,9 +715,6 @@ msgstr "Actualizando"
|
||||
msgid "Uploaded"
|
||||
msgstr "Subido"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Ver Malla"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -782,6 +779,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Borrar"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Inicio"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Apagar"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Ver Malla"
|
||||
|
||||
#~ msgid "Machine"
|
||||
#~ msgstr "Máquina"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-03-31 10:50-0300\n"
|
||||
"Last-Translator: O. Robardet\n"
|
||||
"Language-Team: \n"
|
||||
@@ -181,9 +181,6 @@ msgstr "Date"
|
||||
msgid "Decrease"
|
||||
msgstr "Diminuer"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Effacer"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr "Masquer les capteurs dans Temp."
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Accueil"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Origine XYZ"
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr "Moyen"
|
||||
msgid "Menu"
|
||||
msgstr "Menu"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Modifié"
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr "Nom"
|
||||
msgid "Network"
|
||||
msgstr "Réseau"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "Nouveau"
|
||||
|
||||
@@ -451,9 +451,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Rien de sélectionné"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Éteindre"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Obsolète de %d"
|
||||
@@ -559,6 +556,9 @@ msgstr "Longueur de rétraction"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "Vitesse de rétraction"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Réessayez #%s"
|
||||
@@ -713,9 +713,6 @@ msgstr "Mise à jour"
|
||||
msgid "Uploaded"
|
||||
msgstr "Téléchargé"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Voir le maillage"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -780,6 +777,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Effacer"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Accueil"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Éteindre"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Voir le maillage"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "Trier par: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Klipperscreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-03-31 10:54-0300\n"
|
||||
"Last-Translator: Tal Rahav <talrhv1@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
@@ -183,9 +183,6 @@ msgstr "תאריך"
|
||||
msgid "Decrease"
|
||||
msgstr "הורד"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "מחק"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr "מחק קובץ"
|
||||
|
||||
@@ -292,9 +289,6 @@ msgstr "הסתר חיישנים בטמפ'."
|
||||
msgid "Hide temp."
|
||||
msgstr "הסתר טמפרטורה"
|
||||
|
||||
msgid "Home"
|
||||
msgstr "איפוס"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "איפוס XYZ"
|
||||
|
||||
@@ -424,6 +418,9 @@ msgstr "בינוני"
|
||||
msgid "Menu"
|
||||
msgstr "תפריט"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "שונה"
|
||||
|
||||
@@ -442,6 +439,9 @@ msgstr "שם"
|
||||
msgid "Network"
|
||||
msgstr "רשת"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "חדש"
|
||||
|
||||
@@ -453,9 +453,6 @@ msgstr "איתור אוטומטי אינו נתמך, זה צריך להיות מ
|
||||
msgid "Nothing selected"
|
||||
msgstr "שום דבר לא נבחר"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "כבוי"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "מיושן על ידי %d"
|
||||
@@ -563,6 +560,9 @@ msgstr "מרחק משיכה"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "מהירות משיכה"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "נסה שוב #%s"
|
||||
@@ -717,9 +717,6 @@ msgstr "מעדכן"
|
||||
msgid "Uploaded"
|
||||
msgstr "הועלה"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "צפה ברשת"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -788,6 +785,18 @@ msgstr "מ\"מ/ש"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "מחק"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "איפוס"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "כבוי"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "צפה ברשת"
|
||||
|
||||
#~ msgid "Machine"
|
||||
#~ msgstr "מכונה"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: AntoszHUN\n"
|
||||
"Language-Team: \n"
|
||||
@@ -176,9 +176,6 @@ msgstr "Dátum"
|
||||
msgid "Decrease"
|
||||
msgstr "Csökkent"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Töröl"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr "Fájl törlése?"
|
||||
|
||||
@@ -285,9 +282,6 @@ msgstr "Hőfok szenzorok elrejtése."
|
||||
msgid "Hide temp."
|
||||
msgstr "Hőfok elrejtése"
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Kezdőpontok"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "X-Y-Z kezdőpont"
|
||||
|
||||
@@ -307,7 +301,7 @@ msgid "Homing"
|
||||
msgstr "Kezdőpont"
|
||||
|
||||
msgid "Host"
|
||||
msgstr "Gazda"
|
||||
msgstr "Gazdagép"
|
||||
|
||||
msgid "Hostname"
|
||||
msgstr "Gazdanév"
|
||||
@@ -417,6 +411,9 @@ msgstr "Közepes"
|
||||
msgid "Menu"
|
||||
msgstr "Menü"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Módosított"
|
||||
|
||||
@@ -435,6 +432,9 @@ msgstr "Név"
|
||||
msgid "Network"
|
||||
msgstr "Hálózat"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "Új"
|
||||
|
||||
@@ -448,9 +448,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Nincs kiválasztva"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Ki"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "%d által elavult"
|
||||
@@ -509,7 +506,7 @@ msgid "Printer Connections"
|
||||
msgstr "Nyomtató csatlakozások"
|
||||
|
||||
msgid "Printer Select"
|
||||
msgstr ""
|
||||
msgstr "Nyomtató kiválasztása"
|
||||
|
||||
msgid "Printing"
|
||||
msgstr "Nyomtatás"
|
||||
@@ -556,6 +553,9 @@ msgstr "Visszahúzási hossz"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "Visszahúzási sebesség"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Újra #%s"
|
||||
@@ -710,9 +710,6 @@ msgstr "Frissítés"
|
||||
msgid "Uploaded"
|
||||
msgstr "Feltöltve"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Háló nézet"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -777,6 +774,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Töröl"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Kezdőpontok"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Ki"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Háló nézet"
|
||||
|
||||
#~ msgid "Machine"
|
||||
#~ msgstr "Gép"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: pappicio\n"
|
||||
"Language-Team: \n"
|
||||
@@ -176,9 +176,6 @@ msgstr "Data"
|
||||
msgid "Decrease"
|
||||
msgstr "Diminuisci"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Elimina"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -285,9 +282,6 @@ msgstr "Nascondi sensori in Temp."
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Inizio"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Home XYZ"
|
||||
|
||||
@@ -417,6 +411,9 @@ msgstr "Medio"
|
||||
msgid "Menu"
|
||||
msgstr "Menù"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Modificato"
|
||||
|
||||
@@ -435,6 +432,9 @@ msgstr "Nome"
|
||||
msgid "Network"
|
||||
msgstr "Rete"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
@@ -446,9 +446,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Niente selezionato"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Off"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Obsoleto di %d"
|
||||
@@ -554,6 +551,9 @@ msgstr ""
|
||||
msgid "Retraction Speed"
|
||||
msgstr ""
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Riprova #%s"
|
||||
@@ -708,9 +708,6 @@ msgstr "In aggiornamento"
|
||||
msgid "Uploaded"
|
||||
msgstr "Caricato"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Visual. Mesh"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -775,6 +772,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Elimina"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Inizio"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Off"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Visual. Mesh"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "Ordine: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -2,7 +2,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: NSteven\n"
|
||||
"Language-Team: NSteven\n"
|
||||
@@ -176,9 +176,6 @@ msgstr "날짜"
|
||||
msgid "Decrease"
|
||||
msgstr "낮추기"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "삭제"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -285,9 +282,6 @@ msgstr "온도 섹션에서 센서 항목 숨김."
|
||||
msgid "Hide temp."
|
||||
msgstr "온도 숨김"
|
||||
|
||||
msgid "Home"
|
||||
msgstr "홈"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "전체 홈"
|
||||
|
||||
@@ -417,6 +411,9 @@ msgstr "중간"
|
||||
msgid "Menu"
|
||||
msgstr "메뉴"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "수정됨"
|
||||
|
||||
@@ -435,6 +432,9 @@ msgstr "이름"
|
||||
msgid "Network"
|
||||
msgstr "네트워크"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "신규"
|
||||
|
||||
@@ -446,9 +446,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "아무것도 선택하지 않ㅇ"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "끄기"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "%d 보다 오래됨"
|
||||
@@ -553,6 +550,9 @@ msgstr "퇴추 길이"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "퇴출 속도"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "재시도 #%s"
|
||||
@@ -707,9 +707,6 @@ msgstr "업데이트 중.."
|
||||
msgid "Uploaded"
|
||||
msgstr "업로드됨"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "메쉬 프로파일 보기"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -772,6 +769,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "삭제"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "홈"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "끄기"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "메쉬 프로파일 보기"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "분류 기준: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-03-31 11:06-0300\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@@ -182,9 +182,6 @@ msgstr "Data"
|
||||
msgid "Decrease"
|
||||
msgstr "Obniż"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Skasuj"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -291,9 +288,6 @@ msgstr "Ukryj czujniki w Temp."
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Baza"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Baza Wszystkich"
|
||||
|
||||
@@ -423,6 +417,9 @@ msgstr "Średni"
|
||||
msgid "Menu"
|
||||
msgstr "Menu"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Zmodyfikowane"
|
||||
|
||||
@@ -441,6 +438,9 @@ msgstr "Nazwa"
|
||||
msgid "Network"
|
||||
msgstr "Sieć"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
@@ -452,9 +452,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Nic nie wybrano"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Wyłącz"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Nieaktualne przez %d"
|
||||
@@ -561,6 +558,9 @@ msgstr ""
|
||||
msgid "Retraction Speed"
|
||||
msgstr ""
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Spróbuj ponownie #%s"
|
||||
@@ -715,9 +715,6 @@ msgstr "Aktualizacja"
|
||||
msgid "Uploaded"
|
||||
msgstr "Przesłane"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Wyświetl siatkę"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -784,6 +781,18 @@ msgstr "mm/s²"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Skasuj"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Baza"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Wyłącz"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Wyświetl siatkę"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "Sortuj wg: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -6,7 +6,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-06-03 20:25-0500\n"
|
||||
"Last-Translator: Jakob Kais <schpuntik@freenet.de>\n"
|
||||
"Language-Team: \n"
|
||||
@@ -182,9 +182,6 @@ msgstr "Дата"
|
||||
msgid "Decrease"
|
||||
msgstr "Уменьшить"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Удалить"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -291,9 +288,6 @@ msgstr "Скрыть датчики в Temp."
|
||||
msgid "Hide temp."
|
||||
msgstr "Скрыть температуру."
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Парковка"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Парковать все"
|
||||
|
||||
@@ -423,6 +417,9 @@ msgstr "Среднее"
|
||||
msgid "Menu"
|
||||
msgstr "Меню"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Изменено"
|
||||
|
||||
@@ -441,6 +438,9 @@ msgstr "Имя"
|
||||
msgid "Network"
|
||||
msgstr "Сеть"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "Новый"
|
||||
|
||||
@@ -452,9 +452,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Ничего не выбрано"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Выкл"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Устарело на %d"
|
||||
@@ -561,6 +558,9 @@ msgstr "Длина ретракта"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "Скорость ретракта"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Повторить #%s"
|
||||
@@ -715,9 +715,6 @@ msgstr "Обновление"
|
||||
msgid "Uploaded"
|
||||
msgstr "Дата"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Смотреть сетку"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -784,6 +781,18 @@ msgstr "мм/с"
|
||||
msgid "mm/s²"
|
||||
msgstr "мм/с²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Удалить"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Парковка"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Выкл"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Смотреть сетку"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "Орден: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-04-15 17:25+0200\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@@ -181,9 +181,6 @@ msgstr "Datum"
|
||||
msgid "Decrease"
|
||||
msgstr "Minska"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Radera"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr "Dölj sensorer i Temp."
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Hem"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Hem Alla"
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr "Medium"
|
||||
msgid "Menu"
|
||||
msgstr "Meny"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Ändrad"
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr "Namn"
|
||||
msgid "Network"
|
||||
msgstr "Nätverk"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
@@ -451,9 +451,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Inget valt"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Avstängd"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr ""
|
||||
@@ -559,6 +556,9 @@ msgstr ""
|
||||
msgid "Retraction Speed"
|
||||
msgstr ""
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr ""
|
||||
@@ -713,9 +713,6 @@ msgstr "Uppdaterar"
|
||||
msgid "Uploaded"
|
||||
msgstr "Uppladdad"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr ""
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -780,6 +777,15 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Radera"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Hem"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Avstängd"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "Sortera efter: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"PO-Revision-Date: 2022-09-21 19:32+0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-10-30 16:54+0300\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: tr_TR\n"
|
||||
@@ -64,7 +64,7 @@ msgid "Apply %s%.2f offset to Probe?"
|
||||
msgstr "Prob için %s%.2f ofset uygula?"
|
||||
|
||||
msgid "Are you sure do you want to exclude the object?"
|
||||
msgstr ""
|
||||
msgstr "Nesneyi hariç tutmak istediğinizden emin misiniz?"
|
||||
|
||||
msgid "Are you sure you want to run Emergency Stop?"
|
||||
msgstr "Acil Durdurma'yı çalıştırmak istediğinizden emin misiniz?"
|
||||
@@ -181,9 +181,6 @@ msgstr "Tarih"
|
||||
msgid "Decrease"
|
||||
msgstr "Azalt"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Sil"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr "Dosyayı Sil?"
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr "Sıcaklıktaki sensörleri gizleyin."
|
||||
msgid "Hide temp."
|
||||
msgstr "Sıcaklığı gizle."
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Ana Ekran"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Eksenleri Sıfırla"
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr "Orta"
|
||||
msgid "Menu"
|
||||
msgstr "Menü"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Değiştirilmiş"
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr "İsim"
|
||||
msgid "Network"
|
||||
msgstr "Ağ"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "Yeni"
|
||||
|
||||
@@ -453,9 +453,6 @@ msgstr ""
|
||||
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"
|
||||
@@ -508,13 +505,13 @@ msgid "Print Time"
|
||||
msgstr "Yazdırma Süresi"
|
||||
|
||||
msgid "Printer"
|
||||
msgstr ""
|
||||
msgstr "Yazıcı"
|
||||
|
||||
msgid "Printer Connections"
|
||||
msgstr "Yazıcı Bağlantıları"
|
||||
|
||||
msgid "Printer Select"
|
||||
msgstr ""
|
||||
msgstr "Yazıcı Seçimi"
|
||||
|
||||
msgid "Printing"
|
||||
msgstr "Yazdırılıyor"
|
||||
@@ -561,6 +558,9 @@ msgstr "Geri Çekme Uzunluğu"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "Geri Çekme Hızı"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Yeniden Dene #%s"
|
||||
@@ -616,10 +616,10 @@ msgid "Show"
|
||||
msgstr "Göster"
|
||||
|
||||
msgid "Show Heater Power"
|
||||
msgstr ""
|
||||
msgstr "Isıtıcı Gücünü Göster"
|
||||
|
||||
msgid "Shutdown"
|
||||
msgstr ""
|
||||
msgstr "Kapat"
|
||||
|
||||
msgid "Size"
|
||||
msgstr "Boyut"
|
||||
@@ -715,9 +715,6 @@ msgstr "Yükleniyor"
|
||||
msgid "Uploaded"
|
||||
msgstr "Yüklendi"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Örgüyü Görüntüle"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -782,6 +779,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Sil"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Ana Ekran"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Kapa"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Örgüyü Görüntüle"
|
||||
|
||||
#~ msgid "Machine"
|
||||
#~ msgstr "Makine"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 2022-09-04 14:53-0300\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-09-16 21:40+0300\n"
|
||||
"Last-Translator: Andrii Komarovskyi\n"
|
||||
"Language-Team: Andrii Komarovskyi\n"
|
||||
@@ -182,9 +182,6 @@ msgstr "Дата"
|
||||
msgid "Decrease"
|
||||
msgstr "Зменшити"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "Видалити"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr "Видалити файл?"
|
||||
|
||||
@@ -295,9 +292,6 @@ msgstr "Сховати датчик t°."
|
||||
msgid "Hide temp."
|
||||
msgstr "Приховати темп."
|
||||
|
||||
msgid "Home"
|
||||
msgstr "Домашня сторінка"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "Дім Всі"
|
||||
|
||||
@@ -429,6 +423,9 @@ msgstr "Середній"
|
||||
msgid "Menu"
|
||||
msgstr "Меню"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "Змінено"
|
||||
|
||||
@@ -447,6 +444,9 @@ msgstr "Ім'я"
|
||||
msgid "Network"
|
||||
msgstr "Сітка"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr "Новий"
|
||||
|
||||
@@ -460,9 +460,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "Не обрано"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "Вимк"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "Застаріло на %d"
|
||||
@@ -573,6 +570,9 @@ msgstr "Довжина втягування"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "Швидкість втягування"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "Повторіть #%s"
|
||||
@@ -727,9 +727,6 @@ msgstr "Оновлення"
|
||||
msgid "Uploaded"
|
||||
msgstr "Завантажено"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "Показати сітку"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -796,6 +793,18 @@ msgstr "мм/с"
|
||||
msgid "mm/s²"
|
||||
msgstr "мм/с²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "Видалити"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "Домашня сторінка"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "Вимк"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "Показати сітку"
|
||||
|
||||
#~ msgid "Machine"
|
||||
#~ msgstr "Машина"
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-07-16 23:03+0800\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@@ -181,9 +181,6 @@ msgstr "日期"
|
||||
msgid "Decrease"
|
||||
msgstr "减少"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "删除"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr "隐藏温度传感器。"
|
||||
msgid "Hide temp."
|
||||
msgstr "隐藏温度。"
|
||||
|
||||
msgid "Home"
|
||||
msgstr "首页"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "全部归零"
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr "中"
|
||||
msgid "Menu"
|
||||
msgstr "菜单"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "修改时间"
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr "文件名称"
|
||||
msgid "Network"
|
||||
msgstr "网络"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
@@ -451,9 +451,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "未选择任何内容"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "关闭"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "已过时 %d"
|
||||
@@ -558,6 +555,9 @@ msgstr "回抽长度"
|
||||
msgid "Retraction Speed"
|
||||
msgstr "回抽速度"
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "重试 #%s"
|
||||
@@ -712,9 +712,6 @@ msgstr "更新中"
|
||||
msgid "Uploaded"
|
||||
msgstr "上传时间"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "查看热床网格"
|
||||
|
||||
msgid "X+"
|
||||
msgstr ""
|
||||
|
||||
@@ -777,6 +774,18 @@ msgstr ""
|
||||
msgid "mm/s²"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "删除"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "首页"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "关闭"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "查看热床网格"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "排序: "
|
||||
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: KlipperScreen\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-10-27 23:42-0300\n"
|
||||
"POT-Creation-Date: 2022-11-12 11:20-0300\n"
|
||||
"PO-Revision-Date: 2022-03-31 11:25-0300\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
@@ -181,9 +181,6 @@ msgstr "日期"
|
||||
msgid "Decrease"
|
||||
msgstr "減少"
|
||||
|
||||
msgid "Delete"
|
||||
msgstr "刪除"
|
||||
|
||||
msgid "Delete File?"
|
||||
msgstr ""
|
||||
|
||||
@@ -290,9 +287,6 @@ msgstr "在溫度中隱藏傳感器。"
|
||||
msgid "Hide temp."
|
||||
msgstr ""
|
||||
|
||||
msgid "Home"
|
||||
msgstr "首頁"
|
||||
|
||||
msgid "Home All"
|
||||
msgstr "歸零全部"
|
||||
|
||||
@@ -422,6 +416,9 @@ msgstr "中"
|
||||
msgid "Menu"
|
||||
msgstr "選單"
|
||||
|
||||
msgid "Mesh calibrate"
|
||||
msgstr ""
|
||||
|
||||
msgid "Modified"
|
||||
msgstr "修改"
|
||||
|
||||
@@ -440,6 +437,9 @@ msgstr "名稱"
|
||||
msgid "Network"
|
||||
msgstr "網路"
|
||||
|
||||
msgid "Never"
|
||||
msgstr ""
|
||||
|
||||
msgid "New"
|
||||
msgstr ""
|
||||
|
||||
@@ -451,9 +451,6 @@ msgstr ""
|
||||
msgid "Nothing selected"
|
||||
msgstr "未選擇任何內容"
|
||||
|
||||
msgid "Off"
|
||||
msgstr "關閉"
|
||||
|
||||
#, python-format
|
||||
msgid "Outdated by %d"
|
||||
msgstr "已過時 %d"
|
||||
@@ -558,6 +555,9 @@ msgstr ""
|
||||
msgid "Retraction Speed"
|
||||
msgstr ""
|
||||
|
||||
msgid "Retry"
|
||||
msgstr ""
|
||||
|
||||
#, python-format
|
||||
msgid "Retry #%s"
|
||||
msgstr "重試 #%s"
|
||||
@@ -712,9 +712,6 @@ msgstr "更新"
|
||||
msgid "Uploaded"
|
||||
msgstr "上傳時間"
|
||||
|
||||
msgid "View Mesh"
|
||||
msgstr "檢視網格"
|
||||
|
||||
msgid "X+"
|
||||
msgstr "X+"
|
||||
|
||||
@@ -777,6 +774,18 @@ msgstr "mm/s"
|
||||
msgid "mm/s²"
|
||||
msgstr "mm/s²"
|
||||
|
||||
#~ msgid "Delete"
|
||||
#~ msgstr "刪除"
|
||||
|
||||
#~ msgid "Home"
|
||||
#~ msgstr "首頁"
|
||||
|
||||
#~ msgid "Off"
|
||||
#~ msgstr "關閉"
|
||||
|
||||
#~ msgid "View Mesh"
|
||||
#~ msgstr "檢視網格"
|
||||
|
||||
#~ msgid "Sort by: "
|
||||
#~ msgstr "排序: "
|
||||
|
||||
|
||||
+29
-95
@@ -6,69 +6,51 @@ from gi.repository import Gdk, GLib
|
||||
|
||||
|
||||
class Printer:
|
||||
def __init__(self, printer_info, data, state_execute_cb):
|
||||
self.klipper = {"version": printer_info['software_version']}
|
||||
self.tempstore = None
|
||||
def __init__(self, state_cb):
|
||||
self.config = None
|
||||
self.data = None
|
||||
self.state = "disconnected"
|
||||
self.state_cb = state_execute_cb
|
||||
self.power_devices = {}
|
||||
self.store_timeout = False
|
||||
self.data = data
|
||||
self.state_cb = state_cb
|
||||
self.state_callbacks = None
|
||||
self.devices = {}
|
||||
self.power_devices = {}
|
||||
self.state_callbacks = {
|
||||
"disconnected": None,
|
||||
"error": None,
|
||||
"paused": None,
|
||||
"printing": None,
|
||||
"ready": None,
|
||||
"startup": None,
|
||||
"shutdown": None
|
||||
}
|
||||
self.tools = []
|
||||
self.extrudercount = 0
|
||||
self.tempdevcount = 0
|
||||
self.fancount = 0
|
||||
self.output_pin_count = 0
|
||||
self.store_timeout = None
|
||||
self.tempstore = {}
|
||||
|
||||
def reset(self):
|
||||
GLib.source_remove(self.store_timeout)
|
||||
self.store_timeout = None
|
||||
self.config = None
|
||||
self.data = None
|
||||
self.state = None
|
||||
self.state_cb = None
|
||||
self.data = None
|
||||
self.state_callbacks = None
|
||||
self.devices = None
|
||||
self.power_devices = None
|
||||
self.state_callbacks = None
|
||||
self.tools = None
|
||||
self.extrudercount = None
|
||||
self.tempdevcount = None
|
||||
self.fancount = None
|
||||
self.config = None
|
||||
self.klipper = None
|
||||
self.tempstore = None
|
||||
self.output_pin_count = None
|
||||
self.store_timeout = None
|
||||
self.tempstore = None
|
||||
|
||||
def reinit(self, printer_info, data):
|
||||
logging.debug(f"Moonraker object status: {data}")
|
||||
self.config = data['configfile']['config']
|
||||
self.data = data
|
||||
self.devices = {}
|
||||
self.tools = []
|
||||
self.extrudercount = 0
|
||||
self.tempdevcount = 0
|
||||
self.fancount = 0
|
||||
self.output_pin_count = 0
|
||||
self.tools = []
|
||||
self.devices = {}
|
||||
self.data = data
|
||||
self.klipper = {}
|
||||
self.tempstore = {}
|
||||
if not self.store_timeout:
|
||||
self.store_timeout = GLib.timeout_add_seconds(1, self._update_temp_store)
|
||||
|
||||
self.klipper = {
|
||||
"version": printer_info['software_version']
|
||||
}
|
||||
|
||||
for x in self.config.keys():
|
||||
if x[:8] == "extruder":
|
||||
self.tools.append(x)
|
||||
@@ -100,22 +82,11 @@ class Printer:
|
||||
name = x.split()[1] if len(x.split()) > 1 else x
|
||||
if not name.startswith("_"):
|
||||
self.fancount += 1
|
||||
if x.startswith('output_pin '):
|
||||
# Support for hiding devices by name
|
||||
if not x.split()[1].startswith("_"):
|
||||
self.output_pin_count += 1
|
||||
if x.startswith('bed_mesh '):
|
||||
r = self.config[x]
|
||||
r['x_count'] = int(r['x_count'])
|
||||
r['y_count'] = int(r['y_count'])
|
||||
r['max_x'] = float(r['max_x'])
|
||||
r['min_x'] = float(r['min_x'])
|
||||
r['max_y'] = float(r['max_y'])
|
||||
r['min_y'] = float(r['min_y'])
|
||||
r['points'] = [[float(j.strip()) for j in i.split(",")] for i in r['points'].strip().split("\n")]
|
||||
if x.startswith('output_pin ') and not x.split()[1].startswith("_"):
|
||||
self.output_pin_count += 1
|
||||
self.process_update(data)
|
||||
|
||||
logging.info(f"Klipper version: {self.klipper['version']}")
|
||||
logging.info(f"Klipper version: {printer_info['software_version']}")
|
||||
logging.info(f"# Extruders: {self.extrudercount}")
|
||||
logging.info(f"# Temperature devices: {self.tempdevcount}")
|
||||
logging.info(f"# Fans: {self.fancount}")
|
||||
@@ -137,19 +108,14 @@ class Printer:
|
||||
if "webhooks" in data or "print_stats" in data:
|
||||
self.process_status_update()
|
||||
|
||||
def get_updates(self):
|
||||
updates = self.data.copy()
|
||||
updates.update(self.devices)
|
||||
return updates
|
||||
|
||||
def evaluate_state(self):
|
||||
# webhooks states: startup, ready, shutdown, error
|
||||
if self.data['webhooks']['state'] == "ready":
|
||||
if self.data['print_stats']: # standby, printing, paused, error, complete
|
||||
if self.data['print_stats']['state'] == 'paused' or self.data.get('pause_resume').get('is_paused'):
|
||||
return "paused"
|
||||
if self.data['print_stats']['state'] == 'printing':
|
||||
return "printing"
|
||||
# print_stats: standby, printing, paused, error, complete
|
||||
if self.data['webhooks']['state'] == "ready" and self.data['print_stats']:
|
||||
if self.data['print_stats']['state'] == 'paused' or self.data.get('pause_resume').get('is_paused'):
|
||||
return "paused"
|
||||
if self.data['print_stats']['state'] == 'printing':
|
||||
return "printing"
|
||||
return self.data['webhooks']['state']
|
||||
|
||||
def process_status_update(self):
|
||||
@@ -164,17 +130,12 @@ class Printer:
|
||||
def change_state(self, state):
|
||||
if state not in list(self.state_callbacks): # disconnected, startup, ready, shutdown, error, paused, printing
|
||||
return
|
||||
logging.debug(f"Changing state from '{self.state}' to '{state}'")
|
||||
prev_state = self.state
|
||||
self.state = state
|
||||
if state != self.state:
|
||||
logging.debug(f"Changing state from '{self.state}' to '{state}'")
|
||||
self.state = state
|
||||
if self.state_callbacks[state] is not None:
|
||||
logging.debug(f"Adding callback for state: {state}")
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_HIGH_IDLE,
|
||||
self.state_cb,
|
||||
self.state_callbacks[state],
|
||||
prev_state
|
||||
)
|
||||
GLib.idle_add(self.state_cb, self.state_callbacks[state])
|
||||
|
||||
def configure_power_devices(self, data):
|
||||
self.power_devices = {}
|
||||
@@ -194,9 +155,6 @@ class Printer:
|
||||
def get_config_section(self, section):
|
||||
return self.config[section] if section in self.config else False
|
||||
|
||||
def get_data(self):
|
||||
return self.data
|
||||
|
||||
def get_fans(self):
|
||||
fans = []
|
||||
if self.config_section_exists("fan"):
|
||||
@@ -209,7 +167,6 @@ class Printer:
|
||||
def get_output_pins(self):
|
||||
output_pins = []
|
||||
output_pins.extend(iter(self.get_config_section_list("output_pin ")))
|
||||
logging.debug(f"{output_pins}")
|
||||
return output_pins
|
||||
|
||||
def get_gcode_macros(self):
|
||||
@@ -254,9 +211,6 @@ class Printer:
|
||||
|
||||
return data
|
||||
|
||||
def get_klipper_version(self):
|
||||
return self.klipper['version']
|
||||
|
||||
def get_power_devices(self):
|
||||
return list(self.power_devices)
|
||||
|
||||
@@ -272,20 +226,6 @@ class Printer:
|
||||
return self.data[stat][substat] if substat in self.data[stat] else {}
|
||||
return self.data[stat]
|
||||
|
||||
def get_state(self):
|
||||
return self.state
|
||||
|
||||
def set_dev_temps(self, dev, temp, target=None, power=None):
|
||||
if dev in self.devices:
|
||||
self.devices[dev]['temperature'] = temp
|
||||
if target is not None:
|
||||
self.devices[dev]['target'] = target
|
||||
if power is not None:
|
||||
self.devices[dev]['power'] = power
|
||||
|
||||
def get_dev_stats(self, dev):
|
||||
return self.devices[dev] if dev in self.devices else None
|
||||
|
||||
def get_dev_stat(self, dev, stat):
|
||||
if dev in self.devices and stat in self.devices[dev]:
|
||||
return self.devices[dev][stat]
|
||||
@@ -314,9 +254,6 @@ class Printer:
|
||||
return self.config[pin]["value"]
|
||||
return 0
|
||||
|
||||
def get_extruder_count(self):
|
||||
return self.extrudercount
|
||||
|
||||
def get_temp_store_devices(self):
|
||||
if self.tempstore is not None:
|
||||
return list(self.tempstore)
|
||||
@@ -364,11 +301,6 @@ class Printer:
|
||||
def config_section_exists(self, section):
|
||||
return section in self.get_config_section_list()
|
||||
|
||||
def set_callbacks(self, callbacks):
|
||||
for name, cb in callbacks.items():
|
||||
if name in list(self.state_callbacks):
|
||||
self.state_callbacks[name] = cb
|
||||
|
||||
def set_dev_stat(self, dev, stat, value):
|
||||
if dev not in self.devices:
|
||||
return
|
||||
@@ -376,6 +308,8 @@ class Printer:
|
||||
self.devices[dev][stat] = value
|
||||
|
||||
def _update_temp_store(self):
|
||||
if self.tempstore is None:
|
||||
return False
|
||||
for device in self.tempstore:
|
||||
for x in self.tempstore[device]:
|
||||
if len(self.tempstore[device][x]) >= 1200:
|
||||
|
||||
@@ -4,8 +4,6 @@ import logging
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
|
||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||
|
||||
|
||||
class ScreenPanel:
|
||||
|
||||
@@ -21,6 +19,7 @@ class ScreenPanel:
|
||||
self.title = title
|
||||
self.devices = {}
|
||||
self.active_heaters = []
|
||||
self.ks_printer_cfg = None
|
||||
|
||||
self.layout = Gtk.Layout()
|
||||
self.layout.set_size(self._screen.width, self._screen.height)
|
||||
@@ -32,12 +31,7 @@ class ScreenPanel:
|
||||
|
||||
self._show_heater_power = self._config.get_main_config().getboolean('show_heater_power', False)
|
||||
|
||||
def initialize(self, panel_name):
|
||||
# Create gtk items here
|
||||
return
|
||||
|
||||
def emergency_stop(self, widget):
|
||||
|
||||
if self._config.get_main_config().getboolean('confirm_estop', False):
|
||||
self._screen._confirm_send_action(widget, _("Are you sure you want to run Emergency Stop?"),
|
||||
"printer.emergency_stop")
|
||||
@@ -67,24 +61,7 @@ class ScreenPanel:
|
||||
def get_title(self):
|
||||
return self.title
|
||||
|
||||
def home(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
|
||||
|
||||
def homexy(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME_XY)
|
||||
|
||||
def z_tilt(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.Z_TILT)
|
||||
|
||||
def quad_gantry_level(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.QUAD_GANTRY_LEVEL)
|
||||
|
||||
def menu_item_clicked(self, widget, panel, item):
|
||||
logging.info(f"### Creating panel {item['panel']} : {panel} {item}")
|
||||
if "items" in item:
|
||||
self._screen.show_panel(f'{self._screen._cur_panels[-1]}_{panel}',
|
||||
item['panel'], item['name'], 1, False, items=item['items'])
|
||||
return
|
||||
self._screen.show_panel(f'{self._screen._cur_panels[-1]}_{panel}', item['panel'], item['name'], 1, False)
|
||||
|
||||
def menu_return(self, widget, home=False):
|
||||
@@ -99,10 +76,6 @@ class ScreenPanel:
|
||||
def show_all(self):
|
||||
self._screen.show_all()
|
||||
|
||||
def update_image_text(self, label, text):
|
||||
if label in self.labels and 'l' in self.labels[label]:
|
||||
self.labels[label]['l'].set_text(text)
|
||||
|
||||
def load_menu(self, widget, name):
|
||||
if f"{name}_menu" not in self.labels:
|
||||
return
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
class BedMap(Gtk.DrawingArea):
|
||||
def __init__(self, font_size, bm):
|
||||
super().__init__()
|
||||
self.set_hexpand(True)
|
||||
self.set_vexpand(True)
|
||||
self.connect('draw', self.draw_graph)
|
||||
self.font_size = font_size
|
||||
self.font_spacing = round(self.font_size * 1.5)
|
||||
self.bm = list(reversed(bm)) if bm is not None else None
|
||||
|
||||
def update_bm(self, bm):
|
||||
self.bm = list(reversed(bm)) if bm is not None else None
|
||||
|
||||
def draw_graph(self, da, ctx):
|
||||
width = da.get_allocated_width()
|
||||
height = da.get_allocated_height()
|
||||
# Styling
|
||||
ctx.set_line_width(1)
|
||||
ctx.set_font_size(self.font_size)
|
||||
|
||||
if self.bm is None:
|
||||
ctx.move_to(self.font_spacing, height / 2)
|
||||
ctx.set_source_rgb(0.5, 0.5, 0.5)
|
||||
ctx.show_text(_("No mesh has been loaded"))
|
||||
ctx.stroke()
|
||||
return
|
||||
|
||||
rows = len(self.bm)
|
||||
columns = len(self.bm[0])
|
||||
for i, row in enumerate(self.bm):
|
||||
ty = height / rows * i
|
||||
by = ty + height / rows
|
||||
for j, column in enumerate(row):
|
||||
lx = width / columns * j
|
||||
rx = lx + width / columns
|
||||
# Colors
|
||||
ctx.set_source_rgb(*self.colorbar(column))
|
||||
ctx.move_to(lx, ty)
|
||||
ctx.line_to(lx, by)
|
||||
ctx.line_to(rx, by)
|
||||
ctx.line_to(rx, ty)
|
||||
ctx.close_path()
|
||||
ctx.fill()
|
||||
ctx.stroke()
|
||||
# Numbers
|
||||
ctx.set_source_rgb(0, 0, 0)
|
||||
ctx.move_to((lx + rx) / 2 - self.font_size, (ty + by + self.font_size) / 2)
|
||||
ctx.show_text(f"{column:.2f}")
|
||||
ctx.stroke()
|
||||
|
||||
@staticmethod
|
||||
def colorbar(value):
|
||||
rmax = 0.25
|
||||
color = min(1, max(0, 1 - 1 / rmax * abs(value)))
|
||||
if value > 0:
|
||||
return [1, color, color]
|
||||
if value < 0:
|
||||
return [color, color, 1]
|
||||
return [1, 1, 1]
|
||||
@@ -47,9 +47,15 @@ class HeaterGraph(Gtk.DrawingArea):
|
||||
for name in self.store if "temperatures" in self.store[name])
|
||||
|
||||
def get_max_num(self, data_points=0):
|
||||
mnum = []
|
||||
for x in self.store:
|
||||
mnum.extend(max(self.printer.get_temp_store(x, t, data_points)) for t in self.store[x] if t != "show")
|
||||
mnum = [0]
|
||||
for device in self.store:
|
||||
if self.store[device]['show']:
|
||||
temp = self.printer.get_temp_store(device, "temperatures", data_points)
|
||||
if temp:
|
||||
mnum.append(max(temp))
|
||||
target = self.printer.get_temp_store(device, "targets", data_points)
|
||||
if target:
|
||||
mnum.append(max(target))
|
||||
return max(mnum)
|
||||
|
||||
def draw_graph(self, da, ctx):
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import logging
|
||||
import os
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
@@ -5,63 +7,108 @@ from gi.repository import Gtk, GLib
|
||||
|
||||
|
||||
class Keyboard(Gtk.Box):
|
||||
langs = ["de", "en", "es"]
|
||||
|
||||
def __init__(self, screen, close_cb, entry=None):
|
||||
super().__init__(orientation=Gtk.Orientation.VERTICAL)
|
||||
_ = screen.lang.gettext
|
||||
self._gtk = screen.gtk
|
||||
self.close_cb = close_cb
|
||||
self.keyboard = Gtk.Grid()
|
||||
self.keyboard.set_direction(Gtk.TextDirection.LTR)
|
||||
self.timeout = self.clear_timeout = None
|
||||
self.entry = entry
|
||||
|
||||
self.keys = [
|
||||
[["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "⌫"],
|
||||
["a", "s", "d", "f", "g", "h", "j", "k", "l", "'"],
|
||||
["ABC", "z", "x", "c", "v", "b", "n", "m", ",", ".", "?123"],
|
||||
["✕", " ", "✔"]
|
||||
],
|
||||
[["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "⌫"],
|
||||
["A", "S", "D", "F", "G", "H", "J", "K", "L", "'"],
|
||||
["?123", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "abc"],
|
||||
["✕", " ", "✔"]
|
||||
],
|
||||
[["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "⌫"],
|
||||
["=", "-", "+", "*", "/", "\\", ":", ";", "'", "\""],
|
||||
["abc", "(", ")", "#", "$", "!", "?", "@", "_", ",", "ABC"],
|
||||
["✕", " ", "✔"]
|
||||
]
|
||||
]
|
||||
language = self.detect_language(screen._config.get_main_config().get("language", None))
|
||||
logging.info(f"Keyboard {language}")
|
||||
|
||||
self.labels = self.keys.copy()
|
||||
if language == "de":
|
||||
self.keys = [
|
||||
[
|
||||
["q", "w", "e", "r", "t", "z", "u", "i", "o", "p", "ü", "⌫"],
|
||||
["a", "s", "d", "f", "g", "h", "j", "k", "l", "ö", "ä"],
|
||||
["ABC", "y", "x", "c", "v", "b", "n", "m", ",", ".", "?123"],
|
||||
],
|
||||
[
|
||||
["Q", "W", "E", "R", "T", "Z", "U", "I", "O", "P", "Ü", "⌫"],
|
||||
["A", "S", "D", "F", "G", "H", "J", "K", "L", "Ö", "Ä"],
|
||||
["?123", "Y", "X", "C", "V", "B", "N", "M", ",", ".", "abc"],
|
||||
],
|
||||
[
|
||||
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "ß", "⌫"],
|
||||
["=", "-", "+", "*", "/", "\\", ":", ";", "'", "\"", "ẞ"],
|
||||
["abc", "(", ")", "#", "$", "!", "?", "@", "_", ",", "ABC"],
|
||||
]
|
||||
]
|
||||
else:
|
||||
self.keys = [
|
||||
[
|
||||
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "⌫"],
|
||||
["a", "s", "d", "f", "g", "h", "j", "k", "l", "'"],
|
||||
["ABC", "z", "x", "c", "v", "b", "n", "m", ",", ".", "?123"],
|
||||
],
|
||||
[
|
||||
["Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "⌫"],
|
||||
["A", "S", "D", "F", "G", "H", "J", "K", "L", "'"],
|
||||
["?123", "Z", "X", "C", "V", "B", "N", "M", ",", ".", "abc"],
|
||||
],
|
||||
[
|
||||
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "⌫"],
|
||||
["=", "-", "+", "*", "/", "\\", ":", ";", "'", "\""],
|
||||
["abc", "(", ")", "#", "$", "!", "?", "@", "_", ",", "ABC"],
|
||||
]
|
||||
]
|
||||
|
||||
if language == "es":
|
||||
self.keys[0][1].remove("'")
|
||||
self.keys[0][1].append("ñ")
|
||||
self.keys[1][1].remove("'")
|
||||
self.keys[1][1].append("Ñ")
|
||||
|
||||
for pallet in self.keys:
|
||||
pallet.append(["✕", " ", "✔"])
|
||||
|
||||
self.buttons = self.keys.copy()
|
||||
for p, pallet in enumerate(self.keys):
|
||||
for r, row in enumerate(pallet):
|
||||
for k, key in enumerate(row):
|
||||
self.labels[p][r][k] = self._gtk.Button(key)
|
||||
self.labels[p][r][k].set_hexpand(True)
|
||||
self.labels[p][r][k].set_vexpand(True)
|
||||
self.labels[p][r][k].connect('button-press-event', self.repeat, key)
|
||||
self.labels[p][r][k].connect('button-release-event', self.release)
|
||||
self.labels[p][r][k].get_style_context().add_class("keyboard_pad")
|
||||
if key == "⌫":
|
||||
self.buttons[p][r][k] = screen.gtk.ButtonImage("backspace", scale=.6)
|
||||
elif key == "✕":
|
||||
self.buttons[p][r][k] = screen.gtk.ButtonImage("cancel", scale=.6)
|
||||
elif key == "✔":
|
||||
self.buttons[p][r][k] = screen.gtk.ButtonImage("complete", scale=.6)
|
||||
else:
|
||||
self.buttons[p][r][k] = screen.gtk.Button(key)
|
||||
self.buttons[p][r][k].set_hexpand(True)
|
||||
self.buttons[p][r][k].set_vexpand(True)
|
||||
self.buttons[p][r][k].connect('button-press-event', self.repeat, key)
|
||||
self.buttons[p][r][k].connect('button-release-event', self.release)
|
||||
self.buttons[p][r][k].get_style_context().add_class("keyboard_pad")
|
||||
|
||||
self.pallet_nr = 0
|
||||
self.set_pallet(self.pallet_nr)
|
||||
self.add(self.keyboard)
|
||||
|
||||
def detect_language(self, language):
|
||||
if language is None or language == "system_lang":
|
||||
for language in self.langs:
|
||||
if os.getenv('LANG').lower().startswith(language):
|
||||
return language
|
||||
for _ in self.langs:
|
||||
if language.startswith(_):
|
||||
return _
|
||||
return "en"
|
||||
|
||||
def set_pallet(self, p):
|
||||
pallet = self.keys[p]
|
||||
span = 2
|
||||
for r, row in enumerate(pallet[:-1]):
|
||||
for _ in range(len(self.keys[self.pallet_nr]) + 1):
|
||||
self.keyboard.remove_row(0)
|
||||
self.pallet_nr = p
|
||||
for r, row in enumerate(self.keys[p][:-1]):
|
||||
for k, key in enumerate(row):
|
||||
x = k * 2 + 1 if r == 1 else k * 2
|
||||
old = self.keyboard.get_child_at(x, r)
|
||||
if old:
|
||||
self.keyboard.remove(old)
|
||||
self.keyboard.attach(self.labels[p][r][k], x, r, span, 1)
|
||||
if not self.keyboard.get_child_at(0, 4):
|
||||
self.keyboard.attach(self.labels[p][3][0], 0, 4, 3, 1)
|
||||
self.keyboard.attach(self.labels[p][3][1], 3, 4, 16, 1)
|
||||
self.keyboard.attach(self.labels[p][3][2], 19, 4, 3, 1)
|
||||
self.keyboard.attach(self.buttons[p][r][k], x, r, 2, 1)
|
||||
self.keyboard.attach(self.buttons[p][3][0], 0, 4, 3, 1) # ✕
|
||||
self.keyboard.attach(self.buttons[p][3][1], 3, 4, 16, 1) # Space
|
||||
self.keyboard.attach(self.buttons[p][3][2], 19, 4, 3, 1) # ✔
|
||||
self.show_all()
|
||||
|
||||
def repeat(self, widget, event, key):
|
||||
|
||||
@@ -8,7 +8,6 @@ class Keypad(Gtk.Box):
|
||||
def __init__(self, screen, change_temp, close_function):
|
||||
super().__init__(orientation=Gtk.Orientation.VERTICAL)
|
||||
|
||||
_ = screen.lang.gettext
|
||||
self.labels = {}
|
||||
self.change_temp = change_temp
|
||||
self.screen = screen
|
||||
|
||||
+12
-19
@@ -11,7 +11,7 @@ from queue import Queue
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import GLib, Gdk
|
||||
from gi.repository import GLib
|
||||
|
||||
|
||||
class WifiManager:
|
||||
@@ -103,10 +103,7 @@ class WifiManager:
|
||||
def callback(self, cb_type, msg):
|
||||
if cb_type in self._callbacks:
|
||||
for cb in self._callbacks[cb_type]:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_DEFAULT_IDLE,
|
||||
cb,
|
||||
msg)
|
||||
GLib.idle_add(cb, msg)
|
||||
|
||||
def connect(self, ssid):
|
||||
netid = None
|
||||
@@ -164,9 +161,8 @@ class WifiManager:
|
||||
self.networks[ssid]['connected'] = ssid == con_ssid
|
||||
if prev_ssid != self.connected_ssid:
|
||||
for cb in self._callbacks['connected']:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_DEFAULT_IDLE,
|
||||
cb, self.connected_ssid, prev_ssid)
|
||||
args = self.connected_ssid, prev_ssid
|
||||
GLib.idle_add(cb, *args)
|
||||
return [con_ssid, con_bssid]
|
||||
elif "ssid" in variables and "bssid" in variables:
|
||||
self.connected = True
|
||||
@@ -175,9 +171,8 @@ class WifiManager:
|
||||
self.networks[ssid]['connected'] = ssid == variables['ssid']
|
||||
if prev_ssid != self.connected_ssid:
|
||||
for cb in self._callbacks['connected']:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_DEFAULT_IDLE,
|
||||
cb, self.connected_ssid, prev_ssid)
|
||||
args = self.connected_ssid, prev_ssid
|
||||
GLib.idle_add(cb, *args)
|
||||
return [variables['ssid'], variables['bssid']]
|
||||
else:
|
||||
logging.info("Resetting connected_ssid")
|
||||
@@ -187,9 +182,8 @@ class WifiManager:
|
||||
self.networks[ssid]['connected'] = False
|
||||
if prev_ssid != self.connected_ssid:
|
||||
for cb in self._callbacks['connected']:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_DEFAULT_IDLE,
|
||||
cb, self.connected_ssid, prev_ssid)
|
||||
args = self.connected_ssid, prev_ssid
|
||||
GLib.idle_add(cb, *args)
|
||||
return None
|
||||
|
||||
def get_current_wifi_idle_add(self):
|
||||
@@ -289,9 +283,8 @@ class WifiManager:
|
||||
new_networks.append(net)
|
||||
if new_networks or deleted_networks:
|
||||
for cb in self._callbacks['scan_results']:
|
||||
Gdk.threads_add_idle(
|
||||
GLib.PRIORITY_DEFAULT_IDLE,
|
||||
cb, new_networks, deleted_networks)
|
||||
args = new_networks, deleted_networks
|
||||
GLib.idle_add(cb, *args)
|
||||
|
||||
def wpa_cli(self, command, wait=True):
|
||||
if wait is False:
|
||||
@@ -326,7 +319,7 @@ class WpaSocket(Thread):
|
||||
continue
|
||||
if msg.startswith("<"):
|
||||
if "CTRL-EVENT-SCAN-RESULTS" in msg:
|
||||
Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.wm.scan_results)
|
||||
GLib.idle_add(self.wm.scan_results)
|
||||
elif "CTRL-EVENT-DISCONNECTED" in msg:
|
||||
self.callback("connecting_status", msg)
|
||||
match = re.match('<3>CTRL-EVENT-DISCONNECTED bssid=(\\S+) reason=3 locally_generated=1', msg)
|
||||
@@ -338,7 +331,7 @@ class WpaSocket(Thread):
|
||||
elif "Trying to associate" in msg or "CTRL-EVENT-REGDOM-CHANGE" in msg:
|
||||
self.callback("connecting_status", msg)
|
||||
elif "CTRL-EVENT-CONNECTED" in msg:
|
||||
Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.wm.get_current_wifi_idle_add)
|
||||
GLib.idle_add(self.wm.get_current_wifi_idle_add)
|
||||
self.callback("connecting_status", msg)
|
||||
elif self.skip_commands > 0:
|
||||
self.skip_commands = self.skip_commands - 1
|
||||
|
||||
+69
-57
@@ -19,11 +19,13 @@ class BasePanel(ScreenPanel):
|
||||
self.time_min = -1
|
||||
self.time_format = self._config.get_main_config().getboolean("24htime", True)
|
||||
self.time_update = None
|
||||
self.titlebar_items = []
|
||||
self.titlebar_name_type = None
|
||||
self.buttons_showing = {
|
||||
'back': not back,
|
||||
'macros_shortcut': False,
|
||||
'printer_select': False
|
||||
'printer_select': False,
|
||||
'estop': False,
|
||||
}
|
||||
self.current_extruder = None
|
||||
# Action bar buttons
|
||||
@@ -110,74 +112,62 @@ class BasePanel(ScreenPanel):
|
||||
|
||||
# Layout is and content are on screen_panel
|
||||
self.layout.add(self.main_grid)
|
||||
|
||||
def initialize(self, panel_name):
|
||||
self.update_time()
|
||||
return
|
||||
|
||||
def show_heaters(self, show=True):
|
||||
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:
|
||||
return
|
||||
try:
|
||||
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:
|
||||
return
|
||||
|
||||
printer_cfg = self._config.get_printer_config(self._screen.connected_printer)
|
||||
if printer_cfg is not None:
|
||||
self.titlebar_name_type = printer_cfg.get("titlebar_name_type", None)
|
||||
else:
|
||||
self.titlebar_name_type = None
|
||||
logging.info(f"Titlebar name type: {self.titlebar_name_type}")
|
||||
img_size = self._gtk.img_scale * .5
|
||||
for device in self._screen.printer.get_temp_store_devices():
|
||||
self.labels[device] = Gtk.Label(label="100º")
|
||||
self.labels[device].set_ellipsize(Pango.EllipsizeMode.START)
|
||||
|
||||
img_size = self._gtk.img_scale * .5
|
||||
for device in self._screen.printer.get_temp_store_devices():
|
||||
self.labels[device] = Gtk.Label(label="100º")
|
||||
self.labels[device].set_ellipsize(Pango.EllipsizeMode.START)
|
||||
self.labels[f'{device}_box'] = Gtk.Box()
|
||||
icon = self.get_icon(device, img_size)
|
||||
if icon is not None:
|
||||
self.labels[f'{device}_box'].pack_start(icon, False, False, 3)
|
||||
self.labels[f'{device}_box'].pack_start(self.labels[device], False, False, 0)
|
||||
|
||||
self.labels[f'{device}_box'] = Gtk.Box()
|
||||
icon = self.get_icon(device, img_size)
|
||||
if icon is not None:
|
||||
self.labels[f'{device}_box'].pack_start(icon, False, False, 3)
|
||||
self.labels[f'{device}_box'].pack_start(self.labels[device], False, False, 0)
|
||||
# Limit the number of items according to resolution
|
||||
nlimit = int(round(log(self._screen.width, 10) * 5 - 10.5))
|
||||
|
||||
# Limit the number of items according to resolution
|
||||
nlimit = int(round(log(self._screen.width, 10) * 5 - 10.5))
|
||||
n = 0
|
||||
if self._screen.printer.get_tools():
|
||||
self.current_extruder = self._screen.printer.get_stat("toolhead", "extruder")
|
||||
if self.current_extruder and f"{self.current_extruder}_box" in self.labels:
|
||||
self.control['temp_box'].add(self.labels[f"{self.current_extruder}_box"])
|
||||
n += 1
|
||||
|
||||
n = 0
|
||||
if self._screen.printer.get_tools():
|
||||
self.current_extruder = self._screen.printer.get_stat("toolhead", "extruder")
|
||||
if self.current_extruder and f"{self.current_extruder}_box" in self.labels:
|
||||
self.control['temp_box'].add(self.labels[f"{self.current_extruder}_box"])
|
||||
if self._screen.printer.has_heated_bed():
|
||||
self.control['temp_box'].add(self.labels['heater_bed_box'])
|
||||
n += 1
|
||||
|
||||
if self._screen.printer.has_heated_bed():
|
||||
self.control['temp_box'].add(self.labels['heater_bed_box'])
|
||||
n += 1
|
||||
|
||||
# Options in the config have priority
|
||||
if printer_cfg is not None:
|
||||
titlebar_items = printer_cfg.get("titlebar_items", None)
|
||||
if titlebar_items is not None:
|
||||
titlebar_items = [str(i.strip()) for i in titlebar_items.split(',')]
|
||||
logging.info(f"Titlebar items: {titlebar_items}")
|
||||
for device in self._screen.printer.get_temp_store_devices():
|
||||
# Users can fill the bar if they want
|
||||
if n >= nlimit + 1:
|
||||
# Options in the config have priority
|
||||
for device in self._screen.printer.get_temp_store_devices():
|
||||
# Users can fill the bar if they want
|
||||
if n >= nlimit + 1:
|
||||
break
|
||||
name = device.split()[1] if len(device.split()) > 1 else device
|
||||
for item in self.titlebar_items:
|
||||
if name == item:
|
||||
self.control['temp_box'].add(self.labels[f"{device}_box"])
|
||||
n += 1
|
||||
break
|
||||
name = device.split()[1] if len(device.split()) > 1 else device
|
||||
for item in titlebar_items:
|
||||
if name == item:
|
||||
self.control['temp_box'].add(self.labels[f"{device}_box"])
|
||||
n += 1
|
||||
break
|
||||
|
||||
# If there is enough space fill with heater_generic
|
||||
for device in self._screen.printer.get_temp_store_devices():
|
||||
if n >= nlimit:
|
||||
break
|
||||
if device.startswith("heater_generic"):
|
||||
self.control['temp_box'].add(self.labels[f"{device}_box"])
|
||||
n += 1
|
||||
self.control['temp_box'].show_all()
|
||||
# If there is enough space fill with heater_generic
|
||||
for device in self._screen.printer.get_temp_store_devices():
|
||||
if n >= nlimit:
|
||||
break
|
||||
if device.startswith("heater_generic"):
|
||||
self.control['temp_box'].add(self.labels[f"{device}_box"])
|
||||
n += 1
|
||||
self.control['temp_box'].show_all()
|
||||
except Exception as e:
|
||||
logging.debug(f"Couldn't create heaters box: {e}")
|
||||
|
||||
def get_icon(self, device, img_size):
|
||||
if device.startswith("extruder"):
|
||||
@@ -285,6 +275,9 @@ class BasePanel(ScreenPanel):
|
||||
self.buttons_showing['printer_select'] = False
|
||||
|
||||
def set_title(self, title):
|
||||
if not title:
|
||||
self.titlelbl.set_label(f"{self._screen.connecting_to_printer}")
|
||||
return
|
||||
try:
|
||||
env = Environment(extensions=["jinja2.ext.i18n"], autoescape=True)
|
||||
env.install_gettext_translations(self._config.get_lang())
|
||||
@@ -306,3 +299,22 @@ class BasePanel(ScreenPanel):
|
||||
self.time_min = now.minute
|
||||
self.time_format = confopt
|
||||
return True
|
||||
|
||||
def show_estop(self, show=True):
|
||||
if show and self.buttons_showing['estop'] is False:
|
||||
self.control['estop'].set_sensitive(True)
|
||||
self.buttons_showing['estop'] = True
|
||||
elif show is False and self.buttons_showing['estop']:
|
||||
self.control['estop'].set_sensitive(False)
|
||||
self.buttons_showing['estop'] = False
|
||||
|
||||
def set_ks_printer_cfg(self, printer):
|
||||
self.ks_printer_cfg = self._config.get_printer_config(printer)
|
||||
if self.ks_printer_cfg is not None:
|
||||
self.titlebar_name_type = self.ks_printer_cfg.get("titlebar_name_type", None)
|
||||
titlebar_items = self.ks_printer_cfg.get("titlebar_items", None)
|
||||
if titlebar_items is not None:
|
||||
self.titlebar_items = [str(i.strip()) for i in titlebar_items.split(',')]
|
||||
logging.info(f"Titlebar name type: {self.titlebar_name_type} items: {self.titlebar_items}")
|
||||
else:
|
||||
self.titlebar_items = []
|
||||
@@ -18,16 +18,12 @@ class BedLevelPanel(ScreenPanel):
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.response_count = 0
|
||||
self.panel_name = ""
|
||||
self.screw_dict = {}
|
||||
self.screws = []
|
||||
self.y_cnt = 0
|
||||
self.x_cnt = 0
|
||||
self.x_offset = 0
|
||||
self.y_offset = 0
|
||||
|
||||
def initialize(self, panel_name):
|
||||
self.panel_name = panel_name
|
||||
self.labels['dm'] = self._gtk.ButtonImage("motor-off", _("Disable XY"), "color3")
|
||||
self.labels['dm'].connect("clicked", self.disable_motors)
|
||||
screw_positions = []
|
||||
|
||||
+82
-139
@@ -1,20 +1,13 @@
|
||||
import gi
|
||||
import logging
|
||||
import contextlib
|
||||
import numpy as np
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Pango
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib import cm
|
||||
from matplotlib import rc
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas
|
||||
from matplotlib.ticker import LinearLocator
|
||||
|
||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||
from ks_includes.screen_panel import ScreenPanel
|
||||
from ks_includes.widgets.bedmap import BedMap
|
||||
|
||||
|
||||
def create_panel(*args):
|
||||
@@ -25,18 +18,16 @@ class BedMeshPanel(ScreenPanel):
|
||||
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.clear = None
|
||||
self.profiles = {}
|
||||
self.show_create = False
|
||||
self.active_mesh = None
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
addprofile = self._gtk.ButtonImage("increase", " " + _("Add profile"), "color1", .66, Gtk.PositionType.LEFT, 1)
|
||||
addprofile.connect("clicked", self.show_create_profile)
|
||||
addprofile.set_hexpand(True)
|
||||
clear = self._gtk.ButtonImage("cancel", " " + _("Clear"), "color2", .66, Gtk.PositionType.LEFT, 1)
|
||||
clear.connect("clicked", self._clear_mesh)
|
||||
clear.set_hexpand(True)
|
||||
self.clear = self._gtk.ButtonImage("cancel", " " + _("Clear"), "color2", .66, Gtk.PositionType.LEFT, 1)
|
||||
self.clear.connect("clicked", self.send_clear_mesh)
|
||||
self.clear.set_hexpand(True)
|
||||
calibrate = self._gtk.ButtonImage("refresh", " " + _("Calibrate"), "color3", .66, Gtk.PositionType.LEFT, 1)
|
||||
calibrate.connect("clicked", self.calibrate_mesh)
|
||||
calibrate.set_hexpand(True)
|
||||
@@ -45,7 +36,7 @@ class BedMeshPanel(ScreenPanel):
|
||||
topbar.set_hexpand(True)
|
||||
topbar.set_vexpand(False)
|
||||
topbar.add(addprofile)
|
||||
topbar.add(clear)
|
||||
topbar.add(self.clear)
|
||||
topbar.add(calibrate)
|
||||
|
||||
# Create a grid for all profiles
|
||||
@@ -57,53 +48,87 @@ class BedMeshPanel(ScreenPanel):
|
||||
scroll.add(self.labels['profiles'])
|
||||
scroll.set_vexpand(True)
|
||||
|
||||
# Create a box to contain all of the above
|
||||
self.labels['main_box'] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
self.labels['main_box'].set_vexpand(True)
|
||||
self.labels['main_box'].pack_start(topbar, False, False, 0)
|
||||
self.labels['main_box'].pack_end(scroll, True, True, 0)
|
||||
|
||||
self.load_meshes()
|
||||
|
||||
self.content.add(self.labels['main_box'])
|
||||
grid = self._gtk.HomogeneousGrid()
|
||||
grid.set_row_homogeneous(False)
|
||||
grid.attach(topbar, 0, 0, 2, 1)
|
||||
self.labels['map'] = BedMap(self._gtk.get_font_size(), self.active_mesh)
|
||||
if self._screen.vertical_mode:
|
||||
grid.attach(self.labels['map'], 0, 2, 2, 1)
|
||||
grid.attach(scroll, 0, 3, 2, 1)
|
||||
self.labels['map'].set_size_request(self._gtk.get_content_width(), self._gtk.get_content_height() * .4)
|
||||
else:
|
||||
grid.attach(self.labels['map'], 0, 2, 1, 1)
|
||||
grid.attach(scroll, 1, 2, 1, 1)
|
||||
self.labels['main_grid'] = grid
|
||||
self.content.add(self.labels['main_grid'])
|
||||
|
||||
def activate(self):
|
||||
self.load_meshes()
|
||||
with contextlib.suppress(KeyError):
|
||||
self.activate_mesh(self._screen.printer.get_stat("bed_mesh", "profile_name"))
|
||||
|
||||
def activate_mesh(self, profile):
|
||||
if self.active_mesh is not None:
|
||||
self.profiles[self.active_mesh]['name'].set_sensitive(True)
|
||||
self.profiles[self.active_mesh]['name'].get_style_context().remove_class("button_active")
|
||||
if profile == "":
|
||||
logging.info("Clearing active profile")
|
||||
self.profiles[self.active_mesh]['button_box'].add(self.profiles[self.active_mesh]['load'])
|
||||
self.active_mesh = None
|
||||
self.update_graph()
|
||||
self.clear.set_sensitive(False)
|
||||
return
|
||||
if profile not in self.profiles:
|
||||
self.add_profile(profile)
|
||||
|
||||
logging.info(f"Active {self.active_mesh} changing to {profile}")
|
||||
self.profiles[profile]['button_box'].remove(self.profiles[profile]['load'])
|
||||
if self.active_mesh != profile:
|
||||
logging.info(f"Active {self.active_mesh} changing to {profile}")
|
||||
self.profiles[profile]['name'].set_sensitive(False)
|
||||
self.profiles[profile]['name'].get_style_context().add_class("button_active")
|
||||
self.active_mesh = profile
|
||||
self.update_graph(profile=profile)
|
||||
self.clear.set_sensitive(True)
|
||||
|
||||
def retrieve_bm(self, profile):
|
||||
if profile is None:
|
||||
return None
|
||||
if profile == self.active_mesh:
|
||||
bm = self._printer.get_stat("bed_mesh")
|
||||
if bm is None:
|
||||
logging.info(f"Unable to load active mesh: {profile}")
|
||||
return None
|
||||
matrix = 'probed_matrix'
|
||||
else:
|
||||
bm = self._printer.get_config_section(f"bed_mesh {profile}")
|
||||
if bm is False:
|
||||
logging.info(f"Unable to load profile: {profile}")
|
||||
self.remove_profile(profile)
|
||||
return None
|
||||
matrix = 'points'
|
||||
return bm[matrix]
|
||||
|
||||
def update_graph(self, widget=None, profile=None):
|
||||
self.labels['map'].update_bm(self.retrieve_bm(profile))
|
||||
self.labels['map'].queue_draw()
|
||||
|
||||
def add_profile(self, profile):
|
||||
logging.debug(f"Adding Profile: {profile}")
|
||||
name = Gtk.Label()
|
||||
name.set_markup(f"<big><b>{profile}</b></big>")
|
||||
name.set_hexpand(True)
|
||||
name = self._gtk.Button(f"<big><b>{profile}</b></big>")
|
||||
name.get_children()[0].set_use_markup(True)
|
||||
name.get_children()[0].set_line_wrap(True)
|
||||
name.get_children()[0].set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
||||
name.set_vexpand(False)
|
||||
name.set_halign(Gtk.Align.START)
|
||||
name.set_line_wrap(True)
|
||||
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
||||
name.connect("clicked", self.send_load_mesh, profile)
|
||||
name.connect("clicked", self.update_graph, profile)
|
||||
|
||||
buttons = {
|
||||
"save": self._gtk.ButtonImage("complete", _("Save"), "color3"),
|
||||
"delete": self._gtk.ButtonImage("cancel", _("Delete"), "color3"),
|
||||
"view": self._gtk.ButtonImage("bed-level", _("View Mesh"), "color1"),
|
||||
"load": self._gtk.ButtonImage("load", _("Load"), "color2"),
|
||||
"save": self._gtk.ButtonImage("complete", None, "color4", .75),
|
||||
"delete": self._gtk.ButtonImage("cancel", None, "color2", .75),
|
||||
}
|
||||
buttons["save"].connect("clicked", self.send_save_mesh, profile)
|
||||
buttons["delete"].connect("clicked", self.send_remove_mesh, profile)
|
||||
buttons["view"].connect("clicked", self.show_mesh, profile)
|
||||
buttons["load"].connect("clicked", self.send_load_mesh, profile)
|
||||
|
||||
for b in buttons.values():
|
||||
b.set_hexpand(False)
|
||||
@@ -114,8 +139,6 @@ class BedMeshPanel(ScreenPanel):
|
||||
if profile != "default":
|
||||
button_box.add(buttons["save"])
|
||||
button_box.add(buttons["delete"])
|
||||
button_box.add(buttons["view"])
|
||||
button_box.add(buttons["load"])
|
||||
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
|
||||
box.pack_start(name, True, True, 0)
|
||||
@@ -126,12 +149,11 @@ class BedMeshPanel(ScreenPanel):
|
||||
frame.add(box)
|
||||
|
||||
self.profiles[profile] = {
|
||||
"name": name,
|
||||
"button_box": button_box,
|
||||
"row": frame,
|
||||
"load": buttons["load"],
|
||||
"save": buttons["save"],
|
||||
"delete": buttons["delete"],
|
||||
"view": buttons["view"],
|
||||
}
|
||||
|
||||
pl = list(self.profiles)
|
||||
@@ -151,15 +173,17 @@ class BedMeshPanel(ScreenPanel):
|
||||
return False
|
||||
|
||||
def load_meshes(self):
|
||||
bm_profiles = self._screen.printer.get_config_section_list("bed_mesh ")
|
||||
logging.info(f"Bed profiles: {bm_profiles}")
|
||||
bm_profiles = self._printer.get_stat("bed_mesh", "profiles")
|
||||
for prof in bm_profiles:
|
||||
self.add_profile(prof[9:])
|
||||
if prof not in self.profiles:
|
||||
self.add_profile(prof)
|
||||
for prof in self.profiles:
|
||||
if prof not in bm_profiles:
|
||||
self.remove_profile(prof)
|
||||
|
||||
def process_update(self, action, data):
|
||||
if action == "notify_status_update":
|
||||
with contextlib.suppress(KeyError):
|
||||
logging.info(data['bed_mesh'])
|
||||
self.activate_mesh(data['bed_mesh']['profile_name'])
|
||||
|
||||
def remove_create(self):
|
||||
@@ -171,7 +195,7 @@ class BedMeshPanel(ScreenPanel):
|
||||
self.content.remove(child)
|
||||
|
||||
self.show_create = False
|
||||
self.content.add(self.labels['main_box'])
|
||||
self.content.add(self.labels['main_grid'])
|
||||
self.content.show()
|
||||
|
||||
def remove_profile(self, profile):
|
||||
@@ -185,6 +209,10 @@ class BedMeshPanel(ScreenPanel):
|
||||
pos = profiles.index(profile) + 1 if profile != "default" else 0
|
||||
self.labels['profiles'].remove_row(pos)
|
||||
del self.profiles[profile]
|
||||
if not self.profiles:
|
||||
self.active_mesh = None
|
||||
self.update_graph()
|
||||
self.clear.set_sensitive(False)
|
||||
|
||||
def show_create_profile(self, widget):
|
||||
|
||||
@@ -223,85 +251,10 @@ class BedMeshPanel(ScreenPanel):
|
||||
def _show_keyboard(self, widget=None, event=None):
|
||||
self._screen.show_keyboard(entry=self.labels['profile_name'])
|
||||
|
||||
def show_mesh(self, widget, profile):
|
||||
if profile == self.active_mesh:
|
||||
bm = self._printer.get_stat("bed_mesh")
|
||||
if bm is None:
|
||||
logging.info(f"Unable to load active mesh: {profile}")
|
||||
return
|
||||
matrix = 'probed_matrix'
|
||||
# if 'mesh_matrix' in bm and bm['mesh_matrix'][0]:
|
||||
# matrix = 'mesh_matrix'
|
||||
x_range = [int(bm['mesh_min'][0]), int(bm['mesh_max'][0])]
|
||||
y_range = [int(bm['mesh_min'][1]), int(bm['mesh_max'][1])]
|
||||
else:
|
||||
bm = self._printer.get_config_section(f"bed_mesh {profile}")
|
||||
if bm is False:
|
||||
logging.info(f"Unable to load profile: {profile}")
|
||||
self.remove_profile(profile)
|
||||
return
|
||||
matrix = 'points'
|
||||
x_range = [int(bm['min_x']), int(bm['max_x'])]
|
||||
y_range = [int(bm['min_y']), int(bm['max_y'])]
|
||||
# Zscale can be offered as a slider instead of hardcoded values reasonable values 0.5 - 2 (mm)
|
||||
z_range = [min(min(min(bm[matrix])), -1), max(max(max(bm[matrix])), 1)]
|
||||
counts = [len(bm[matrix][0]), len(bm[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])]
|
||||
x, y = np.meshgrid(x, y)
|
||||
z = np.asarray(bm[matrix])
|
||||
|
||||
rc('axes', edgecolor="#e2e2e2", labelcolor="#e2e2e2")
|
||||
rc(('xtick', 'ytick'), color="#e2e2e2")
|
||||
fig = plt.figure(facecolor='#12121277')
|
||||
ax = Axes3D(fig, azim=245, elev=23)
|
||||
ax.set(title=profile, xlabel="X", ylabel="Y", facecolor='none')
|
||||
ax.spines['bottom'].set_color("#e2e2e2")
|
||||
fig.add_axes(ax)
|
||||
# Color gradient could also be configurable as a slider reasonable values 0.1 - 0.2 (mm)
|
||||
surf = ax.plot_surface(x, y, z, cmap=cm.coolwarm, vmin=-0.2, vmax=0.2)
|
||||
|
||||
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))
|
||||
# A StrMethodFormatter is used automatically
|
||||
ax.zaxis.set_major_formatter('{x:.02f}')
|
||||
fig.colorbar(surf, shrink=0.7, aspect=5, pad=0.25)
|
||||
|
||||
title = Gtk.Label()
|
||||
title.set_markup(f"<b>{profile}</b>")
|
||||
title.set_hexpand(True)
|
||||
title.set_halign(Gtk.Align.CENTER)
|
||||
|
||||
canvas = FigureCanvas(fig)
|
||||
canvas.set_size_request(self._screen.width * .9, self._screen.height / 3 * 2)
|
||||
# Remove the "matplotlib-canvas" class which forces a white background.
|
||||
# https://github.com/matplotlib/matplotlib/commit/3c832377fb4c4b32fcbdbc60fdfedb57296bc8c0
|
||||
style_ctx = canvas.get_style_context()
|
||||
for css_class in style_ctx.list_classes():
|
||||
style_ctx.remove_class(css_class)
|
||||
|
||||
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
box.add(title)
|
||||
box.add(canvas)
|
||||
box.show_all()
|
||||
|
||||
buttons = [
|
||||
{"name": _("Close"), "response": Gtk.ResponseType.CANCEL}
|
||||
]
|
||||
self._gtk.Dialog(self._screen, buttons, box, self._close_dialog)
|
||||
|
||||
@staticmethod
|
||||
def _close_dialog(widget, response):
|
||||
widget.destroy()
|
||||
|
||||
def create_profile(self, widget):
|
||||
name = self.labels['profile_name'].get_text()
|
||||
if " " in name:
|
||||
name = f'"{name}"'
|
||||
if self.active_mesh is None:
|
||||
self.calibrate_mesh(None)
|
||||
|
||||
self._screen._ws.klippy.gcode_script(f"BED_MESH_PROFILE SAVE={name}")
|
||||
self.remove_create()
|
||||
@@ -311,31 +264,21 @@ class BedMeshPanel(ScreenPanel):
|
||||
if self._screen.printer.get_stat("toolhead", "homed_axes") != "xyz":
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
|
||||
|
||||
self._screen._ws.klippy.gcode_script(
|
||||
"BED_MESH_CALIBRATE"
|
||||
)
|
||||
self._screen._ws.klippy.gcode_script("BED_MESH_CALIBRATE")
|
||||
|
||||
# Load zcalibrate to do a manual mesh
|
||||
if not (self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch")):
|
||||
self.menu_item_clicked(widget, "refresh", {"name": "Mesh calibrate", "panel": "zcalibrate"})
|
||||
self.menu_item_clicked(widget, "refresh", {"name": _("Mesh calibrate"), "panel": "zcalibrate"})
|
||||
|
||||
def _clear_mesh(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(
|
||||
"BED_MESH_CLEAR"
|
||||
)
|
||||
def send_clear_mesh(self, widget):
|
||||
self._screen._ws.klippy.gcode_script("BED_MESH_CLEAR")
|
||||
|
||||
def send_load_mesh(self, widget, profile):
|
||||
self._screen._ws.klippy.gcode_script(
|
||||
KlippyGcodes.bed_mesh_load(profile)
|
||||
)
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.bed_mesh_load(profile))
|
||||
|
||||
def send_save_mesh(self, widget, profile):
|
||||
self._screen._ws.klippy.gcode_script(
|
||||
KlippyGcodes.bed_mesh_save(profile)
|
||||
)
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.bed_mesh_save(profile))
|
||||
|
||||
def send_remove_mesh(self, widget, profile):
|
||||
self._screen._ws.klippy.gcode_script(
|
||||
KlippyGcodes.bed_mesh_remove(profile)
|
||||
)
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.bed_mesh_remove(profile))
|
||||
self.remove_profile(profile)
|
||||
@@ -27,8 +27,6 @@ class ConsolePanel(ScreenPanel):
|
||||
super().__init__(screen, title, back)
|
||||
self.autoscroll = True
|
||||
self.hidetemps = True
|
||||
|
||||
def initialize(self, panel_name):
|
||||
self._screen._ws.send_method("server.gcode_store", {"count": 100}, self.gcode_response)
|
||||
|
||||
o1_lbl = Gtk.Label(_("Auto-scroll"))
|
||||
|
||||
+2
-1
@@ -11,7 +11,8 @@ def create_panel(*args):
|
||||
|
||||
|
||||
class ExamplePanel(ScreenPanel):
|
||||
def initialize(self, panel_name):
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
|
||||
# Create gtk items here
|
||||
|
||||
|
||||
+9
-5
@@ -29,14 +29,11 @@ class ExcludeObjectPanel(ScreenPanel):
|
||||
logging.info(f'Excluded: {self.excluded_objects}')
|
||||
self.objects = self._printer.get_stat("exclude_object", "objects")
|
||||
self.labels['map'] = None
|
||||
|
||||
def initialize(self, panel_name):
|
||||
for obj in self.objects:
|
||||
logging.info(f"Adding {obj['name']}")
|
||||
self.add_object(obj["name"])
|
||||
|
||||
scroll = self._gtk.ScrolledWindow()
|
||||
scroll.set_size_request((self._screen.width * .9) // 2, -1)
|
||||
scroll.add(self.object_list)
|
||||
scroll.set_halign(Gtk.Align.CENTER)
|
||||
|
||||
@@ -47,10 +44,17 @@ class ExcludeObjectPanel(ScreenPanel):
|
||||
|
||||
if self.objects and "polygon" in self.objects[0]:
|
||||
self.labels['map'] = ObjectMap(self._screen, self._printer, self._gtk.get_font_size())
|
||||
grid.attach(self.labels['map'], 0, 2, 1, 1)
|
||||
grid.attach(scroll, 1, 2, 1, 1)
|
||||
if self._screen.vertical_mode:
|
||||
grid.attach(self.labels['map'], 0, 2, 2, 1)
|
||||
grid.attach(scroll, 0, 3, 2, 1)
|
||||
scroll.set_size_request(self._screen.width, -1)
|
||||
else:
|
||||
grid.attach(self.labels['map'], 0, 2, 1, 1)
|
||||
grid.attach(scroll, 1, 2, 1, 1)
|
||||
scroll.set_size_request((self._screen.width * .9) // 2, -1)
|
||||
else:
|
||||
grid.attach(scroll, 0, 2, 2, 1)
|
||||
scroll.set_size_request(self._gtk.get_content_width(), -1)
|
||||
|
||||
self.content.add(grid)
|
||||
self.content.show_all()
|
||||
|
||||
+2
-4
@@ -18,15 +18,12 @@ class ExtrudePanel(ScreenPanel):
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.current_extruder = self._printer.get_stat("toolhead", "extruder")
|
||||
|
||||
macros = self._screen.printer.get_gcode_macros()
|
||||
self.load_filament = any("LOAD_FILAMENT" in macro.upper() for macro in macros)
|
||||
self.unload_filament = any("UNLOAD_FILAMENT" in macro.upper() for macro in macros)
|
||||
|
||||
self.speeds = ['1', '2', '5', '25']
|
||||
self.speed = int(self.speeds[1])
|
||||
self.distances = ['5', '10', '15', '25']
|
||||
self.distance = int(self.distances[1])
|
||||
print_cfg = self._config.get_printer_config(self._screen.connected_printer)
|
||||
if print_cfg is not None:
|
||||
dis = print_cfg.get("extrude_distances", '5, 10, 15, 25')
|
||||
@@ -40,7 +37,8 @@ class ExtrudePanel(ScreenPanel):
|
||||
if 1 < len(vel) < 5:
|
||||
self.speeds = vel
|
||||
|
||||
def initialize(self, panel_name):
|
||||
self.distance = int(self.distances[1])
|
||||
self.speed = int(self.speeds[1])
|
||||
self.labels['extrude'] = self._gtk.ButtonImage("extrude", _("Extrude"), "color4")
|
||||
self.labels['extrude'].connect("clicked", self.extrude, "+")
|
||||
self.labels['load'] = self._gtk.ButtonImage("arrow-down", _("Load"), "color3")
|
||||
|
||||
+2
-3
@@ -16,10 +16,9 @@ CHANGEABLE_FANS = ["fan", "fan_generic"]
|
||||
|
||||
|
||||
class FanPanel(ScreenPanel):
|
||||
|
||||
def initialize(self, panel_name):
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.fan_speed = {}
|
||||
self.user_selecting = False
|
||||
self.devices = {}
|
||||
# Create a grid for all devices
|
||||
self.labels['devices'] = Gtk.Grid()
|
||||
|
||||
+2
-4
@@ -21,10 +21,8 @@ class FineTunePanel(ScreenPanel):
|
||||
percent_delta = percent_deltas[-2]
|
||||
speed = extrusion = 100
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
logging.debug("FineTunePanel")
|
||||
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
print_cfg = self._config.get_printer_config(self._screen.connected_printer)
|
||||
if print_cfg is not None:
|
||||
bs = print_cfg.get("z_babystep_values", "0.01, 0.05")
|
||||
|
||||
@@ -23,8 +23,6 @@ class MacroPanel(ScreenPanel):
|
||||
self.loaded_macros = []
|
||||
self.macros = {}
|
||||
self.menu = ['macros_menu']
|
||||
|
||||
def initialize(self, panel_name):
|
||||
sort = Gtk.Label(_("Sort:"))
|
||||
sort.set_hexpand(False)
|
||||
|
||||
|
||||
+28
-35
@@ -34,11 +34,6 @@ class InputShaperPanel(ScreenPanel):
|
||||
self.status.set_halign(Gtk.Align.START)
|
||||
self.status.set_ellipsize(Pango.EllipsizeMode.END)
|
||||
self.calibrating_axis = None
|
||||
self.has_sensor = False
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
self.has_sensor = False
|
||||
self.calibrating_axis = None
|
||||
|
||||
auto_calibration_label = Gtk.Label()
|
||||
@@ -169,34 +164,32 @@ class InputShaperPanel(ScreenPanel):
|
||||
)
|
||||
|
||||
def process_update(self, action, data):
|
||||
|
||||
if action == "notify_gcode_response":
|
||||
self.status.set_text(f"{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
|
||||
if action != "notify_gcode_response":
|
||||
return
|
||||
self.status.set_text(f"{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.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'] or (self.calibrating_axis == "both" and results['axis'] == 'y'):
|
||||
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'] \
|
||||
or (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']))
|
||||
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']))
|
||||
+39
-45
@@ -7,8 +7,9 @@ import contextlib
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import GLib, Gtk, Pango
|
||||
from numpy import sqrt, pi, dot, array, median
|
||||
from ks_includes.screen_panel import ScreenPanel
|
||||
from math import pi, sqrt
|
||||
from statistics import median
|
||||
|
||||
|
||||
def create_panel(*args):
|
||||
@@ -18,6 +19,14 @@ def create_panel(*args):
|
||||
class JobStatusPanel(ScreenPanel):
|
||||
def __init__(self, screen, title, back=False):
|
||||
super().__init__(screen, title, False)
|
||||
self.extrusion_button = None
|
||||
self.elapsed_button = None
|
||||
self.left_button = None
|
||||
self.fan_button = None
|
||||
self.speed_button = None
|
||||
self.z_button = None
|
||||
self.heater_button = None
|
||||
self.extruder_button = None
|
||||
self.grid = self._gtk.HomogeneousGrid()
|
||||
self.grid.set_row_homogeneous(False)
|
||||
self.pos_z = 0
|
||||
@@ -29,10 +38,9 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.oheight = 0
|
||||
self.current_extruder = None
|
||||
self.fila_section = 0
|
||||
self.buttons = None
|
||||
self.is_paused = False
|
||||
self.buttons = {}
|
||||
self.filename_label = self.filename = self.prev_pos = self.prev_gpos = None
|
||||
self.state_timeout = self.close_timeout = self.vel_timeout = self.animation_timeout = None
|
||||
self.close_timeout = self.vel_timeout = self.animation_timeout = None
|
||||
self.file_metadata = self.fans = {}
|
||||
self.state = "standby"
|
||||
self.timeleft_type = "auto"
|
||||
@@ -40,8 +48,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.main_status_displayed = True
|
||||
self.velstore = self.flowstore = []
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
data = ['pos_x', 'pos_y', 'pos_z', 'time_left', 'duration', 'slicer_time', 'file_time',
|
||||
'filament_time', 'est_time', 'speed_factor', 'req_speed', 'max_accel', 'extrude_factor', 'zoffset',
|
||||
'zoffset', 'filament_used', 'filament_total', 'advance', 'fan', 'layer', 'total_layers', 'height',
|
||||
@@ -134,7 +140,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.grid.attach(self.buttons['button_grid'], 0, 3, 4, 1)
|
||||
|
||||
self.content.add(self.grid)
|
||||
self._screen.wake_screen()
|
||||
|
||||
def create_status_grid(self, widget=None):
|
||||
self.main_status_displayed = True
|
||||
@@ -360,11 +365,10 @@ class JobStatusPanel(ScreenPanel):
|
||||
def activate(self):
|
||||
ps = self._printer.get_stat("print_stats")
|
||||
self.set_state(ps['state'])
|
||||
if self.state_timeout is None:
|
||||
self.state_timeout = GLib.timeout_add_seconds(1, self.state_check)
|
||||
self.create_status_grid()
|
||||
if self.vel_timeout is None:
|
||||
self.vel_timeout = GLib.timeout_add_seconds(1, self.update_velocity)
|
||||
self._screen.base_panel_show_all()
|
||||
|
||||
def deactivate(self):
|
||||
if self.vel_timeout is not None:
|
||||
@@ -396,7 +400,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.buttons['save_offset_endstop'].connect("clicked", self.save_offset, "endstop")
|
||||
|
||||
def save_offset(self, widget, device):
|
||||
|
||||
saved_z_offset = 0
|
||||
if self._printer.config_section_exists("probe"):
|
||||
saved_z_offset = float(self._screen.printer.get_config_section("probe")['z_offset'])
|
||||
@@ -436,11 +439,9 @@ class JobStatusPanel(ScreenPanel):
|
||||
widget.destroy()
|
||||
|
||||
def restart(self, widget):
|
||||
self.disable_button("restart")
|
||||
if self.filename != "none":
|
||||
self._screen._ws.klippy.print_start(self.filename)
|
||||
self.new_print()
|
||||
GLib.timeout_add_seconds(5, self.enable_button("restart"))
|
||||
|
||||
def resume(self, widget):
|
||||
self._screen._ws.klippy.print_resume(self._response_callback, "enable_button", "pause", "cancel")
|
||||
@@ -451,7 +452,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
self._screen.show_all()
|
||||
|
||||
def cancel(self, widget):
|
||||
|
||||
buttons = [
|
||||
{"name": _("Cancel Print"), "response": Gtk.ResponseType.OK},
|
||||
{"name": _("Go Back"), "response": Gtk.ResponseType.CANCEL}
|
||||
@@ -490,15 +490,12 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.enable_button(*args)
|
||||
|
||||
def close_panel(self, widget=None):
|
||||
self.disable_button("menu")
|
||||
logging.debug("Closing job_status panel")
|
||||
self.remove_close_timeout()
|
||||
self.state_check()
|
||||
if self.state not in ["printing", "paused", "cancelling"]:
|
||||
self._screen.printer_ready()
|
||||
self._printer.change_state("ready")
|
||||
GLib.timeout_add_seconds(5, self.enable_button("menu"))
|
||||
|
||||
return False
|
||||
|
||||
def remove_close_timeout(self):
|
||||
@@ -521,9 +518,7 @@ class JobStatusPanel(ScreenPanel):
|
||||
|
||||
def new_print(self):
|
||||
self.remove_close_timeout()
|
||||
if self.state_timeout is None:
|
||||
self.state_timeout = GLib.timeout_add_seconds(1, self.state_check)
|
||||
self._screen.wake_screen()
|
||||
self._screen.close_screensaver()
|
||||
self.state_check()
|
||||
|
||||
def process_update(self, action, data):
|
||||
@@ -584,11 +579,12 @@ class JobStatusPanel(ScreenPanel):
|
||||
if self.prev_gpos is not None:
|
||||
interval = now - self.prev_gpos[1]
|
||||
# Calculate Velocity
|
||||
vel = [(pos[0] - self.prev_gpos[0][0]),
|
||||
(pos[1] - self.prev_gpos[0][1]),
|
||||
(pos[2] - self.prev_gpos[0][2])]
|
||||
vel = array(vel)
|
||||
self.velstore.append(sqrt(vel.dot(vel)) / interval)
|
||||
vel = sqrt(sum([
|
||||
(pos[0] - self.prev_gpos[0][0]) ** 2,
|
||||
(pos[1] - self.prev_gpos[0][1]) ** 2,
|
||||
(pos[2] - self.prev_gpos[0][2]) ** 2]
|
||||
)) / interval
|
||||
self.velstore.append(vel)
|
||||
self.prev_gpos = [pos, now]
|
||||
with contextlib.suppress(KeyError):
|
||||
self.extrusion = int(round(data["gcode_move"]["extrude_factor"] * 100))
|
||||
@@ -614,11 +610,12 @@ class JobStatusPanel(ScreenPanel):
|
||||
evelocity = (pos[3] - self.prev_pos[0][3]) / interval
|
||||
self.flowstore.append(self.fila_section * evelocity)
|
||||
# Calculate Velocity
|
||||
vel = [(pos[0] - self.prev_pos[0][0]),
|
||||
(pos[1] - self.prev_pos[0][1]),
|
||||
(pos[2] - self.prev_pos[0][2])]
|
||||
vel = array(vel)
|
||||
self.velstore.append(sqrt(vel.dot(vel)) / interval)
|
||||
vel = sqrt(sum([
|
||||
(pos[0] - self.prev_pos[0][0]) ** 2,
|
||||
(pos[1] - self.prev_pos[0][1]) ** 2,
|
||||
(pos[2] - self.prev_pos[0][2]) ** 2]
|
||||
)) / interval
|
||||
self.velstore.append(vel)
|
||||
self.prev_pos = [pos, now]
|
||||
with contextlib.suppress(KeyError):
|
||||
self.velstore.append(float(data["motion_report"]["live_velocity"]))
|
||||
@@ -634,12 +631,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
if fan_label:
|
||||
self.labels['fan'].set_text(fan_label[:12])
|
||||
|
||||
if "layer_height" in self.file_metadata and "object_height" in self.file_metadata:
|
||||
layer_label = (
|
||||
f"{1 + round((self.pos_z - self.f_layer_h) / self.layer_h)} / {self.labels['total_layers'].get_text()}"
|
||||
)
|
||||
self.labels['layer'].set_label(layer_label)
|
||||
|
||||
self.state_check()
|
||||
if self.state not in ["printing", "paused"]:
|
||||
return
|
||||
@@ -650,6 +641,14 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.update_filename()
|
||||
else:
|
||||
self.update_percent_complete()
|
||||
if 'info' in ps and 'total_layer' in ps['info'] and ps['info']['total_layer'] is not None:
|
||||
self.labels['total_layers'].set_label(f"{ps['info']['total_layer']}")
|
||||
if 'info' in ps and 'current_layer' in ps['info'] and ps['info']['current_layer'] is not None:
|
||||
self.labels['layer'].set_label(f"{ps['info']['current_layer']} / {self.labels['total_layers'].get_text()}")
|
||||
elif "layer_height" in self.file_metadata and "object_height" in self.file_metadata:
|
||||
self.labels['layer'].set_label(
|
||||
f"{1 + round((self.pos_z - self.f_layer_h) / self.layer_h)} / {self.labels['total_layers'].get_text()}")
|
||||
|
||||
if 'print_duration' in ps:
|
||||
if int(ps['print_duration']) == 0 and self.progress > 0.001:
|
||||
# Print duration remains at 0 when using No-extusion tests
|
||||
@@ -674,8 +673,8 @@ class JobStatusPanel(ScreenPanel):
|
||||
self.velstore.append(0)
|
||||
if not self.flowstore:
|
||||
self.flowstore.append(0)
|
||||
self.flowrate = median(array(self.flowstore))
|
||||
self.vel = median(array(self.velstore))
|
||||
self.flowrate = median(self.flowstore)
|
||||
self.vel = median(self.velstore)
|
||||
self.velstore = []
|
||||
self.flowstore = []
|
||||
self.labels['flowrate'].set_label(f"{self.flowrate:.1f} mm³/s")
|
||||
@@ -762,7 +761,7 @@ class JobStatusPanel(ScreenPanel):
|
||||
return True
|
||||
|
||||
def _add_timeout(self, job_timeout):
|
||||
self._screen.wake_screen()
|
||||
self._screen.close_screensaver()
|
||||
self.remove_close_timeout()
|
||||
timeout = self._config.get_main_config().getint(job_timeout, 0)
|
||||
if timeout != 0:
|
||||
@@ -770,7 +769,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
return False
|
||||
|
||||
def set_state(self, state):
|
||||
|
||||
if self.state != state:
|
||||
logging.debug(f"Changing job_status state from '{self.state}' to '{state}'")
|
||||
if state == "paused":
|
||||
@@ -826,11 +824,11 @@ class JobStatusPanel(ScreenPanel):
|
||||
def show_file_thumbnail(self):
|
||||
if self._files.has_thumbnail(self.filename):
|
||||
if self._screen.vertical_mode:
|
||||
width = -1
|
||||
width = self._screen.width * 0.9
|
||||
height = self._screen.height / 4
|
||||
else:
|
||||
width = self._screen.width / 3
|
||||
height = -1
|
||||
height = self._gtk.get_content_height() * 0.47
|
||||
pixbuf = self.get_file_image(self.filename, width, height)
|
||||
if pixbuf is not None:
|
||||
self.labels['thumbnail'].set_from_pixbuf(pixbuf)
|
||||
@@ -884,10 +882,6 @@ class JobStatusPanel(ScreenPanel):
|
||||
logging.debug("Cannot find file metadata. Listening for updated metadata")
|
||||
self._screen.files.add_file_callback(self._callback_metadata)
|
||||
|
||||
def update_image_text(self, label, text):
|
||||
if label in self.labels and 'l' in self.labels[label]:
|
||||
self.labels[label]['l'].set_text(text)
|
||||
|
||||
def update_percent_complete(self):
|
||||
if self.state not in ["printing", "paused"]:
|
||||
return
|
||||
|
||||
+3
-6
@@ -16,14 +16,9 @@ class LimitsPanel(ScreenPanel):
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.limits = {}
|
||||
self.grid = Gtk.Grid()
|
||||
self.options = None
|
||||
self.values = {}
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
scroll = self._gtk.ScrolledWindow()
|
||||
scroll.add(self.grid)
|
||||
self.grid = Gtk.Grid()
|
||||
|
||||
conf = self._printer.get_config_section("printer")
|
||||
self.options = [
|
||||
@@ -42,6 +37,8 @@ class LimitsPanel(ScreenPanel):
|
||||
for opt in self.options:
|
||||
self.add_option(opt['option'], opt['name'], opt['units'], opt['max'])
|
||||
|
||||
scroll = self._gtk.ScrolledWindow()
|
||||
scroll.add(self.grid)
|
||||
self.content.add(scroll)
|
||||
self.content.show_all()
|
||||
|
||||
|
||||
+9
-5
@@ -2,7 +2,7 @@ import gi
|
||||
import logging
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib, Pango
|
||||
from gi.repository import Gtk, GLib
|
||||
from panels.menu import MenuPanel
|
||||
|
||||
from ks_includes.widgets.graph import HeaterGraph
|
||||
@@ -16,16 +16,17 @@ def create_panel(*args):
|
||||
class MainPanel(MenuPanel):
|
||||
def __init__(self, screen, title, back=False):
|
||||
super().__init__(screen, title, False)
|
||||
self.left_panel = None
|
||||
self.items = None
|
||||
self.grid = self._gtk.HomogeneousGrid()
|
||||
self.grid.set_hexpand(True)
|
||||
self.grid.set_vexpand(True)
|
||||
self.devices = {}
|
||||
self.graph_update = None
|
||||
self.active_heater = None
|
||||
self.h = 1
|
||||
self.grid = self._gtk.HomogeneousGrid()
|
||||
self.grid.set_hexpand(True)
|
||||
self.grid.set_vexpand(True)
|
||||
|
||||
def initialize(self, panel_name, items, extrudercount):
|
||||
def initialize(self, items):
|
||||
logging.info("### Making MainMenu")
|
||||
|
||||
self.items = items
|
||||
@@ -48,6 +49,8 @@ class MainPanel(MenuPanel):
|
||||
self.layout.show_all()
|
||||
|
||||
def update_graph_visibility(self):
|
||||
if self.left_panel is None:
|
||||
return
|
||||
count = 0
|
||||
for device in self.devices:
|
||||
visible = self._config.get_config().getboolean(f"graph {self._screen.connected_printer}",
|
||||
@@ -74,6 +77,7 @@ class MainPanel(MenuPanel):
|
||||
# This has a high impact on load
|
||||
self.graph_update = GLib.timeout_add_seconds(5, self.update_graph)
|
||||
self.update_graph_visibility()
|
||||
self._screen.base_panel_show_all()
|
||||
|
||||
def deactivate(self):
|
||||
if self.graph_update:
|
||||
|
||||
+13
-19
@@ -16,23 +16,23 @@ class MenuPanel(ScreenPanel):
|
||||
i = 0
|
||||
j2_data = None
|
||||
|
||||
def initialize(self, panel_name, display_name, items):
|
||||
|
||||
self.items = items
|
||||
self.create_menu_items()
|
||||
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.items = None
|
||||
self.grid = self._gtk.HomogeneousGrid()
|
||||
|
||||
def initialize(self, items):
|
||||
self.items = items
|
||||
self.create_menu_items()
|
||||
scroll = self._gtk.ScrolledWindow()
|
||||
scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
|
||||
scroll.add(self.grid)
|
||||
|
||||
self.content.add(scroll)
|
||||
|
||||
def activate(self):
|
||||
self.j2_data = self._printer.get_printer_status_data()
|
||||
self.j2_data.update({
|
||||
'moonraker_connected': self._screen._ws.is_connected()
|
||||
'moonraker_connected': self._screen._ws.connected
|
||||
})
|
||||
if self._screen.vertical_mode:
|
||||
self.arrangeMenuItems(self.items, 3)
|
||||
@@ -47,8 +47,8 @@ class MenuPanel(ScreenPanel):
|
||||
i = 0
|
||||
for item in items:
|
||||
key = list(item)[0]
|
||||
logging.debug(f"Evaluating item: {key}")
|
||||
if not self.evaluate_enable(item[key]['enable']):
|
||||
logging.debug(f"X > {key}")
|
||||
continue
|
||||
|
||||
if columns == 4:
|
||||
@@ -82,11 +82,11 @@ class MenuPanel(ScreenPanel):
|
||||
parsed_name = j2_temp.render()
|
||||
|
||||
b = self._gtk.ButtonImage(item['icon'], parsed_name, f"color{(i % 4) + 1}")
|
||||
if item['panel'] is not False:
|
||||
if item['panel'] is not None:
|
||||
b.connect("clicked", self.menu_item_clicked, item['panel'], item)
|
||||
elif item['method'] is not False:
|
||||
elif item['method'] is not None:
|
||||
params = item['params'] if item['params'] is not False else {}
|
||||
if item['confirm'] is not False:
|
||||
if item['confirm'] is not None:
|
||||
b.connect("clicked", self._screen._confirm_send_action, item['confirm'], item['method'], params)
|
||||
else:
|
||||
b.connect("clicked", self._screen._send_action, item['method'], params)
|
||||
@@ -95,18 +95,12 @@ class MenuPanel(ScreenPanel):
|
||||
self.labels[key] = b
|
||||
|
||||
def evaluate_enable(self, enable):
|
||||
if enable is True:
|
||||
return True
|
||||
if enable is False:
|
||||
return False
|
||||
|
||||
if enable == "{{ moonraker_connected }}":
|
||||
logging.info("moonraker is_connected %s", self._screen._ws.is_connected())
|
||||
return self._screen._ws.is_connected()
|
||||
logging.info(f"moonraker connected {self._screen._ws.connected}")
|
||||
return self._screen._ws.connected
|
||||
|
||||
self.j2_data = self._printer.get_printer_status_data()
|
||||
try:
|
||||
logging.debug(f"Template: '{enable}'")
|
||||
j2_temp = Template(enable, autoescape=True)
|
||||
result = j2_temp.render(self.j2_data)
|
||||
return result == 'True'
|
||||
|
||||
+20
-15
@@ -7,10 +7,6 @@ from gi.repository import Gtk, Pango
|
||||
from ks_includes.KlippyGcodes import KlippyGcodes
|
||||
from ks_includes.screen_panel import ScreenPanel
|
||||
|
||||
AXIS_X = "X"
|
||||
AXIS_Y = "Y"
|
||||
AXIS_Z = "Z"
|
||||
|
||||
|
||||
def create_panel(*args):
|
||||
return MovePanel(*args)
|
||||
@@ -25,23 +21,20 @@ class MovePanel(ScreenPanel):
|
||||
self.settings = {}
|
||||
self.menu = ['move_menu']
|
||||
|
||||
def initialize(self, panel_name):
|
||||
grid = self._gtk.HomogeneousGrid()
|
||||
|
||||
self.labels['x+'] = self._gtk.ButtonImage("arrow-right", _("X+"), "color1")
|
||||
self.labels['x+'].connect("clicked", self.move, AXIS_X, "+")
|
||||
self.labels['x+'].connect("clicked", self.move, "X", "+")
|
||||
self.labels['x-'] = self._gtk.ButtonImage("arrow-left", _("X-"), "color1")
|
||||
self.labels['x-'].connect("clicked", self.move, AXIS_X, "-")
|
||||
self.labels['x-'].connect("clicked", self.move, "X", "-")
|
||||
|
||||
self.labels['y+'] = self._gtk.ButtonImage("arrow-up", _("Y+"), "color2")
|
||||
self.labels['y+'].connect("clicked", self.move, AXIS_Y, "+")
|
||||
self.labels['y+'].connect("clicked", self.move, "Y", "+")
|
||||
self.labels['y-'] = self._gtk.ButtonImage("arrow-down", _("Y-"), "color2")
|
||||
self.labels['y-'].connect("clicked", self.move, AXIS_Y, "-")
|
||||
self.labels['y-'].connect("clicked", self.move, "Y", "-")
|
||||
|
||||
self.labels['z+'] = self._gtk.ButtonImage("z-farther", _("Z+"), "color3")
|
||||
self.labels['z+'].connect("clicked", self.move, AXIS_Z, "+")
|
||||
self.labels['z+'].connect("clicked", self.move, "Z", "+")
|
||||
self.labels['z-'] = self._gtk.ButtonImage("z-closer", _("Z-"), "color3")
|
||||
self.labels['z-'].connect("clicked", self.move, AXIS_Z, "-")
|
||||
self.labels['z-'].connect("clicked", self.move, "Z", "-")
|
||||
|
||||
self.labels['home'] = self._gtk.ButtonImage("home", _("Home All"), "color4")
|
||||
self.labels['home'].connect("clicked", self.home)
|
||||
@@ -61,6 +54,7 @@ class MovePanel(ScreenPanel):
|
||||
_("Are you sure you wish to disable motors?"),
|
||||
"printer.gcode.script", script)
|
||||
|
||||
grid = self._gtk.HomogeneousGrid()
|
||||
if self._screen.vertical_mode:
|
||||
if self._screen.lang_ltr:
|
||||
grid.attach(self.labels['x+'], 2, 1, 1, 1)
|
||||
@@ -203,12 +197,11 @@ class MovePanel(ScreenPanel):
|
||||
direction = "-" if direction == "+" else "+"
|
||||
|
||||
dist = f"{direction}{self.distance}"
|
||||
config_key = "move_speed_z" if axis == AXIS_Z else "move_speed_xy"
|
||||
config_key = "move_speed_z" if axis == "Z" else "move_speed_xy"
|
||||
printer_cfg = self._config.get_printer_config(self._screen.connected_printer)
|
||||
speed = None if printer_cfg is None else printer_cfg.getint(config_key, None)
|
||||
if speed is None:
|
||||
speed = self._config.get_config()['main'].getint(config_key, 20)
|
||||
|
||||
speed = 60 * max(1, speed)
|
||||
|
||||
self._screen._ws.klippy.gcode_script(f"{KlippyGcodes.MOVE_RELATIVE}\n{KlippyGcodes.MOVE} {axis}{dist} F{speed}")
|
||||
@@ -275,3 +268,15 @@ class MovePanel(ScreenPanel):
|
||||
self.unload_menu()
|
||||
return True
|
||||
return False
|
||||
|
||||
def home(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
|
||||
|
||||
def homexy(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME_XY)
|
||||
|
||||
def z_tilt(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.Z_TILT)
|
||||
|
||||
def quad_gantry_level(self, widget):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.QUAD_GANTRY_LEVEL)
|
||||
@@ -30,10 +30,6 @@ class NetworkPanel(ScreenPanel):
|
||||
logging.info(f"Found wireless interfaces: {self.wireless_interfaces}")
|
||||
self.wifi = WifiManager(self.wireless_interfaces[0])
|
||||
|
||||
def initialize(self, menu):
|
||||
grid = self._gtk.HomogeneousGrid()
|
||||
grid.set_hexpand(True)
|
||||
|
||||
# Get IP Address
|
||||
gws = netifaces.gateways()
|
||||
if "default" in gws and netifaces.AF_INET in gws["default"]:
|
||||
@@ -118,7 +114,6 @@ class NetworkPanel(ScreenPanel):
|
||||
def add_network(self, ssid, show=True):
|
||||
|
||||
if ssid is None:
|
||||
logging.info("SSID is None")
|
||||
return
|
||||
ssid = ssid.strip()
|
||||
if ssid in list(self.networks):
|
||||
@@ -314,7 +309,6 @@ class NetworkPanel(ScreenPanel):
|
||||
def remove_network(self, ssid, show=True):
|
||||
if ssid not in list(self.networks):
|
||||
return
|
||||
logging.info(self.labels['networklist'])
|
||||
for i in range(len(self.labels['networklist'])):
|
||||
if self.networks[ssid] == self.labels['networklist'].get_child_at(0, i):
|
||||
self.labels['networklist'].remove_row(i)
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ def create_panel(*args):
|
||||
|
||||
class OutputPinPanel(ScreenPanel):
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.devices = {}
|
||||
# Create a grid for all devices
|
||||
self.labels['devices'] = Gtk.Grid()
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ def create_panel(*args):
|
||||
|
||||
|
||||
class PowerPanel(ScreenPanel):
|
||||
def initialize(self, panel_name):
|
||||
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
self.devices = {}
|
||||
|
||||
# Create a grid for all devices
|
||||
|
||||
@@ -36,8 +36,6 @@ class PrintPanel(ScreenPanel):
|
||||
self.directories = {}
|
||||
self.labels['directories'] = {}
|
||||
self.labels['files'] = {}
|
||||
|
||||
def initialize(self, panel_name):
|
||||
sort = Gtk.Label(_("Sort:"))
|
||||
sbox = Gtk.Box(spacing=0)
|
||||
sbox.set_vexpand(False)
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import gi
|
||||
import logging
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib
|
||||
from ks_includes.screen_panel import ScreenPanel
|
||||
|
||||
logger = logging.getLogger("KlipperScreen.PrinterSelect")
|
||||
|
||||
|
||||
def create_panel(*args):
|
||||
return PrinterSelect(*args)
|
||||
@@ -15,8 +12,6 @@ def create_panel(*args):
|
||||
class PrinterSelect(ScreenPanel):
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, False)
|
||||
|
||||
def initialize(self, panel_name):
|
||||
printers = self._config.get_printers()
|
||||
|
||||
grid = self._gtk.HomogeneousGrid()
|
||||
@@ -38,7 +33,7 @@ class PrinterSelect(ScreenPanel):
|
||||
for i, printer in enumerate(printers):
|
||||
name = list(printer)[0]
|
||||
self.labels[name] = self._gtk.ButtonImage("extruder", name, f"color{1 + i % 4}")
|
||||
self.labels[name].connect("clicked", self._screen.connect_printer_widget, name)
|
||||
self.labels[name].connect("clicked", self.connect_printer, name)
|
||||
if self._screen.vertical_mode:
|
||||
row = i % columns
|
||||
col = int(i / columns)
|
||||
@@ -47,6 +42,10 @@ class PrinterSelect(ScreenPanel):
|
||||
row = int(i / columns)
|
||||
grid.attach(self.labels[name], col, row, 1, 1)
|
||||
|
||||
def connect_printer(self, widget, name):
|
||||
self._screen.connect_printer(name)
|
||||
|
||||
def activate(self):
|
||||
self._screen.base_panel.action_bar.hide()
|
||||
self._screen._ws.connecting = False
|
||||
GLib.timeout_add(100, self._screen.base_panel.action_bar.hide)
|
||||
@@ -20,9 +20,6 @@ class FWRetractionPanel(ScreenPanel):
|
||||
self.grid = Gtk.Grid()
|
||||
self.values = {}
|
||||
self.list = {}
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
conf = self._printer.get_config_section("firmware_retraction")
|
||||
|
||||
retract_length = float(conf['retract_length']) if 'retract_length' in conf else 0
|
||||
|
||||
+1
-9
@@ -16,11 +16,6 @@ class SettingsPanel(ScreenPanel):
|
||||
super().__init__(screen, title, back)
|
||||
self.printers = self.settings = {}
|
||||
self.menu = ['settings_menu']
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
self.labels['add_printer_button'] = self._gtk.Button(_("Add Printer"), "color1")
|
||||
|
||||
options = self._config.get_configurable_options().copy()
|
||||
options.append({"printers": {
|
||||
"name": _("Printer Connections"),
|
||||
@@ -120,12 +115,9 @@ class SettingsPanel(ScreenPanel):
|
||||
scale.connect("button-release-event", self.scale_moved, option['section'], opt_name)
|
||||
dev.add(scale)
|
||||
elif option['type'] == "printer":
|
||||
logging.debug(f"Option: {option}")
|
||||
box = Gtk.Box()
|
||||
box.set_vexpand(False)
|
||||
label = Gtk.Label()
|
||||
url = f"{option['moonraker_host']}:{option['moonraker_port']}"
|
||||
label.set_markup(f"<big>{option['name']}</big>\n{url}")
|
||||
label = Gtk.Label(f"{option['moonraker_host']}:{option['moonraker_port']}")
|
||||
box.add(label)
|
||||
dev.add(box)
|
||||
elif option['type'] == "menu":
|
||||
|
||||
+22
-19
@@ -3,7 +3,7 @@ import logging
|
||||
import os
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gdk, Gtk, Pango
|
||||
from gi.repository import Gtk, Pango
|
||||
|
||||
from ks_includes.screen_panel import ScreenPanel
|
||||
|
||||
@@ -13,15 +13,10 @@ def create_panel(*args):
|
||||
|
||||
|
||||
class SplashScreenPanel(ScreenPanel):
|
||||
box = None
|
||||
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, back)
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
image = self._gtk.Image("klipper", self._screen.width / 5, -1)
|
||||
|
||||
image = self._gtk.Image("klipper", self._screen.width / 5, self._screen.height * .5)
|
||||
self.labels['text'] = Gtk.Label(_("Initializing printer..."))
|
||||
self.labels['text'].set_line_wrap(True)
|
||||
self.labels['text'].set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
||||
@@ -38,6 +33,8 @@ class SplashScreenPanel(ScreenPanel):
|
||||
self.labels['restart_system'].connect("clicked", self.restart_system)
|
||||
self.labels['shutdown'] = self._gtk.ButtonImage("shutdown", _('System Shutdown'), "color2")
|
||||
self.labels['shutdown'].connect("clicked", self.shutdown)
|
||||
self.labels['retry'] = self._gtk.ButtonImage("load", _('Retry'), "color3")
|
||||
self.labels['retry'].connect("clicked", self.retry)
|
||||
|
||||
self.labels['actions'] = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||
self.labels['actions'].set_hexpand(True)
|
||||
@@ -46,13 +43,9 @@ class SplashScreenPanel(ScreenPanel):
|
||||
self.labels['actions'].set_homogeneous(True)
|
||||
self.labels['actions'].set_size_request(self._screen.base_panel.content.get_allocation().width, 0)
|
||||
|
||||
scroll = Gtk.ScrolledWindow()
|
||||
scroll.set_property("overlay-scrolling", False)
|
||||
scroll = self._gtk.ScrolledWindow()
|
||||
scroll.set_hexpand(True)
|
||||
scroll.set_vexpand(True)
|
||||
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['text'])
|
||||
|
||||
info = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
|
||||
@@ -79,21 +72,24 @@ class SplashScreenPanel(ScreenPanel):
|
||||
|
||||
self.clear_action_bar()
|
||||
printer = self._screen.connected_printer
|
||||
if printer is not None and not self._screen.shutdown:
|
||||
if printer is not None and self._screen._ws.connected:
|
||||
printer_cfg = self._config.get_printer_config(printer)
|
||||
if printer_cfg is not None:
|
||||
power_devices = printer_cfg.get("power_devices", "")
|
||||
power_devices = [str(i.strip()) for i in power_devices.split(',')]
|
||||
logging.info(f"Associated power devices: {power_devices}")
|
||||
self.add_power_button(self._screen.search_power_devices(power_devices))
|
||||
if power_devices[0]:
|
||||
logging.info(f"Associated power devices: {power_devices}")
|
||||
self.add_power_button(self._screen.search_power_devices(power_devices))
|
||||
|
||||
if self._screen.printer is not None and self._screen.printer.state != "disconnected":
|
||||
if self._screen._ws and self._screen._ws.connected:
|
||||
self.labels['actions'].add(self.labels['restart'])
|
||||
self.labels['actions'].add(self.labels['firmware_restart'])
|
||||
else:
|
||||
self.labels['actions'].add(self.labels['restart_system'])
|
||||
self.labels['actions'].add(self.labels['shutdown'])
|
||||
self.labels['actions'].add(self.labels['menu'])
|
||||
if self._screen._ws and not self._screen._ws.connecting:
|
||||
self.labels['actions'].add(self.labels['retry'])
|
||||
self.labels['actions'].show_all()
|
||||
|
||||
def add_power_button(self, powerdevs):
|
||||
@@ -105,6 +101,9 @@ class SplashScreenPanel(ScreenPanel):
|
||||
|
||||
def activate(self):
|
||||
self.check_power_status()
|
||||
self._screen.base_panel.show_macro_shortcut(False)
|
||||
self._screen.base_panel.show_heaters(False)
|
||||
self._screen.base_panel.show_estop(False)
|
||||
|
||||
def check_power_status(self):
|
||||
if 'power' in self.labels:
|
||||
@@ -124,8 +123,7 @@ class SplashScreenPanel(ScreenPanel):
|
||||
self._screen._ws.klippy.restart()
|
||||
|
||||
def shutdown(self, widget):
|
||||
|
||||
if self._screen._ws.is_connected():
|
||||
if self._screen._ws.connected:
|
||||
self._screen._confirm_send_action(widget,
|
||||
_("Are you sure you wish to shutdown the system?"),
|
||||
"machine.shutdown")
|
||||
@@ -135,10 +133,15 @@ class SplashScreenPanel(ScreenPanel):
|
||||
|
||||
def restart_system(self, widget):
|
||||
|
||||
if self._screen._ws.is_connected():
|
||||
if self._screen._ws.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")
|
||||
|
||||
def retry(self, widget):
|
||||
self.update_text((_("Connecting to %s") % self._screen.connecting_to_printer))
|
||||
self._screen._ws.retry()
|
||||
self.show_restart_buttons()
|
||||
+7
-13
@@ -32,10 +32,6 @@ class SystemPanel(ScreenPanel):
|
||||
self.refresh = None
|
||||
self.update_status = None
|
||||
self.update_dialog = None
|
||||
self.update_prog = None
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
grid = self._gtk.HomogeneousGrid()
|
||||
grid.set_row_homogeneous(False)
|
||||
|
||||
@@ -83,7 +79,6 @@ class SystemPanel(ScreenPanel):
|
||||
infogrid.attach(self.labels[f"{prog}_restart"], 0, i, 1, 1)
|
||||
|
||||
infogrid.attach(self.labels[f"{prog}_status"], 2, i, 1, 1)
|
||||
logging.info(f"Updating program: {prog} ")
|
||||
self.update_program_info(prog)
|
||||
|
||||
infogrid.attach(self.labels[prog], 1, i, 1, 1)
|
||||
@@ -279,7 +274,6 @@ class SystemPanel(ScreenPanel):
|
||||
dialog.set_response_sensitive(Gtk.ResponseType.CANCEL, False)
|
||||
dialog.get_widget_for_response(Gtk.ResponseType.CANCEL).hide()
|
||||
|
||||
self.update_prog = program
|
||||
self.update_dialog = dialog
|
||||
|
||||
logging.info(f"Sending machine.update.recover name: {program}")
|
||||
@@ -325,7 +319,6 @@ class SystemPanel(ScreenPanel):
|
||||
dialog.set_response_sensitive(Gtk.ResponseType.CANCEL, False)
|
||||
dialog.get_widget_for_response(Gtk.ResponseType.CANCEL).hide()
|
||||
|
||||
self.update_prog = program
|
||||
self.update_dialog = dialog
|
||||
|
||||
if program in ['klipper', 'moonraker', 'system', 'full']:
|
||||
@@ -338,12 +331,11 @@ class SystemPanel(ScreenPanel):
|
||||
|
||||
def update_program_info(self, p):
|
||||
|
||||
logging.info(f"Updating program: {p} ")
|
||||
if 'version_info' not in self.update_status or p not in self.update_status['version_info']:
|
||||
logging.info(f"Unknown version: {p}")
|
||||
return
|
||||
|
||||
info = self.update_status['version_info'][p]
|
||||
logging.info(f"{p}: {info}")
|
||||
|
||||
if p == "system":
|
||||
self.labels[p].set_markup("<b>System</b>")
|
||||
@@ -352,7 +344,7 @@ class SystemPanel(ScreenPanel):
|
||||
self.labels[f"{p}_status"].get_style_context().remove_class('update')
|
||||
self.labels[f"{p}_status"].set_sensitive(False)
|
||||
else:
|
||||
self._needs_update(p)
|
||||
self._needs_update(p, local="", remote=info['package_count'])
|
||||
|
||||
elif 'configured_type' in info and info['configured_type'] == 'git_repo':
|
||||
if info['is_valid'] and not info['is_dirty']:
|
||||
@@ -361,7 +353,7 @@ class SystemPanel(ScreenPanel):
|
||||
self.labels[f"{p}_status"].get_style_context().remove_class('invalid')
|
||||
else:
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']} -> {info['remote_version']}")
|
||||
self._needs_update(p)
|
||||
self._needs_update(p, info['version'], info['remote_version'])
|
||||
else:
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']}")
|
||||
self.labels[f"{p}_status"].set_label(_("Invalid"))
|
||||
@@ -371,15 +363,17 @@ class SystemPanel(ScreenPanel):
|
||||
self._already_updated(p, info)
|
||||
else:
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']} -> {info['remote_version']}")
|
||||
self._needs_update(p)
|
||||
self._needs_update(p, info['version'], info['remote_version'])
|
||||
|
||||
def _already_updated(self, p, info):
|
||||
logging.info(f"{p} {info['version']}")
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']}")
|
||||
self.labels[f"{p}_status"].set_label(_("Up To Date"))
|
||||
self.labels[f"{p}_status"].get_style_context().remove_class('update')
|
||||
self.labels[f"{p}_status"].set_sensitive(False)
|
||||
|
||||
def _needs_update(self, p):
|
||||
def _needs_update(self, p, local="", remote=""):
|
||||
logging.info(f"{p} {local} -> {remote}")
|
||||
self.labels[f"{p}_status"].set_label(_("Update"))
|
||||
self.labels[f"{p}_status"].get_style_context().add_class('update')
|
||||
self.labels[f"{p}_status"].set_sensitive(True)
|
||||
|
||||
@@ -30,13 +30,11 @@ class TemperaturePanel(ScreenPanel):
|
||||
self.preheat_options = self._screen._config.get_preheat_options()
|
||||
logging.debug(f"Preheat options: {self.preheat_options}")
|
||||
self.grid = self._gtk.HomogeneousGrid()
|
||||
|
||||
def initialize(self, panel_name):
|
||||
self._gtk.reset_temp_color()
|
||||
self.grid.attach(self.create_left_panel(), 0, 0, 1, 1)
|
||||
|
||||
# When printing start in temp_delta mode and only select tools
|
||||
state = self._printer.get_state()
|
||||
state = self._printer.state
|
||||
logging.info(state)
|
||||
selection = []
|
||||
if state not in ["printing", "paused"]:
|
||||
|
||||
+57
-35
@@ -18,22 +18,16 @@ class ZCalibratePanel(ScreenPanel):
|
||||
widgets = {}
|
||||
distances = ['.01', '.05', '.1', '.5', '1', '5']
|
||||
distance = distances[-2]
|
||||
probe_types = ["probe", "bltouch", "smart_effector", "dockable_probe"]
|
||||
|
||||
def __init__(self, screen, title, back=True):
|
||||
super().__init__(screen, title, False)
|
||||
self.z_offset = None
|
||||
|
||||
def initialize(self, panel_name):
|
||||
|
||||
if self._printer.config_section_exists("probe"):
|
||||
self.z_offset = float(self._screen.printer.get_config_section("probe")['z_offset'])
|
||||
elif self._printer.config_section_exists("bltouch"):
|
||||
self.z_offset = float(self._screen.printer.get_config_section("bltouch")['z_offset'])
|
||||
elif self._printer.config_section_exists("smart_effector"):
|
||||
self.z_offset = float(self._screen.printer.get_config_section("smart_effector")['z_offset'])
|
||||
else:
|
||||
self.z_offset = None
|
||||
|
||||
for probe_type in self.probe_types:
|
||||
if self._printer.config_section_exists(probe_type):
|
||||
self.z_offset = float(self._screen.printer.get_config_section(probe_type)['z_offset'])
|
||||
logging.info(f"Using: {probe_type} Z offset: {self.z_offset}")
|
||||
break
|
||||
self.widgets['zposition'] = Gtk.Label("Z: ?")
|
||||
|
||||
pos = self._gtk.HomogeneousGrid()
|
||||
@@ -62,9 +56,11 @@ class ZCalibratePanel(ScreenPanel):
|
||||
and not self._screen.printer.get_config_section("stepper_z")['endstop_pin'].startswith("probe"):
|
||||
self._add_button("Endstop", "endstop", pobox)
|
||||
functions.append("endstop")
|
||||
if self._printer.config_section_exists("probe") or self._printer.config_section_exists("bltouch"):
|
||||
self._add_button("Probe", "probe", pobox)
|
||||
functions.append("probe")
|
||||
for probe_type in self.probe_types:
|
||||
if self._printer.config_section_exists(probe_type):
|
||||
self._add_button("Probe", "probe", pobox)
|
||||
functions.append("probe")
|
||||
break
|
||||
if self._printer.config_section_exists("bed_mesh") and "probe" not in functions:
|
||||
# This is used to do a manual bed mesh if there is no probe
|
||||
self._add_button("Bed mesh", "mesh", pobox)
|
||||
@@ -157,10 +153,10 @@ class ZCalibratePanel(ScreenPanel):
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.Z_ENDSTOP_CALIBRATE)
|
||||
|
||||
def _move_to_position(self):
|
||||
# Get position from config
|
||||
x_position = y_position = None
|
||||
z_hop = speed = None
|
||||
# Get position from config
|
||||
printer_cfg = self._config.get_printer_config(self._screen.connected_printer)
|
||||
logging.info(printer_cfg)
|
||||
if printer_cfg is not None:
|
||||
x_position = printer_cfg.getfloat("calibrate_x_position", None)
|
||||
y_position = printer_cfg.getfloat("calibrate_y_position", None)
|
||||
@@ -169,6 +165,35 @@ class ZCalibratePanel(ScreenPanel):
|
||||
x_position = self._config.get_config()['z_calibrate_position'].getfloat("calibrate_x_position", None)
|
||||
y_position = self._config.get_config()['z_calibrate_position'].getfloat("calibrate_y_position", None)
|
||||
|
||||
klipper_cfg = self._screen.printer.get_config_section_list()
|
||||
for probe_type in self.probe_types:
|
||||
if probe_type in klipper_cfg:
|
||||
probe = self._screen.printer.get_config_section(probe_type)
|
||||
if "sample_retract_dist" in probe:
|
||||
z_hop = probe['sample_retract_dist']
|
||||
if "speed" in probe:
|
||||
speed = probe['speed']
|
||||
|
||||
# Use safe_z_home position
|
||||
if "safe_z_home" in self._screen.printer.get_config_section_list():
|
||||
safe_z = self._screen.printer.get_config_section("safe_z_home")
|
||||
safe_z_xy = safe_z['home_xy_position']
|
||||
safe_z_xy = [str(i.strip()) for i in safe_z_xy.split(',')]
|
||||
if x_position is None:
|
||||
x_position = float(safe_z_xy[0])
|
||||
logging.debug(f"Using safe_z x:{x_position}")
|
||||
if y_position is None:
|
||||
y_position = float(safe_z_xy[1])
|
||||
logging.debug(f"Using safe_z y:{y_position}")
|
||||
if 'z_hop' in safe_z:
|
||||
z_hop = safe_z['z_hop']
|
||||
if 'z_hop_speed' in safe_z:
|
||||
speed = safe_z['z_hop_speed']
|
||||
|
||||
speed = 15 if speed is None else speed
|
||||
z_hop = 5 if z_hop is None else z_hop
|
||||
self._screen._ws.klippy.gcode_script(f"G0 Z{z_hop} F{float(speed) * 60}")
|
||||
|
||||
if x_position is not None and y_position is not None:
|
||||
logging.debug(f"Configured probing position X: {x_position} Y: {y_position}")
|
||||
self._screen._ws.klippy.gcode_script(f'G0 X{x_position} Y{y_position} F3000')
|
||||
@@ -176,9 +201,9 @@ class ZCalibratePanel(ScreenPanel):
|
||||
logging.info("Detected delta kinematics calibrating at 0,0")
|
||||
self._screen._ws.klippy.gcode_script('G0 X0 Y0 F3000')
|
||||
else:
|
||||
self._calculate_position()
|
||||
self._calculate_position(klipper_cfg)
|
||||
|
||||
def _calculate_position(self):
|
||||
def _calculate_position(self, klipper_cfg):
|
||||
logging.debug("Position not configured, probing the middle of the bed")
|
||||
try:
|
||||
xmax = float(self._screen.printer.get_config_section("stepper_x")['position_max'])
|
||||
@@ -191,20 +216,15 @@ class ZCalibratePanel(ScreenPanel):
|
||||
logging.info(f"Center position X:{x_position} Y:{y_position}")
|
||||
|
||||
# Find probe offset
|
||||
klipper_cfg = self._screen.printer.get_config_section_list()
|
||||
x_offset = y_offset = None
|
||||
if "bltouch" in klipper_cfg:
|
||||
bltouch = self._screen.printer.get_config_section("bltouch")
|
||||
if "x_offset" in bltouch:
|
||||
x_offset = float(bltouch['x_offset'])
|
||||
if "y_offset" in bltouch:
|
||||
y_offset = float(bltouch['y_offset'])
|
||||
elif "probe" in klipper_cfg:
|
||||
probe = self._screen.printer.get_config_section("probe")
|
||||
if "x_offset" in probe:
|
||||
x_offset = float(probe['x_offset'])
|
||||
if "y_offset" in probe:
|
||||
y_offset = float(probe['y_offset'])
|
||||
for probe_type in self.probe_types:
|
||||
if probe_type in klipper_cfg:
|
||||
probe = self._screen.printer.get_config_section(probe_type)
|
||||
if "x_offset" in probe:
|
||||
x_offset = float(probe['x_offset'])
|
||||
if "y_offset" in probe:
|
||||
y_offset = float(probe['y_offset'])
|
||||
break
|
||||
logging.info(f"Offset X:{x_offset} Y:{y_offset}")
|
||||
if x_offset is not None:
|
||||
x_position = x_position - x_offset
|
||||
@@ -253,9 +273,7 @@ class ZCalibratePanel(ScreenPanel):
|
||||
self.distance = distance
|
||||
|
||||
def move(self, widget, direction):
|
||||
dist = f"{direction}{self.distance}"
|
||||
logging.info(f"# Moving {KlippyGcodes.testz_move(dist)}")
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.testz_move(dist))
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.testz_move(f"{direction}{self.distance}"))
|
||||
|
||||
def abort(self, widget):
|
||||
logging.info("Aborting calibration")
|
||||
@@ -292,3 +310,7 @@ class ZCalibratePanel(ScreenPanel):
|
||||
self.widgets['complete'].get_style_context().remove_class('color3')
|
||||
self.widgets['cancel'].set_sensitive(False)
|
||||
self.widgets['cancel'].get_style_context().remove_class('color2')
|
||||
|
||||
def activate(self):
|
||||
# This is only here because klipper doesn't provide a method to detect if it's calibrating
|
||||
self._screen._ws.klippy.gcode_script(KlippyGcodes.testz_move("+0.001"))
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import argparse
|
||||
|
||||
import gi
|
||||
|
||||
import json
|
||||
@@ -27,9 +28,6 @@ from ks_includes.config import KlipperScreenConfig
|
||||
from panels.base_panel import BasePanel
|
||||
|
||||
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
||||
logging.getLogger('matplotlib').setLevel(logging.WARNING)
|
||||
# This is here to avoid performance issues opening bed_mesh
|
||||
import matplotlib.pyplot # noqa
|
||||
|
||||
PRINTER_BASE_STATUS_OBJECTS = [
|
||||
'bed_mesh',
|
||||
@@ -53,32 +51,38 @@ PRINTER_BASE_STATUS_OBJECTS = [
|
||||
klipperscreendir = pathlib.Path(__file__).parent.resolve()
|
||||
|
||||
|
||||
def set_text_direction(lang=None):
|
||||
rtl_languages = ['he_IL']
|
||||
if lang is None:
|
||||
for lng in rtl_languages:
|
||||
if os.getenv('LANG').startswith(lng):
|
||||
lang = lng
|
||||
break
|
||||
if lang in rtl_languages:
|
||||
Gtk.Widget.set_default_direction(Gtk.TextDirection.RTL)
|
||||
logging.debug("Enabling RTL mode")
|
||||
return False
|
||||
Gtk.Widget.set_default_direction(Gtk.TextDirection.LTR)
|
||||
return True
|
||||
|
||||
|
||||
class KlipperScreen(Gtk.Window):
|
||||
""" Class for creating a screen for Klipper via HDMI """
|
||||
_cur_panels = []
|
||||
bed_temp_label = None
|
||||
connecting = False
|
||||
connecting_to_printer = None
|
||||
connected_printer = None
|
||||
currentPanel = None
|
||||
files = None
|
||||
filename = ""
|
||||
keyboard = None
|
||||
last_update = {}
|
||||
load_panel = {}
|
||||
number_tools = 1
|
||||
panels = {}
|
||||
popup_message = None
|
||||
screensaver = None
|
||||
printer = None
|
||||
printer_select_callbacks = []
|
||||
printer_select_prepanel = None
|
||||
subscriptions = []
|
||||
shutdown = True
|
||||
updating = False
|
||||
update_queue = []
|
||||
_ws = None
|
||||
init_printer_timeout = None
|
||||
dpms_timeout = None
|
||||
screensaver_timeout = None
|
||||
reinit_count = 0
|
||||
@@ -94,37 +98,44 @@ class KlipperScreen(Gtk.Window):
|
||||
configfile = os.path.normpath(os.path.expanduser(args.configfile))
|
||||
|
||||
self._config = KlipperScreenConfig(configfile, self)
|
||||
self.lang_ltr = self.set_text_direction(self._config.get_main_config().get("language", None))
|
||||
self.lang_ltr = set_text_direction(self._config.get_main_config().get("language", None))
|
||||
|
||||
Gtk.Window.__init__(self)
|
||||
self.set_title("KlipperScreen")
|
||||
monitor = Gdk.Display.get_default().get_primary_monitor()
|
||||
self.width = self._config.get_main_config().getint("width", monitor.get_geometry().width)
|
||||
self.height = self._config.get_main_config().getint("height", monitor.get_geometry().height)
|
||||
self.set_default_size(self.width, self.height)
|
||||
self.set_resizable(False)
|
||||
if not (self._config.get_main_config().get("width") or self._config.get_main_config().get("height")):
|
||||
self.fullscreen()
|
||||
self.vertical_mode = self.width < self.height
|
||||
logging.info(f"Screen resolution: {self.width}x{self.height}")
|
||||
self.theme = self._config.get_main_config().get('theme')
|
||||
self.show_cursor = self._config.get_main_config().getboolean("show_cursor", fallback=False)
|
||||
self.gtk = KlippyGtk(self, self.width, self.height, self.theme, self.show_cursor,
|
||||
show_cursor = self._config.get_main_config().getboolean("show_cursor", fallback=False)
|
||||
self.gtk = KlippyGtk(self, self.width, self.height, self.theme, show_cursor,
|
||||
self._config.get_main_config().get("font_size", "medium"))
|
||||
self.init_style()
|
||||
self.set_icon_from_file(os.path.join(klipperscreendir, "styles", "icon.svg"))
|
||||
|
||||
self.base_panel = BasePanel(self, title="Base Panel", back=False)
|
||||
self.add(self.base_panel.get())
|
||||
self.show_all()
|
||||
if show_cursor:
|
||||
self.get_window().set_cursor(
|
||||
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.ARROW))
|
||||
os.system("xsetroot -cursor_name arrow")
|
||||
else:
|
||||
self.get_window().set_cursor(
|
||||
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.BLANK_CURSOR))
|
||||
os.system("xsetroot -cursor ks_includes/emptyCursor.xbm ks_includes/emptyCursor.xbm")
|
||||
self.base_panel.activate()
|
||||
|
||||
self.printer_initializing(_("Initializing"))
|
||||
if self._config.errors:
|
||||
self.show_error_modal("Invalid config file", self._config.get_errors())
|
||||
# Prevent this dialog from being destroyed
|
||||
self.dialogs = []
|
||||
self.set_screenblanking_timeout(self._config.get_main_config().get('screen_blanking'))
|
||||
|
||||
# Move mouse to 0,0
|
||||
os.system("/usr/bin/xdotool mousemove 0 0")
|
||||
self.change_cursor()
|
||||
self.initial_connection()
|
||||
|
||||
def initial_connection(self):
|
||||
@@ -137,83 +148,32 @@ class KlipperScreen(Gtk.Window):
|
||||
pname = list(printers[0])[0]
|
||||
self.connect_printer(pname)
|
||||
else:
|
||||
self.base_panel.show_printer_select(True)
|
||||
self.show_printer_select()
|
||||
|
||||
def connect_printer_widget(self, widget, name):
|
||||
self.connect_printer(name)
|
||||
|
||||
def connect_printer(self, name):
|
||||
self.connecting_to_printer = name
|
||||
if self._ws is not None and self._ws.connected:
|
||||
self._ws.close()
|
||||
return
|
||||
|
||||
data = {
|
||||
"moonraker_host": "127.0.0.1",
|
||||
"moonraker_port": "7125",
|
||||
"moonraker_api_key": False
|
||||
}
|
||||
|
||||
self.connecting_to_printer = name
|
||||
|
||||
if self.connected_printer == name:
|
||||
if self.printer_select_prepanel is not None:
|
||||
self.show_panel(self.printer_select_prepanel, "", "", 2)
|
||||
self.printer_select_prepanel = None
|
||||
while len(self.printer_select_callbacks) > 0:
|
||||
i = self.printer_select_callbacks.pop(0)
|
||||
i()
|
||||
if self.printer.get_state() not in ["disconnected", "error", "startup", "shutdown"]:
|
||||
self.base_panel.show_heaters(True)
|
||||
self.base_panel.show_printer_select(True)
|
||||
self.base_panel.show_macro_shortcut(self._config.get_main_config().getboolean('side_macro_shortcut', True))
|
||||
return
|
||||
|
||||
# Cleanup
|
||||
self.printer_select_callbacks = []
|
||||
self.printer_select_prepanel = None
|
||||
if self.files is not None:
|
||||
self.files.reset()
|
||||
self.files = None
|
||||
if self.printer is not None:
|
||||
self.printer.reset()
|
||||
self.printer = None
|
||||
|
||||
logging.info(f"Connecting to printer: {name}")
|
||||
for printer in self._config.get_printers():
|
||||
pname = list(printer)[0]
|
||||
|
||||
if pname != name:
|
||||
continue
|
||||
data = printer[pname]
|
||||
break
|
||||
|
||||
if self._ws is not None:
|
||||
self._ws.close()
|
||||
self.connecting = True
|
||||
|
||||
logging.info(f"Connecting to printer: {name}")
|
||||
self.apiclient = KlippyRest(data["moonraker_host"], data["moonraker_port"], data["moonraker_api_key"])
|
||||
|
||||
self.printer = Printer({
|
||||
"software_version": "Unknown"
|
||||
}, {
|
||||
'configfile': {
|
||||
'config': {}
|
||||
},
|
||||
'print_stats': {
|
||||
'state': 'disconnected'
|
||||
},
|
||||
'virtual_sdcard': {
|
||||
'is_active': False
|
||||
}
|
||||
}, self.state_execute)
|
||||
|
||||
self._remove_all_panels()
|
||||
self.subscriptions = []
|
||||
for panel in list(self.panels):
|
||||
if panel not in ["printer_select", "splash_screen"]:
|
||||
del self.panels[panel]
|
||||
for dialog in self.dialogs:
|
||||
dialog.destroy()
|
||||
self.base_panel.show_printer_select(True)
|
||||
self.printer_initializing(_("Connecting to %s") % name)
|
||||
|
||||
self.printer.set_callbacks({
|
||||
self.printer = Printer(self.state_execute)
|
||||
self.printer.state_callbacks = {
|
||||
"disconnected": self.state_disconnected,
|
||||
"error": self.state_error,
|
||||
"paused": self.state_paused,
|
||||
@@ -221,13 +181,15 @@ class KlipperScreen(Gtk.Window):
|
||||
"ready": self.state_ready,
|
||||
"startup": self.state_startup,
|
||||
"shutdown": self.state_shutdown
|
||||
})
|
||||
}
|
||||
self._remove_all_panels()
|
||||
self.printer_initializing(_("Connecting to %s") % name)
|
||||
|
||||
self._ws = KlippyWebsocket(self,
|
||||
{
|
||||
"on_connect": self.init_printer,
|
||||
"on_message": self._websocket_callback,
|
||||
"on_close": self.printer_initializing
|
||||
"on_close": self.websocket_disconnected
|
||||
},
|
||||
data["moonraker_host"],
|
||||
data["moonraker_port"]
|
||||
@@ -235,22 +197,19 @@ class KlipperScreen(Gtk.Window):
|
||||
|
||||
self.files = KlippyFiles(self)
|
||||
self._ws.initial_connect()
|
||||
self.connecting = False
|
||||
|
||||
self.connected_printer = name
|
||||
logging.debug(f"Connected to printer: {name}")
|
||||
|
||||
def ws_subscribe(self):
|
||||
requested_updates = {
|
||||
"objects": {
|
||||
"bed_mesh": ["profile_name", "mesh_max", "mesh_min", "probed_matrix"],
|
||||
"bed_mesh": ["profile_name", "mesh_max", "mesh_min", "probed_matrix", "profiles"],
|
||||
"configfile": ["config"],
|
||||
"display_status": ["progress", "message"],
|
||||
"fan": ["speed"],
|
||||
"gcode_move": ["extrude_factor", "gcode_position", "homing_origin", "speed_factor", "speed"],
|
||||
"idle_timeout": ["state"],
|
||||
"pause_resume": ["is_paused"],
|
||||
"print_stats": ["print_duration", "total_duration", "filament_used", "filename", "state", "message"],
|
||||
"print_stats": ["print_duration", "total_duration", "filament_used", "filename", "state", "message",
|
||||
"info"],
|
||||
"toolhead": ["homed_axes", "estimated_print_time", "print_time", "position", "extruder",
|
||||
"max_accel", "max_accel_to_decel", "max_velocity", "square_corner_velocity"],
|
||||
"virtual_sdcard": ["file_position", "is_active", "progress"],
|
||||
@@ -280,61 +239,45 @@ class KlipperScreen(Gtk.Window):
|
||||
panel_path = os.path.join(os.path.dirname(__file__), 'panels', f"{panel}.py")
|
||||
logging.info(f"Panel path: {panel_path}")
|
||||
if not os.path.exists(panel_path):
|
||||
msg = f"Panel {panel} does not exist"
|
||||
logging.info(msg)
|
||||
raise Exception(msg)
|
||||
logging.error(f"Panel {panel} does not exist")
|
||||
raise FileNotFoundError(os.strerror(2), "\n" + panel_path)
|
||||
|
||||
module = importlib.import_module(f"panels.{panel}")
|
||||
if not hasattr(module, "create_panel"):
|
||||
msg = f"Cannot locate create_panel function for {panel}"
|
||||
logging.info(msg)
|
||||
raise Exception(msg)
|
||||
raise ImportError(f"Cannot locate create_panel function for {panel}")
|
||||
self.load_panel[panel] = getattr(module, "create_panel")
|
||||
|
||||
try:
|
||||
return self.load_panel[panel](*args)
|
||||
except Exception as e:
|
||||
msg = f"Unable to create panel {panel}\n{e}"
|
||||
logging.exception(msg)
|
||||
raise Exception(msg) from e
|
||||
raise RuntimeError(f"Unable to create panel: {panel}\n{e}") from e
|
||||
|
||||
def show_panel(self, panel_name, panel_type, title, remove=None, pop=True, **kwargs):
|
||||
if panel_name not in self.panels:
|
||||
try:
|
||||
self.panels[panel_name] = self._load_panel(panel_type, self, title)
|
||||
|
||||
if kwargs != {}:
|
||||
self.panels[panel_name].initialize(panel_name, **kwargs)
|
||||
else:
|
||||
self.panels[panel_name].initialize(panel_name)
|
||||
except Exception as e:
|
||||
if panel_name in self.panels:
|
||||
del self.panels[panel_name]
|
||||
logging.exception(f"Unable to load panel {panel_type}")
|
||||
self.show_error_modal(f"Unable to load panel {panel_type}", f"{e}")
|
||||
return
|
||||
|
||||
if hasattr(self.panels[panel_name], "process_update"):
|
||||
self.panels[panel_name].process_update("notify_status_update", self.printer.get_data())
|
||||
|
||||
try:
|
||||
if remove == 2:
|
||||
self._remove_all_panels()
|
||||
elif remove == 1:
|
||||
self._remove_current_panel(pop)
|
||||
|
||||
if panel_name not in self.panels:
|
||||
try:
|
||||
self.panels[panel_name] = self._load_panel(panel_type, self, title)
|
||||
if hasattr(self.panels[panel_name], "initialize"):
|
||||
self.panels[panel_name].initialize(**kwargs)
|
||||
except Exception as e:
|
||||
if panel_name in self.panels:
|
||||
del self.panels[panel_name]
|
||||
logging.exception(f"Unable to load panel {panel_type}")
|
||||
self.show_error_modal(f"Unable to load panel {panel_type}", f"{e}")
|
||||
return
|
||||
|
||||
logging.debug(f"Attaching panel {panel_name}")
|
||||
self.base_panel.add_content(self.panels[panel_name])
|
||||
|
||||
logging.debug(f"Showing back. count: {len(self._cur_panels)}")
|
||||
if len(self._cur_panels) == 0:
|
||||
self.base_panel.show_back(False)
|
||||
else:
|
||||
self.base_panel.show_back(True)
|
||||
self.base_panel.show_back(len(self._cur_panels) > 0)
|
||||
self.show_all()
|
||||
|
||||
if hasattr(self.panels[panel_name], "process_update"):
|
||||
self.panels[panel_name].process_update("notify_status_update", self.printer.get_updates())
|
||||
self.add_subscription(panel_name)
|
||||
if hasattr(self.panels[panel_name], "activate"):
|
||||
self.panels[panel_name].activate()
|
||||
@@ -343,11 +286,10 @@ class KlipperScreen(Gtk.Window):
|
||||
logging.exception(f"Error attaching panel:\n{e}")
|
||||
|
||||
self._cur_panels.append(panel_name)
|
||||
logging.debug(f"Current panel hierarchy: {self._cur_panels}")
|
||||
logging.debug(f"Current panel hierarchy: {' > '.join(self._cur_panels)}")
|
||||
|
||||
def show_popup_message(self, message, level=3):
|
||||
if self.screensaver is not None:
|
||||
self.wake_screen()
|
||||
self.close_screensaver()
|
||||
if self.popup_message is not None:
|
||||
self.close_popup_message()
|
||||
|
||||
@@ -397,7 +339,7 @@ class KlipperScreen(Gtk.Window):
|
||||
self.popup_message = None
|
||||
|
||||
def show_error_modal(self, err, e=""):
|
||||
logging.exception(f"Showing error modal: {err}")
|
||||
logging.error(f"Showing error modal: {err}")
|
||||
|
||||
title = Gtk.Label()
|
||||
title.set_markup(f"<b>{err}</b>\n")
|
||||
@@ -429,12 +371,11 @@ class KlipperScreen(Gtk.Window):
|
||||
]
|
||||
self.gtk.Dialog(self, buttons, grid, self.error_modal_response)
|
||||
|
||||
@staticmethod
|
||||
def error_modal_response(widget, response_id):
|
||||
def error_modal_response(self, widget, response_id):
|
||||
widget.destroy()
|
||||
self.reload_panels()
|
||||
|
||||
def restart_warning(self, value):
|
||||
|
||||
logging.debug(f"Showing restart warning because: {value}")
|
||||
|
||||
buttons = [
|
||||
@@ -514,16 +455,11 @@ class KlipperScreen(Gtk.Window):
|
||||
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
)
|
||||
|
||||
def is_printing(self):
|
||||
return self.printer.get_state() == "printing"
|
||||
|
||||
def is_updating(self):
|
||||
return self.updating
|
||||
|
||||
def _go_to_submenu(self, widget, name):
|
||||
logging.info(f"#### Go to submenu {name}")
|
||||
# self._remove_current_panel(False)
|
||||
|
||||
# Find current menu item
|
||||
if "main_panel" in self._cur_panels:
|
||||
menu = "__main"
|
||||
@@ -539,21 +475,29 @@ class KlipperScreen(Gtk.Window):
|
||||
logging.info("No items in menu, returning.")
|
||||
return
|
||||
|
||||
self.show_panel(f'{self._cur_panels[-1]}_{name}',
|
||||
"menu", disname, 1, False, display_name=disname, items=menuitems)
|
||||
self.show_panel(f'{self._cur_panels[-1]}_{name}', "menu", disname, 1, False, items=menuitems)
|
||||
|
||||
def _remove_all_panels(self):
|
||||
while len(self._cur_panels) > 0:
|
||||
self._remove_current_panel(True, False)
|
||||
self.show_all()
|
||||
self.subscriptions = []
|
||||
self._cur_panels = []
|
||||
for _ in self.base_panel.content.get_children():
|
||||
self.base_panel.content.remove(_)
|
||||
for panel in list(self.panels):
|
||||
if panel not in ["printer_select", "splash_screen"]:
|
||||
del self.panels[panel]
|
||||
for dialog in self.dialogs:
|
||||
dialog.destroy()
|
||||
self.close_screensaver()
|
||||
|
||||
def _remove_current_panel(self, pop=True, show=True):
|
||||
def _remove_current_panel(self, pop=True):
|
||||
if len(self._cur_panels) <= 0:
|
||||
self.reload_panels()
|
||||
return
|
||||
self.base_panel.remove(self.panels[self._cur_panels[-1]].get_content())
|
||||
if hasattr(self.panels[self._cur_panels[-1]], "deactivate"):
|
||||
self.panels[self._cur_panels[-1]].deactivate()
|
||||
self.remove_subscription(self._cur_panels[-1])
|
||||
if self._cur_panels[-1] in self.subscriptions:
|
||||
self.subscriptions.remove(self._cur_panels[-1])
|
||||
if pop is True:
|
||||
self._cur_panels.pop()
|
||||
if len(self._cur_panels) > 0:
|
||||
@@ -562,11 +506,8 @@ class KlipperScreen(Gtk.Window):
|
||||
if hasattr(self.panels[self._cur_panels[-1]], "activate"):
|
||||
self.panels[self._cur_panels[-1]].activate()
|
||||
if hasattr(self.panels[self._cur_panels[-1]], "process_update"):
|
||||
self.panels[self._cur_panels[-1]].process_update("notify_status_update",
|
||||
self.printer.get_updates())
|
||||
self.add_subscription(self._cur_panels[-1])
|
||||
if show is True:
|
||||
self.show_all()
|
||||
self.show_all()
|
||||
|
||||
def _menu_go_back(self, widget=None):
|
||||
logging.info("#### Menu go back")
|
||||
@@ -583,17 +524,8 @@ class KlipperScreen(Gtk.Window):
|
||||
self._remove_current_panel()
|
||||
|
||||
def add_subscription(self, panel_name):
|
||||
for sub in self.subscriptions:
|
||||
if sub == panel_name:
|
||||
return
|
||||
|
||||
self.subscriptions.append(panel_name)
|
||||
|
||||
def remove_subscription(self, panel_name):
|
||||
for i in range(len(self.subscriptions)):
|
||||
if self.subscriptions[i] == panel_name:
|
||||
self.subscriptions.pop(i)
|
||||
return
|
||||
if panel_name not in self.subscriptions:
|
||||
self.subscriptions.append(panel_name)
|
||||
|
||||
def reset_screensaver_timeout(self, *args):
|
||||
if self.screensaver_timeout is not None:
|
||||
@@ -657,7 +589,6 @@ class KlipperScreen(Gtk.Window):
|
||||
if self._config.get_main_config().get('screen_blanking') != "off":
|
||||
logging.debug("Screen wake up")
|
||||
os.system("xset -display :0 dpms force on")
|
||||
self.close_screensaver()
|
||||
|
||||
def set_dpms(self, use_dpms):
|
||||
self.use_dpms = use_dpms
|
||||
@@ -706,45 +637,37 @@ class KlipperScreen(Gtk.Window):
|
||||
if self.updating is True and updating is False and len(self.update_queue) > 0:
|
||||
i = self.update_queue.pop()
|
||||
self.update_queue = []
|
||||
i[0](i[1])
|
||||
|
||||
i[0]()
|
||||
self.updating = updating
|
||||
|
||||
def show_printer_select(self, widget=None):
|
||||
logging.debug(f"Saving panel: {self._cur_panels[0]}")
|
||||
self.printer_select_prepanel = self._cur_panels[0]
|
||||
self.base_panel.show_heaters(False)
|
||||
self.show_panel("printer_select", "printer_select", _("Printer Select"), 2)
|
||||
|
||||
def state_execute(self, callback, prev_state):
|
||||
def state_execute(self, callback):
|
||||
if self.is_updating():
|
||||
self.update_queue.append([callback, prev_state])
|
||||
self.update_queue.append([callback])
|
||||
else:
|
||||
callback(prev_state)
|
||||
self.init_printer()
|
||||
callback()
|
||||
|
||||
def state_disconnected(self, prev_state):
|
||||
if "printer_select" in self._cur_panels:
|
||||
self.printer_select_callbacks = [self.state_disconnected]
|
||||
return
|
||||
def websocket_disconnected(self, msg):
|
||||
self.printer_initializing(msg)
|
||||
self.connecting = True
|
||||
self.connected_printer = None
|
||||
self.files.reset()
|
||||
self.files = None
|
||||
self.printer.reset()
|
||||
self.printer = None
|
||||
self.connect_printer(self.connecting_to_printer)
|
||||
|
||||
def state_disconnected(self):
|
||||
logging.debug("### Going to disconnected")
|
||||
self.base_panel.show_macro_shortcut(False)
|
||||
self.wake_screen()
|
||||
self.close_screensaver()
|
||||
self.printer_initializing(_("Klipper has disconnected"))
|
||||
if self.connected_printer is not None:
|
||||
self.connected_printer = None
|
||||
# Try to reconnect
|
||||
self.connect_printer(self.connecting_to_printer)
|
||||
else:
|
||||
self.initial_connection()
|
||||
|
||||
def state_error(self, prev_state):
|
||||
if "printer_select" in self._cur_panels:
|
||||
self.printer_select_callbacks = [self.state_error]
|
||||
return
|
||||
|
||||
self.base_panel.show_macro_shortcut(False)
|
||||
self.wake_screen()
|
||||
def state_error(self):
|
||||
self.close_screensaver()
|
||||
msg = self.printer.get_stat("webhooks", "state_message")
|
||||
if "FIRMWARE_RESTART" in msg:
|
||||
self.printer_initializing("<b>" + _("Klipper has encountered an error.") + "\n" +
|
||||
@@ -758,100 +681,48 @@ class KlipperScreen(Gtk.Window):
|
||||
self.printer_initializing("<b>" + _("Klipper has encountered an error.") +
|
||||
"</b>" + "\n\n" + msg)
|
||||
|
||||
for panel in list(self.panels):
|
||||
if panel not in ["printer_select", "splash_screen"]:
|
||||
del self.panels[panel]
|
||||
for dialog in self.dialogs:
|
||||
dialog.destroy()
|
||||
|
||||
def state_paused(self, prev_state):
|
||||
def state_paused(self):
|
||||
if "job_status" not in self._cur_panels:
|
||||
self.printer_printing()
|
||||
|
||||
def state_printing(self, prev_state):
|
||||
if "printer_select" in self._cur_panels:
|
||||
self.printer_select_callbacks = [self.state_printing]
|
||||
return
|
||||
|
||||
def state_printing(self):
|
||||
if "job_status" not in self._cur_panels:
|
||||
self.printer_printing()
|
||||
else:
|
||||
self.panels["job_status"].new_print()
|
||||
|
||||
def state_ready(self, prev_state):
|
||||
if "printer_select" in self._cur_panels:
|
||||
self.printer_select_callbacks = [self.state_ready]
|
||||
return
|
||||
|
||||
self.base_panel.show_macro_shortcut(self._config.get_main_config().getboolean('side_macro_shortcut', True))
|
||||
self.base_panel.show_heaters(True)
|
||||
|
||||
def state_ready(self):
|
||||
# Do not return to main menu if completing a job, timeouts/user input will return
|
||||
if "job_status" in self._cur_panels or "main_menu" in self._cur_panels:
|
||||
if "job_status" in self._cur_panels:
|
||||
return
|
||||
|
||||
if prev_state not in ['paused', 'printing']:
|
||||
self.init_printer()
|
||||
self.base_panel._printer = self.printer
|
||||
|
||||
self.printer_ready()
|
||||
|
||||
def state_startup(self, prev_state):
|
||||
if "printer_select" in self._cur_panels:
|
||||
self.printer_select_callbacks = [self.state_startup]
|
||||
return
|
||||
|
||||
def state_startup(self):
|
||||
self.printer_initializing(_("Klipper is attempting to start"))
|
||||
|
||||
def state_shutdown(self, prev_state):
|
||||
if "printer_select" in self._cur_panels:
|
||||
self.printer_select_callbacks = [self.state_shutdown]
|
||||
return
|
||||
|
||||
self.base_panel.show_macro_shortcut(False)
|
||||
self.wake_screen()
|
||||
def state_shutdown(self):
|
||||
self.close_screensaver()
|
||||
msg = self.printer.get_stat("webhooks", "state_message")
|
||||
if "ready" in msg:
|
||||
msg = ""
|
||||
msg = msg if "ready" not in msg else ""
|
||||
self.printer_initializing("<b>" + _("Klipper has shutdown") +
|
||||
"</b>" + "\n\n" + msg)
|
||||
|
||||
def toggle_macro_shortcut(self, value):
|
||||
self.base_panel.show_macro_shortcut(value)
|
||||
|
||||
def set_text_direction(self, lang=None):
|
||||
rtl_languages = ['he_IL']
|
||||
if lang is None:
|
||||
for lng in rtl_languages:
|
||||
if os.getenv('LANG').startswith(lng):
|
||||
lang = lng
|
||||
break
|
||||
if lang in rtl_languages:
|
||||
Gtk.Widget.set_default_direction(Gtk.TextDirection.RTL)
|
||||
logging.debug("Enabling RTL mode")
|
||||
return False
|
||||
Gtk.Widget.set_default_direction(Gtk.TextDirection.LTR)
|
||||
return True
|
||||
|
||||
def change_language(self, lang):
|
||||
self._config.install_language(lang)
|
||||
self.lang_ltr = self.set_text_direction(lang)
|
||||
self.lang_ltr = set_text_direction(lang)
|
||||
self._config._create_configurable_options(self)
|
||||
self.reload_panels()
|
||||
|
||||
def reload_panels(self, *args):
|
||||
self._remove_all_panels()
|
||||
for panel in list(self.panels):
|
||||
del self.panels[panel]
|
||||
for dialog in self.dialogs:
|
||||
dialog.destroy()
|
||||
self.printer.change_state(self.printer.state)
|
||||
|
||||
def _websocket_callback(self, action, data):
|
||||
|
||||
if self.connecting is True:
|
||||
if self.connecting:
|
||||
return
|
||||
|
||||
if action == "notify_klippy_disconnected":
|
||||
self.printer.change_state("disconnected")
|
||||
return
|
||||
@@ -859,10 +730,9 @@ class KlipperScreen(Gtk.Window):
|
||||
self.printer.change_state("shutdown")
|
||||
elif action == "notify_klippy_ready":
|
||||
self.printer.change_state("ready")
|
||||
elif action == "notify_status_update" and self.printer.get_state() != "shutdown":
|
||||
elif action == "notify_status_update" and self.printer.state != "shutdown":
|
||||
self.printer.process_update(data)
|
||||
elif action == "notify_filelist_changed":
|
||||
logging.debug("Filelist changed: %s", json.dumps(data, indent=2))
|
||||
if self.files is not None:
|
||||
self.files.process_update(data)
|
||||
elif action == "notify_metadata_update":
|
||||
@@ -873,13 +743,13 @@ class KlipperScreen(Gtk.Window):
|
||||
logging.debug("Power status changed: %s", data)
|
||||
self.printer.process_power_update(data)
|
||||
self.panels['splash_screen'].check_power_status()
|
||||
elif self.printer.get_state() not in ["error", "shutdown"] and action == "notify_gcode_response":
|
||||
elif action == "notify_gcode_response" and self.printer.state not in ["error", "shutdown"]:
|
||||
if not (data.startswith("B:") or data.startswith("T:")):
|
||||
if data.startswith("echo: "):
|
||||
self.show_popup_message(data[6:], 1)
|
||||
elif data.startswith("!! "):
|
||||
self.show_popup_message(data[3:], 3)
|
||||
if "SAVE_CONFIG" in data and self.printer.get_state() == "ready":
|
||||
if "SAVE_CONFIG" in data and self.printer.state == "ready":
|
||||
script = {"script": "SAVE_CONFIG"}
|
||||
self._confirm_send_action(
|
||||
None,
|
||||
@@ -887,15 +757,11 @@ class KlipperScreen(Gtk.Window):
|
||||
"printer.gcode.script",
|
||||
script
|
||||
)
|
||||
|
||||
self.base_panel.process_update(action, data)
|
||||
if self._cur_panels[-1] in self.subscriptions:
|
||||
if self._cur_panels and self._cur_panels[-1] in self.subscriptions:
|
||||
self.panels[self._cur_panels[-1]].process_update(action, data)
|
||||
|
||||
def _confirm_send_action(self, widget, text, method, params=None):
|
||||
|
||||
if params is None:
|
||||
params = {}
|
||||
buttons = [
|
||||
{"name": _("Continue"), "response": Gtk.ResponseType.OK},
|
||||
{"name": _("Cancel"), "response": Gtk.ResponseType.CANCEL}
|
||||
@@ -929,19 +795,17 @@ class KlipperScreen(Gtk.Window):
|
||||
widget.destroy()
|
||||
|
||||
def _send_action(self, widget, method, params):
|
||||
logging.info(f"{method}: {params}")
|
||||
self._ws.send_method(method, params)
|
||||
|
||||
def printer_initializing(self, text=None, disconnect=False):
|
||||
def printer_initializing(self, msg):
|
||||
self.close_popup_message()
|
||||
self.show_panel('splash_screen', "splash_screen", _("Home"), 2)
|
||||
if disconnect is True and self.printer is not None:
|
||||
self.shutdown = True
|
||||
self.printer.state = "disconnected"
|
||||
if text is not None:
|
||||
self.panels['splash_screen'].update_text(text)
|
||||
if 'splash_screen' not in self.panels or 'printer_select' not in self._cur_panels:
|
||||
self.show_panel('splash_screen', "splash_screen", None, 2)
|
||||
self.panels['splash_screen'].update_text(msg)
|
||||
|
||||
def search_power_devices(self, power_devices):
|
||||
if self.connected_printer is None:
|
||||
if self.connected_printer is None or not power_devices:
|
||||
return
|
||||
found_devices = []
|
||||
devices = self.printer.get_power_devices()
|
||||
@@ -955,11 +819,10 @@ class KlipperScreen(Gtk.Window):
|
||||
logging.info("Found %s", found_devices)
|
||||
return found_devices
|
||||
else:
|
||||
logging.info("Power devices not found")
|
||||
logging.info("Associated power devices not found")
|
||||
return None
|
||||
|
||||
def power_on(self, widget, devices):
|
||||
|
||||
for device in devices:
|
||||
if self.printer.get_power_device_status(device) == "off":
|
||||
self.show_popup_message(_("Sending Power ON signal to: %s") % devices, level=1)
|
||||
@@ -969,38 +832,42 @@ class KlipperScreen(Gtk.Window):
|
||||
logging.info("%s is ON", device)
|
||||
|
||||
def init_printer(self):
|
||||
|
||||
state = self.apiclient.get_server_info()
|
||||
if state is False:
|
||||
return False
|
||||
logging.info("Moonraker not connected")
|
||||
return
|
||||
self.connecting = not self._ws.connected
|
||||
self.connected_printer = self.connecting_to_printer
|
||||
self.base_panel.set_ks_printer_cfg(self.connected_printer)
|
||||
|
||||
# Moonraker is ready, set a loop to init the printer
|
||||
self.reinit_count += 1
|
||||
self.init_printer_timeout = GLib.timeout_add_seconds(3, self.init_printer)
|
||||
|
||||
self.shutdown = False
|
||||
powerdevs = self.apiclient.send_request("machine/device_power/devices")
|
||||
if powerdevs is not False:
|
||||
self.printer.configure_power_devices(powerdevs['result'])
|
||||
|
||||
if state['result']['klippy_connected'] is False:
|
||||
self.panels['splash_screen'].update_text(
|
||||
logging.info("Klipper not connected")
|
||||
self.printer_initializing(
|
||||
_("Moonraker: connected")
|
||||
+ f"\n\nKlipper: {state['result']['klippy_state']}\n\n"
|
||||
+ _("Retry #%s") % self.reinit_count
|
||||
)
|
||||
return False
|
||||
GLib.timeout_add_seconds(3, self.init_printer)
|
||||
return
|
||||
|
||||
printer_info = self.apiclient.get_printer_info()
|
||||
if printer_info is False:
|
||||
return self._update_splash_screen("Unable to get printer info from moonraker")
|
||||
|
||||
data = self.apiclient.send_request("printer/objects/query?" + "&".join(PRINTER_BASE_STATUS_OBJECTS))
|
||||
if data is False:
|
||||
return self._update_splash_screen("Error getting printer object data")
|
||||
self.printer_initializing("Unable to get printer info from moonraker")
|
||||
GLib.timeout_add_seconds(3, self.init_printer)
|
||||
return
|
||||
|
||||
config = self.apiclient.send_request("printer/objects/query?configfile")
|
||||
if config is False:
|
||||
return self._update_splash_screen("Error getting printer config data")
|
||||
self.printer_initializing("Error getting printer configuration")
|
||||
GLib.timeout_add_seconds(3, self.init_printer)
|
||||
return
|
||||
|
||||
# Reinitialize printer, in case the printer was shut down and anything has changed.
|
||||
self.printer.reinit(printer_info['result'], config['result']['status'])
|
||||
@@ -1016,7 +883,9 @@ class KlipperScreen(Gtk.Window):
|
||||
data = self.apiclient.send_request("printer/objects/query?" + "&".join(PRINTER_BASE_STATUS_OBJECTS +
|
||||
extra_items))
|
||||
if data is False:
|
||||
return self._update_splash_screen("Error getting printer object data with extra items")
|
||||
self.printer_initializing("Error getting printer object data with extra items")
|
||||
GLib.timeout_add_seconds(3, self.init_printer)
|
||||
return
|
||||
|
||||
tempstore = self.apiclient.send_request("server/temperature_store")
|
||||
if tempstore is not False:
|
||||
@@ -1027,29 +896,23 @@ class KlipperScreen(Gtk.Window):
|
||||
self.files.refresh_files()
|
||||
|
||||
logging.info("Printer initialized")
|
||||
GLib.source_remove(self.init_printer_timeout)
|
||||
self.reinit_count = 0
|
||||
return False
|
||||
|
||||
def _update_splash_screen(self, msg):
|
||||
logging.info(msg)
|
||||
self.panels['splash_screen'].update_text(msg)
|
||||
return False
|
||||
def base_panel_show_all(self):
|
||||
self.base_panel.show_macro_shortcut(self._config.get_main_config().getboolean('side_macro_shortcut', True))
|
||||
self.base_panel.show_heaters(True)
|
||||
self.base_panel.show_estop(True)
|
||||
|
||||
def printer_ready(self):
|
||||
self.close_popup_message()
|
||||
self.show_panel('main_panel', "main_menu", _("Home"), 2,
|
||||
items=self._config.get_menu_items("__main"), extrudercount=self.printer.get_extruder_count())
|
||||
self.ws_subscribe()
|
||||
if "job_status" in self.panels:
|
||||
self.remove_subscription("job_status")
|
||||
del self.panels["job_status"]
|
||||
self.show_panel('main_panel', "main_menu", None, 2, items=self._config.get_menu_items("__main"))
|
||||
self.base_panel_show_all()
|
||||
|
||||
def printer_printing(self):
|
||||
self.close_screensaver()
|
||||
self.close_popup_message()
|
||||
self.show_panel('job_status', "job_status", _("Printing"), 2)
|
||||
self.base_panel.show_heaters(True)
|
||||
self.base_panel.show_macro_shortcut(self._config.get_main_config().getboolean('side_macro_shortcut', True))
|
||||
self.base_panel_show_all()
|
||||
for dialog in self.dialogs:
|
||||
dialog.destroy()
|
||||
|
||||
@@ -1108,27 +971,21 @@ class KlipperScreen(Gtk.Window):
|
||||
self.base_panel.get_content().remove(self.keyboard['box'])
|
||||
self.keyboard = None
|
||||
|
||||
def change_cursor(self, cursortype=None):
|
||||
if cursortype == "watch":
|
||||
os.system("xsetroot -cursor_name watch")
|
||||
elif self.show_cursor:
|
||||
self.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
|
||||
os.system("xsetroot -cursor_name arrow")
|
||||
else:
|
||||
self.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.BLANK_CURSOR))
|
||||
os.system("xsetroot -cursor ks_includes/emptyCursor.xbm ks_includes/emptyCursor.xbm")
|
||||
return
|
||||
|
||||
|
||||
def main():
|
||||
version = functions.get_software_version()
|
||||
parser = argparse.ArgumentParser(description="KlipperScreen - A GUI for Klipper")
|
||||
homedir = os.path.expanduser("~")
|
||||
|
||||
parser.add_argument(
|
||||
"-c", "--configfile", default="~/KlipperScreen.conf", metavar='<configfile>',
|
||||
"-c", "--configfile", default=os.path.join(homedir, "KlipperScreen.conf"), metavar='<configfile>',
|
||||
help="Location of KlipperScreen configuration file"
|
||||
)
|
||||
logdir = os.path.join(homedir, "printer_data", "logs")
|
||||
if not os.path.exists(logdir):
|
||||
logdir = "/tmp"
|
||||
parser.add_argument(
|
||||
"-l", "--logfile", default="/tmp/KlipperScreen.log", metavar='<logfile>',
|
||||
"-l", "--logfile", default=os.path.join(logdir, "KlipperScreen.log"), metavar='<logfile>',
|
||||
help="Location of KlipperScreen logfile output"
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -4,7 +4,7 @@ SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
KSPATH=$(sed 's/\/scripts//g' <<< $SCRIPTPATH)
|
||||
KSENV="${KLIPPERSCREEN_VENV:-${HOME}/.KlipperScreen-env}"
|
||||
|
||||
XSERVER="xinit xinput x11-xserver-utils xdotool"
|
||||
XSERVER="xinit xinput x11-xserver-utils xserver-xorg-input-evdev xserver-xorg-input-libinput"
|
||||
FBTURBO="xserver-xorg-video-fbturbo"
|
||||
FBDEV="xserver-xorg-video-fbdev"
|
||||
PYTHON="python3-virtualenv virtualenv python3-distutils"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
numpy==1.21.4
|
||||
jinja2==3.1.2
|
||||
matplotlib==3.5.0
|
||||
netifaces==0.11.0
|
||||
requests==2.28.1
|
||||
websocket-client==1.4.1
|
||||
websocket-client==1.4.2
|
||||
pycairo==1.21.0
|
||||
PyGObject==3.42.2
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
IMGDIR=$SCRIPTPATH/../docs/img
|
||||
|
||||
for file in $IMGDIR/*
|
||||
do
|
||||
res=$(identify $file | cut -d ' ' -f 3)
|
||||
if [ "$res" != "1532x898" ]; then
|
||||
echo "Converting $file"
|
||||
convert $file -crop 1532x898+2+48 $file
|
||||
fi
|
||||
done
|
||||
File renamed without changes.
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# Change XCLIENT and/or display to your destination xserver (XSDL platform).
|
||||
# Example: export DISPLAY=192.168.1.101:0
|
||||
|
||||
# Note: You will likely want to reserve a DHCP address or set a static IP of the
|
||||
# Xserver clientso that your IP does not change and require reconfiguration.
|
||||
|
||||
export XCLIENT=change_me
|
||||
export DISPLAY=change_me
|
||||
|
||||
if [ $XCLIENT == "change_me" ]; then
|
||||
echo "launch_klipperscreen.sh for XSDL/XServer Clients has not been cofigured properly. Please edit this file to point to your XServer Client"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Send script to daemon process so that it does not fail when tty closes.
|
||||
#
|
||||
|
||||
export PYKLIPPERSCREEN=~/.KlipperScreen-env/bin/python
|
||||
export PYKLIPPERSCREENPARAM=~/KlipperScreen/screen.py
|
||||
|
||||
|
||||
if [ -f $PYKLIPPERSCREEN ]; then
|
||||
echo "Testing $PYKLIPPERSCREEN"
|
||||
test -x $PYKLIPPERSCREEN || echo "$PYKLIPPERSCREEN is Not Executable"
|
||||
fi
|
||||
|
||||
if [ -f $PYKLIPPERSCREENPARAM ]; then
|
||||
echo "Testing $PYKLIPPERSCREENPARAM"
|
||||
test -f $PYKLIPPERSCREENPARAM || echo "$PYKLIPPERSCREENPARAM is not a file"
|
||||
fi
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting Klipper Screen Xclient Deamon .... "
|
||||
setsid "$PYKLIPPERSCREEN" "$PYKLIPPERPARAM" #>/dev/null 2>&1 < /dev/null &
|
||||
echo "running"
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping Klipper Screen Xclient Deamon .... "
|
||||
PID=`ps -ef|grep KlipperScreen-env/bin/python|awk '{print $2}'`
|
||||
kill -9 $PID
|
||||
echo "stopping"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
KSPATH=$(sed 's/\/scripts//g' <<< $SCRIPTPATH)
|
||||
KSENV="${HOME}/.KlipperScreen-env"
|
||||
|
||||
update_virtualenv()
|
||||
{
|
||||
echo "Creating virtual environment"
|
||||
[ ! -d ${KSENV} ] && virtualenv -p /usr/bin/python3 ${KSENV}
|
||||
|
||||
${KSENV}/bin/pip install -r ${KSPATH}/scripts/KlipperScreen-requirements.txt
|
||||
${KSENV}/bin/pip install --no-binary ":all" "vext.gi==0.7.4"
|
||||
${KSENV}/bin/vext -e
|
||||
}
|
||||
|
||||
update_virtualenv
|
||||
@@ -4,7 +4,12 @@
|
||||
# Keeps the process alive while the server is active
|
||||
# to mimic default X's behaviour and keep the service happy
|
||||
|
||||
./lauch_klipperscreen.sh
|
||||
if [ -f $PWD/launch_klipperscreen.sh ]; then
|
||||
exec $PWD/launch_klipperscreen.sh
|
||||
elif [ ! -f $PWD/launch_klipperscreen.sh ]; then
|
||||
echo "launch_klipperscreen.sh does not exist"
|
||||
exit
|
||||
fi
|
||||
|
||||
ret=1
|
||||
timeout=0
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ button {
|
||||
background-image: none;
|
||||
background-color: #13181C;
|
||||
margin: .25em;
|
||||
padding: 0 .5em;
|
||||
padding: .2em .5em 0;
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
-gtk-icon-shadow: none;
|
||||
|
||||
Reference in new issue
Block a user