Compare commits

...
47 Commits
Author SHA1 Message Date
alfrix 8af5c0b2d4 Trace memory 2023-03-24 08:12:19 -06:00
alfrix da9f970231 print: refactors 2023-03-22 06:51:34 -06:00
alfrix 3417765223 job_status: fix panel not showing and not updating thumbnails
safeguard against thumbnail corruption or other errors fixes #893
better system to update name and thumbnails fixes #889
2023-03-19 05:55:30 -06:00
alfrix b963c55140 job_status: fix save endstop not working fixes #929 2023-03-17 07:50:50 -06:00
alfrix 2d8419ca13 fix desktop icon not appearing 2023-03-17 07:50:50 -06:00
Jookiaandalfrix 5f3827a2cb screen: Only switch layouts if the window has been majorly resized (#913)
* screen: Only switch layouts if the window has been majorly resized

Changing the layout can cause the window to resize on some systems.
This can create a feedback loop on systems with square displays.

Keep track of the vertical aspect ratio associated with the current
mode and only switch between vertical and horizontal mode when a
significant aspect ratio change has been detected.

* fixup

---------

Co-authored-by: alfrix <alfredomonclus@gmail.com>
2023-03-17 07:49:28 -06:00
alfrix d6f7bdcfe6 macros: use the new get_macro instead of get_config due to recent issues 2023-03-11 16:53:08 -06:00
alfrix 87c3f03719 fix issues caused by dfe1ac8d
fix #924
fix #923
2023-03-11 16:40:06 -06:00
Alfredo Monclus 094b90cf86 network: integrate networkmanager (#917)
fixes #881
this should be temporary until an implementation of sdbus-networkmanager
2023-03-11 07:43:10 -06:00
alfrixandAndriy 3220f084ec Update Ukranian close #914
Re-done due to merge conflicts

Co-authored-by: Andriy <40995038+komandrik@users.noreply.github.com>
2023-03-10 20:29:18 -06:00
alfrix dfe1ac8d2c macros: fix list not loading when there are extra spaces fixes #909 2023-03-10 20:03:28 -06:00
alfrix be473bf626 bed_level: fix auto-detect when there is no config file fixes #918 2023-03-10 06:43:02 -06:00
alfrix b353f8526e timeout requests to prevent locking 2023-03-09 07:32:46 -06:00
alfrix 122752b000 leakfix 2023-03-09 07:32:46 -06:00
alfrix 0f0c6f9b6e always maintain printers data, should avoid a bunch of issues 2023-03-09 07:32:46 -06:00
alfrix 18af1d1410 bed_level: add center screw close #863 2023-03-08 06:36:54 -06:00
alfrix 926d78de01 bed_level: remove screws only if in list and simplify detection fixes #910 2023-03-08 06:11:23 -06:00
alfrix a5b639fba2 bed_level: fix compatibility with python 3.7 2023-03-03 08:12:41 -06:00
Alfredo Monclusandczaky 55af0d753c bed_level: improve screw detection (#908)
* Use max_distance for fitting screws to buttons

The max distance is at most 1/3 of the diagonal,
depending on how many screws are there in horizontal or
vertical orientation.

This is a safe guard to prevent assigning screws to buttons
that would confuse the users, for very skewed screw configs.

use a smaller button scale fixes #891

Co-authored-by: alfrix <alfredomonclus@gmail.com>

Co-authored-by: czaky <jendrzej.w@lczak.net>
2023-03-01 07:41:43 -06:00
alfrix d6693fbecc make the menu icon non-mandatory
this was caused by #866
fixes #902
2023-02-20 07:57:45 -06:00
alfrix e426b06b8b lint fix 2023-02-13 21:10:53 -06:00
alfrix c722674918 fix popup word wrap 2023-02-13 21:08:21 -06:00
Geoffrey Young 3d7e92f507 add ability to style and template menu buttons (#866)
* add ability to select button style for menu items

* allow for jinja template rendering for (nearly) all menu options
this shuffles params json checks to display time instead of config time
2023-02-13 21:06:33 -06:00
Thijs Triemstra fc7b8c5304 fix typos (#897) 2023-02-13 21:05:48 -06:00
alfrix a6bb0fd02e zcalibrate: fix dialog loop, fix popup errors not showing at end #844 2023-02-06 18:27:35 -06:00
dependabot[bot] dcb6d18709 build(deps): bump websocket-client from 1.5.0 to 1.5.1 (#888)
Bumps [websocket-client](https://github.com/websocket-client/websocket-client) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/websocket-client/websocket-client/releases)
- [Changelog](https://github.com/websocket-client/websocket-client/blob/master/ChangeLog)
- [Commits](https://github.com/websocket-client/websocket-client/compare/v1.5.0...v1.5.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-06 16:35:20 -06:00
alfrix 69571c88b8 fix german keyboard issue caused by #886 2023-02-05 22:32:07 -06:00
Cyril Guislain c33b5d6311 Fix German Keyboard and Add French Keyboard (#886) 2023-02-05 21:47:11 -06:00
alfrix 49add980b3 theme: add light icon to material-dark fix:#884 2023-02-05 10:24:58 -06:00
dependabot[bot] 8d8d3bf9af build(deps): bump requests from 2.28.1 to 2.28.2 (#868)
Bumps [requests](https://github.com/psf/requests) from 2.28.1 to 2.28.2.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.28.1...v2.28.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-05 10:20:24 -06:00
alfrix 059f1a8026 update docs screenshot 2023-01-29 15:49:41 -06:00
alfrix eeffdd26dd mask modemmanager close #857 2023-01-29 15:49:41 -06:00
camerony 5de5e1e3eb Update on-screen keyboard.py (#874) 2023-01-29 09:54:53 -06:00
dependabot[bot] 485c82c53f build(deps): bump websocket-client from 1.4.2 to 1.5.0 (#877)
Bumps [websocket-client](https://github.com/websocket-client/websocket-client) from 1.4.2 to 1.5.0.
- [Release notes](https://github.com/websocket-client/websocket-client/releases)
- [Changelog](https://github.com/websocket-client/websocket-client/blob/master/ChangeLog)
- [Commits](https://github.com/websocket-client/websocket-client/compare/v1.4.2...v1.5.0)

---
updated-dependencies:
- dependency-name: websocket-client
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-29 09:43:04 -06:00
camerony 4e60f65404 network: fix button size, and update ipv4 address on network change (#879) 2023-01-29 09:42:49 -06:00
camerony 85cec193f9 Fix Changing wifi networks hangs 2023-01-29 09:40:45 -06:00
alfrix 34055277e0 Add czech and update ru .mo 2023-01-29 09:34:29 -06:00
AleksandrBukin 9b4c58369e Update Ru (#871)
line 626: "Show Heater Power" in RU "Показать мощность нагрева"
2023-01-29 09:16:18 -06:00
AntoszHUN b96adf55ed Update Hungarian Language (#848) 2022-12-13 20:04:48 -03:00
Alex Hornung f6afb4d4ab install: Fix Xwrapper.config existence test (#846) 2022-12-13 20:04:08 -03:00
alfrix 3c5449f0db job_status: cast float to zoffset 2022-12-12 19:53:34 -03:00
alfrix c828d8349c camera: fix for busters old libmpv fixes #840 2022-12-12 08:12:52 -03:00
alfrix 9fa047eb8b camera: fix libmpv-dev not installing fixes #842 2022-12-12 08:00:38 -03:00
alfrix 82b8cbcca5 zcalibrate: fix initial zhop causing issues for some machines fixes #837 2022-12-12 01:42:30 -03:00
alfrix 1f5a090bfd camera: always fullscreen, fix inverted vo logic, fixes #839 2022-12-12 01:25:36 -03:00
alfrix e4d5cd65ce fix a couple of errors that may happen if klipper fails to start or takes too long 2022-12-11 19:22:45 -03:00
alfrix 502d9699bd fix actions not appearing in printers without name after last commit fix #838 2022-12-11 15:25:28 -03:00
32 changed files with 2571 additions and 319 deletions

No files matched your search

+3 -1
View File
@@ -79,7 +79,7 @@ calibrate_y_position: 100
# Bed Screws
# define the screw positons required for odd number of screws in a comma separated list
# possible values are: bl, br, bm, fl, fr, fm, lm, rm
# possible values are: bl, br, bm, fl, fr, fm, lm, rm, center
# they correspond to back-left, back-right, back-middle, front-left, front-right, front-middle, left-middle, right-middle
screw_positions: ""
@@ -133,6 +133,8 @@ A menu item is configured as follows:
name: Item Name
icon: home
# Optional Parameters
# Icon style, defined as "button.mycolor4" (for example) in the theme css
style: mycolor4
# Panel from the panels listed below
panel: preheat
# Moonraker method to call when the item is selected
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 13 KiB

+20 -9
View File
@@ -116,27 +116,38 @@ class KlippyGtk:
def Image(self, image_name=None, width=None, height=None):
if image_name is None:
return Gtk.Image()
pixbuf = self.PixbufFromIcon(image_name, width, height)
return Gtk.Image.new_from_pixbuf(pixbuf) if pixbuf is not None else Gtk.Image()
def PixbufFromIcon(self, filename, width=None, height=None):
width = width if width is not None else self.img_width
height = height if height is not None else self.img_height
filename = os.path.join(self.themedir, image_name)
filename = os.path.join(self.themedir, filename)
for ext in ["svg", "png"]:
with contextlib.suppress(Exception):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(f"{filename}.{ext}", int(width), int(height))
if pixbuf is not None:
return Gtk.Image.new_from_pixbuf(pixbuf)
logging.error(f"Unable to find image {filename}.{ext}")
return Gtk.Image()
pixbuf = self.PixbufFromFile(f"{filename}.{ext}", int(width), int(height))
if pixbuf is not None:
return pixbuf
return None
@staticmethod
def PixbufFromFile(filename, width=-1, height=-1):
return GdkPixbuf.Pixbuf.new_from_file_at_size(filename, int(width), int(height))
try:
return GdkPixbuf.Pixbuf.new_from_file_at_size(filename, int(width), int(height))
except Exception as e:
logging.exception(e)
logging.error(f"Unable to find image {filename}")
return None
def PixbufFromHttp(self, resource, width=-1, height=-1):
response = self.screen.apiclient.get_thumbnail_stream(resource)
if response is False:
return None
stream = Gio.MemoryInputStream.new_from_data(response, None)
pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale(stream, int(width), int(height), True)
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale(stream, int(width), int(height), True)
except Exception as e:
logging.exception(e)
return None
stream.close_async(2)
return pixbuf
+1 -1
View File
@@ -37,7 +37,7 @@ class KlippyRest:
headers = {} if self.api_key is False else {"x-api-key": self.api_key}
data = False
try:
response = requests.get(url, headers=headers)
response = requests.get(url, headers=headers, timeout=3)
response.raise_for_status()
if json:
logging.debug(f"Sending request to {url}")
File diff suppressed because it is too large. Load diff
+4 -8
View File
@@ -175,7 +175,7 @@ class KlipperScreenConfig:
strs = ('gcode', '')
numbers = [f'{option}' for option in self.config[section] if option != 'gcode']
elif section.startswith('menu '):
strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm')
strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm', 'style')
elif section == 'bed_screws':
# This section may be deprecated in favor of moving this options under the printer section
numbers = ('rotation', '')
@@ -549,13 +549,9 @@ class KlipperScreenConfig:
"panel": cfg.get("panel", None),
"method": cfg.get("method", None),
"confirm": cfg.get("confirm", None),
"enable": cfg.get("enable", "True")
"enable": cfg.get("enable", "True"),
"params": cfg.get("params", "{}"),
"style": cfg.get("style", None)
}
try:
item["params"] = json.loads(cfg.get("params", "{}"))
except Exception as e:
logging.exception(f"Unable to parse parameters for [{name}]:\n{e}")
item["params"] = {}
return {name[(len(menu) + 6):]: item}
Binary file not shown.
@@ -0,0 +1,776 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Czech\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-01-29 09:28-0600\n"
"PO-Revision-Date: 2023-01-29 09:27-0600\n"
"Last-Translator: \n"
"Language-Team: Jan Stanka (stanky@email.cz)\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 ? 1 : 2);\n"
"X-Generator: Poedit 2.4.2\n"
#, python-format
msgid "%s will be updated to version"
msgstr "%s bude aktualizováno na verzi"
msgid "(default)"
msgstr ""
msgid "24 Hour Time"
msgstr "24 hod formát"
msgid "A FIRMWARE_RESTART may fix the issue."
msgstr "FW restart může fixnout chyby."
msgid "ADXL Not Configured"
msgstr "ADXL není nastaven"
msgid "Abort"
msgstr "Zrušit"
msgid "Acceleration:"
msgstr "Zrychlení:"
msgid "Accept"
msgstr "Přijmout"
msgid "Actions"
msgstr "Akce"
msgid "Add profile"
msgstr "Přidat profil"
msgid "Apply"
msgstr "Použít"
#, python-format
msgid "Apply %.2f offset to Endstop?"
msgstr "Použít %.2f přesah k Endstop?"
#, python-format
msgid "Apply %s%.2f offset to Probe?"
msgstr "Použít %s%.2f přesah k Sondě?"
msgid "Are you sure do you want to exclude the object?"
msgstr "Opravdu chceš vyjmout objekt?"
msgid "Are you sure you want to run Emergency Stop?"
msgstr "Opravdu okamžitě zastavit?"
msgid "Are you sure you wish to cancel this print?"
msgstr "Opravdu chcete zrušit tisk?"
msgid "Are you sure you wish to disable motors?"
msgstr "Opravdu chcete uvolnit motory?"
msgid "Are you sure you wish to reboot the system?"
msgstr "Opravdu chcete rebootovat systém?"
msgid "Are you sure you wish to shutdown the system?"
msgstr "Opravdu chcete vypnout systém?"
msgid "Auto"
msgstr "Auto"
msgid "Auto-calibrate"
msgstr "Auto-kalibrace"
msgid "Auto-close notifications"
msgstr "Automaticky zavřít upozornění"
msgid "Auto-scroll"
msgstr "Auto posun"
msgid "Bed Level"
msgstr "Vyrovnání podložky"
msgid "Bed Mesh"
msgstr "Mapa podložky"
msgid "Bed screw configuration:"
msgstr "Vyrovnání šroubů podložky:"
msgid "Calibrate"
msgstr "Kalibrace"
msgid "Calibrated"
msgstr "Zkalibrováno"
msgid "Calibrated, save configuration to make it permanent"
msgstr "Zkalibrováno, uložit změny jako trvalé"
msgid "Calibrating"
msgstr "Kalibruji"
msgid "Camera"
msgstr ""
msgid "Can't set above the maximum:"
msgstr "Nemohu nastavit víc než max:"
msgid "Cancel"
msgstr "Zrušit"
msgid "Cancel Print"
msgstr "Zrušit tisk"
msgid "Cancelled"
msgstr "Zrušeno"
msgid "Cancelling"
msgstr "Ruším"
msgid "Cannot connect to Moonraker"
msgstr "Nelze se připojit k Moonraker"
msgid "Channel"
msgstr "Kanál"
msgid "Check ADXL Wiring"
msgstr "Zkontroluj zapojení ADXL"
msgid "Checking for updates, please wait..."
msgstr "Kontrola aktualizací, čekej ..."
msgid "Clear"
msgstr "Vymaž"
msgid "Close"
msgstr "Zavřít"
msgid "Complete"
msgstr "Hotovo"
msgid "Configuration"
msgstr "Konfigurace"
msgid "Confirm Emergency Stop"
msgstr "Potvrzovat Emergency Stop"
msgid "Connected"
msgstr "Připojeno"
#, python-format
msgid "Connecting to %s"
msgstr "Připojování k %s"
msgid "Console"
msgstr "Konsole"
msgid "Continue"
msgstr "Pokračuj"
msgid "Cooldown"
msgstr "Zchladit"
msgid "Date"
msgstr "Datum"
msgid "Delete Directory?"
msgstr ""
msgid "Delete File?"
msgstr "Smazat soubor?"
msgid "Deselect"
msgstr "Odznačit"
msgid "Disable Motors"
msgstr "Uvolnit motory"
msgid "Disable XY"
msgstr "Uvolnit XY"
msgid "Distance (mm)"
msgstr "Vzdálenost (mm)"
#, python-format
msgid "Do you want to recover %s?"
msgstr "Obnovit %s?"
msgid "Elapsed:"
msgstr "Uplynulo:"
msgid "Error"
msgstr "Chyba"
msgid "Estimated Time Method"
msgstr "Výpočet doby tisku"
msgid "Exclude Object"
msgstr "Vyloučit objekt"
msgid "Extra Large"
msgstr "Extra velký"
msgid "Extrude"
msgstr "Extruze"
msgid "Extrusion +"
msgstr "Extruze +"
msgid "Extrusion -"
msgstr "Extruze -"
msgid "Failed, adjust position first"
msgstr "Chyba, nastav nejprve pozici"
msgid "Fan"
msgstr "Větrák"
msgid "Filament Used"
msgstr "Typ filamentu"
msgid "Filament total:"
msgstr "Filament celkem:"
msgid "Filament used:"
msgstr "Použitý filament:"
msgid "Filament:"
msgstr "Filament:"
msgid "File"
msgstr "Soubor"
msgid "File:"
msgstr "Soubor:"
msgid "Finding ADXL"
msgstr "Hledání ADXL"
msgid "Fine Tuning"
msgstr "Ladění"
msgid "Finish"
msgstr "Konec"
msgid "Firmware Restart"
msgstr "Firmware Restart"
msgid "Flow:"
msgstr "Tok:"
msgid "Flowrate:"
msgstr "Rychlost toku:"
msgid "Font Size"
msgstr "Velikost fontu"
msgid "Full Update"
msgstr "Úplný update"
msgid "Fullscreen"
msgstr ""
msgid "Go Back"
msgstr "Zpět"
msgid "Height:"
msgstr "Výška:"
msgid "Hidden"
msgstr "Skrytý"
msgid "Hide"
msgstr "Skrýt"
msgid "Hide sensors in Temp."
msgstr "Skrýt senzory v Temp."
msgid "Hide temp."
msgstr "Skrýt teplotu"
msgid "Home All"
msgstr "Zaparkovat XYZ"
msgid "Home X"
msgstr "Zaparkovat X"
msgid "Home XY"
msgstr "Zaparkovat XY"
msgid "Home Y"
msgstr "Zaparkovat Y"
msgid "Home Z"
msgstr "Zaparkovat Z"
msgid "Homing"
msgstr "Domů"
msgid "Host"
msgstr "Host"
msgid "Hostname"
msgstr "Hostname"
msgid "Icon Theme"
msgstr "Sada ikon"
msgid "Initializing printer..."
msgstr "Startuji tiskárnu ..."
msgid "Input Shaper"
msgstr ""
msgid "Interface"
msgstr "Rozhraní"
msgid "Invalid"
msgstr "Špatně"
msgid "Invalid password"
msgstr "Špatné heslo"
msgid "Invert X"
msgstr "Otočit X"
msgid "Invert Y"
msgstr "Otočit Y"
msgid "Invert Z"
msgstr "Otočit Z"
msgid "Klipper Restart"
msgstr "Klipper Restart"
msgid "Klipper has disconnected"
msgstr "Klipper odpojen"
msgid "Klipper has encountered an error."
msgstr "Klipper zaznamenal chybu."
msgid "Klipper has shutdown"
msgstr "Klipper zastaven"
msgid "Klipper is attempting to start"
msgstr "Klipper startuje"
msgid "Klipper will reboot"
msgstr "Klipper se restartuje"
msgid "KlipperScreen will reboot"
msgstr "KlipperScreen se restartuje"
msgid "Language"
msgstr "Jazyk"
msgid "Large"
msgstr "Velký"
msgid "Layer:"
msgstr "Vrstva:"
msgid "Left:"
msgstr "Zbývá:"
msgid "Limits"
msgstr "Limity"
msgid "Load"
msgstr "Zasuň"
msgid "Lower Nozzle"
msgstr "Trysku níž"
msgid "Macro shortcut on sidebar"
msgstr "Macro shortcut on sidebar"
msgid "Macros"
msgstr "Makra"
msgid "Main Menu"
msgstr "Hlavní menu"
msgid "Max"
msgstr "Max"
msgid "Max Acceleration"
msgstr "Max. zrychlení"
msgid "Max Acceleration to Deceleration"
msgstr "Z max. zrychlení do zpomalení"
msgid "Max Velocity"
msgstr "Max. rychlost"
msgid "Maximum"
msgstr "Maximum"
msgid "Measure Both"
msgstr "Změřit oboje"
msgid "Measure X"
msgstr "Změřit X"
msgid "Measure Y"
msgstr "Změřit Y"
msgid "Medium"
msgstr "Střední"
msgid "Menu"
msgstr "Menu"
msgid "Mesh calibrate"
msgstr "Kalibrace sítě"
msgid "Modified"
msgstr "Změněno"
msgid "Moonraker: connected"
msgstr "Moonraker: připojen"
msgid "Move"
msgstr "Posun"
msgid "Move Distance (mm)"
msgstr "Vzdálenost posunu (mm)"
msgid "Name"
msgstr "Jméno"
msgid "Network"
msgstr "Síť"
msgid "Never"
msgstr "Nikdy"
msgid "New"
msgstr "Nový"
msgid ""
"Not supported for auto-detection, it needs to be configured in klipperscreen."
"conf"
msgstr "Nepodporováno autodetekcí, nakonfiguruj v klipperscreen.conf"
msgid "Nothing selected"
msgstr "Nevybráno nic"
#, python-format
msgid "Outdated by %d"
msgstr "Zastaralý %d"
msgid "PSK for"
msgstr "PSK pro"
msgid "Package will be updated"
msgid_plural "Packages will be updated"
msgstr[0] "Balíček bude aktualizován"
msgstr[1] "Balíčky budou aktualizovány"
msgstr[2] ""
msgid "Part Fan"
msgstr "Částečný ofuk"
msgid "Password saved"
msgstr "Heslo uloženo"
msgid "Pause"
msgstr "Pauza"
msgid "Paused"
msgstr "Pozastaveno"
msgid "Perform a full upgrade?"
msgstr "Úplně aktualizovat?"
msgid "Pins"
msgstr "Piny"
msgid "Please recompile and flash the micro-controller."
msgstr "Znovu přelož a flashni micro-controller."
msgid "Power"
msgstr "Zdroj"
msgid "Power On Printer"
msgstr "Zapni tiskárnu"
msgid "Pressure Advance:"
msgstr "Pressure Advance:"
msgid "Print"
msgstr "Tisk"
msgid "Print Control"
msgstr "Nastavení tisku"
msgid "Print Time"
msgstr "Čas tisku"
msgid "Printer"
msgstr "Tiskárna"
msgid "Printer Connections"
msgstr "Připojení"
msgid "Printer Select"
msgstr "Výběr tiskárny"
msgid "Printing"
msgstr "Probíhá tisk"
msgid "Probe Offset"
msgstr "Offset sondy"
msgid "Profile Name:"
msgstr "Jméno profilu:"
msgid "Provide KlipperScreen.log when asking for help.\n"
msgstr "Provide KlipperScreen.log when asking for help.\n"
msgid "Quad Gantry Level"
msgstr "Quad Gantry Level"
msgid "Raise Nozzle"
msgstr "Zvedni trysku"
msgid "Recover"
msgstr "Recover"
msgid "Recover Hard"
msgstr "Recover Hard"
msgid "Recover Soft"
msgstr "Recover Soft"
msgid "Reference"
msgstr "Reference"
msgid "Refresh"
msgstr "Obnovit"
msgid "Rename/Move:"
msgstr ""
msgid "Restart"
msgstr "Restart"
msgid "Resume"
msgstr "Pokračuj"
msgid "Retract"
msgstr "Retrakce"
msgid "Retraction"
msgstr "Retrakce"
msgid "Retraction Length"
msgstr "Délka retrakce"
msgid "Retraction Speed"
msgstr "Rychlost retrakce"
msgid "Retry"
msgstr "Znovu"
msgid "Retrying"
msgstr "Zkouším znovu"
msgid "Save"
msgstr "Uložit"
msgid "Save Config"
msgstr "Ulož nastavení"
msgid "Save Z"
msgstr "Uložit Z"
msgid "Save configuration?"
msgstr "Uložit nastavení?"
msgid "Saved"
msgstr "Uloženo"
#, python-format
msgid "Saved offset: %s"
msgstr "Uložený offset: %s"
msgid "Screen DPMS"
msgstr "Screen DPMS"
msgid "Screen Power Off Time"
msgstr "Čas vypnutí displeje"
msgid "Screws Adjust"
msgstr "Nastavit šrouby"
msgid "Select"
msgstr "Vyber"
msgid "Send"
msgstr "Odeslat"
msgid "Set Temp"
msgstr "Nastav teplotu"
msgid "Settings"
msgstr "Nastavení"
msgid "Show"
msgstr "Ukaž"
msgid "Show Heater Power"
msgstr "Ukaž odběr topení"
msgid "Shutdown"
msgstr "Shutdown"
msgid "Size"
msgstr "Velikost"
msgid "Slicer"
msgstr "Slicer"
msgid "Slicer Time correction (%)"
msgstr "Časová korekce Sliceru (%)"
msgid "Slicer:"
msgstr "Slicer:"
msgid "Small"
msgstr "Malý"
msgid "Speed (mm/s)"
msgstr "Rychlost (mm/s)"
msgid "Speed +"
msgstr "Rychlost ₊"
msgid "Speed -"
msgstr "Rychlost -"
msgid "Speed:"
msgstr "Rychlost:"
msgid "Square Corner Velocity"
msgstr ""
msgid "Start"
msgstr "Start"
msgid "Starting WiFi Association"
msgstr "Připojování k WiFi"
msgid "Starting recovery for"
msgstr "Obnovuji"
msgid "Starting update for"
msgstr "Aktualizuji"
msgid "System"
msgstr "Systém"
msgid "System Restart"
msgstr "Restart systému"
msgid "System Shutdown"
msgstr "Vypnutí"
msgid "Temp (°C)"
msgstr "Teplota (°C)"
msgid "Temperature"
msgstr "Teplota"
msgid "Total:"
msgstr "Total:"
msgid "Unknown Heater"
msgstr "Neznámé topení"
msgid "Unknown screw position"
msgstr "Neznámé nastavení šroubů"
msgid "Unload"
msgstr "Vysuň"
msgid "Unretract Extra Length"
msgstr "Vysuň extra délku"
msgid "Unretract Speed"
msgstr "Vysunovací rychlost"
msgid "Up To Date"
msgstr "Aktuální"
msgid "Update"
msgstr "Aktualizuj"
msgid "Updating"
msgstr "Aktualizuji"
msgid "Uploaded"
msgstr "Nahrané"
msgid "XY Move Speed (mm/s)"
msgstr "Rychlost pohybu XY (mm/s)"
msgid "XY Speed (mm/s)"
msgstr "Rychlost XY (mm/s)"
msgid "Z Calibrate"
msgstr "Kalibrace Z"
msgid "Z Move Speed (mm/s)"
msgstr "Rychlost pohybu Z (mm/s)"
msgid "Z Speed (mm/s)"
msgstr "Rychlost pohybu Z (mm/s)"
msgid "Z Tilt"
msgstr "Z Tilt"
msgid "Z offset:"
msgstr "Z offset:"
msgid "commit"
msgid_plural "commits"
msgstr[0] ""
msgstr[1] ""
msgstr[2] ""
msgid "dBm"
msgstr "dBm"
msgid "hour"
msgid_plural "hours"
msgstr[0] "hodina"
msgstr[1] "hodiny"
msgstr[2] "hodin"
msgid "minutes"
msgstr "min"
msgid "mm"
msgstr "mm"
msgid "mm/s"
msgstr "mm/s"
msgid "mm/s²"
msgstr "mm/s²"
msgid "mm³/s"
msgstr "mm³/s"
#~ msgid "Decrease"
#~ msgstr "Snížit"
#~ msgid "Increase"
#~ msgstr "Zvětšit"
#, python-format
#~ msgid "Sending Power ON signal to: %s"
#~ msgstr "Odeslat ZAP do %s"
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: KlipperScreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-30 18:17-0300\n"
"POT-Creation-Date: 2022-12-13 20:39-0300\n"
"PO-Revision-Date: \n"
"Last-Translator: AntoszHUN\n"
"Language-Team: \n"
@@ -202,7 +202,7 @@ msgid "Exclude Object"
msgstr "Objektum kizárása"
msgid "Extra Large"
msgstr ""
msgstr "Extra nagy"
msgid "Extrude"
msgstr "Száladagolás"
@@ -322,7 +322,7 @@ msgid "Invalid"
msgstr "Érvénytelen"
msgid "Invalid password"
msgstr ""
msgstr "Érvénytelen jelszó"
msgid "Invert X"
msgstr "Fordított X"
@@ -397,7 +397,7 @@ msgid "Max Velocity"
msgstr "Max sebesség"
msgid "Maximum"
msgstr ""
msgstr "Maximum"
msgid "Measure Both"
msgstr "Mindkettő mérése"
@@ -415,7 +415,7 @@ msgid "Menu"
msgstr "Menü"
msgid "Mesh calibrate"
msgstr ""
msgstr "Háló kalibrálása"
msgid "Modified"
msgstr "Módosított"
@@ -436,7 +436,7 @@ msgid "Network"
msgstr "Hálózat"
msgid "Never"
msgstr ""
msgstr "Soha"
msgid "New"
msgstr "Új"
@@ -521,7 +521,7 @@ msgid "Profile Name:"
msgstr "Profil név:"
msgid "Provide KlipperScreen.log when asking for help.\n"
msgstr ""
msgstr "Add meg a KlipperScreen.log-ot, amikor segítséget kérsz.\n"
msgid "Quad Gantry Level"
msgstr "Négy állású szint"
@@ -563,7 +563,7 @@ msgid "Retraction Speed"
msgstr "Visszahúzási sebesség"
msgid "Retry"
msgstr ""
msgstr "Újra"
msgid "Retrying"
msgstr "Újrapróbálkozás"
Binary file not shown.
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: KlipperScreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-30 18:17-0300\n"
"POT-Creation-Date: 2023-01-29 09:28-0600\n"
"PO-Revision-Date: 2022-11-30 18:15-0300\n"
"Last-Translator: Jakob Kais <schpuntik@freenet.de>\n"
"Language-Team: \n"
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"X-Generator: Poedit 3.2.1\n"
"X-Poedit-Flags-xgettext: --add-comments\n"
@@ -112,6 +112,9 @@ msgstr "Откалибровано, сохраните конфигурацию,
msgid "Calibrating"
msgstr "Калибровка"
msgid "Camera"
msgstr ""
msgid "Can't set above the maximum:"
msgstr "Невозможно установить выше максимума:"
@@ -173,8 +176,8 @@ msgstr "Остудить"
msgid "Date"
msgstr "Дата"
msgid "Decrease"
msgstr "Уменьшить"
msgid "Delete Directory?"
msgstr ""
msgid "Delete File?"
msgstr "Удалить Файл?"
@@ -267,6 +270,9 @@ msgstr "Размер шрифта"
msgid "Full Update"
msgstr "Полный Обновлять"
msgid "Fullscreen"
msgstr ""
msgid "Go Back"
msgstr "Назад"
@@ -312,9 +318,6 @@ msgstr "Имя хоста"
msgid "Icon Theme"
msgstr "Темы"
msgid "Increase"
msgstr "Поднять"
msgid "Initializing printer..."
msgstr "Принтер стартует..."
@@ -551,6 +554,9 @@ msgstr "Ссылка"
msgid "Refresh"
msgstr "Обновить"
msgid "Rename/Move:"
msgstr ""
msgid "Restart"
msgstr "Перезагрузка"
@@ -609,10 +615,6 @@ msgstr "Выбирать"
msgid "Send"
msgstr "Отправить"
#, python-format
msgid "Sending Power ON signal to: %s"
msgstr "Отправка сигнала включения питания на: %s"
msgid "Set Temp"
msgstr "Заданная температура"
@@ -623,7 +625,7 @@ msgid "Show"
msgstr "Показывать"
msgid "Show Heater Power"
msgstr "Показать мощьность нагрева"
msgstr "Показать мощность нагрева"
msgid "Shutdown"
msgstr "Выключить"
@@ -766,6 +768,16 @@ msgstr "мм/с²"
msgid "mm³/s"
msgstr "мм/с³"
#~ msgid "Decrease"
#~ msgstr "Уменьшить"
#~ msgid "Increase"
#~ msgstr "Поднять"
#, python-format
#~ msgid "Sending Power ON signal to: %s"
#~ msgstr "Отправка сигнала включения питания на: %s"
#~ msgid "Sort:"
#~ msgstr "Сортировать:"
Binary file not shown.
@@ -8,16 +8,16 @@ msgstr ""
"Project-Id-Version: 2022-09-04 14:53-0300\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-30 18:17-0300\n"
"PO-Revision-Date: 2022-11-30 18:16-0300\n"
"PO-Revision-Date: 2023-03-10 20:26-0600\n"
"Last-Translator: Andrii Komarovskyi\n"
"Language-Team: Andrii Komarovskyi\n"
"Language: uk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"X-Generator: Poedit 3.2.1\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"X-Generator: Poedit 2.4.2\n"
#, python-format
msgid "%s will be updated to version"
@@ -62,7 +62,7 @@ msgid "Apply %s%.2f offset to Probe?"
msgstr "Застосувати зміщення %s%.2f до зонда?"
msgid "Are you sure do you want to exclude the object?"
msgstr ""
msgstr "Ви впевнені, що бажаєте виключити об’єкт?"
msgid "Are you sure you want to run Emergency Stop?"
msgstr "Ви впевнені, що хочете зробити аварійну зупинку?"
@@ -208,7 +208,7 @@ msgid "Exclude Object"
msgstr "Виключити об’єкт"
msgid "Extra Large"
msgstr ""
msgstr "Дуже Великий"
msgid "Extrude"
msgstr ""
@@ -332,7 +332,7 @@ msgid "Invalid"
msgstr "Недійсний"
msgid "Invalid password"
msgstr ""
msgstr "Недійсний пароль"
msgid "Invert X"
msgstr "Інвертувати X"
@@ -409,7 +409,7 @@ msgid "Max Velocity"
msgstr "Макс. швидкість"
msgid "Maximum"
msgstr ""
msgstr "Максимум"
msgid "Measure Both"
msgstr "Виміряти все"
@@ -427,7 +427,7 @@ msgid "Menu"
msgstr "Меню"
msgid "Mesh calibrate"
msgstr ""
msgstr "Калібрування сітки столу"
msgid "Modified"
msgstr "Змінено"
@@ -445,10 +445,10 @@ msgid "Name"
msgstr "Ім'я"
msgid "Network"
msgstr "Сітка"
msgstr "Мережа"
msgid "Never"
msgstr ""
msgstr "Ніколи"
msgid "New"
msgstr "Новий"
@@ -518,13 +518,13 @@ msgid "Print Time"
msgstr "Час друку"
msgid "Printer"
msgstr ""
msgstr "Принтер"
msgid "Printer Connections"
msgstr "Підключення принтера"
msgid "Printer Select"
msgstr ""
msgstr "Вибір Принтера"
msgid "Printing"
msgstr "Друк"
@@ -536,7 +536,7 @@ msgid "Profile Name:"
msgstr "Ім'я профілю:"
msgid "Provide KlipperScreen.log when asking for help.\n"
msgstr ""
msgstr "Надайте KlipperScreen.log, коли звертаєтесь по допомогу.\n"
msgid "Quad Gantry Level"
msgstr "Портальне вирівнювання"
@@ -557,7 +557,9 @@ msgid "Reference"
msgstr "Довідка"
msgid "Refresh"
msgstr "Оновити"
msgstr ""
"Перевірка\n"
"Оновлень"
msgid "Restart"
msgstr "Перезапуск"
@@ -580,7 +582,7 @@ msgid "Retraction Speed"
msgstr "Швидкість втягування"
msgid "Retry"
msgstr ""
msgstr "Повторіть спробу"
msgid "Retrying"
msgstr "Повторна спроба"
@@ -633,10 +635,10 @@ msgid "Show"
msgstr "Показати"
msgid "Show Heater Power"
msgstr ""
msgstr "Показати Потужність Нагрівача"
msgid "Shutdown"
msgstr "вимкнувся"
msgstr "Вимкнути"
msgid "Size"
msgstr "Розмір"
@@ -714,7 +716,7 @@ msgid "Unretract Speed"
msgstr "Швидкість повернення"
msgid "Up To Date"
msgstr "Оновити"
msgstr "Актуально"
msgid "Update"
msgstr "Оновлення"
+20 -27
View File
@@ -7,12 +7,12 @@ from gi.repository import GLib
class Printer:
def __init__(self, state_cb):
self.config = None
self.data = None
def __init__(self, state_cb, state_callbacks, busy_cb):
self.config = {}
self.data = {}
self.state = "disconnected"
self.state_cb = state_cb
self.state_callbacks = None
self.state_callbacks = state_callbacks
self.devices = {}
self.power_devices = {}
self.tools = []
@@ -22,28 +22,9 @@ class Printer:
self.output_pin_count = 0
self.store_timeout = None
self.tempstore = {}
self.busy_cb = None
self.busy = None
self.temperature_store_size = None
def reset(self):
self.config = None
self.data = None
self.state = None
self.state_cb = None
self.state_callbacks = None
self.devices = None
self.power_devices = None
self.tools = None
self.extrudercount = None
self.tempdevcount = None
self.fancount = None
self.output_pin_count = None
self.store_timeout = None
self.tempstore = None
self.busy_cb = None
self.busy = None
self.temperature_store_size = None
self.busy_cb = busy_cb
self.busy = False
self.tempstore_size = 1200
def reinit(self, printer_info, data):
self.config = data['configfile']['config']
@@ -101,6 +82,8 @@ class Printer:
logging.info(f"# Output pins: {self.output_pin_count}")
def process_update(self, data):
if self.data is None:
return
for x in (self.get_tools() + self.get_heaters() + self.get_filament_sensors()):
if x in data:
for i in data[x]:
@@ -172,6 +155,16 @@ class Printer:
def get_config_section(self, section):
return self.config[section] if section in self.config else False
def get_macro(self, macro):
return next(
(
self.config[key]
for key in self.config.keys()
if key.find(macro) > -1
),
False,
)
def get_fans(self):
fans = []
if self.config_section_exists("fan"):
@@ -316,7 +309,7 @@ class Printer:
return True
def init_temp_store(self, tempstore):
if 'result' in tempstore:
if tempstore and 'result' in tempstore:
if self.tempstore and list(self.tempstore) != list(tempstore['result']):
logging.debug("Tempstore has changed")
self.tempstore = tempstore['result']
+2 -2
View File
@@ -49,11 +49,11 @@ class ScreenPanel:
def get_file_image(self, filename, width=None, height=None, small=False):
if not self._files.has_thumbnail(filename):
return None
width = width if width is not None else self._gtk.img_width
height = height if height is not None else self._gtk.img_height
loc = self._files.get_thumbnail_location(filename, small)
if loc is None:
return None
width = width if width is not None else self._gtk.img_width
height = height if height is not None else self._gtk.img_height
if loc[0] == "file":
return self._gtk.PixbufFromFile(loc[1], width, height)
if loc[0] == "http":
+47 -14
View File
@@ -8,7 +8,7 @@ from gi.repository import Gtk, GLib
class Keyboard(Gtk.Box):
langs = ["de", "en", "es"]
langs = ["de", "en", "fr", "es"]
def __init__(self, screen, close_cb, entry=None):
super().__init__(orientation=Gtk.Orientation.VERTICAL)
@@ -26,42 +26,73 @@ class Keyboard(Gtk.Box):
[
["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"],
["ABC", "123", "#+=", "y", "x", "c", "v", "b", "n", "m"],
],
[
["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"],
["abc", "123", "#+=", "Y", "X", "C", "V", "B", "N", "M"],
],
[
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "ß", "⌫"],
["=", "-", "+", "*", "/", "\\", ":", ";", "'", "\"", "ẞ"],
["abc", "(", ")", "#", "$", "!", "?", "@", "_", ",", "ABC"],
["-", "/", ":", ";", "(", ")", "$", "&", "@", "\"", "ẞ"],
["ABC", "abc", "#+=", ".", ",", "?", "!", "'"],
],
[
["[", "]", "{", "}", "#", "%", "^", "*", "+", "=", "⌫"],
["_", "\\", "|", "~", "<", ">", "€", "£", "¥", "•"],
["ABC", "abc", "123", ".", ",", "?", "!", "'"],
]
]
elif language == "fr":
self.keys = [
[
["a", "z", "e", "r", "t", "y", "u", "i", "o", "p", "⌫"],
["q", "s", "d", "f", "g", "h", "j", "k", "l", "m"],
["ABC", "123", "#+=", "w", "x", "c", "v", "b", "n"],
],
[
["A", "Z", "E", "R", "T", "Y", "U", "I", "O", "P", "⌫"],
["Q", "S", "D", "F", "G", "H", "J", "K", "L", "M"],
["abc", "123", "#+=", "W", "X", "C", "V", "B", "N"],
],
[
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "⌫"],
["-", "/", ":", ";", "(", ")", "$", "&", "@", "\""],
["ABC", "abc", "#+=", ".", ",", "?", "!", "'"],
],
[
["[", "]", "{", "}", "#", "%", "^", "*", "+", "=", "⌫"],
["_", "\\", "|", "~", "<", ">", "€", "£", "¥", "•"],
["ABC", "abc", "123", ".", ",", "?", "!", "'"],
]
]
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"],
["a", "s", "d", "f", "g", "h", "j", "k", "l"],
["ABC", "123", "#+=", "z", "x", "c", "v", "b", "n", "m"],
],
[
["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"],
["A", "S", "D", "F", "G", "H", "J", "K", "L"],
["abc", "123", "#+=", "Z", "X", "C", "V", "B", "N", "M"],
],
[
["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "⌫"],
["=", "-", "+", "*", "/", "\\", ":", ";", "'", "\""],
["abc", "(", ")", "#", "$", "!", "?", "@", "_", ",", "ABC"],
["-", "/", ":", ";", "(", ")", "$", "&", "@", "\""],
["ABC", "abc", "#+=", ".", ",", "?", "!", "'"],
],
[
["[", "]", "{", "}", "#", "%", "^", "*", "+", "=", "⌫"],
["_", "\\", "|", "~", "<", ">", "€", "£", "¥", "•"],
["ABC", "abc", "123", ".", ",", "?", "!", "'"],
]
]
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:
@@ -152,7 +183,9 @@ class Keyboard(Gtk.Box):
self.set_pallet(0)
elif key == "ABC":
self.set_pallet(1)
elif key == "?123":
elif key == "123":
self.set_pallet(2)
elif key == "#+=":
self.set_pallet(3)
else:
Gtk.Entry.do_insert_at_cursor(self.entry, key)
+1 -1
View File
@@ -110,7 +110,7 @@ class WifiManager:
logging.info(f"Attempting to connect to wifi: {netid}")
self.callback("connecting_status", f"Attempting to connect to {ssid}")
self.wpa_cli(f"SELECT_NETWORK {id}")
self.wpa_cli(f"SELECT_NETWORK {netid}")
self.save_wpa_conf()
def delete_network(self, ssid):
+1 -1
View File
@@ -5,7 +5,7 @@ import contextlib
import logging
import uuid
import NetworkManager
from ks_includes import NetworkManager
import dbus
from dbus.mainloop.glib import DBusGMainLoop
import gi
+1 -1
View File
@@ -242,7 +242,7 @@ class BasePanel(ScreenPanel):
name = f"{name[:1].upper()}: "
self.labels[device].set_label(f"{name}{int(temp)}°")
with contextlib.suppress(KeyError):
with contextlib.suppress(Exception):
if data["toolhead"]["extruder"] != self.current_extruder:
self.control['temp_box'].remove(self.labels[f"{self.current_extruder}_box"])
self.current_extruder = data["toolhead"]["extruder"]
+116 -71
View File
@@ -1,5 +1,6 @@
import logging
import re
import math
import gi
@@ -14,6 +15,29 @@ def create_panel(*args):
return BedLevelPanel(*args)
# Find the screw closest to the point,
# but return None if the distance is above max_distance.
# If remove is set to true, the screw is also removed
# from the list of passed in screws.
def find_closest(screws, point, max_distance, remove=False):
if len(screws) == 0:
return None
closest = screws[0]
min_distance = math.hypot(closest[0] - point[0], closest[1] - point[1])
for screw in screws[1:]:
distance = math.hypot(screw[0] - point[0], screw[1] - point[1])
if distance < min_distance:
closest = screw
min_distance = distance
if min_distance > max_distance:
return None
if remove:
screws.remove(closest)
return closest
class BedLevelPanel(ScreenPanel):
def __init__(self, screen, title):
@@ -49,7 +73,8 @@ class BedLevelPanel(ScreenPanel):
self.y_offset = round(float(probe['y_offset']), 1)
logging.debug(f"offset X: {self.x_offset} Y: {self.y_offset}")
# bed_screws uses NOZZLE positions
# screws_tilt_adjust uses PROBE positions and to be offseted for the buttons to work equal to bed_screws
# screws_tilt_adjust uses PROBE positions and
# to be offseted for the buttons to work equal to bed_screws
new_screws = [
[round(screw[0] + self.x_offset, 1), round(screw[1] + self.y_offset, 1)]
for screw in self.screws
@@ -60,6 +85,35 @@ class BedLevelPanel(ScreenPanel):
elif "bed_screws" in self._printer.get_config_section_list():
self.screws = self._get_screws("bed_screws")
logging.info(f"bed_screws: {self.screws}")
nscrews = len(self.screws)
# KS config
valid_positions = True
valid_screws = ["bl", "fl", "fr", "br", "bm", "fm", "lm", "rm", "center"]
if self.ks_printer_cfg is not None:
screw_positions = self.ks_printer_cfg.get("screw_positions", "")
if screw_positions:
screw_positions = [str(i.strip()) for i in screw_positions.split(',')]
logging.info(f"Positions: {screw_positions}")
for screw in screw_positions:
if screw not in valid_screws:
logging.error(f"Unknown screw: {screw}")
self._screen.show_popup_message(_("Unknown screw position") + f": {screw}")
valid_positions = False
if not (3 <= len(screw_positions) <= 9):
valid_positions = False
else:
if nscrews in (3, 5, 7):
valid_positions = False
screw_positions = valid_screws
rotation = self.ks_printer_cfg.getint("screw_rotation", 0)
logging.info(f"Rotation: {rotation}")
else:
if nscrews in (3, 5, 7):
valid_positions = False
screw_positions = valid_screws
if 'bed_screws' in self._config.get_config():
rotation = self._config.get_config()['bed_screws'].getint("rotation", 0)
logging.debug(f"Rotation: {rotation}")
# get dimensions
x_positions = {x[0] for x in self.screws}
@@ -70,89 +124,73 @@ class BedLevelPanel(ScreenPanel):
min_x = min(x_positions)
max_x = max(x_positions)
mid_x = round((min_x + max_x) / 2)
min_y = min(y_positions)
max_y = max(y_positions)
mid_y = round((min_y + max_y) / 2)
fl = [min_x, min_y]
bl = [min_x, max_y]
br = [max_x, max_y]
fr = [max_x, min_y]
max_distance = math.ceil(
math.hypot(max_x - min_x, max_y - min_y)
/ min(self.x_cnt, self.y_cnt, 3)
)
if self.x_cnt == 3:
mid_x = [x for x in list(zip(*self.screws))[0] if x not in (min_x, max_x)][0]
fm = [mid_x, min_y]
bm = [mid_x, max_y]
else:
fm = bm = None
if self.y_cnt == 3:
mid_y = [y for y in list(zip(*self.screws))[1] if y not in (min_y, max_y)][0]
lm = [min_x, mid_y]
rm = [max_x, mid_y]
else:
lm = rm = None
logging.debug(f"Using max_distance: {max_distance} to fit: {len(self.screws)} screws.")
logging.debug(f"Using {len(self.screws)}-screw locations [x,y] [{self.x_cnt}x{self.y_cnt}]")
remaining_screws = self.screws[:]
self.buttons['bl'] = self._gtk.Button("bed-level-t-l", scale=2.5)
self.buttons['br'] = self._gtk.Button("bed-level-t-r", scale=2.5)
self.buttons['fl'] = self._gtk.Button("bed-level-b-l", scale=2.5)
self.buttons['fr'] = self._gtk.Button("bed-level-b-r", scale=2.5)
self.buttons['lm'] = self._gtk.Button("bed-level-l-m", scale=2.5)
self.buttons['rm'] = self._gtk.Button("bed-level-r-m", scale=2.5)
self.buttons['fm'] = self._gtk.Button("bed-level-b-m", scale=2.5)
self.buttons['bm'] = self._gtk.Button("bed-level-t-m", scale=2.5)
fl = find_closest(remaining_screws, (min_x, min_y), max_distance, remove="fl" in screw_positions)
bl = find_closest(remaining_screws, (min_x, max_y), max_distance, remove="bl" in screw_positions)
br = find_closest(remaining_screws, (max_x, max_y), max_distance, remove="br" in screw_positions)
fr = find_closest(remaining_screws, (max_x, min_y), max_distance, remove="fr" in screw_positions)
valid_positions = True
if self.ks_printer_cfg is not None:
screw_positions = self.ks_printer_cfg.get("screw_positions", "")
screw_positions = [str(i.strip()) for i in screw_positions.split(',')]
logging.info(f"Positions: {screw_positions}")
for screw in screw_positions:
if screw not in ("bl", "fl", "fr", "br", "bm", "fm", "lm", "rm", ""):
logging.error(f"Unknown screw: {screw}")
self._screen.show_popup_message(_("Unknown screw position") + f": {screw}")
valid_positions = False
if not (3 <= len(screw_positions) <= 8):
valid_positions = False
rotation = self.ks_printer_cfg.getint("screw_rotation", 0)
logging.info(f"Rotation: {rotation}")
else:
valid_positions = False
if 'bed_screws' in self._config.get_config():
rotation = self._config.get_config()['bed_screws'].getint("rotation", 0)
logging.debug(f"Rotation: {rotation}")
fm = find_closest(remaining_screws, (mid_x, min_y), max_distance, remove="fm" in screw_positions)
bm = find_closest(remaining_screws, (mid_x, max_y), max_distance, remove="bm" in screw_positions)
lm = find_closest(remaining_screws, (min_x, mid_y), max_distance, remove="lm" in screw_positions)
rm = find_closest(remaining_screws, (max_x, mid_y), max_distance, remove="rm" in screw_positions)
center = find_closest(remaining_screws, (mid_x, mid_y), max_distance, remove="center" in screw_positions)
if len(remaining_screws) != 0:
logging.debug(f"Screws not used: {remaining_screws}")
logging.debug(f"Using {len(self.screws) - len(remaining_screws)}/{len(self.screws)}-screw locations")
button_scale = 2
self.buttons['bl'] = self._gtk.Button("bed-level-t-l", scale=button_scale)
self.buttons['br'] = self._gtk.Button("bed-level-t-r", scale=button_scale)
self.buttons['fl'] = self._gtk.Button("bed-level-b-l", scale=button_scale)
self.buttons['fr'] = self._gtk.Button("bed-level-b-r", scale=button_scale)
self.buttons['lm'] = self._gtk.Button("bed-level-l-m", scale=button_scale)
self.buttons['rm'] = self._gtk.Button("bed-level-r-m", scale=button_scale)
self.buttons['fm'] = self._gtk.Button("bed-level-b-m", scale=button_scale)
self.buttons['bm'] = self._gtk.Button("bed-level-t-m", scale=button_scale)
self.buttons['center'] = self._gtk.Button("increase", scale=button_scale)
bedgrid = Gtk.Grid()
nscrews = len(self.screws)
if valid_positions:
if "bl" in screw_positions:
if "bl" in screw_positions and bl:
bedgrid.attach(self.buttons['bl'], 1, 0, 1, 1)
if "fl" in screw_positions:
if "fl" in screw_positions and fl:
bedgrid.attach(self.buttons['fl'], 1, 2, 1, 1)
if "fr" in screw_positions:
if "fr" in screw_positions and fr:
bedgrid.attach(self.buttons['fr'], 3, 2, 1, 1)
if "br" in screw_positions:
if "br" in screw_positions and br:
bedgrid.attach(self.buttons['br'], 3, 0, 1, 1)
if "bm" in screw_positions:
if "bm" in screw_positions and bm:
bedgrid.attach(self.buttons['bm'], 2, 0, 1, 1)
if "fm" in screw_positions:
if "fm" in screw_positions and fm:
bedgrid.attach(self.buttons['fm'], 2, 2, 1, 1)
if "lm" in screw_positions:
bedgrid.attach(self.buttons['lm'], 1, 1, 1, 1)
if "rm" in screw_positions:
bedgrid.attach(self.buttons['rm'], 3, 1, 1, 1)
elif nscrews in {4, 6, 8}:
bedgrid.attach(self.buttons['bl'], 1, 0, 1, 1)
bedgrid.attach(self.buttons['fl'], 1, 2, 1, 1)
bedgrid.attach(self.buttons['fr'], 3, 2, 1, 1)
bedgrid.attach(self.buttons['br'], 3, 0, 1, 1)
if self.x_cnt == 3:
bedgrid.attach(self.buttons['bm'], 2, 0, 1, 1)
bedgrid.attach(self.buttons['fm'], 2, 2, 1, 1)
if self.y_cnt == 3:
if "lm" in screw_positions and lm:
bedgrid.attach(self.buttons['lm'], 1, 1, 1, 1)
if "rm" in screw_positions and rm:
bedgrid.attach(self.buttons['rm'], 3, 1, 1, 1)
if "center" in screw_positions and center:
bedgrid.attach(self.buttons['center'], 2, 1, 1, 1)
self.buttons['center'].connect("clicked", self.go_to_position, center)
else:
label = Gtk.Label(
_("Bed screw configuration:") + f" {nscrews}\n\n"
@@ -253,7 +291,7 @@ class BedLevelPanel(ScreenPanel):
'fl': fl,
'lm': lm
}
self.screw_dict['center'] = center
grid.attach(bedgrid, 1, 0, 3, 2)
self.content.add(grid)
@@ -261,9 +299,16 @@ class BedLevelPanel(ScreenPanel):
for key, value in self.screw_dict.items():
self.buttons[key].set_label(f"{value}")
def go_to_position(self, widget, position):
def home(self):
# Test if all axes have been homed. Home if necessary.
if self._printer.get_stat("toolhead", "homed_axes") != "xyz":
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
# do Z_TILT_CALIBRATE if applicable.
if self._printer.config_section_exists("z_tilt"):
self._screen._ws.klippy.gcode_script(KlippyGcodes.Z_TILT)
def go_to_position(self, widget, position):
self.home()
logging.debug(f"Going to position: {position}")
script = [
f"{KlippyGcodes.MOVE_ABSOLUTE}",
@@ -284,8 +329,9 @@ class BedLevelPanel(ScreenPanel):
def process_busy(self, busy):
for button in self.buttons:
if button == "screws":
self.buttons[button].set_sensitive(self._printer.config_section_exists("screws_tilt_adjust")
and (not busy))
self.buttons[button].set_sensitive(
self._printer.config_section_exists("screws_tilt_adjust")
and (not busy))
continue
self.buttons[button].set_sensitive((not busy))
@@ -347,8 +393,7 @@ class BedLevelPanel(ScreenPanel):
return sorted(screws, key=lambda s: (float(s[1]), float(s[0])))
def screws_tilt_calculate(self, widget):
if self._printer.get_stat("toolhead", "homed_axes") != "xyz":
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
self.home()
self.response_count = 0
self.buttons['screws'].set_sensitive(False)
self._screen._ws.klippy.gcode_script("SCREWS_TILT_CALCULATE")
+40 -34
View File
@@ -29,12 +29,12 @@ class CameraPanel(ScreenPanel):
self.content.add(box)
self.content.show_all()
self.url = self.ks_printer_cfg.get("camera_url", "http://127.0.0.1/webcam/?action=stream").replace('"', '')
logging.debug(f"Camera URL: {self.url}")
# wayland has no primary monitor with that we can detect it
self.wayland = Gdk.Display.get_default().get_primary_monitor() is None
# gpu output driver doesn't work on a pi3 and the autoselected sdl doesn't size correctly
# consider adding a software switch to enable the gpu backend if set by the user
self.vo = 'x11' if self.wayland else 'wlshm'
self.vo = 'wlshm' if self.wayland else 'x11'
logging.debug(f"Camera URL: {self.url} vo: {self.vo} wayland: {self.wayland}")
def activate(self):
self.play()
@@ -45,40 +45,46 @@ class CameraPanel(ScreenPanel):
self.mpv = None
def play(self, fs=None):
# Create mpv after show or the 'window' property will be None
self.mpv = mpv.MPV(
log_handler=self.log,
vo=self.vo,
profile='sw-fast',
)
# On wayland mpv cannot be embedded at least for now
# https://github.com/mpv-player/mpv/issues/9654
if fs or self.wayland:
self.mpv.fullscreen = True
@self.mpv.on_key_press('MBTN_LEFT' or 'MBTN_LEFT_DBL')
def clicked():
self.mpv.quit(0)
else:
self.mpv.wid = f'{self.da.get_property("window").get_xid()}'
@self.mpv.on_key_press('MBTN_LEFT' or 'MBTN_LEFT_DBL')
def clicked():
self._screen.show_popup_message(self.url, level=1)
self.mpv.play(self.url)
if fs or self.wayland:
try:
self.mpv.wait_for_playback()
except mpv.ShutdownError:
logging.info('Exiting Fullscreen')
except Exception as e:
logging.exception(e)
if self.mpv:
self.mpv.terminate()
self.mpv = None
if self.wayland:
self._screen._menu_go_back()
else:
self.play()
# Create mpv after show or the 'window' property will be None
try:
self.mpv = mpv.MPV(
log_handler=self.log,
vo=self.vo,
profile='sw-fast',
)
except ValueError:
self.mpv = mpv.MPV(
log_handler=self.log,
vo=self.vo,
)
# On wayland mpv cannot be embedded at least for now
# https://github.com/mpv-player/mpv/issues/9654
# if fs or self.wayland:
self.mpv.fullscreen = True
@self.mpv.on_key_press('MBTN_LEFT' or 'MBTN_LEFT_DBL')
def clicked():
self.mpv.quit(0)
# else:
# self.mpv.wid = f'{self.da.get_property("window").get_xid()}'
#
# @self.mpv.on_key_press('MBTN_LEFT' or 'MBTN_LEFT_DBL')
# def clicked():
# self._screen.show_popup_message(self.url, level=1)
self.mpv.play(self.url)
# if fs or self.wayland:
try:
self.mpv.wait_for_playback()
except mpv.ShutdownError:
logging.info('Exiting Fullscreen')
except Exception as e:
logging.exception(e)
self.mpv.terminate()
self.mpv = None
self._screen._menu_go_back()
@staticmethod
def log(loglevel, component, message):
+6 -1
View File
@@ -83,7 +83,12 @@ class MacroPanel(ScreenPanel):
"params": {},
}
pattern = r'params\.(?P<param>..*)\|default\((?P<default>..*)\).*'
gcode = self._printer.get_config_section(f"gcode_macro {macro}")["gcode"].split("\n")
gcode = self._printer.get_macro(macro)
if gcode and "gcode" in gcode:
gcode = gcode["gcode"].split("\n")
else:
logging.debug(f"Couldn't load {macro}\n{gcode}")
return
i = 0
for line in gcode:
if line.startswith("{") and "params." in line:
+23 -18
View File
@@ -119,7 +119,7 @@ class JobStatusPanel(ScreenPanel):
overlay.add_overlay(box)
self.grid.attach(overlay, 0, 0, 1, 1)
self.labels['thumbnail'] = self._gtk.Image("file", self._screen.width / 4, self._screen.height / 4)
self.labels['thumbnail'] = self._gtk.Image()
self.labels['info_grid'] = Gtk.Grid()
self.labels['info_grid'].attach(self.labels['thumbnail'], 0, 0, 1, 1)
if self._printer.get_tools():
@@ -351,9 +351,14 @@ class JobStatusPanel(ScreenPanel):
def activate(self):
ps = self._printer.get_stat("print_stats")
self.set_state(ps['state'])
if 'filename' in ps and (ps['filename'] != self.filename):
logging.debug(f"Changing filename: '{self.filename}' to '{ps['filename']}'")
self.update_filename()
if self.flow_timeout is None:
self.flow_timeout = GLib.timeout_add_seconds(2, self.update_flow)
self._screen.base_panel_show_all()
logging.debug("Job_status panel")
self._screen.memory_trace()
def deactivate(self):
if self.flow_timeout is not None:
@@ -394,7 +399,7 @@ class JobStatusPanel(ScreenPanel):
+ "\n\n"
+ _("Saved offset: %s") % saved_z_offset)
elif device == "endstop":
label.set_label(_("Apply %.2f offset to Endstop?") % (sign, abs(self.zoffset)))
label.set_label(_("Apply %s%.2f offset to Endstop?") % (sign, abs(self.zoffset)))
label.set_hexpand(True)
label.set_halign(Gtk.Align.CENTER)
label.set_vexpand(True)
@@ -559,7 +564,7 @@ class JobStatusPanel(ScreenPanel):
)
self.buttons['speed'].set_label(self.labels['req_speed'].get_label())
with contextlib.suppress(KeyError):
self.zoffset = data["gcode_move"]["homing_origin"][2]
self.zoffset = float(data["gcode_move"]["homing_origin"][2])
self.labels['zoffset'].set_label(f"{self.zoffset:.2f} {self.mm}")
if "motion_report" in data:
with contextlib.suppress(KeyError):
@@ -610,13 +615,11 @@ class JobStatusPanel(ScreenPanel):
f"{1 + round((self.pos_z - self.f_layer_h) / self.layer_h)} / {self.labels['total_layers'].get_text()}")
if 'print_duration' in ps:
total_duration = ps['total_duration']
print_duration = ps['print_duration']
if 'filament_used' in ps:
self.labels['filament_used'].set_label(f"{float(ps['filament_used']) / 1000:.1f} m")
self.update_time_left(total_duration, print_duration, ps['filament_used'])
self.update_time_left(ps['total_duration'], ps['print_duration'], ps['filament_used'])
else:
self.update_time_left(total_duration, print_duration)
self.update_time_left(ps['total_duration'], ps['print_duration'])
elapsed_label = f"{self.labels['elapsed'].get_text()} {self.labels['duration'].get_text()}"
self.buttons['elapsed'].set_label(elapsed_label)
@@ -770,16 +773,18 @@ class JobStatusPanel(ScreenPanel):
self.content.show_all()
def show_file_thumbnail(self):
if self._files.has_thumbnail(self.filename):
if self._screen.vertical_mode:
width = self._screen.width * 0.9
height = self._screen.height / 4
else:
width = self._screen.width / 3
height = self._gtk.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)
if self._screen.vertical_mode:
width = self._screen.width * 0.9
height = self._screen.height / 4
else:
width = self._screen.width / 3
height = self._gtk.content_height * 0.47
pixbuf = self.get_file_image(self.filename, width, height)
logging.debug(self.filename)
if pixbuf is None:
logging.debug("no pixbuf")
pixbuf = self._gtk.PixbufFromIcon("file", width / 2, height / 2)
self.labels['thumbnail'].set_from_pixbuf(pixbuf)
def update_filename(self):
self.filename = self._printer.get_stat('print_stats', 'filename')
@@ -812,7 +817,6 @@ class JobStatusPanel(ScreenPanel):
logging.info(f"Update Metadata. File: {self.filename} Size: {self.file_metadata['size']}")
if "estimated_time" in self.file_metadata and self.timeleft_type == "slicer":
self.labels["est_time"].set_label(self.format_time(self.file_metadata['estimated_time']))
self.show_file_thumbnail()
if "object_height" in self.file_metadata:
self.oheight = float(self.file_metadata['object_height'])
self.labels['height'].set_label(f"{self.oheight} {self.mm}")
@@ -829,6 +833,7 @@ class JobStatusPanel(ScreenPanel):
self.file_metadata = {}
logging.debug("Cannot find file metadata. Listening for updated metadata")
self._screen.files.add_file_callback(self._callback_metadata)
self.show_file_thumbnail()
def update_percent_complete(self):
if self.state not in ["printing", "paused"]:
+24 -7
View File
@@ -2,6 +2,8 @@ import logging
import gi
import json
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from jinja2 import Environment, Template
@@ -65,7 +67,7 @@ class MenuPanel(ScreenPanel):
self.grid.attach(self.labels[key], col, row, width, height)
i += 1
self.j2_data = None
return self.grid
def create_menu_items(self):
@@ -75,14 +77,29 @@ class MenuPanel(ScreenPanel):
env = Environment(extensions=["jinja2.ext.i18n"], autoescape=True)
env.install_gettext_translations(self._config.get_lang())
j2_temp = env.from_string(item['name'])
parsed_name = j2_temp.render()
b = self._gtk.Button(item['icon'], parsed_name, f"color{(i % 4) + 1}")
printer = self._printer.get_printer_status_data()
name = env.from_string(item['name']).render(printer)
icon = env.from_string(item['icon']).render(printer) if item['icon'] else None
style = env.from_string(item['style']).render(printer) if item['style'] else None
b = self._gtk.Button(icon, name, (style if style else f"color{(i % 4) + 1}"))
if item['panel'] is not None:
b.connect("clicked", self.menu_item_clicked, item['panel'], item)
panel = env.from_string(item['panel']).render(printer)
b.connect("clicked", self.menu_item_clicked, panel, item)
elif item['method'] is not None:
params = item['params'] if item['params'] is not False else {}
params = {}
if item['params'] is not False:
try:
p = env.from_string(item['params']).render(printer)
params = json.loads(p)
except Exception as e:
logging.exception(f"Unable to parse parameters for [{name}]:\n{e}")
params = {}
if item['confirm'] is not None:
b.connect("clicked", self._screen._confirm_send_action, item['confirm'], item['method'], params)
else:
@@ -96,7 +113,7 @@ class MenuPanel(ScreenPanel):
logging.info(f"moonraker connected {self._screen._ws.connected}")
return self._screen._ws.connected
elif enable == "{{ camera_configured }}":
return self.ks_printer_cfg.get("camera_url", None) is not None
return self.ks_printer_cfg and self.ks_printer_cfg.get("camera_url", None) is not None
self.j2_data = self._printer.get_printer_status_data()
try:
j2_temp = Template(enable, autoescape=True)
+5 -2
View File
@@ -159,12 +159,12 @@ class NetworkPanel(ScreenPanel):
labels.set_valign(Gtk.Align.CENTER)
labels.set_halign(Gtk.Align.START)
connect = self._gtk.Button("load", style="color3")
connect = self._gtk.Button("load", None, "color3", .66)
connect.connect("clicked", self.connect_network, ssid)
connect.set_hexpand(False)
connect.set_halign(Gtk.Align.END)
delete = self._gtk.Button("delete", style="color3")
delete = self._gtk.Button("delete", None, "color3", .66)
delete.connect("clicked", self.remove_wifi_network, ssid)
delete.set_hexpand(False)
delete.set_halign(Gtk.Align.END)
@@ -178,6 +178,7 @@ class NetworkPanel(ScreenPanel):
buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
if network_id != -1 or netinfo['connected']:
buttons.pack_end(connect, False, False, 0)
buttons.pack_end(delete, False, False, 0)
else:
buttons.pack_end(connect, False, False, 0)
@@ -386,6 +387,7 @@ class NetworkPanel(ScreenPanel):
ifadd = netifaces.ifaddresses(self.interface)
if netifaces.AF_INET in ifadd and len(ifadd[netifaces.AF_INET]) > 0:
ipv4 = f"<b>IPv4:</b> {ifadd[netifaces.AF_INET][0]['addr']} "
self.labels['ip'].set_text(f"IP: {ifadd[netifaces.AF_INET][0]['addr']} ")
if netifaces.AF_INET6 in ifadd and len(ifadd[netifaces.AF_INET6]) > 0:
ipv6 = f"<b>IPv6:</b> {ifadd[netifaces.AF_INET6][0]['addr'].split('%')[0]} "
info = '<b>' + _("Hostname") + f':</b> {hostname}\n{ipv4}\n{ipv6}\n'
@@ -413,6 +415,7 @@ class NetworkPanel(ScreenPanel):
ipv6 = ""
if netifaces.AF_INET in ifadd and len(ifadd[netifaces.AF_INET]) > 0:
ipv4 = f"<b>IPv4:</b> {ifadd[netifaces.AF_INET][0]['addr']} "
self.labels['ip'].set_text(f"IP: {ifadd[netifaces.AF_INET][0]['addr']} ")
if netifaces.AF_INET6 in ifadd and len(ifadd[netifaces.AF_INET6]) > 0:
ipv6 = f"<b>IPv6:</b> {ifadd[netifaces.AF_INET6][0]['addr'].split('%')[0]} "
connected = (
+36 -26
View File
@@ -82,6 +82,7 @@ class PrintPanel(ScreenPanel):
if self.cur_directory != "gcodes":
self.change_dir(None, "gcodes")
self._refresh_files()
logging.debug("Print panel")
def add_directory(self, directory, show=True):
parent_dir = os.path.dirname(directory)
@@ -332,7 +333,10 @@ class PrintPanel(ScreenPanel):
directory = os.path.join("gcodes", os.path.dirname(filename)) if os.path.dirname(filename) else "gcodes"
if directory not in self.filelist or os.path.basename(filename).startswith("."):
return
self.filelist[directory]["files"].pop(self.filelist[directory]["files"].index(os.path.basename(filename)))
try:
self.filelist[directory]["files"].pop(self.filelist[directory]["files"].index(os.path.basename(filename)))
except Exception as e:
logging.exception(e)
dir_parts = directory.split(os.sep)
i = len(dir_parts)
while i > 1:
@@ -352,7 +356,10 @@ class PrintPanel(ScreenPanel):
self.dir_panels[parent_dir].show_all()
i -= 1
self.dir_panels[directory].remove(self.files[filename])
try:
self.dir_panels[directory].remove(self.files[filename])
except Exception as e:
logging.exception(e)
self.dir_panels[directory].show_all()
self.files.pop(filename)
@@ -408,6 +415,7 @@ class PrintPanel(ScreenPanel):
def _refresh_files(self, widget=None):
self._files.refresh_files()
self._screen.memory_trace()
def show_rename(self, widget, fullpath):
self.source = fullpath
@@ -417,35 +425,37 @@ class PrintPanel(ScreenPanel):
self.content.remove(child)
if "rename_file" not in self.labels:
lbl = self._gtk.Label(_("Rename/Move:"))
lbl.set_halign(Gtk.Align.START)
lbl.set_hexpand(False)
self.labels['new_name'] = Gtk.Entry()
self.labels['new_name'].set_text(fullpath)
self.labels['new_name'].set_hexpand(True)
self.labels['new_name'].connect("activate", self.rename)
self.labels['new_name'].connect("focus-in-event", self._screen.show_keyboard)
save = self._gtk.Button("complete", _("Save"), "color3")
save.set_hexpand(False)
save.connect("clicked", self.rename)
box = Gtk.Box()
box.pack_start(self.labels['new_name'], True, True, 5)
box.pack_start(save, False, False, 5)
self.labels['rename_file'] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5)
self.labels['rename_file'].set_valign(Gtk.Align.CENTER)
self.labels['rename_file'].set_hexpand(True)
self.labels['rename_file'].set_vexpand(True)
self.labels['rename_file'].pack_start(lbl, True, True, 5)
self.labels['rename_file'].pack_start(box, True, True, 5)
self._create_rename_box(fullpath)
self.content.add(self.labels['rename_file'])
self.labels['new_name'].set_text(fullpath[7:])
self.labels['new_name'].grab_focus_without_selecting()
self.showing_rename = True
def _create_rename_box(self, fullpath):
lbl = self._gtk.Label(_("Rename/Move:"))
lbl.set_halign(Gtk.Align.START)
lbl.set_hexpand(False)
self.labels['new_name'] = Gtk.Entry()
self.labels['new_name'].set_text(fullpath)
self.labels['new_name'].set_hexpand(True)
self.labels['new_name'].connect("activate", self.rename)
self.labels['new_name'].connect("focus-in-event", self._screen.show_keyboard)
save = self._gtk.Button("complete", _("Save"), "color3")
save.set_hexpand(False)
save.connect("clicked", self.rename)
box = Gtk.Box()
box.pack_start(self.labels['new_name'], True, True, 5)
box.pack_start(save, False, False, 5)
self.labels['rename_file'] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=5)
self.labels['rename_file'].set_valign(Gtk.Align.CENTER)
self.labels['rename_file'].set_hexpand(True)
self.labels['rename_file'].set_vexpand(True)
self.labels['rename_file'].pack_start(lbl, True, True, 5)
self.labels['rename_file'].pack_start(box, True, True, 5)
def hide_rename(self):
self._screen.remove_keyboard()
for child in self.content.get_children():
+3 -2
View File
@@ -183,7 +183,9 @@ class ZCalibratePanel(ScreenPanel):
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}")
self._screen._ws.klippy.gcode_script(f"G91\nG0 Z{z_hop} F{float(speed) * 60}")
if self._printer.get_stat("gcode_move", "absolute_coordinates"):
self._screen._ws.klippy.gcode_script("G90")
if x_position is not None and y_position is not None:
logging.debug(f"Configured probing position X: {x_position} Y: {y_position}")
@@ -242,7 +244,6 @@ class ZCalibratePanel(ScreenPanel):
logging.info(data)
elif "save_config" in data:
self.buttons_not_calibrating()
self._screen.show_popup_message(_("Calibrated, save configuration to make it permanent"), level=1)
elif "out of range" in data:
self._screen.show_popup_message(data)
self.buttons_not_calibrating()
+63 -40
View File
@@ -10,6 +10,7 @@ import traceback # noqa
import locale
import sys
import gi
import tracemalloc
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
@@ -82,7 +83,7 @@ class KlipperScreen(Gtk.Window):
panels = {}
popup_message = None
screensaver = None
printer = None
printers = printer = None
subscriptions = []
updating = False
_ws = None
@@ -90,8 +91,11 @@ class KlipperScreen(Gtk.Window):
reinit_count = 0
max_retries = 4
initialized = False
initial_snapshot = None
switch_count = 0
def __init__(self, args, version):
tracemalloc.start()
try:
super().__init__(title="KlipperScreen")
except Exception as e:
@@ -122,7 +126,8 @@ class KlipperScreen(Gtk.Window):
self.set_resizable(True)
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
self.aspect_ratio = self.width / self.height
self.vertical_mode = self.aspect_ratio < 1.0
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)
@@ -151,13 +156,24 @@ class KlipperScreen(Gtk.Window):
self.initial_connection()
def initial_connection(self):
printers = self._config.get_printers()
self.printers = self._config.get_printers()
state_callbacks = {
"disconnected": self.state_disconnected,
"error": self.state_error,
"paused": self.state_paused,
"printing": self.state_printing,
"ready": self.state_ready,
"startup": self.state_startup,
"shutdown": self.state_shutdown
}
for printer in self.printers:
printer["data"] = Printer(state_execute, state_callbacks, self.process_busy_state)
default_printer = self._config.get_main_config().get('default_printer')
logging.debug(f"Default printer: {default_printer}")
if [True for p in printers if default_printer in p]:
if [True for p in self.printers if default_printer in p]:
self.connect_printer(default_printer)
elif len(printers) == 1:
pname = list(printers[0])[0]
elif len(self.printers) == 1:
pname = list(self.printers[0])[0]
self.connect_printer(pname)
else:
self.base_panel.show_printer_select(True)
@@ -168,40 +184,27 @@ class KlipperScreen(Gtk.Window):
if self._ws is not None and self._ws.connected:
self._ws.close()
self.connected_printer = None
self.printer.state = "disconnected"
if self.files:
self.files.reset()
self.files = None
if self.printer:
self.printer.reset()
self.printer = None
self.connecting = True
self.initialized = False
data = {
"moonraker_host": "127.0.0.1",
"moonraker_port": "7125",
"moonraker_api_key": False
}
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
for printer in self.printers:
if name == list(printer)[0]:
ind = self.printers.index(printer)
break
self.printer = self.printers[ind]["data"]
self.apiclient = KlippyRest(
self.printers[ind][name]["moonraker_host"],
self.printers[ind][name]["moonraker_port"],
self.printers[ind][name]["moonraker_api_key"],
)
self.apiclient = KlippyRest(data["moonraker_host"], data["moonraker_port"], data["moonraker_api_key"])
self.printer = Printer(state_execute)
self.printer.state_callbacks = {
"disconnected": self.state_disconnected,
"error": self.state_error,
"paused": self.state_paused,
"printing": self.state_printing,
"ready": self.state_ready,
"startup": self.state_startup,
"shutdown": self.state_shutdown
}
self.printer.busy_cb = self.process_busy_state
self.printer_initializing(_("Connecting to %s") % name, remove=True)
self._ws = KlippyWebsocket(self,
@@ -210,13 +213,30 @@ class KlipperScreen(Gtk.Window):
"on_message": self._websocket_callback,
"on_close": self.websocket_disconnected
},
data["moonraker_host"],
data["moonraker_port"]
self.printers[ind][name]["moonraker_host"],
self.printers[ind][name]["moonraker_port"],
)
self.files = KlippyFiles(self)
self._ws.initial_connect()
def memory_trace(self):
snapshot = tracemalloc.take_snapshot()
snapshot = snapshot.filter_traces((
tracemalloc.Filter(False, "<frozen importlib._bootstrap_external>"),
tracemalloc.Filter(False, "<unknown>"),
tracemalloc.Filter(False, tracemalloc.__file__),
))
if self.initial_snapshot is None:
self.initial_snapshot = snapshot
logging.debug("[ Initial memory snapshot ]")
else:
self.switch_count += 1
logging.debug("[ Top 10 memory diffs (Shown: %d times)]", self.switch_count)
top_stats = snapshot.compare_to(self.initial_snapshot, 'lineno')
for stat in top_stats[:10]:
logging.debug(stat)
def ws_subscribe(self):
requested_updates = {
"objects": {
@@ -316,6 +336,7 @@ class KlipperScreen(Gtk.Window):
msg.set_vexpand(True)
msg.get_child().set_line_wrap(True)
msg.get_child().set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
msg.get_child().set_max_width_chars(40)
msg.connect("clicked", self.close_popup_message)
msg.get_style_context().add_class("message_popup")
if level == 1:
@@ -327,7 +348,7 @@ class KlipperScreen(Gtk.Window):
popup = Gtk.Popover.new(self.base_panel.titlebar)
popup.get_style_context().add_class("message_popup_popover")
popup.set_size_request(self.width, -1)
popup.set_size_request(self.width * .9, -1)
popup.set_halign(Gtk.Align.CENTER)
popup.add(msg)
popup.popup()
@@ -626,8 +647,6 @@ class KlipperScreen(Gtk.Window):
self.connected_printer = None
self.files.reset()
self.files = None
self.printer.reset()
self.printer = None
self.initialized = False
self.connect_printer(self.connecting_to_printer)
@@ -727,7 +746,7 @@ class KlipperScreen(Gtk.Window):
elif "unknown" in data.lower() and \
not ("TESTZ" in data or "MEASURE_AXES_NOISE" in data or "ACCELEROMETER_QUERY" in data):
self.show_popup_message(data)
if "SAVE_CONFIG" in data and self.printer.state == "ready":
elif "SAVE_CONFIG" in data and self.printer.state == "ready":
script = {"script": "SAVE_CONFIG"}
self._confirm_send_action(
None,
@@ -965,9 +984,13 @@ class KlipperScreen(Gtk.Window):
def update_size(self, *args):
self.width, self.height = self.get_size()
if self.vertical_mode != (self.width < self.height):
new_ratio = self.width / self.height
new_mode = new_ratio < 1.0
ratio_delta = abs(self.aspect_ratio - new_ratio)
if ratio_delta > 0.1 and self.vertical_mode != new_mode:
self.reload_panels()
self.vertical_mode = self.width < self.height
self.vertical_mode = new_mode
self.aspect_ratio = new_ratio
def main():
+14 -9
View File
@@ -9,11 +9,11 @@ FBDEV="xserver-xorg-video-fbdev"
PYTHON="python3-virtualenv virtualenv python3-distutils"
PYGOBJECT="libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0"
MISC="librsvg2-common libopenjp2-7 libatlas-base-dev wireless-tools libdbus-glib-1-dev autoconf"
OPTIONAL="xserver-xorg-legacy fonts-nanum fonts-ipafont, libmpv-dev"
OPTIONAL="xserver-xorg-legacy fonts-nanum fonts-ipafont libmpv-dev"
# moonraker will check this list when updating
# if new packages are required for existing installs add them below too.
PKGLIST="libdbus-glib-1-dev autoconf fonts-ipafont, libmpv-dev"
PKGLIST="libdbus-glib-1-dev autoconf fonts-ipafont libmpv-dev"
Red='\033[0;31m'
Green='\033[0;32m'
@@ -43,7 +43,7 @@ install_packages()
echo_text "Checking for broken packages..."
output=$(dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci])
if [ $? -eq 0 ]; then
echo_text "Detectected broken pacakges. Attempting to fix"
echo_text "Detected broken packages. Attempting to fix"
sudo apt-get -f install
output=$(dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci])
if [ $? -eq 0 ]; then
@@ -73,16 +73,16 @@ install_packages()
fi
sudo apt-get install -y $PYTHON
if [ $? -eq 0 ]; then
echo_ok "Installed Python dependincies"
echo_ok "Installed Python dependencies"
else
echo_error "Installation of Python dependincies failed ($PYTHON)"
echo_error "Installation of Python dependencies failed ($PYTHON)"
exit 1
fi
sudo apt-get install -y $PYGOBJECT
if [ $? -eq 0 ]; then
echo_ok "Installed PyGobject dependincies"
echo_ok "Installed PyGobject dependencies"
else
echo_error "Installation of PyGobject dependincies failed ($PYGOBJECT)"
echo_error "Installation of PyGobject dependencies failed ($PYGOBJECT)"
exit 1
fi
sudo apt-get install -y $MISC
@@ -92,6 +92,10 @@ install_packages()
echo_error "Installation of Misc packages failed ($MISC)"
exit 1
fi
# ModemManager interferes with klipper comms
# on buster it's installed as a dependency of mpv
# it doesn't happen on bullseye
sudo systemctl mask ModemManager.service
}
create_virtualenv()
@@ -149,7 +153,7 @@ modify_user()
update_x11()
{
if [ -e /etc/X11/Xwrapper.conf ]
if [ -e /etc/X11/Xwrapper.config ]
then
echo_text "Updating X11 Xwrapper"
sudo sed -i 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
@@ -164,6 +168,7 @@ add_desktop_file()
DESKTOP=$(<$SCRIPTPATH/KlipperScreen.desktop)
mkdir -p $HOME/.local/share/applications/
echo "$DESKTOP" | tee $HOME/.local/share/applications/KlipperScreen.desktop > /dev/null
sudo cp $SCRIPTPATH/../styles/icon.svg /usr/share/icons/hicolor/scalable/apps/KlipperScreen.svg
}
start_KlipperScreen()
@@ -173,7 +178,7 @@ start_KlipperScreen()
sudo systemctl start KlipperScreen
}
if [ "$EUID" == 0 ]
then echo_error "Plaease do not run this script as root"
then echo_error "Please do not run this script as root"
exit 1
fi
install_packages
+4 -3
View File
@@ -1,8 +1,9 @@
jinja2==3.1.2
netifaces==0.11.0
requests==2.28.1
websocket-client==1.4.2
requests==2.28.2
websocket-client==1.5.1
pycairo==1.22.0
PyGObject==3.42.2
python-networkmanager==2.2
python-mpv==0.5.2
six==1.16.0
dbus-python==1.3.2
+1 -1
View File
@@ -1,7 +1,7 @@
[Desktop Entry]
Name=KlipperScreen
GenericName=Touch screen GUI for Klipper via Moonraker
Icon=$HOME/KlipperScreen/styles/icon.svg
Icon=KlipperScreen
Exec=sh -c "$HOME/.KlipperScreen-env/bin/python $HOME/KlipperScreen/screen.py"
Terminal=false
Type=Application
+54
View File
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg4"
sodipodi:docname="light.svg"
inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)">
<metadata
id="metadata6">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
id="namedview6"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
showgrid="false"
inkscape:zoom="26"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-width="1920"
inkscape:window-height="1018"
inkscape:window-x="-6"
inkscape:window-y="-6"
inkscape:window-maximized="1"
inkscape:current-layer="svg4"
inkscape:document-rotation="0" />
<path
d="m 12,2 c 3.865993,0 7,3.1340068 7,7 0,2.38 -1.19,4.47 -3,5.74 V 17 c 0,0.552285 -0.447715,1 -1,1 H 9 C 8.4477153,18 8,17.552285 8,17 V 14.74 C 6.19,13.47 5,11.38 5,9 5,5.1340068 8.1340068,2 12,2 M 9,21 v -1 h 6 v 1 c 0,0.552285 -0.447715,1 -1,1 H 10 C 9.4477153,22 9,21.552285 9,21"
id="path2"
style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:#e2e2e2;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;stop-color:#000000;stop-opacity:1"
sodipodi:nodetypes="cscsssscsccccsssc" />
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB