Compare commits

...
134 Commits
Author SHA1 Message Date
Jordan Ruthe ca8abecb55 gcode_macros: Update to hide macros based on settings 2021-01-07 01:02:38 -05:00
Jordan Ruthe 934acd0ad0 move: Update to get configuration value properly 2021-01-07 01:02:25 -05:00
Jordan Ruthe 71abc27ad8 splash_screen: Don't display power on if no power devices 2021-01-07 01:02:10 -05:00
Jordan Ruthe 642fe8a52e settings: Create settings panel for KlipperScreen settings 2021-01-07 01:01:55 -05:00
Jordan Ruthe b2b3127183 extrude: Include translations in function 2021-01-07 01:00:43 -05:00
Jordan Ruthe d11e9ec3a6 Create script to update translations with new words and update translation files 2021-01-07 00:59:39 -05:00
Jordan Ruthe 3fee1ff947 zh_CN: Add translation 2021-01-07 00:24:24 -05:00
Jordan Ruthe 0bdb5ac457 he_IL: Updates to translations 2021-01-07 00:24:10 -05:00
Jordan Ruthe 3a60277392 extrude: Updates for language compatability 2021-01-03 18:44:19 -05:00
Jordan Ruthe 0b8751836c Add fr_FR translation 2021-01-03 16:23:21 -05:00
Jordan Ruthe e227f22aba Update he_IL translations 2021-01-03 16:22:41 -05:00
Jordan Ruthe b57cbc8352 Language support for RTL and he_IL 2021-01-03 16:04:26 -05:00
Jordan Ruthe 7b593b704c screen_panel: Parse jinja from config file 2021-01-03 12:45:39 -05:00
Jordan Ruthe 3c2bdee22a Update to allow translations from config file. Updates to use translations from config file. 2021-01-03 12:43:53 -05:00
Jordan Ruthe c08a293f83 job_status: fix problem with directories in the filename 2020-12-29 10:35:23 -05:00
Jordan 9d89311bcc updates to several panels to account for a lack of heater_bed 2020-12-28 17:08:17 -05:00
Jordan 63764ee32e config: log only defined config, redact api key 2020-12-28 16:30:05 -05:00
Jordan c58b040be2 printer: change how states are transitioned 2020-12-28 16:21:15 -05:00
Jordan 389eceaf06 job_status: fix percentage above 100; fix no timeout for job complete 2020-12-28 15:53:20 -05:00
Jordan 9aa4389eaf websocket: remove token debug 2020-12-28 11:53:00 -05:00
Jordan 931d15b6cc printer: Updates to make toolcount less confusing 2020-12-28 11:52:54 -05:00
Jordan 3abbe921b2 extrude: fix panel to allow for multiple extruders 2020-12-21 10:01:21 -05:00
Jordan e2a0f86f45 panels: Add extruder-0 image so that panels align to the T0/T1.. command 2020-12-21 09:57:42 -05:00
Jordan 263b07ae94 docs: update changelog 2020-12-21 09:42:48 -05:00
Jordan f223332cd8 job_status: updates to show active extruder 2020-12-21 09:40:26 -05:00
Jordan 1c2519be41 gcode_macros: visual updates 2020-12-20 23:52:01 -05:00
Jordan 9016b67c6f power: visual updates 2020-12-20 23:51:41 -05:00
Jordan 37c043b3f9 KlippyWebsocket: changes to allow for moonraker api key 2020-12-20 15:43:42 -05:00
Jordan 717e4ee902 readme: updates to hardware 2020-12-18 15:43:39 -05:00
Jordan cb90a0bd70 docs: Update for gcode_macros panel 2020-12-18 15:30:57 -05:00
Jordan 6a6161dfef printer: add bltouch/probe variables 2020-12-18 15:25:35 -05:00
Jordan 1973002b3d power: cleanup dependency 2020-12-18 15:22:30 -05:00
Jordan 51714180ac gcode_macros: add a panel for gcode macros 2020-12-18 15:22:16 -05:00
Jordan 246c15494c screen: Allow fallback for other languages 2020-12-18 13:10:45 -05:00
Jordan 5c1d5a1825 screen: Better error display for klippy 2020-12-18 13:02:10 -05:00
dependabot[bot] 136ecf79fb build(deps): bump humanize from 3.1.0 to 3.2.0 (#31)
Bumps [humanize](https://github.com/jmoiron/humanize) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/jmoiron/humanize/releases)
- [Commits](https://github.com/jmoiron/humanize/compare/3.1.0...3.2.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-18 12:34:13 -05:00
dependabot[bot] 3fe1665e0b build(deps): bump requests from 2.25.0 to 2.25.1 (#33)
Bumps [requests](https://github.com/psf/requests) from 2.25.0 to 2.25.1.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.25.0...v2.25.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-18 12:33:56 -05:00
Jordan Ruthe c3f96418ea screen: allow custom moonraker url/port 2020-12-16 23:02:33 -05:00
Jordan Ruthe bcbbc03151 config: Allow specifying configfile location from command line 2020-12-16 23:00:50 -05:00
Jordan Ruthe 51da7cecc8 job_status: change how metadata update is handled 2020-12-10 17:01:51 -05:00
Jordan Ruthe 07554250ad screen: Catch "startup" state from moonraker 2020-12-10 12:35:44 -05:00
Jordan Ruthe 9f4204b898 job_status: update Z value to gcode value 2020-12-09 13:25:01 -05:00
Jordan Ruthe 5682eb5616 fix job status panel not updating filename after one print 2020-12-08 23:48:48 -05:00
Jordan Ruthe 47d08f5385 job_status: line wrapping for filenames with no spaces 2020-12-08 23:38:38 -05:00
Jordan Ruthe ecc4c5ac4c readme: Include more links/info 2020-12-08 23:35:45 -05:00
Jordan Ruthe f343f03b96 job_status: Refactored layout in panel 2020-12-08 23:32:27 -05:00
Jordan Ruthe 36c9b42970 splash_screen: Update klipper logo to scale for lower resolutions 2020-12-08 20:28:15 -05:00
Jordan Ruthe 5408aec036 screen: fix broken function call 2020-12-07 15:53:50 -05:00
Jordan Ruthe 7471cd39b9 style: fix color on progress bar 2020-12-07 15:46:50 -05:00
jordanruthe 238badb110 UI scaling (#28)
* Initial UI scaling commit

* temperature: updates to styling

* screen: fix dialog creation

* bed_level: scale images

* job_status: updates to scaling
2020-12-07 15:44:03 -05:00
Jordan Ruthe ea465b0f4d bed_level: fix math error 2020-12-06 21:23:16 -05:00
Jordan Ruthe fb0a0557c5 docs: Updates to bed_level panel 2020-12-06 21:04:09 -05:00
Jordan Ruthe e6b71d5478 screen: fixes to popup message 2020-12-06 21:03:32 -05:00
Jordan Ruthe a18eb42399 screen: init GTK earlier 2020-12-06 16:09:27 -05:00
Jordan Ruthe 9047f58c60 bed_level: change so only screws_tilt_adjust section will take into account the probe offset 2020-12-06 16:06:34 -05:00
Jordan Ruthe 1c384144c4 files: load metadata faster than 6 seconds after start 2020-12-06 15:30:55 -05:00
Jordan Ruthe 348a9e3e42 screen: move version ahead of config output in logfile 2020-12-06 15:30:37 -05:00
Jordan Ruthe 4736ed4d84 bed_level: updates to screws_tilt_calculate feature 2020-12-05 17:09:29 -05:00
Jordan Ruthe 0907c6a06a move: Allow inverting of the axis 2020-12-05 15:42:34 -05:00
Jordan Ruthe cf3a924bb2 screen: Set buttons under message bar to not be sensitive when covered 2020-12-05 14:14:02 -05:00
Jordan Ruthe d61db5fb17 files: Changes to metadata request to fix getting stuck in a loop 2020-12-05 13:50:15 -05:00
Jordan Ruthe 3ad44d9ecf configuration: update icons for homing 2020-12-05 13:46:17 -05:00
Jordan Ruthe cb39b469b0 bed_level: include screws_tilt_calculate command 2020-12-04 19:41:45 -05:00
Jordan Ruthe 5ad29f0183 screen: popup error messages 2020-12-04 19:11:16 -05:00
Jordan Ruthe a2f178c7e0 extrude: fix not showing temperatures 2020-12-04 18:28:49 -05:00
Jordan Ruthe 7efb0fddf0 fan: Remove user select buttons if fan on/off is hit while selecting 2020-12-04 14:26:08 -05:00
Jordan Ruthe 46410f797a fine_tune: Remove fan from fine tune panel. Add fan to print menu 2020-12-04 14:20:31 -05:00
Jordan Ruthe c7496973ee docs: Update with latest changes 2020-12-04 14:13:41 -05:00
Jordan Ruthe 2d29eef255 configuration: hide extrude while printing 2020-12-04 14:13:10 -05:00
Jordan Ruthe 3e11fad1fd bed_mesh: Add panel for bed_mesh 2020-12-04 14:13:03 -05:00
Jordan Ruthe a724836378 fine_tune: remove unused code 2020-12-04 14:04:09 -05:00
Jordan Ruthe 25b89cb7e9 menu: refactor adding items to menu so they can be dynamically added/rmeoved. 2020-12-04 14:03:14 -05:00
Jordan Ruthe b37ba531f7 screen: add popup message capability 2020-12-04 14:02:06 -05:00
Jordan Ruthe 58b6325776 screen: cleanup unused code 2020-12-04 14:01:50 -05:00
Jordan Ruthe 5cfed7f477 install: enable systemd 2020-12-03 20:22:17 -05:00
Jordan Ruthe 369fc24e16 screen: include "error" for state calculation 2020-12-03 13:40:25 -05:00
Jordan Ruthe a099151693 job_status: Fix problem with cancel print not working 2020-12-03 09:46:45 -05:00
Jordan Ruthe c182cc21f2 z_calibrate: uncomment probe commands 2020-12-02 19:22:04 -05:00
Jordan Ruthe 16f7d4543a job_status: Update confirm dialog. Fix variable name 2020-12-02 16:33:04 -05:00
Jordan Ruthe 3a4c556f25 fan: reset value to current fan value after cancel 2020-12-02 14:42:00 -05:00
Jordan Ruthe 67e04248c3 files: Fix error with metadata being perpetually requested 2020-12-02 14:35:48 -05:00
Jordan Ruthe 08a7057668 Change panel layout. Add title and move back button 2020-12-02 14:35:28 -05:00
Jordan Ruthe 6d71022dbf KlipperScreen.conf: fix move icon 2020-12-01 18:46:51 -05:00
Jordan Ruthe 972c869e62 Fix requirements 2020-12-01 18:43:38 -05:00
jordanruthe c36aa4b430 screen: fix case for no power devices 2020-11-29 10:44:07 -05:00
jordanruthe 90950101d8 install: Update script to get the current username 2020-11-29 10:28:48 -05:00
Jordan Ruthe 67d61d164c system: add klipper version 2020-11-28 14:25:47 -05:00
Jordan Ruthe cc59ec68d0 Add power panel 2020-11-28 14:00:26 -05:00
Jordan Ruthe 48c276d22f menu: add ability for enable to hide certain menus 2020-11-28 13:57:51 -05:00
Jordan Ruthe 728f9cfa0f screen/panels: add action to process update 2020-11-28 13:52:03 -05:00
Jordan Ruthe 1c0e4fbf86 menu: remove unnecessary logging 2020-11-28 10:33:12 -05:00
Jordan Ruthe f7484c3df5 screen: fix errors 2020-11-28 10:32:48 -05:00
Jordan Ruthe b70e84a7ee example: update to including logging 2020-11-28 10:31:06 -05:00
Jordan 16c2c64904 screen: remove unnecessary includes 2020-11-24 04:35:47 +00:00
Jordan Ruthe 70c93ee878 panels.md: Update to include all panels 2020-11-23 21:24:55 -05:00
Jordan Ruthe 1b7146c8ec zcalibrate: Add emergency stop button 2020-11-23 21:15:51 -05:00
Jordan Ruthe ac2e9de2d4 Merge branch 'dynamic_panels' 2020-11-23 21:01:31 -05:00
Jordan Ruthe 8204e3ab17 Dynamically load panels 2020-11-23 21:00:04 -05:00
Jordan Ruthe f0f4581241 Documentation updates 2020-11-22 19:41:29 -05:00
Jordan Ruthe d5fc92c1af zcalibrate: Have accept go back to the menu 2020-11-22 19:30:34 -05:00
Jordan Ruthe 906da8550e Documentation updates 2020-11-22 19:29:55 -05:00
Jordan Ruthe 2f25ef2040 Documentation updates 2020-11-22 19:27:03 -05:00
jordanruthe 3b62439939 Move files to ks_includes and update references 2020-11-18 17:15:05 -05:00
Jordan Ruthe 557dd86364 Fix CR line end problem 2020-11-18 10:46:57 -05:00
dependabot[bot] aeea57bd2f Bump requests from 2.24.0 to 2.25.0 (#10)
Bumps [requests](https://github.com/psf/requests) from 2.24.0 to 2.25.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/master/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.24.0...v2.25.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-18 09:54:34 -05:00
Jordan 186c8026cf Remove extra file 2020-11-18 14:41:24 +00:00
Jordan Ruthe 7db6a541f2 all: Update to enable language files 2020-11-18 07:49:12 -05:00
Jordan Ruthe 2341642cc2 bed_level: clean comment 2020-11-18 06:08:28 -05:00
Jordan Ruthe 2ffe6809fd bed_level: Fix incorrectly assigned variable 2020-11-18 06:05:06 -05:00
Jordan Ruthe 2626899d53 zcalibrate: Check for homed axes 2020-11-18 05:56:09 -05:00
Jordan Ruthe 6e8f904983 Update configuration for Save Config button 2020-11-18 05:55:45 -05:00
Jordan Ruthe cc5b87eefe Remove old configuration file 2020-11-18 05:41:54 -05:00
vacapetrandjordanruthe 85a2ba116c Adjust fine tune panel for lower resolution (#16)
* Update print.py

* Update KlipperScreen.config

adding the HOME XY button

* Update KlipperScreen.config

* adjust the display for a lower resolution/800x480/

string shortening / long string caused the display to shift at a lower resolution. (panel job_status )

* adjust the display for a lower resolution/800x480/

string shortening / long string caused the display to shift at a lower resolution. (panel fine_tune )

Co-authored-by: jordanruthe <31575189+jordanruthe@users.noreply.github.com>
2020-11-18 04:36:28 -05:00
Jordan Ruthe c2be717fa9 Move support files to ks_includes folder.
Fix job_status panel submenu
2020-11-17 00:03:02 -05:00
Jordan Ruthe c57760d857 Merge branch 'configfile' 2020-11-16 23:57:08 -05:00
Jordan Ruthe 891539c5ff Change configuration to configparser for more flexibility. 2020-11-16 23:51:15 -05:00
Jordan Ruthe 87d346e541 Stability updates for websocket and printer shutdown 2020-11-16 18:18:11 -05:00
Jordan Ruthe f223f74f7f Better error handling of loading panels. 2020-11-16 14:38:24 -05:00
Jordan Ruthe df5ac88f84 Add KlipperScreen version to system panel 2020-11-16 00:22:35 -05:00
Jordan Ruthe 8733292dc3 Fixing key not found error 2020-11-16 00:17:51 -05:00
Jordan Ruthe 8df55012d7 Logging updates, includes version number.
Fix gcode_moves not being queried on opening
2020-11-16 00:17:32 -05:00
Jordan Ruthe 18a55fab2e Fix installation script 2020-11-15 14:14:05 -05:00
vacapetr ca9960871d Vacapetr patch 1 (#14)
* adjust the display for a lower resolution/800x480/

string shortening / long string caused the display to shift at a lower resolution. (panel job_status )
2020-11-14 17:16:03 -05:00
dependabot[bot] 127237fd76 Bump humanize from 2.5.0 to 3.1.0 (#9)
* Bump humanize from 2.5.0 to 3.1.0

Bumps [humanize](https://github.com/jmoiron/humanize) from 2.5.0 to 3.1.0.
- [Release notes](https://github.com/jmoiron/humanize/releases)
- [Commits](https://github.com/jmoiron/humanize/compare/2.5.0...3.1.0)

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

* Create update-python-venv.sh

Create update virtual-env script
2020-11-14 13:14:24 -05:00
vacapetr ca9f869ac3 Add HOME XY button and change in print.py for lower resolution (#13)
* Update KlipperScreen.config

adding the HOME XY button
2020-11-14 13:01:19 -05:00
Jordan Ruthe d29c0ab063 Documentation updates 2020-11-14 11:28:52 -05:00
Jordan Ruthe 33beb60af9 Update print panel to handle different resolutions better 2020-11-14 11:25:08 -05:00
Jordan Ruthe 29f78bda5e Change line wrap mode to char for longer filenames 2020-11-14 10:54:37 -05:00
Jordan Ruthe 1a8e6dd250 Merge branch 'master' of https://github.com/jordanruthe/KlipperScreen 2020-11-14 10:17:30 -05:00
Jordan Ruthe 12c0e9f5b1 Fix extruder gcode command 2020-11-14 10:17:12 -05:00
Jordan Ruthe 952d46da24 Highlight all heaters by default on preheat panel 2020-11-14 10:14:36 -05:00
Jordan Ruthe 929efa8e41 Fix problem with ZCalibrate panel 2020-11-14 10:09:15 -05:00
jordanruthe fb840f2404 Merge pull request #12 from vacapetr/patch-1
Update extrude.py
2020-11-14 09:58:14 -05:00
vacapetr 19e0ff5028 Update extrude.py 2020-11-14 09:38:47 +01:00
75 changed files with 6826 additions and 2502 deletions

No files matched your search

-147
View File
@@ -1,147 +0,0 @@
{
"preheat_options": {
"PLA": {
"tool": 195,
"bed": 40
},
"ABS":{
"tool": 220,
"bed": 90
}
},
"mainmenu": [
{
"name": "Homing",
"icon": "home",
"panel": "menu",
"items": [
{
"name": "Home All",
"icon": "home",
"method": "printer.gcode.script",
"params": {"script": "G28"}
},
{
"name": "Home X",
"icon": "home-x",
"method": "printer.gcode.script",
"params": {"script": "G28 X"}
},
{
"name": "Home Y",
"icon": "home-y",
"method": "printer.gcode.script",
"params": {"script": "G28 Y"}
},
{
"name": "Home Z",
"icon": "home-z",
"method": "printer.gcode.script",
"params": {"script": "G28 Z"}
}
]
},
{
"name": "Preheat",
"icon": "heat-up",
"panel": "preheat"
},
{
"name": "Actions" ,
"icon": "actions",
"panel": "menu",
"items": [
{
"name": "Move",
"icon": "move",
"panel": "move"
},
{
"name": "Extrude",
"icon": "filament",
"panel": "extrude"
},
{
"name": "Fan",
"icon": "fan",
"panel": "fan"
},
{
"name": "Temperature",
"icon": "heat-up",
"panel": "temperature"
},
{
"name": "Disable Motors",
"icon": "motor-off",
"method": "printer.gcode.script",
"params": {"script": "M18"},
"command": {
"method": "printer.gcode.script",
"params": {"script": "M18"}
}
}
]
},
{
"name": "Configuration",
"icon": "control",
"panel": "menu",
"items": [
{
"name": "Bed Level",
"icon": "bed-level",
"panel": "bed_level"
},
{
"name": "ZOffsets",
"icon": "z-offset-increase",
"panel": "zcalibrate"
},
{
"name": "Network",
"icon": "network",
"panel": "network"
},
{
"name": "System",
"icon": "info",
"panel": "system"
}
]
},
{
"name": "Print",
"icon": "print",
"panel": "print"
}
],
"printmenu": [
{
"name": "Temperature",
"icon": "heat-up",
"panel": "temperature"
},
{
"name": "Tuning",
"icon": "fan",
"panel": "finetune"
},
{
"name": "Network",
"icon": "network",
"panel": "network"
},
{
"name": "System",
"icon": "info",
"panel": "system"
},
{
"name": "Extrude",
"icon": "filament",
"panel": "extrude"
}
]
}
-209
View File
@@ -1,209 +0,0 @@
# -*- coding: utf-8 -*-
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GdkPixbuf, GLib
import os
klipperscreendir = os.getcwd()
class KlippyGtk:
labels = {}
@staticmethod
def Label(label, style):
l = Gtk.Label(label)
if style != False:
l.get_style_context().add_class(style)
return l
@staticmethod
def ImageLabel(image_name, text, size=20, style=False):
box1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=15)
image = Gtk.Image()
#TODO: update file reference
image.set_from_file(klipperscreendir + "/styles/z-bolt/images/" + str(image_name) + ".svg")
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(klipperscreendir + "/styles/z-bolt/images/" + str(image_name) + ".svg", 20, 20, True)
image.set_from_pixbuf(pixbuf)
label = Gtk.Label()
label.set_text(text)
box1.add(image) #, size, size)
box1.add(label)
if style != False:
ctx = box1.get_style_context()
ctx.add_class(style)
return {"l": label, "b": box1}
@staticmethod
def Image(image_name, style=False, width=None, height=None):
pixbuf = GdkPixbuf.Pixbuf.new_from_file(klipperscreendir + "/styles/z-bolt/images/" + str(image_name) + ".svg")
if height != None and width != None:
pixbuf = pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.BILINEAR)
return Gtk.Image.new_from_pixbuf(pixbuf)
@staticmethod
def ImageFromFile(filename, style=False, width=None, height=None):
if height != -1 or width != -1:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename, width, height, True)
else:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename)
return Gtk.Image.new_from_pixbuf(pixbuf)
@staticmethod
def PixbufFromFile(filename, style=False, width=None, height=None):
if height != -1 or width != -1:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename, width, height, True)
else:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(filename)
return pixbuf
@staticmethod
def ProgressBar(style=False):
bar = Gtk.ProgressBar()
if style != False:
ctx = bar.get_style_context()
ctx.add_class(style)
return bar
@staticmethod
def Button(label=None, style=None):
b = Gtk.Button(label=label)
b.set_hexpand(True)
b.set_vexpand(True)
b.set_can_focus(False)
b.props.relief = Gtk.ReliefStyle.NONE
if style != None:
b.get_style_context().add_class(style)
return b
@staticmethod
def ButtonImage(image_name, label=None, style=None, height=None, width=None):
pixbuf = GdkPixbuf.Pixbuf.new_from_file(klipperscreendir + "/styles/z-bolt/images/" + str(image_name) + ".svg")
if height != None and width != None:
pixbuf = pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.BILINEAR)
img = Gtk.Image.new_from_pixbuf(pixbuf)
b = Gtk.Button(label=label)
b.set_image(img)
b.set_hexpand(True)
b.set_vexpand(True)
b.set_can_focus(False)
b.set_image_position(Gtk.PositionType.TOP)
b.set_always_show_image(True)
b.props.relief = Gtk.ReliefStyle.NONE
if style != None:
b.get_style_context().add_class(style)
return b
@staticmethod
def ConfirmDialog(screen, text, buttons, callback=None, *args):
dialog = Gtk.Dialog()
#TODO: Factor other resolutions in
dialog.set_default_size(984, 580)
dialog.set_resizable(False)
dialog.set_transient_for(screen)
dialog.set_modal(True)
for button in buttons:
dialog.add_button(button_text=button['name'], response_id=button['response'])
dialog.connect("response", callback, *args)
dialog.get_style_context().add_class("dialog")
content_area = dialog.get_content_area()
content_area.set_margin_start(15)
content_area.set_margin_end(15)
content_area.set_margin_top(15)
content_area.set_margin_bottom(15)
label = Gtk.Label()
label.set_line_wrap(True)
label.set_size_request(800, -1)
label.set_markup(text)
label.get_style_context().add_class("text")
table = Gtk.Table(1, 1, False)
table.attach(label, 0, 1, 0, 1, Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
table.set_vexpand(True)
table.set_halign(Gtk.Align.CENTER)
table.set_valign(Gtk.Align.CENTER)
content_area.add(table)
dialog.show_all()
return dialog
@staticmethod
def ToggleButtonImage(image_name, label, style=False):
img = Gtk.Image.new_from_file(klipperscreendir + "/styles/z-bolt/images/" + str(image_name) + ".svg")
b = Gtk.ToggleButton(label=label)
#b.props.relief = Gtk.RELIEF_NONE
b.set_image(img)
b.set_hexpand(True)
b.set_vexpand(True)
b.set_can_focus(False)
b.set_image_position(Gtk.PositionType.TOP)
b.set_always_show_image(True)
b.props.relief = Gtk.ReliefStyle.NONE
if style != False:
ctx = b.get_style_context()
ctx.add_class(style)
return b
@staticmethod
def HomogeneousGrid():
g = Gtk.Grid()
g.set_row_homogeneous(True)
g.set_column_homogeneous(True)
return g
@staticmethod
def ToggleButton(text):
b = Gtk.ToggleButton(text)
b.props.relief = Gtk.ReliefStyle.NONE
b.set_hexpand(True)
b.set_vexpand(True)
return b
@staticmethod
def formatFileName(name):
name = name.split('/')[-1] if "/" in name else name
name = name.split('.gcod')[0] if ".gcode" in name else name
if len(name) > 25:
return name[0:25] + "\n" + name[25:50]
return name
@staticmethod
def formatTimeString(seconds):
time = int(seconds)
text = ""
if int(time/3600) !=0:
text += str(int(time/3600))+"h "
text += str(int(time/60)%60)+"m "+str(time%60)+"s"
return text
@staticmethod
def formatTemperatureString(temp, target):
if (target > temp-2 and target < temp+2) or round(target,0) == 0:
return str(round(temp,2)) + "°C" #°C →"
return str(round(temp,2)) + "°C → " + str(round(target,2)) + "°C"
-23
View File
@@ -1,23 +0,0 @@
import json
import requests
import logging
class KlippyRest:
def __init__(self, ip, port=7125):
self.ip = ip
self.port = port
def get_info(self):
return self.send_request("server/info")
def send_request(self, method):
r = requests.get("http://%s:%s/%s" % (self.ip, self.port, method))
if r.status_code != 200:
return False
#TODO: Try/except
data = json.loads(r.content)
return data
+20 -37
View File
@@ -1,5 +1,5 @@
# KlipperScreen
KlipperScreen is an idea based from [OctoScreen](https://github.com/Z-Bolt/OctoScreen/), but instead of needing OctoPrint or to compile go, KlipperScreen is python based and interacts directly with Moonraker, Klipper's API service, so that it can be run with no dependencies besides Klipper.
KlipperScreen is an idea based from [OctoScreen](https://github.com/Z-Bolt/OctoScreen/), but instead of needing OctoPrint or to compile go, KlipperScreen is python based and interacts directly with [Moonraker](https://github.com/arksine/moonraker), Klipper's API service.
Current feature list:
- [x] Homing
@@ -10,53 +10,36 @@ Current feature list:
- [x] Fan control
- [x] Disable steppers
- [x] Configure Z Offset using PROBE_CALIBRATE
- [ ] Print tuning (Z Babystepping, Speed Control, Flow Control)
- [x] Print tuning (Z Babystepping, Speed Control, Flow Control)
- [x] Manual bed leveling assist
- [x] Using thumbnails from prusa on job status page
- [x] Scale UI based off of resolution
- [ ] Better system panel
- [ ] Wifi selection
- [ ] Manual bed leveling assist
- [ ] Using thumbnails from prusa on job status page
- [ ] Scale UI based off of resolution
More details to come...
[Changelog](docs/changelog.md)
### Required Hardware
KlipperScreen should run on any HDMI touchscreen that you can connect to a raspberry pi. The required video driver may
be slightly different depending on what model you get. I am developing on a 1024x600 resolution screen. Due to this,
other resolutions may not be scaled properly at this moment. UI scaling is a future development item.
KlipperScreen should run on any touchscreen that you can connect to a computer. The required video driver may be
slightly different depending on what model you get. KlipperScreen will scale to the resolution of the screen being used.
However, three resolutions are tested during development: 1024x600, 800x480, 480x320.
#### Configure Hardware
There are no recommended screens, but there are several screens that work with KlipperScreen. They include screens that
use HDMI/USB, Raspberry Pi GPIO, or the Rapsberry Pi DSI (ribbon cable) port.
Add the following to _/boot/config.txt_. You can alter the hdmi_cvt to your screen specifications. This example is setup
for a resolution of 1024x600 and a refresh rate of 60hz.
```
hdmi_cvt=1024 600 60 6 0 0 0
hdmi_group=2
hdmi_mode=87
hdmi_drive=2
```
* Development has been using 1024x600 for a screen resolution. Other resolutions may have issues currently
### Links
After changing _/boot/config.txt_ you must reboot your raspberry pi. Please also ensure you followed setting up your screen via the screen instructions. This will likely have a xorg.conf.d file for input from the touchscreen that you need to create.
[Installation](docs/Installation.md)
### Installation
[Configuration](docs/Configuration.md)
Follow the instructions to install klipper and moonraker.
klipper: https://github.com/KevinOConnor/klipper/
moonraker: https://github.com/Arksine/moonraker
[Panels](docs/panels.md)
Ensure that 127.0.0.1 is a trusted client for moonraker, such as in this example:
```
[authorization]
trusted_clients:
127.0.0.1
```
For moonraker, ensure that 127.0.0.1 is a trusted client:
### Sample Panels
Run _scripts/KlipperScreen-install.sh_
This script will install packages that are listed under manual install, create a
python virtual environment at ${HOME}/.KlipperScreen-env and install a systemd
service file.
Main Menu
![Main Menu](docs/img/main_panel.png)
As an option to do development or interact with KlipperScreen from your computer, you may install tigervnc-scraping-server and VNC to your pi instance. Follow tigervnc server setup procedures for details on how to do that.
Job Status
![Job Status](docs/img/job_status.png)
+80 -186
View File
@@ -1,207 +1,101 @@
# Configuration
In the KlipperScreen folder, a file _KlipperScreen.config_ allows for configuration of the screen. The configuration
file is a json formatted file. There are three main options to configure.
KlipperScreen has some configuration options which are outlined below. KlipperScreen will search for a configuration
file in the following order:
_${HOME}/KlipperScreen.conf_
_${KlipperScreen_Directory}/KlipperScreen.conf_
If one of those files are found, it will be used over the default configuration. The default configuration will be
merged with the custom configuration, so if you do not define any menus the default menus will be used.The default
config is included here: [ks_includes/KlipperScreen.conf](../ks_includes/KlipperScreen.conf)
## Main Options
```
{
"preheat_options",
"mainmenu",
"printmenu"
}
[main]
# Define the moonraker host/port if different from 127.0.0.1 and 7125
moonraker_host: 127.0.0.1
moonraker_port: 7125
# Moonraker API key if this is not connecting from a trusted client IP
moonraker_api_key: False
# Invert axis in move panel. Default is False. Change to true to invert
invert_x: False
invert_y: False
invert_z: False
# Time (seconds) before the Job Status page reverts to main menu after a successful job
job_complete_timeout: 30
# Time (seconds) before the Job Status page reverts to main menu after a successful job.
# If this option is 0, the user must click on a button to go back to the main menu.
job_error_timeout: 0
```
## Preheat Options
Under preheat options, you may specify pre-defined temperatures for easy warmup. Each material should be formatted as
follows:
```
"Material": {
"tool": 195,
"bed": 40
}
```
Tool is the extruder temperature, bed is the heated bed temperature. An example configuration for PLA and abs would be
like this:
```
"preheat_options": {
"PLA": {
"tool": 195,
"bed": 40
},
"ABS":{
"tool": 220,
"bed": 90
}
}
[preheat my_temp_setting]
# Temperature for the heated bed
bed: 40
# Temperature for the tools
extruder: 195
```
## Main menu
## Menu
This allows a custom configuration for the menu displayed while the printer is idle. You can use sub-menus to group
different items and there are several panel options available. It is possible to have a gcode script run on a menu
button press.
Available panels:
* bed_level: Manual bed level
* extrude: Controls for extrusion
* fan: Controls fan speed
* finetune: Controls for fine-tuning print settings such as z-babystepping or extrustion rate
* menu: Allows for a sub-menu
* move: Controls the print head
* network: Network information panel
* preheat: Preheat bed/tools
* system: System information panel
* temperature: Controls temperature settings
* zcalibrate: Calibrating a probe
button press. There are two menus available in KlipperScreen, __main and __print. The __main menu is displayed while the
printer is idle. The __print menu is accessible from the printing status page.
A menu item is configured as follows:
```
{
"name": "Name displayed",
"icon": "file name from icons folder",
"panel": "panel from above options",
# Optional parameters
"items": [] # Items for a submenu
"method": "printer.gcode.script" # Moonraker method for a request
"params": {} # Parameters for the moonraker method
}
[menu __main my_menu_item]
# To build a sub-menu of this menu item, you would next use [menu __main my_menu_item sub_menu_item]
name: Item Name
icon: home
# Optional Parameters
# Panel from the panels listed below
panel: preheat
# Moonraker method to call when the item is selected
method: printer.gcode.script
# Parameters that would be passed with the method above
params: {"script":"G28 X"}
# Enable allows hiding of a menu if the condition is false. This statement is evaluated in Jinja2
# Available variables are listed below.
enable: {{ printer.power_devices.count > 0 }}
```
Available panels are listed here: [docs/panels.md](panels.md)
Certain variables are available for conditional testing of the enable statement:
```
printer.bltouch # Available if bltouch section defined in config
printer.gcode_macros.count # Number of gcode macros
printer.idle_timeout # Idle timeout section
printer.pause_resume # Pause resume section of Klipper
printer.probe # Available if probe section defined in config
printer.power_devices.count # Number of power devices configured in Moonraker
```
A sample configuration of a main menu would be as follows:
```
"mainmenu": [
{
"name": "Homing",
"icon": "home",
"panel": "menu",
"items": [
{
"name": "Home All",
"icon": "home",
"method": "printer.gcode.script",
"params": {"script": "G28"}
},
{
"name": "Home X",
"icon": "home-x",
"method": "printer.gcode.script",
"params": {"script": "G28 X"}
},
{
"name": "Home Y",
"icon": "home-y",
"method": "printer.gcode.script",
"params": {"script": "G28 Y"}
},
{
"name": "Home Z",
"icon": "home-z",
"method": "printer.gcode.script",
"params": {"script": "G28 Z"}
}
]
},
{
"name": "Preheat",
"icon": "heat-up",
"panel": "preheat"
},
{
"name": "Actions" ,
"icon": "actions",
"panel": "menu",
"items": [
{
"name": "Move",
"icon": "move",
"panel": "move"
},
{
"name": "Extrude",
"icon": "filament",
"panel": "extrude"
},
{
"name": "Fan",
"icon": "fan",
"panel": "fan"
},
{
"name": "Temperature",
"icon": "heat-up",
"panel": "temperature"
},
{
"name": "Disable Motors",
"icon": "motor-off",
"method": "printer.gcode.script",
"params": {"script": "M18"},
}
]
},
{
"name": "Configuration",
"icon": "control",
"panel": "menu",
"items": [
{
"name": "Bed Level",
"icon": "bed-level",
"panel": "bed_level"
},
{
"name": "ZOffsets",
"icon": "z-offset-increase",
"panel": "zcalibrate"
},
{
"name": "Network",
"icon": "network",
"panel": "network"
},
{
"name": "System",
"icon": "info",
"panel": "system"
}
]
},
{
"name": "Print",
"icon": "print",
"panel": "print"
}
]
```
[menu __main homing]
name: Homing
icon: home
## Print menu
The print menu controls items that are available during a print job. Certain panels, such as movement or homing, are
panels that shouldn't be displayed during a print as they could cause print errors. A default configuration is below:
[menu __main preheat]
name: Preheat
icon: heat-up
panel: preheat
```
"printmenu": [
{
"name": "Temperature",
"icon": "heat-up",
"panel": "temperature"
},
{
"name": "Tuning",
"icon": "fan",
"panel": "finetune"
},
{
"name": "Network",
"icon": "network",
"panel": "network"
},
{
"name": "System",
"icon": "info",
"panel": "system"
},
{
"name": "Extrude",
"icon": "filament",
"panel": "extrude"
}
]
[menu __main print]
name: Print
icon: print
panel: print
[menu __main homing homeall]
name: Home All
icon: home
method: printer.gcode.script
params: {"script":"G28"}
```
+43
View File
@@ -0,0 +1,43 @@
### Required Hardware
KlipperScreen should run on any HDMI touchscreen that you can connect to a computer. The required video driver may
be slightly different depending on what model you get. I am developing on a 1024x600 resolution screen. Due to this,
other resolutions may not be scaled properly at this moment. UI scaling is a future development item.
#### Configure Hardware
Add the following to _/boot/config.txt_. You can alter the hdmi_cvt to your screen specifications. This example is setup
for a resolution of 1024x600 and a refresh rate of 60hz.
```
hdmi_cvt=1024 600 60 6 0 0 0
hdmi_group=2
hdmi_mode=87
hdmi_drive=2
```
* Development has been using 1024x600 for a screen resolution. Other resolutions may have issues currently
After changing _/boot/config.txt_ you must reboot your raspberry pi. Please also ensure you followed setting up your screen via the screen instructions. This will likely have a xorg.conf.d file for input from the touchscreen that you need to create.
### Installation
Follow the instructions to install klipper and moonraker.
klipper: https://github.com/KevinOConnor/klipper/
moonraker: https://github.com/Arksine/moonraker
Ensure that 127.0.0.1 is a trusted client for moonraker, such as in this example:
```
[authorization]
trusted_clients:
127.0.0.1
```
For moonraker, ensure that 127.0.0.1 is a trusted client:
Run _scripts/KlipperScreen-install.sh_
This script will install packages that are listed under manual install, create a
python virtual environment at ${HOME}/.KlipperScreen-env and install a systemd
service file.
As an option to do development or interact with KlipperScreen from your computer, you may install tigervnc-scraping-server and VNC to your pi instance. Follow tigervnc server setup procedures for details on how to do that.
If you need a custom location for the configuration file, you can add -c or --configfile to the systemd file and specify
the location of your configuration file.
+19
View File
@@ -0,0 +1,19 @@
## Create Translations
You can use a editor such as [poedit](https://poedit.net/) to assist in translations. This guide will assume that you
will be using poedit.
This guide will refer to `language designation`. This can be found from running `echo $LANG` on your pi, as long as you
have set your pi up for your preferred language.
#### New Language
* Select `Create a new translation` or `File -> New from POT/PO` and select `ks_includes/locals/KlipperScreen.pot`.
* Enter your language designation.
* Create the translations
* Save the file as `ks_includes/locales/{LANGUAGE DESIGNATION}/KlipperScreen.po`.
* Select `File -> Compile to MO`. Save this file as `ks_includes/locales/{LANGUAGE DESIGNATION}/KlipperScreen.mo`
Once you have followed those steps, as long as your pi is set up for your preferred language, KlipperScreen will
automatically use the translations provided in the file. KlipperScreen currently does not detect RTL languages, but
support for RTL is planned in the near future.
+57
View File
@@ -1,4 +1,61 @@
## Changelog
#### 2021 01 03
* Updated base language translation files with new phrases
* Allow translations from KlipperScreen.conf for
* Update menus for RTL languages
* Add fr_FR and he_IL language (courtesy of manu7irl)
#### 2020 12 21
* KlipperScreen doesn't have to be a trusted client. It can use the Moonraker API key
* Updates to job_status for multiple extruders. Will now show the current extruder.
* Updates to extrude panel to show multiple extruders and allow switching between them.
#### 2020 12 18
* Add gcode_macros panel
#### 2020 12 16
* Config file can now be specified when running from the command line
* Moonraker host/port can be specified in the configuration file
#### 2020 12 09
* Z value in job status now reflects the gcode Z value. This allows people with ABL to have a better understanding of Z
#### 2020 12 08
* Screen Width/Height are now definable in the configuration file
* Changed job page to allow for more information, display thumbnail of STL
* Job page will now say a job is complete and timeout to the main menu (time changeable from the config)
* Job page will now stay on the job page if there is an error.
* Restart option is available upon a completed/failed job
#### 2020 12 05
* Added ability to invert Z axis in move panel
* Fixed problem with metadata being retreived constantly
#### 2020 12 04
* Removed fan options from fine tuning
* Add bed mesh panel
* Added more variables to the menu enable option
* Hide extrude panel during printing if the printer is not paused
* Add fan panel to print control menu
* Included screws_tilt_calculate gcode command into the bed level panel. This section must be configured in klipper.
#### 2020 12 02
* Change panel layout: Added Title, Back, Emergency Stop, and Home to panels.
#### 2020 11 28
* Add option for enable in menu for configuration. This can hide certain options
* Add Power panel to control power devices via moonraker
* Add klipper version to system panel
#### 2020 11 18
* Changed configuration file format.
* Moved default configuration file to an include folder.
* Added ability to do a confirm dialog from a menu item when running a script
* Added "Save Config" button to default configuration's Configuration menu.
#### 2020 11 14
* Update print panel to include line wrapping for longer filenames
#### 2020 11 13
* Fine Tuning Panel is now fully functional: Z BabyStepping, Fan Speed, Speed Factor, and Extrusion Factor
Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

+79 -5
View File
@@ -2,14 +2,88 @@
### Index
* [Main menu](#main-menu)
* [Move](#move)
* [Preheat](#preheat)
* [Job Status](#job-status)
* [bed_level](#bed-level)
* [extrude](#extrude)
* [fan](#fan)
* [fine_tune](#finetune)
* [gcode_macros](#gcode-macros)
* [move](#move)
* [network](#network)
* [preheat](#preheat)
* [print](#print)
* [system](#system)
* [temperature](#temperature)
* [zcalibrate](#zcalibrate)
### Main Menu
![Main Menu](/docs/img/main_panel.png)
![Main Menu](img/main_panel.png)
### Job Status
![Job Status](img/job_status.png)
### Bed Level
type: bed_level
![Bed Level](img/bedlevel.png)
The bed level panel has the ability to have preset locations from Klipper. Please see documentation on the following
Klipper Sections:
* [bed_screws](https://github.com/KevinOConnor/klipper/blob/master/docs/Config_Reference.md#bed_screws)
* [screws_tilt_adjust](https://github.com/KevinOConnor/klipper/blob/master/docs/Config_Reference.md#screws_tilt_adjust)
_Important Note: Due to Klipper using the bltouch/probe offsets in screws_tilt_adjust, if a bltouch/probe is enabled_
_KlipperScreen will add the offset to the defined screw values. This will not occur if bed_screws section is used._
This panel will favor screws_tilt_adjust over the bed_screws section. If screws_tilt_adjust is defined, an extra button
for _Screws Calibrate_ will appear. This button runs the SCREWS_TILT_CALCULATE command and shows the results on the
panel.
### Extrude
type: extrude
![Extrude](img/extrude.png)
### Fan
type: fan
![Fan](img/fan.png)
### Fine Tune
type: fine_tune
![Fine Tune Panel](img/fine_tune.png)
### Gcode Macros
type: gcode_macros
![Gcode Macros Panel](img/gcode_macros.png)
### Menu
type: menu
![Menu Panel](img/menu.png)
### Move
![Move Panel](/docs/img/move.png)
type: move
![Move Panel](img/move.png)
### Network
type: network
![Network Panel](img/network.png)
### Preheat
![Preheat Panel](/docs/img/preheat.png)
type: preheat
![Preheat Panel](img/preheat.png)
### Print
type: print
![Print Panel](img/print.png)
### System
type: system
![System Panel](img/system.png)
### Temperature
type: temperature
![Temperature](img/temperature.png)
### Z Calibrate
type: zcalibrate
![Z Calibrate](img/zcalibrate.png)
+180
View File
@@ -0,0 +1,180 @@
[main]
moonraker_host: 127.0.0.1
moonraker_port: 7125
[preheat PLA]
bed = 40
extruder = 195
[preheat ABS]
bed = 90
extruder = 220
[menu __main]
name: {{ gettext('Main Menu') }}
[menu __main homing]
name: {{ gettext('Homing') }}
icon: home
[menu __main preheat]
name: {{ gettext('Preheat') }}
icon: heat-up
panel: preheat
[menu __main actions]
name: {{ gettext('Actions') }}
icon: actions
[menu __main config]
name: {{ gettext('Configuration') }}
icon: control
[menu __main print]
name: {{ gettext('Print') }}
icon: print
panel: print
[menu __main homing homeall]
name: {{ gettext('Home All') }}
icon: home
method: printer.gcode.script
params: {"script":"G28"}
[menu __main homing homex]
name: {{ gettext('Home X') }}
icon: home-x
method: printer.gcode.script
params: {"script":"G28 X"}
[menu __main homing homey]
name: {{ gettext('Home Y') }}
icon: home-y
method: printer.gcode.script
params: {"script":"G28 Y"}
[menu __main homing homez]
name: {{ gettext('Home Z') }}
icon: home-z
method: printer.gcode.script
params: {"script":"G28 Z"}
[menu __main homing homexy]
name: {{ gettext('Home XY') }}
icon: home
method: printer.gcode.script
params: {"script":"G28 X Y"}
[menu __main actions move]
name: {{ gettext('Move') }}
icon: move
panel: move
[menu __main actions extrude]
name: {{ gettext('Extrude') }}
icon: filament
panel: extrude
[menu __main actions fan]
name: {{ gettext('Fan') }}
icon: fan
panel: fan
[menu __main actions temperature]
name: {{ gettext('Temperature') }}
icon: heat-up
panel: temperature
[menu __main actions macros]
name: {{ gettext('Macros') }}
icon: custom-script
panel: gcode_macros
enable: {{ printer.gcode_macros.count > 0 }}
[menu __main actions power]
name: {{ gettext('Power') }}
icon: shutdown
panel: power
enable: {{ printer.power_devices.count > 0 }}
[menu __main actions disablemotors]
name: {{ gettext('Disable Motors') }}
icon: motor-off
method: printer.gcode.script
params: {"script":"M18"}
[menu __main config bedlevel]
name: {{ gettext('Bed Level') }}
icon: bed-level
panel: bed_level
[menu __main config bedmesh]
name: {{ gettext('Bed Mesh') }}
icon: bed-level
panel: bed_mesh
enable: {{ printer.bed_mesh is defined }}
[menu __main config zoffset]
name: {{ gettext('Z Calibrate') }}
icon: z-offset-increase
panel: zcalibrate
enable: {{ ((printer.bltouch is defined) or (printer.probe is defined)) }}
[menu __main config network]
name: {{ gettext('Network') }}
icon: network
panel: network
[menu __main config system]
name: {{ gettext('System') }}
icon: info
panel: system
[menu __main config save]
name: {{ gettext('Save Config') }}
icon: complete
method: printer.gcode.script
params: {"script":"SAVE_CONFIG"}
confirm:
{{ gettext('Save configuration.') }}
{{ gettext('Klipper will reboot') }}
[menu __main config settings]
name: {{ gettext('Settings') }}
icon: settings
panel: settings
[menu __print]
name: {{ gettext('Print Control') }}
[menu __print temperature]
name: {{ gettext('Temperature') }}
icon: heat-up
panel: temperature
[menu __print tuning]
name: {{ gettext('Fine Tuning') }}
icon: fan
panel: fine_tune
[menu __print fan]
name: {{ gettext('Fan') }}
icon: fan
panel: fan
[menu __print extrude]
name: {{ gettext('Extrude') }}
icon: filament
panel: extrude
enable: {{ printer.pause_resume.is_paused == True }}
[menu __print network]
name: {{ gettext('Network') }}
icon: network
panel: network
[menu __print system]
name: {{ gettext('System') }}
icon: info
panel: system
@@ -34,16 +34,16 @@ class KlippyGcodes:
@staticmethod
def set_bed_temp(temp):
return KlippyGcodes.SET_BED_TEMP + " S" + str(temp)
return "%s S%s" % (KlippyGcodes.SET_BED_TEMP, str(temp))
@staticmethod
def set_ext_temp(temp, tool=0):
return KlippyGcodes.SET_EXT_TEMP + " T" + str(tool) + " S" + str(temp)
return "%s T%s S%s" % (KlippyGcodes.SET_EXT_TEMP, str(tool), str(temp))
@staticmethod
def set_fan_speed(speed):
speed = str( int(float(int(speed) % 101)/100*255) )
return KlippyGcodes.SET_FAN_SPEED + " S"+ speed
return "%s S%s" % (KlippyGcodes.SET_FAN_SPEED, speed)
@staticmethod
def set_extrusion_rate(rate):
@@ -59,4 +59,12 @@ class KlippyGcodes:
@staticmethod
def extrude(dist, speed=500):
return KlippyGcodes.MOVE + " E" + dist + " F" + speed
return "%s E%s F%s" % (KlippyGcodes.MOVE, dist, speed)
@staticmethod
def bed_mesh_load(profile):
return "BED_MESH_PROFILE LOAD=%s" % profile
@staticmethod
def bed_mesh_save(profile):
return "BED_MESH_PROFILE SAVE=%s" % profile
+229
View File
@@ -0,0 +1,229 @@
# -*- coding: utf-8 -*-
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GdkPixbuf, GLib
import os
klipperscreendir = os.getcwd()
logger = logging.getLogger("KlipperScreen.KlippyGtk")
class KlippyGtk:
labels = {}
font_ratio = 51
width_ratio = 16
height_ratio = 9.375
def __init__(self, width, height):
self.width = width
self.height = height
self.font_size = int(round(self.width / self.font_ratio))
self.header_size = int(round((self.width / self.width_ratio) / 1.33))
self.img_width = int(round(self.width / self.width_ratio))
self.img_height = int(round(self.height / self.height_ratio))
self.header_image_scale_width = .625
self.header_image_scale_height = .625
logger.debug("img width: %s height: %s" % (self.img_width, self.img_height))
def get_header_size(self):
return self.header_size
def get_header_image_scale(self):
return [self.header_image_scale_width, self.header_image_scale_height]
def get_image_width(self):
return self.img_width
def get_image_height(self):
return self.img_height
def get_font_size(self):
return self.font_size
def Label(self, label, style):
l = Gtk.Label(label)
if style != False:
l.get_style_context().add_class(style)
return l
def ImageLabel(self, image_name, text, size=20, style=False, width_scale=.32, height_scale=.32):
box1 = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=15)
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
"%s/styles/z-bolt/images/%s.svg" % (klipperscreendir, str(image_name)),
int(round(self.img_width * width_scale)), int(round(self.img_height * height_scale)), True)
image = Gtk.Image.new_from_pixbuf(pixbuf)
label = Gtk.Label()
label.set_text(text)
box1.add(image)
box1.add(label)
if style != False:
ctx = box1.get_style_context()
ctx.add_class(style)
return {"l": label, "b": box1}
def Image(self, image_name, style=False, width_scale=1, height_scale=1):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
"%s/styles/z-bolt/images/%s" % (klipperscreendir, str(image_name)),
int(round(self.img_width * width_scale)), int(round(self.img_height * height_scale)), True)
return Gtk.Image.new_from_pixbuf(pixbuf)
def ImageFromFile(self, filename, style=False, width_scale=1, height_scale=1):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename,
int(round(self.img_width * width_scale)), int(round(self.img_height * height_scale)), True)
return Gtk.Image.new_from_pixbuf(pixbuf)
def PixbufFromFile(self, filename, style=False, width_scale=1, height_scale=1):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(filename, int(round(self.img_width * width_scale)),
int(round(self.img_height * height_scale)), True)
return pixbuf
def ProgressBar(self, style=False):
bar = Gtk.ProgressBar()
if style != False:
ctx = bar.get_style_context()
ctx.add_class(style)
return bar
def Button(self, label=None, style=None):
b = Gtk.Button(label=label)
b.set_hexpand(True)
b.set_vexpand(True)
b.set_can_focus(False)
b.props.relief = Gtk.ReliefStyle.NONE
if style != None:
b.get_style_context().add_class(style)
return b
def ButtonImage(self, image_name, label=None, style=None, width_scale=1, height_scale=1):
filename = "%s/styles/z-bolt/images/%s.svg" % (klipperscreendir, str(image_name))
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
filename,
int(round(self.img_width * width_scale)),
int(round(self.img_height * height_scale)),
True
)
img = Gtk.Image.new_from_pixbuf(pixbuf)
b = Gtk.Button(label=label)
b.set_image(img)
b.set_hexpand(True)
b.set_vexpand(True)
b.set_can_focus(False)
b.set_image_position(Gtk.PositionType.TOP)
b.set_always_show_image(True)
b.props.relief = Gtk.ReliefStyle.NONE
if style != None:
b.get_style_context().add_class(style)
return b
def Dialog(self, screen, buttons, content, callback=None, *args):
dialog = Gtk.Dialog()
dialog.set_default_size(screen.width - 15, screen.height - 15)
dialog.set_resizable(False)
dialog.set_transient_for(screen)
dialog.set_modal(True)
for button in buttons:
dialog.add_button(button_text=button['name'], response_id=button['response'])
dialog.connect("response", callback, *args)
dialog.get_style_context().add_class("dialog")
grid = Gtk.Grid()
grid.set_size_request(screen.width - 60, -1)
grid.set_vexpand(True)
grid.set_halign(Gtk.Align.CENTER)
grid.set_valign(Gtk.Align.CENTER)
grid.add(content)
content_area = dialog.get_content_area()
content_area.set_margin_start(15)
content_area.set_margin_end(15)
content_area.set_margin_top(15)
content_area.set_margin_bottom(15)
content_area.add(grid)
dialog.show_all()
return dialog, grid
def ToggleButtonImage(self, image_name, label, style=False, width_scale=1, height_scale=1):
filename = "%s/styles/z-bolt/images/%s.svg" % (klipperscreendir, str(image_name))
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
filename,
int(round(self.img_width * width_scale)),
int(round(self.img_height * height_scale)),
True
)
img = Gtk.Image.new_from_pixbuf(pixbuf)
b = Gtk.ToggleButton(label=label)
#b.props.relief = Gtk.RELIEF_NONE
b.set_image(img)
b.set_hexpand(True)
b.set_vexpand(True)
b.set_can_focus(False)
b.set_image_position(Gtk.PositionType.TOP)
b.set_always_show_image(True)
b.props.relief = Gtk.ReliefStyle.NONE
if style != False:
ctx = b.get_style_context()
ctx.add_class(style)
return b
def HomogeneousGrid(self, width=None, height=None):
g = Gtk.Grid()
g.set_row_homogeneous(True)
g.set_column_homogeneous(True)
if width != None and height != None:
g.set_size_request(width, height)
return g
def ToggleButton(self, text):
b = Gtk.ToggleButton(text)
b.props.relief = Gtk.ReliefStyle.NONE
b.set_hexpand(True)
b.set_vexpand(True)
return b
def formatFileName(self, name):
name = name.split('/')[-1] if "/" in name else name
name = name.split('.gcod')[0] if ".gcode" in name else name
if len(name) > 25:
return name[0:25] + "\n" + name[25:50]
return name
def formatTimeString(self, seconds):
time = int(seconds)
text = ""
if int(time/3600) !=0:
text += str(int(time/3600))+"h "
text += str(int(time/60)%60)+"m "+str(time%60)+"s"
return text
def formatTemperatureString(self, temp, target):
if (target > temp-2 and target < temp+2) or round(target,0) == 0:
return str(round(temp,2)) + "°C" #°C →"
return str(round(temp)) + " → " + str(round(target)) + "°C"
+40
View File
@@ -0,0 +1,40 @@
import json
import requests
import logging
logger = logging.getLogger("KlipperScreen.KlippyRest")
class KlippyRest:
def __init__(self, ip, port=7125, api_key=False):
self.ip = ip
self.port = port
self.api_key = api_key
def get_server_info(self):
return self.send_request("server/info")
def get_oneshot_token(self):
r = self.send_request("access/oneshot_token")
if r == False:
return False
return r['result']
def get_printer_info(self):
return self.send_request("printer/info")
def send_request(self, method):
url = "http://%s:%s/%s" % (self.ip, self.port, method)
logger.debug("Sending request to %s" % url)
headers = {} if self.api_key == False else {"x-api-key":self.api_key}
r = requests.get(url, headers=headers)
if r.status_code != 200:
return False
#TODO: Try/except
try:
data = json.loads(r.content)
except:
logger.exception("Unable to parse response from moonraker:\n %s" % r.content)
return False
return data
@@ -13,7 +13,7 @@ logger = logging.getLogger("KlipperScreen.KlipperWebsocket")
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGcodes import KlippyGcodes
from ks_includes.KlippyGcodes import KlippyGcodes
#f = open("/home/pi/.moonraker_api_key", "r")
api_key = "" #f.readline()
@@ -35,27 +35,29 @@ api = {
class KlippyWebsocket(threading.Thread):
_req_id = 0
connected = False
callback_table = {}
timeout = None
def __init__(self, screen, callback):
def __init__(self, screen, callback, host, port):
threading.Thread.__init__(self)
self._screen = screen
self._callback = callback
self.klippy = MoonrakerApi(self)
self._url = "127.0.0.1:7125"
self._url = "%s:%s" % (host, port)
def initial_connect(self):
# Enable a timeout so that way if moonraker is not running, it will attempt to reconnect
if self.timeout == None:
self.timeout = GLib.timeout_add(500, self.reconnect)
def connect (self):
r = requests.get(
"http://%s%s" % (self._url, api['oneshot_token']['url']),
headers={"x-api-key":api_key}
)
if r.status_code != 200:
logger.info("Failed to retrieve oneshot token")
return
try:
token = self._screen.apiclient.get_oneshot_token()
except:
logger.debug("Unable to get oneshot token")
return False
token = json.loads(r.content)['result']
self.ws_url = "ws://%s/websocket?token=%s" % (self._url, token)
self.ws = websocket.WebSocketApp(self.ws_url,
on_message = lambda ws,msg: self.on_message(ws, msg),
@@ -66,7 +68,10 @@ class KlippyWebsocket(threading.Thread):
self._wst = threading.Thread(target=self.ws.run_forever)
self._wst.daemon = True
self._wst.start()
try:
self._wst.start()
except Exception:
logger.debug("Error starting web socket")
def is_connected(self):
return self.connected
@@ -86,16 +91,19 @@ class KlippyWebsocket(threading.Thread):
self.callback_table.pop(response['id'])
return
if "method" in response:
if "method" in response and "on_message" in self._callback:
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._callback,
self._callback['on_message'],
response['method'],
response['params'][0] if "params" in response else {}
)
return
def send_method(self, method, params={}, callback=None, *args):
if self.is_connected() == False:
return False
self._req_id += 1
if callback != None:
self.callback_table[self._req_id] = [callback, method, params, [*args]]
@@ -107,42 +115,57 @@ class KlippyWebsocket(threading.Thread):
"id": self._req_id
}
self.ws.send(json.dumps(data))
return True
def on_open(self, ws):
logger.info("### ws open ###")
logger.info("Moonraker Websocket Open")
logger.info("Self.connected = %s" % self.is_connected())
self.connected = True
self.timeout = None
if "on_connect" in self._callback:
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._callback['on_connect']
)
def on_close(self, ws):
logger.info("### ws closed ###")
if self.is_connected() == False:
logger.debug("Connection already closed")
return
logger.info("Moonraker Websocket Closed")
self.connected = False
if self.timeout == None:
self.timeout = GLib.timeout_add(500, self.reconnect)
# TODO: Make non-blocking
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._screen.printer_initializing,
"Connecting to Moonraker..."
)
if "on_close" in self._callback:
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._callback['on_close'],
"Lost Connection to Moonraker"
)
while (True == True):
try:
info = self._screen.apiclient.get_info()
except Exception:
continue
if info != False:
self.connect()
if self.is_connected():
break
logger.info("### Waiting for websocket")
time.sleep(.5)
def reconnect(self):
logger.debug("Attempting to reconnect")
if self.is_connected():
logger.debug("Reconnected")
return False
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._screen.printer_ready
)
self.connect()
return True
def on_error(self, ws, error):
print(error)
logger.debug("Websocket error: %s" % error)
if error.status_code == 401:
# Check for any pending reconnects and remove. No amount of trying will help
if self.timeout != None:
GLib.source_remove(self.timeout)
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._callback['on_close'],
"Unable to authenticate with moonraker.\nCheck the API key"
)
class MoonrakerApi:
def __init__ (self, ws):
@@ -150,13 +173,13 @@ class MoonrakerApi:
def emergency_stop(self):
logger.info("Sending printer.emergency_stop")
self._ws.send_method(
return self._ws.send_method(
"printer.emergency_stop"
)
def gcode_script(self, script, callback=None, *args):
logger.debug("Sending printer.gcode.script: %s", script)
self._ws.send_method(
return self._ws.send_method(
"printer.gcode.script",
{"script": script},
callback,
@@ -166,7 +189,7 @@ class MoonrakerApi:
def get_file_list(self, callback=None, *args):
#Commenting this log for being too noisy
#logger.debug("Sending server.files.list")
self._ws.send_method(
return self._ws.send_method(
"server.files.list",
{},
callback,
@@ -175,7 +198,7 @@ class MoonrakerApi:
def get_file_metadata(self, filename, callback=None, *args):
logger.debug("Sending server.files.metadata: %s", filename)
self._ws.send_method(
return self._ws.send_method(
"server.files.metadata",
{"filename": filename},
callback,
@@ -184,14 +207,32 @@ class MoonrakerApi:
def object_subscription(self, updates):
logger.debug("Sending printer.objects.subscribe: %s", str(updates))
self._ws.send_method(
return self._ws.send_method(
"printer.objects.subscribe",
updates
)
def power_device_off(self, device, callback=None, *args):
logger.debug("Sending machine.device_power.off: %s" % device)
return self._ws.send_method(
"machine.device_power.off",
{device: False},
callback,
*args
)
def power_device_on(self, device, callback=None, *args):
logger.debug("Sending machine.device_power.on %s" % device)
return self._ws.send_method(
"machine.device_power.on",
{device: False},
callback,
*args
)
def print_cancel(self, callback=None, *args):
logger.debug("Sending printer.print.cancel")
self._ws.send_method(
return self._ws.send_method(
"printer.print.cancel",
{},
callback,
@@ -200,7 +241,7 @@ class MoonrakerApi:
def print_pause(self, callback=None, *args):
logger.debug("Sending printer.print.pause")
self._ws.send_method(
return self._ws.send_method(
"printer.print.pause",
{},
callback,
@@ -209,7 +250,7 @@ class MoonrakerApi:
def print_resume(self, callback=None, *args):
logger.debug("Sending printer.print.resume")
self._ws.send_method(
return self._ws.send_method(
"printer.print.resume",
{},
callback,
@@ -218,7 +259,7 @@ class MoonrakerApi:
def print_start(self, filename, callback=None, *args):
logger.debug("Sending printer.print.start")
self._ws.send_method(
return self._ws.send_method(
"printer.print.start",
{
"filename": filename
@@ -230,7 +271,7 @@ class MoonrakerApi:
def temperature_set(self, heater, target, callback=None, *args):
if heater == "heater_bed":
logger.debug("Sending printer.gcode.script: %s", KlippyGcodes.set_bed_temp(target))
self._ws.send_method(
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_bed_temp(target)
@@ -242,7 +283,7 @@ class MoonrakerApi:
logger.debug("Sending printer.gcode.script: %s",
KlippyGcodes.set_ext_temp(target, heater.replace("tool","")))
#TODO: Add max/min limits
self._ws.send_method(
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_ext_temp(target, heater.replace("tool",""))
@@ -253,7 +294,7 @@ class MoonrakerApi:
def set_bed_temp(self, target, callback=None, *args):
logger.debug("Sending set_bed_temp: %s", KlippyGcodes.set_bed_temp(target))
self._ws.send_method(
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_bed_temp(target)
@@ -264,7 +305,7 @@ class MoonrakerApi:
def set_tool_temp(self, tool, target, callback=None, *args):
logger.debug("Sending set_tool_temp: %s", KlippyGcodes.set_ext_temp(target, tool))
self._ws.send_method(
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_ext_temp(target, tool)
@@ -275,12 +316,12 @@ class MoonrakerApi:
def restart(self):
logger.debug("Sending printer.restart")
self._ws.send_method(
return self._ws.send_method(
"printer.restart"
)
def restart_firmware(self):
logger.debug("Sending printer.firmware_restart")
self._ws.send_method(
return self._ws.send_method(
"printer.firmware_restart"
)
+240
View File
@@ -0,0 +1,240 @@
import configparser
import os
import logging
import json
import re
from io import StringIO
from os import path
logger = logging.getLogger("KlipperScreen.config")
class ConfigError(Exception):
pass
class KlipperScreenConfig:
config = None
configfile_name = "KlipperScreen.conf"
do_not_edit_line = "#~# --- Do not edit below this line. This section is auto generated --- #~#"
do_not_edit_prefix = "#~#"
def __init__(self, configfile, lang=None):
_ = lang.gettext
self.configurable_options = [
{"invert_x": {"section": "main", "name": _("Invert X"), "type": "binary", "value": "False"}},
{"invert_y": {"section": "main", "name": _("Invert Y"), "type": "binary", "value": "False"}},
{"invert_z": {"section": "main", "name": _("Invert Z"), "type": "binary", "value": "False"}}
]
self.default_config_path = "%s/ks_includes/%s" % (os.getcwd(), self.configfile_name)
self.config = configparser.ConfigParser()
self.config_path = self.get_config_file_location(configfile)
logger.debug("Config path location: %s" % self.config_path)
self.defined_config = None
try:
self.config.read(self.default_config_path)
if self.config_path != self.default_config_path:
user_def, saved_def = self.separate_saved_config(self.config_path)
self.defined_config = configparser.ConfigParser()
self.defined_config.read_string(user_def)
self.log_config(self.defined_config)
self.config.read_string(user_def)
if saved_def != None:
self.config.read_string(saved_def)
except KeyError:
raise ConfigError(f"Error reading config: {self.config_path}")
self.get_menu_items("__main")
for item in self.configurable_options:
name = list(item)[0]
vals = item[name]
if vals['section'] not in self.config.sections():
self.config.add_section(vals['section'])
if name not in list(self.config[vals['section']]):
self.config.set(vals['section'], name, vals['value'])
#self.build_main_menu(self.config)
def separate_saved_config(self, config_path):
user_def = []
saved_def = None
found_saved = False
if not path.exists(config_path):
return [None, None]
with open(config_path) as file:
for line in file:
line = line.replace('\n','')
if line == self.do_not_edit_line:
found_saved = True
saved_def = []
continue
if found_saved == False:
user_def.append(line.replace('\n',''))
else:
if line.startswith(self.do_not_edit_prefix):
saved_def.append(line[(len(self.do_not_edit_prefix)+1):])
return ["\n".join(user_def), None if saved_def == None else "\n".join(saved_def)]
def get_config_file_location(self, file):
if not path.exists(file):
file = "%s/%s" % (os.getcwd(), self.configfile_name)
if not path.exists(file):
file = self.default_config_path
logger.info("Found configuration file at: %s" % file)
return file
def get_config(self):
return self.config
def get_configurable_options(self):
return self.configurable_options
def get_main_config(self):
return self.config['main']
def get_main_config_option(self, option, default=None):
return self.config['main'].get(option, default)
def get_menu_items(self, menu="__main", subsection=""):
if subsection != "":
subsection = subsection + " "
index = "menu %s %s" % (menu, subsection)
items = [i[len(index):] for i in self.config.sections() if i.startswith(index)]
menu_items = []
for item in items:
split = item.split()
if len(split) == 1:
menu_items.append(self._build_menu_item(menu, index + item))
return menu_items
def get_menu_name(self, menu="__main", subsection=""):
name = ("menu %s %s" % (menu, subsection)) if subsection != "" else ("menu %s" % menu)
if name not in self.config:
return False
return self.config[name].get('name')
def get_preheat_options(self):
index = "preheat "
items = [i[len(index):] for i in self.config.sections() if i.startswith(index)]
preheat_options = {}
for item in items:
preheat_options[item] = self._build_preheat_item(index + item)
return preheat_options
def get_printer_power_name(self):
return self.config['settings'].get("printer_power_name", "printer")
def get_user_saved_config(self):
if self.config_path != self.default_config_path:
print("Get")
def save_user_config_options(self):
save_config = configparser.ConfigParser()
for item in self.configurable_options:
name = list(item)[0]
opt = item[name]
curval = self.config[opt['section']].get(name)
if curval != opt["value"] or (
self.defined_config != None and opt['section'] in self.defined_config.sections() and
self.defined_config[opt['section']].get(name,None) not in (None, curval)):
if opt['section'] not in save_config.sections():
save_config.add_section(opt['section'])
save_config.set(opt['section'], name, str(curval))
if "displayed_macros" in self.config.sections():
for item in self.config.options('displayed_macros'):
value = self.config['displayed_macros'].getboolean(item, fallback=True)
if value == False or (self.defined_config != None and
"displayed_macros" in self.defined_config.sections() and
self.defined_config['displayed_macros'].getboolean(item, fallback=True) == False and
self.defined_config['displayed_macros'].getboolean(item, fallback=True) != value):
if "displayed_macros" not in save_config.sections():
save_config.add_section("displayed_macros")
save_config.set("displayed_macros", item, str(value))
save_output = self._build_config_string(save_config).split("\n")
for i in range(len(save_output)):
save_output[i] = "%s %s" % (self.do_not_edit_prefix, save_output[i])
if self.config_path == self.default_config_path:
user_def = ""
saved_def = None
else:
user_def, saved_def = self.separate_saved_config(self.config_path)
extra_lb = "\n" if saved_def != 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)
if self.config_path != self.default_config_path:
path = self.config_path
else:
path = os.path.expanduser("~/KlipperScreen.conf")
try:
file = open(path, 'w')
file.write(contents)
file.close()
except:
logger.error("Error writing configuration file")
def set(self, section, name, value):
self.config.set(section, name, value)
def log_config(self, config):
lines = [
" "
"===== Config File =====",
re.sub(
r'(moonraker_api_key\s*=\s*\S+)',
'moonraker_api_key = [redacted]',
self._build_config_string(config)
),
"======================="
]
logger.info("\n".join(lines))
def _build_config_string(self, config):
sfile = StringIO()
config.write(sfile)
sfile.seek(0)
return sfile.read().strip()
def _build_menu_item(self, menu, name):
if name not in self.config:
return False
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)
}
try:
item["params"] = json.loads(cfg.get("params", "{}"))
except:
logger.debug("Unable to parse parameters for [%s]" % name)
item["params"] = {}
return {name[(len(menu) + 6):]: item}
def _build_preheat_item(self, name):
if name not in self.config:
return False
cfg = self.config[name]
item = {
"extruder": cfg.getint("extruder", 0),
"bed": cfg.getint("bed", 0)
}
return item
+67 -18
View File
@@ -14,14 +14,16 @@ class KlippyFiles:
callbacks = []
filelist = []
files = {}
metadata_timeout = {}
timeout = None
thumbnail_dir = "/tmp/.KS-thumbnails"
def __init__(self, screen):
self._screen = screen
self.timeout = GLib.timeout_add(2000, self.ret_files)
self.add_timeout()
if not os.path.exists('/tmp/.KS-thumbnails'):
os.makedirs('/tmp/.KS-thumbnails')
if not os.path.exists(self.thumbnail_dir):
os.makedirs(self.thumbnail_dir)
GLib.idle_add(self.ret_files, False)
@@ -41,12 +43,12 @@ class KlippyFiles:
"size": item['size'],
"modified": item['modified']
}
self.update_metadata(item['filename'])
self.request_metadata(item['filename'])
if len(self.callbacks) > 0 and (len(newfiles) > 0 or len(deletedfiles) > 0):
logger.debug("Running callbacks...")
for cb in self.callbacks:
cb(newfiles, deletedfiles)
cb(newfiles, deletedfiles, [])
if len(deletedfiles) > 0:
logger.debug("Deleted files: %s", deletedfiles)
@@ -54,35 +56,85 @@ class KlippyFiles:
self.filelist.remove(file)
self.files.pop(file, None)
#self.get_file_data(item['filename'])
#files = [asyncio.create_task(self.get_file_data(file)) for file in self.files]
#await asyncio.gather(files)
#files = [GLib.idle_add(self.ret_file_data, file) for file in self.files]
elif method == "server.files.metadata":
if "error" in result.keys():
logger.debug("Error in getting metadata for %s" %(params['filename']))
GLib.timeout_add(2000, self._screen._ws.klippy.get_file_metadata, params['filename'], self._callback)
logger.debug("Error in getting metadata for %s. Retrying in 6 seconds" %(params['filename']))
return
logger.debug("Got metadata for %s" % (result['result']['filename']))
if params['filename'] in self.metadata_timeout:
GLib.source_remove(self.metadata_timeout[params['filename']])
del self.metadata_timeout[params['filename']]
for x in result['result']:
self.files[params['filename']][x] = result['result'][x]
if "thumbnails" in self.files[params['filename']]:
self.files[params['filename']]['thumbnails'].sort(key=lambda x: x['size'], reverse=True)
for thumbnail in self.files[params['filename']]['thumbnails']:
f = open("/tmp/.KS-thumbnails/%s-%s" % (params['filename'], thumbnail['size']), "wb")
f = open("%s/%s-%s" % (self.thumbnail_dir, params['filename'].split('/')[-1], thumbnail['size']),
"wb")
f.write(base64.b64decode(thumbnail['data']))
f.close()
for cb in self.callbacks:
logger.debug("Running metadata callbacks")
cb([], [], [params['filename']])
def add_file_callback(self, callback):
self.callbacks.append(callback)
try:
self.callbacks.append(callback)
except:
logger.debug("Callback not found: %s" % callback)
def remove_file_callback(self, callback):
if callback in self.callbacks:
self.callbacks.pop(self.callbacks.index(callback))
def add_timeout(self):
if self.timeout == None:
self.timeout = GLib.timeout_add(4000, self.ret_files)
def file_exists(self, filename):
return True if filename in self.filelist else False
def file_metadata_exists(self, filename):
if not self.file_exists(filename):
return False
if "slicer" in self.files[filename]:
return True
return False
def get_thumbnail_location(self, filename):
if not self.has_thumbnail(filename):
return None
return "%s/%s-%s" % (self.thumbnail_dir, filename.split('/')[-1], self.files[filename]['thumbnails'][0]['size'])
def has_thumbnail(self, filename):
if filename not in self.files:
return False
return "thumbnails" in self.files[filename] and len(self.files[filename]) > 0
def remove_timeout(self):
if self.timeout != None:
self.timeout = None
def request_metadata(self, filename):
if filename not in self.filelist:
return False
if filename in self.metadata_timeout:
GLib.source_remove(self.metadata_timeout[filename])
self.metadata_timeout[filename] = GLib.timeout_add(
6000, self._screen._ws.klippy.get_file_metadata, filename, self._callback
)
GLib.idle_add(
lambda x, y: False if self._screen._ws.klippy.get_file_metadata(x,y) else False,
filename, self._callback
)
def ret_files(self, retval=True):
self._screen._ws.klippy.get_file_list(self._callback)
if not self._screen._ws.klippy.get_file_list(self._callback):
self.timeout = None
return False
return retval
def ret_file_data (self, filename):
@@ -100,6 +152,3 @@ class KlippyFiles:
def add_file(self, file_name, size, modified, old_file_name = None):
print(file_name)
def update_metadata(self, filename):
self._screen._ws.klippy.get_file_metadata(filename, self._callback)
+435
View File
@@ -0,0 +1,435 @@
# 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.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-07 05:48+0000\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"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: panels/print.py:197
msgid "?"
msgstr ""
#: panels/zcalibrate.py:70
msgid "Abort"
msgstr ""
#: panels/zcalibrate.py:67
msgid "Accept"
msgstr ""
#: ks_includes/KlipperScreen.conf:26
msgid "Actions"
msgstr ""
#: panels/print.py:197
msgid "Are you sure you want to print"
msgstr ""
#: panels/job_status.py:305
msgid "Are you sure you wish to cancel this print?"
msgstr ""
#: ks_includes/KlipperScreen.conf:107
msgid "Bed Level"
msgstr ""
#: ks_includes/KlipperScreen.conf:112
msgid "Bed Mesh"
msgstr ""
#: screen.py:455 panels/job_status.py:267 panels/print.py:193
msgid "Cancel"
msgstr ""
#: panels/fan.py:45
msgid "Cancel Change"
msgstr ""
#: panels/job_status.py:300
msgid "Cancel Print"
msgstr ""
#: screen.py:289
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
#: panels/bed_mesh.py:172 panels/temperature.py:149
msgid "Close"
msgstr ""
#: ks_includes/KlipperScreen.conf:30
msgid "Configuration"
msgstr ""
#: screen.py:454
msgid "Continue"
msgstr ""
#: panels/job_status.py:269
msgid "Control"
msgstr ""
#: panels/preheat.py:54
msgid "Cooldown"
msgstr ""
#: panels/temperature.py:53
msgid "Decrease"
msgstr ""
#: ks_includes/KlipperScreen.conf:101
msgid "Disable Motors"
msgstr ""
#: panels/bed_level.py:101
msgid "Disable XY"
msgstr ""
#: panels/settings.py:32
msgid "Displayed Macros"
msgstr ""
#: panels/zcalibrate.py:63
msgid "Distance (mm)"
msgstr ""
#: panels/job_status.py:135
msgid "Elapsed:"
msgstr ""
#: panels/job_status.py:271
msgid "Emergency Stop"
msgstr ""
#: panels/extrude.py:45 ks_includes/KlipperScreen.conf:74
#: ks_includes/KlipperScreen.conf:167
msgid "Extrude"
msgstr ""
#: panels/fine_tune.py:57
msgid "Extrusion +"
msgstr ""
#: panels/fine_tune.py:61
msgid "Extrusion -"
msgstr ""
#: ks_includes/KlipperScreen.conf:79 ks_includes/KlipperScreen.conf:162
msgid "Fan"
msgstr ""
#: panels/fan.py:35
msgid "Fan Off"
msgstr ""
#: panels/fan.py:38
msgid "Fan On"
msgstr ""
#: panels/extrude.py:30
msgid "Fast"
msgstr ""
#: ks_includes/KlipperScreen.conf:157
msgid "Fine Tuning"
msgstr ""
#: panels/splash_screen.py:62 panels/system.py:24
msgid "Firmware Restart"
msgstr ""
#: screen.py:284 panels/job_status.py:301
msgid "Go Back"
msgstr ""
#: panels/bed_level.py:98 panels/move.py:40 ks_includes/KlipperScreen.conf:39
msgid "Home All"
msgstr ""
#: ks_includes/KlipperScreen.conf:45
msgid "Home X"
msgstr ""
#: ks_includes/KlipperScreen.conf:63
msgid "Home XY"
msgstr ""
#: ks_includes/KlipperScreen.conf:51
msgid "Home Y"
msgstr ""
#: ks_includes/KlipperScreen.conf:57
msgid "Home Z"
msgstr ""
#: panels/zcalibrate.py:29 ks_includes/KlipperScreen.conf:17
msgid "Homing"
msgstr ""
#: panels/temperature.py:51
msgid "Increase"
msgstr ""
#. self._load_panels()
#: screen.py:136
msgid "Initializing"
msgstr ""
#: panels/splash_screen.py:23
msgid "Initializing printer..."
msgstr ""
#: ks_includes/config.py:26
msgid "Invert X"
msgstr ""
#: ks_includes/config.py:27
msgid "Invert Y"
msgstr ""
#: ks_includes/config.py:28
msgid "Invert Z"
msgstr ""
#: panels/system.py:22
msgid "Klipper Restart"
msgstr ""
#: panels/system.py:35
msgid "Klipper Version"
msgstr ""
#: screen.py:384
msgid "Klipper has disconnected"
msgstr ""
#: screen.py:395
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
#: screen.py:399
msgid "Klipper has encountered an error."
msgstr ""
#: screen.py:391
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
#: screen.py:417
msgid "Klipper has shutdown"
msgstr ""
#: screen.py:413
msgid "Klipper is attempting to start"
msgstr ""
#: ks_includes/KlipperScreen.conf:141
msgid "Klipper will reboot"
msgstr ""
#: panels/system.py:39
msgid "KlipperScreen Version"
msgstr ""
#: panels/job_status.py:123
msgid "Left:"
msgstr ""
#: panels/system.py:57
msgid "Load Average"
msgstr ""
#: panels/zcalibrate.py:39
msgid "Lower Nozzle"
msgstr ""
#: ks_includes/KlipperScreen.conf:89
msgid "Macros"
msgstr ""
#: panels/job_status.py:273 ks_includes/KlipperScreen.conf:14
msgid "Main Menu"
msgstr ""
#: panels/extrude.py:30
msgid "Medium"
msgstr ""
#: ks_includes/KlipperScreen.conf:69
msgid "Move"
msgstr ""
#: panels/move.py:86
msgid "Move Distance (mm)"
msgstr ""
#: ks_includes/KlipperScreen.conf:124 ks_includes/KlipperScreen.conf:173
msgid "Network"
msgstr ""
#: panels/network.py:31
msgid "Network Info"
msgstr ""
#: panels/temperature.py:55
msgid "Number Pad"
msgstr ""
#: panels/job_status.py:275
msgid "Pause"
msgstr ""
#: panels/job_status.py:454
msgid "Paused"
msgstr ""
#: ks_includes/KlipperScreen.conf:95
msgid "Power"
msgstr ""
#: panels/splash_screen.py:59
msgid "Power On Printer"
msgstr ""
#: ks_includes/KlipperScreen.conf:21
msgid "Preheat"
msgstr ""
#: panels/print.py:192 ks_includes/KlipperScreen.conf:34
msgid "Print"
msgstr ""
#: ks_includes/KlipperScreen.conf:149
msgid "Print Control"
msgstr ""
#: panels/print.py:122
msgid "Print Time"
msgstr ""
#: panels/job_status.py:231
msgid "Printing"
msgstr ""
#: panels/zcalibrate.py:37
msgid "Raise Nozzle"
msgstr ""
#: panels/job_status.py:277 panels/splash_screen.py:60
msgid "Restart"
msgstr ""
#: panels/job_status.py:279
msgid "Resume"
msgstr ""
#: panels/extrude.py:47
msgid "Retract"
msgstr ""
#: ks_includes/KlipperScreen.conf:134
msgid "Save Config"
msgstr ""
#: ks_includes/KlipperScreen.conf:139
msgid "Save configuration."
msgstr ""
#: panels/bed_level.py:108
msgid "Screws Adjust"
msgstr ""
#: panels/fan.py:42
msgid "Set Speed"
msgstr ""
#: ks_includes/KlipperScreen.conf:144
msgid "Settings"
msgstr ""
#: panels/print.py:120
msgid "Size"
msgstr ""
#: panels/extrude.py:30
msgid "Slow"
msgstr ""
#: panels/fine_tune.py:47
msgid "Speed +"
msgstr ""
#: panels/fine_tune.py:51
msgid "Speed -"
msgstr ""
#: ks_includes/KlipperScreen.conf:129 ks_includes/KlipperScreen.conf:178
msgid "System"
msgstr ""
#: panels/extrude.py:49 ks_includes/KlipperScreen.conf:84
#: ks_includes/KlipperScreen.conf:152
msgid "Temperature"
msgstr ""
#: panels/extrude.py:37
msgid "Tool"
msgstr ""
#: panels/print.py:118
msgid "Uploaded"
msgstr ""
#: panels/move.py:25
msgid "X+"
msgstr ""
#: panels/move.py:27
msgid "X-"
msgstr ""
#: panels/move.py:30
msgid "Y+"
msgstr ""
#: panels/move.py:32
msgid "Y-"
msgstr ""
#: ks_includes/KlipperScreen.conf:118
msgid "Z Calibrate"
msgstr ""
#: panels/zcalibrate.py:28
msgid "Z Offset"
msgstr ""
#: panels/fine_tune.py:36 panels/move.py:35
msgid "Z+"
msgstr ""
#: panels/fine_tune.py:40 panels/move.py:37
msgid "Z-"
msgstr ""
#: panels/fine_tune.py:38
msgid "mm"
msgstr ""
Binary file not shown.
@@ -0,0 +1,416 @@
#: panels/print.py:197
msgid "?"
msgstr ""
#: panels/zcalibrate.py:70
msgid "Abort"
msgstr "Abort"
#: panels/zcalibrate.py:67
msgid "Accept"
msgstr ""
#: ks_includes/KlipperScreen.conf:26
msgid "Actions"
msgstr ""
#: panels/print.py:197
msgid "Are you sure you want to print"
msgstr ""
#: panels/job_status.py:305
msgid "Are you sure you wish to cancel this print?"
msgstr ""
#: ks_includes/KlipperScreen.conf:107
msgid "Bed Level"
msgstr ""
#: ks_includes/KlipperScreen.conf:112
msgid "Bed Mesh"
msgstr ""
#: screen.py:455 panels/job_status.py:267 panels/print.py:193
msgid "Cancel"
msgstr ""
#: panels/fan.py:45
msgid "Cancel Change"
msgstr ""
#: panels/job_status.py:300
msgid "Cancel Print"
msgstr ""
#: screen.py:289
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
#: panels/bed_mesh.py:172 panels/temperature.py:149
msgid "Close"
msgstr ""
#: ks_includes/KlipperScreen.conf:30
msgid "Configuration"
msgstr ""
#: screen.py:454
msgid "Continue"
msgstr ""
#: panels/job_status.py:269
msgid "Control"
msgstr ""
#: panels/preheat.py:54
msgid "Cooldown"
msgstr ""
#: panels/temperature.py:53
msgid "Decrease"
msgstr ""
#: ks_includes/KlipperScreen.conf:101
msgid "Disable Motors"
msgstr ""
#: panels/bed_level.py:101
msgid "Disable XY"
msgstr ""
#: panels/settings.py:32
msgid "Displayed Macros"
msgstr ""
#: panels/zcalibrate.py:63
msgid "Distance (mm)"
msgstr ""
#: panels/job_status.py:135
msgid "Elapsed:"
msgstr ""
#: panels/job_status.py:271
msgid "Emergency Stop"
msgstr ""
#: panels/extrude.py:45 ks_includes/KlipperScreen.conf:74
#: ks_includes/KlipperScreen.conf:167
msgid "Extrude"
msgstr ""
#: panels/fine_tune.py:57
msgid "Extrusion +"
msgstr ""
#: panels/fine_tune.py:61
msgid "Extrusion -"
msgstr ""
#: ks_includes/KlipperScreen.conf:79 ks_includes/KlipperScreen.conf:162
msgid "Fan"
msgstr ""
#: panels/fan.py:35
msgid "Fan Off"
msgstr ""
#: panels/fan.py:38
msgid "Fan On"
msgstr ""
#: panels/extrude.py:30
msgid "Fast"
msgstr ""
#: ks_includes/KlipperScreen.conf:157
msgid "Fine Tuning"
msgstr ""
#: panels/splash_screen.py:62 panels/system.py:24
msgid "Firmware Restart"
msgstr ""
#: screen.py:284 panels/job_status.py:301
msgid "Go Back"
msgstr ""
#: panels/bed_level.py:98 panels/move.py:40 ks_includes/KlipperScreen.conf:39
msgid "Home All"
msgstr ""
#: ks_includes/KlipperScreen.conf:45
msgid "Home X"
msgstr ""
#: ks_includes/KlipperScreen.conf:63
msgid "Home XY"
msgstr ""
#: ks_includes/KlipperScreen.conf:51
msgid "Home Y"
msgstr ""
#: ks_includes/KlipperScreen.conf:57
msgid "Home Z"
msgstr ""
#: panels/zcalibrate.py:29 ks_includes/KlipperScreen.conf:17
msgid "Homing"
msgstr ""
#: panels/temperature.py:51
msgid "Increase"
msgstr ""
#. self._load_panels()
#: screen.py:136
msgid "Initializing"
msgstr ""
#: panels/splash_screen.py:23
msgid "Initializing printer..."
msgstr ""
#: ks_includes/config.py:26
msgid "Invert X"
msgstr ""
#: ks_includes/config.py:27
msgid "Invert Y"
msgstr ""
#: ks_includes/config.py:28
msgid "Invert Z"
msgstr ""
#: panels/system.py:22
msgid "Klipper Restart"
msgstr ""
#: panels/system.py:35
msgid "Klipper Version"
msgstr ""
#: screen.py:384
msgid "Klipper has disconnected"
msgstr ""
#: screen.py:395
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
#: screen.py:399
msgid "Klipper has encountered an error."
msgstr ""
#: screen.py:391
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
#: screen.py:417
msgid "Klipper has shutdown"
msgstr ""
#: screen.py:413
msgid "Klipper is attempting to start"
msgstr ""
#: ks_includes/KlipperScreen.conf:141
msgid "Klipper will reboot"
msgstr ""
#: panels/system.py:39
msgid "KlipperScreen Version"
msgstr ""
#: panels/job_status.py:123
msgid "Left:"
msgstr ""
#: panels/system.py:57
msgid "Load Average"
msgstr ""
#: panels/zcalibrate.py:39
msgid "Lower Nozzle"
msgstr ""
#: ks_includes/KlipperScreen.conf:89
msgid "Macros"
msgstr ""
#: panels/job_status.py:273 ks_includes/KlipperScreen.conf:14
msgid "Main Menu"
msgstr ""
#: panels/extrude.py:30
msgid "Medium"
msgstr ""
#: ks_includes/KlipperScreen.conf:69
msgid "Move"
msgstr ""
#: panels/move.py:86
msgid "Move Distance (mm)"
msgstr ""
#: ks_includes/KlipperScreen.conf:124 ks_includes/KlipperScreen.conf:173
msgid "Network"
msgstr ""
#: panels/network.py:31
msgid "Network Info"
msgstr ""
#: panels/temperature.py:55
msgid "Number Pad"
msgstr ""
#: panels/job_status.py:275
msgid "Pause"
msgstr ""
#: panels/job_status.py:454
msgid "Paused"
msgstr ""
#: ks_includes/KlipperScreen.conf:95
msgid "Power"
msgstr ""
#: panels/splash_screen.py:59
msgid "Power On Printer"
msgstr ""
#: ks_includes/KlipperScreen.conf:21
msgid "Preheat"
msgstr ""
#: panels/print.py:192 ks_includes/KlipperScreen.conf:34
msgid "Print"
msgstr ""
#: ks_includes/KlipperScreen.conf:149
msgid "Print Control"
msgstr ""
#: panels/print.py:122
msgid "Print Time"
msgstr ""
#: panels/job_status.py:231
msgid "Printing"
msgstr ""
#: panels/zcalibrate.py:37
msgid "Raise Nozzle"
msgstr ""
#: panels/job_status.py:277 panels/splash_screen.py:60
msgid "Restart"
msgstr ""
#: panels/job_status.py:279
msgid "Resume"
msgstr ""
#: panels/extrude.py:47
msgid "Retract"
msgstr ""
#: ks_includes/KlipperScreen.conf:134
msgid "Save Config"
msgstr ""
#: ks_includes/KlipperScreen.conf:139
msgid "Save configuration."
msgstr ""
#: panels/bed_level.py:108
msgid "Screws Adjust"
msgstr ""
#: panels/fan.py:42
msgid "Set Speed"
msgstr ""
#: ks_includes/KlipperScreen.conf:144
msgid "Settings"
msgstr ""
#: panels/print.py:120
msgid "Size"
msgstr ""
#: panels/extrude.py:30
msgid "Slow"
msgstr ""
#: panels/fine_tune.py:47
msgid "Speed +"
msgstr ""
#: panels/fine_tune.py:51
msgid "Speed -"
msgstr ""
#: ks_includes/KlipperScreen.conf:129 ks_includes/KlipperScreen.conf:178
msgid "System"
msgstr ""
#: panels/extrude.py:49 ks_includes/KlipperScreen.conf:84
#: ks_includes/KlipperScreen.conf:152
msgid "Temperature"
msgstr ""
#: panels/extrude.py:37
msgid "Tool"
msgstr ""
#: panels/print.py:118
msgid "Uploaded"
msgstr ""
#: panels/move.py:25
msgid "X+"
msgstr ""
#: panels/move.py:27
msgid "X-"
msgstr ""
#: panels/move.py:30
msgid "Y+"
msgstr ""
#: panels/move.py:32
msgid "Y-"
msgstr ""
#: ks_includes/KlipperScreen.conf:118
msgid "Z Calibrate"
msgstr ""
#: panels/zcalibrate.py:28
msgid "Z Offset"
msgstr ""
#: panels/fine_tune.py:36 panels/move.py:35
msgid "Z+"
msgstr ""
#: panels/fine_tune.py:40 panels/move.py:37
msgid "Z-"
msgstr ""
#: panels/fine_tune.py:38
msgid "mm"
msgstr ""
@@ -0,0 +1,469 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-07 05:48+0000\n"
"PO-Revision-Date: 2021-01-03 23:18+0200\n"
"Last-Translator: Emanuel Sharvit <manu7irl@gmail.com>\n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: panels/print.py:197
msgid "?"
msgstr "?"
#: panels/zcalibrate.py:70
msgid "Abort"
msgstr "Annuler"
#: panels/zcalibrate.py:67
msgid "Accept"
msgstr "Accepter"
#: ks_includes/KlipperScreen.conf:26
msgid "Actions"
msgstr "Actions"
#: panels/print.py:197
msgid "Are you sure you want to print"
msgstr "Es tu sure de vouloir imprimer"
#: panels/job_status.py:305
msgid "Are you sure you wish to cancel this print?"
msgstr "Es tu sure de vouloir annuler cette impression?"
#: ks_includes/KlipperScreen.conf:107
msgid "Bed Level"
msgstr "Nivelage du plateau"
#: ks_includes/KlipperScreen.conf:112
msgid "Bed Mesh"
msgstr "Grille du plateau"
#: screen.py:455 panels/job_status.py:267 panels/print.py:193
msgid "Cancel"
msgstr "Annuler"
#: panels/fan.py:45
msgid "Cancel Change"
msgstr "Annuler le changement"
#: panels/job_status.py:300
msgid "Cancel Print"
msgstr "Annuler l'impression"
#: screen.py:289
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"Verifier /tmp/KlipperScreen.log pour plus d'imformation.\n"
"SVP envoie une requte sur GITHUB pour obtenir de l'aide"
#: panels/bed_mesh.py:172 panels/temperature.py:149
msgid "Close"
msgstr "Fermer"
#: ks_includes/KlipperScreen.conf:30
msgid "Configuration"
msgstr "Configuration"
#: screen.py:454
msgid "Continue"
msgstr "Continuer"
#: panels/job_status.py:269
msgid "Control"
msgstr "Controle"
#: panels/preheat.py:54
msgid "Cooldown"
msgstr "Refroidir"
#: panels/temperature.py:53
msgid "Decrease"
msgstr "Diminuer"
#: ks_includes/KlipperScreen.conf:101
msgid "Disable Motors"
msgstr "Déactiver les moteurs"
#: panels/bed_level.py:101
msgid "Disable XY"
msgstr "Deactiver XY"
#: panels/settings.py:32
msgid "Displayed Macros"
msgstr ""
#: panels/zcalibrate.py:63
msgid "Distance (mm)"
msgstr "Distance (mm)"
#: panels/job_status.py:135
msgid "Elapsed:"
msgstr "Écoulé:"
#: panels/job_status.py:271
msgid "Emergency Stop"
msgstr "Arret d'urgence"
#: panels/extrude.py:45 ks_includes/KlipperScreen.conf:74
#: ks_includes/KlipperScreen.conf:167
msgid "Extrude"
msgstr "Extruder"
#: panels/fine_tune.py:57
msgid "Extrusion +"
msgstr "Extrusion +"
#: panels/fine_tune.py:61
msgid "Extrusion -"
msgstr "Extrusion +"
#: ks_includes/KlipperScreen.conf:79 ks_includes/KlipperScreen.conf:162
msgid "Fan"
msgstr "Ventilateur"
#: panels/fan.py:35
msgid "Fan Off"
msgstr "ventilateur éteint"
#: panels/fan.py:38
msgid "Fan On"
msgstr "Ventilateur en marche"
#: panels/extrude.py:30
msgid "Fast"
msgstr "Rapide"
#: ks_includes/KlipperScreen.conf:157
msgid "Fine Tuning"
msgstr "Fin réglage"
#: panels/splash_screen.py:62 panels/system.py:24
msgid "Firmware Restart"
msgstr "Redemarrer le FW"
#: screen.py:284 panels/job_status.py:301
msgid "Go Back"
msgstr "Retourner"
#: panels/bed_level.py:98 panels/move.py:40 ks_includes/KlipperScreen.conf:39
msgid "Home All"
msgstr "Réinitialiser XYZ"
#: ks_includes/KlipperScreen.conf:45
msgid "Home X"
msgstr "Réinitialiser X"
#: ks_includes/KlipperScreen.conf:63
msgid "Home XY"
msgstr "Réinitialiser XY"
#: ks_includes/KlipperScreen.conf:51
msgid "Home Y"
msgstr "Réinitialiser Y"
#: ks_includes/KlipperScreen.conf:57
msgid "Home Z"
msgstr "Réinitialiser Z"
#: panels/zcalibrate.py:29 ks_includes/KlipperScreen.conf:17
msgid "Homing"
msgstr "Réinitialisation"
#: panels/temperature.py:51
msgid "Increase"
msgstr "Augmenter"
#. self._load_panels()
#: screen.py:136
msgid "Initializing"
msgstr "Initialisation"
#: panels/splash_screen.py:23
msgid "Initializing printer..."
msgstr "Initialisation l'imprimante"
#: ks_includes/config.py:26
msgid "Invert X"
msgstr ""
#: ks_includes/config.py:27
msgid "Invert Y"
msgstr ""
#: ks_includes/config.py:28
msgid "Invert Z"
msgstr ""
#: panels/system.py:22
msgid "Klipper Restart"
msgstr "Redémarrer klipper"
#: panels/system.py:35
msgid "Klipper Version"
msgstr "Version de klipper"
#: screen.py:384
msgid "Klipper has disconnected"
msgstr "Klipper s'est déconnecté"
#: screen.py:395
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
"Klipper a rencontré une erreur avec le microcontrôleur.\n"
"Veuillez recompiler et reflasher."
#: screen.py:399
msgid "Klipper has encountered an error."
msgstr "Klipper a rencontré une erreur."
#: screen.py:391
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"Klipper a rencontré une erreur. Taper FIRMWARE_RESTART pour fixer l'erreur."
#: screen.py:417
msgid "Klipper has shutdown"
msgstr "Klipper s'est arrêté"
#: screen.py:413
msgid "Klipper is attempting to start"
msgstr "Klipper tente de démarrer"
#: ks_includes/KlipperScreen.conf:141
msgid "Klipper will reboot"
msgstr "Klipper va redémarrer"
#: panels/system.py:39
msgid "KlipperScreen Version"
msgstr "Version de KlipperScreen"
#: panels/job_status.py:123
msgid "Left:"
msgstr "Gauche:"
#: panels/system.py:57
msgid "Load Average"
msgstr "Charge moyenne"
#: panels/zcalibrate.py:39
msgid "Lower Nozzle"
msgstr "Rapprocher la buse"
#: ks_includes/KlipperScreen.conf:89
msgid "Macros"
msgstr "Macros"
#: panels/job_status.py:273 ks_includes/KlipperScreen.conf:14
msgid "Main Menu"
msgstr "Menu principal"
#: panels/extrude.py:30
msgid "Medium"
msgstr "Moyen"
#: ks_includes/KlipperScreen.conf:69
msgid "Move"
msgstr "Mouvement"
#: panels/move.py:86
msgid "Move Distance (mm)"
msgstr "Distance de mouvement (mm)"
#: ks_includes/KlipperScreen.conf:124 ks_includes/KlipperScreen.conf:173
msgid "Network"
msgstr "Réseau"
#: panels/network.py:31
msgid "Network Info"
msgstr "Information réseau "
#: panels/temperature.py:55
msgid "Number Pad"
msgstr "Pad numerique"
#: panels/job_status.py:275
msgid "Pause"
msgstr "Pause"
#: panels/job_status.py:454
msgid "Paused"
msgstr "En pause"
#: ks_includes/KlipperScreen.conf:95
msgid "Power"
msgstr "Energie"
#: panels/splash_screen.py:59
msgid "Power On Printer"
msgstr "Allumer l'imrimante"
#: ks_includes/KlipperScreen.conf:21
msgid "Preheat"
msgstr "Préchauffer"
#: panels/print.py:192 ks_includes/KlipperScreen.conf:34
msgid "Print"
msgstr "Imprimer"
#: ks_includes/KlipperScreen.conf:149
msgid "Print Control"
msgstr "Controle de l'imprimante"
#: panels/print.py:122
msgid "Print Time"
msgstr "Temps d'impression"
#: panels/job_status.py:231
msgid "Printing"
msgstr "imprime"
#: panels/zcalibrate.py:37
msgid "Raise Nozzle"
msgstr "Éloigner la buse"
#: panels/job_status.py:277 panels/splash_screen.py:60
msgid "Restart"
msgstr "Redémarrage"
#: panels/job_status.py:279
msgid "Resume"
msgstr "Resumer"
#: panels/extrude.py:47
msgid "Retract"
msgstr "Rétracter"
#: ks_includes/KlipperScreen.conf:134
msgid "Save Config"
msgstr "Enregistrer la config"
#: ks_includes/KlipperScreen.conf:139
msgid "Save configuration."
msgstr "Enregistrer la configuration"
#: panels/bed_level.py:108
msgid "Screws Adjust"
msgstr "Ajuster les vis"
#: panels/fan.py:42
msgid "Set Speed"
msgstr "Régler la vitesse"
#: ks_includes/KlipperScreen.conf:144
#, fuzzy
msgid "Settings"
msgstr "Paramètres KS"
#: panels/print.py:120
msgid "Size"
msgstr "dimensions"
#: panels/extrude.py:30
msgid "Slow"
msgstr "Lent"
#: panels/fine_tune.py:47
msgid "Speed +"
msgstr "Vitesse+"
#: panels/fine_tune.py:51
msgid "Speed -"
msgstr "Vitesse-"
#: ks_includes/KlipperScreen.conf:129 ks_includes/KlipperScreen.conf:178
msgid "System"
msgstr "Systeme"
#: panels/extrude.py:49 ks_includes/KlipperScreen.conf:84
#: ks_includes/KlipperScreen.conf:152
msgid "Temperature"
msgstr "Temperature"
#: panels/extrude.py:37
msgid "Tool"
msgstr "outil"
#: panels/print.py:118
msgid "Uploaded"
msgstr "Telecharger"
#: panels/move.py:25
msgid "X+"
msgstr "X+"
#: panels/move.py:27
msgid "X-"
msgstr "X-"
#: panels/move.py:30
msgid "Y+"
msgstr "Y+"
#: panels/move.py:32
msgid "Y-"
msgstr "Y-"
#: ks_includes/KlipperScreen.conf:118
msgid "Z Calibrate"
msgstr "Calibration Z"
#: panels/zcalibrate.py:28
msgid "Z Offset"
msgstr "Décalage Z"
#: panels/fine_tune.py:36 panels/move.py:35
msgid "Z+"
msgstr "Z+"
#: panels/fine_tune.py:40 panels/move.py:37
msgid "Z-"
msgstr "Z-"
#: panels/fine_tune.py:38
msgid "mm"
msgstr "mm"
#~ msgid "Back"
#~ msgstr "Retour"
#~ msgid "Extrusion"
#~ msgstr "Extrusion"
#~ msgid "Fan +"
#~ msgstr "Ventilateur+"
#~ msgid "Fan -"
#~ msgstr "Ventilateur-"
#~ msgid "Speed"
#~ msgstr "Vitesse"
#~ msgid "System Information"
#~ msgstr "Info systeme"
#~ msgid "Time Elapsed"
#~ msgstr "Temps écoulé"
#~ msgid "Time Left"
#~ msgstr "temps restant"
#~ msgid "Tool 1"
#~ msgstr "Outil 1"
@@ -0,0 +1,470 @@
# 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: Klipperscreen\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-07 05:48+0000\n"
"PO-Revision-Date: 2021-01-05 21:32+0200\n"
"Last-Translator: Emanuel Sharvit <manu7irl@gmail.com>\n"
"Language-Team: \n"
"Language: he_IL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n==2 ? 1 : n>10 && n%10==0 ? "
"2 : 3);\n"
"X-Poedit-SourceCharset: UTF-8\n"
#: panels/print.py:197
msgid "?"
msgstr "?"
#: panels/zcalibrate.py:70
msgid "Abort"
msgstr "בטל"
#: panels/zcalibrate.py:67
msgid "Accept"
msgstr "אשר"
#: ks_includes/KlipperScreen.conf:26
msgid "Actions"
msgstr "פעולות"
#: panels/print.py:197
msgid "Are you sure you want to print"
msgstr "האם אתה בטוח שברצונך להדפיס"
#: panels/job_status.py:305
msgid "Are you sure you wish to cancel this print?"
msgstr "האם אתה בטוח שברצונך לבטל את ההדפסה?"
#: ks_includes/KlipperScreen.conf:107
msgid "Bed Level"
msgstr "פילוס מיטה"
#: ks_includes/KlipperScreen.conf:112
msgid "Bed Mesh"
msgstr "מיפוי מיטה"
#: screen.py:455 panels/job_status.py:267 panels/print.py:193
msgid "Cancel"
msgstr "ביטול"
#: panels/fan.py:45
msgid "Cancel Change"
msgstr "בטל שינוי"
#: panels/job_status.py:300
msgid "Cancel Print"
msgstr "בטל הדפסה"
#: screen.py:289
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"בדוק KlipperScreen.log, בתיקית tmp ליותר פרטים.\n"
"אנא שלח דוח תקלה ב- GITHUB, לעזרה."
#: panels/bed_mesh.py:172 panels/temperature.py:149
msgid "Close"
msgstr "סגור"
#: ks_includes/KlipperScreen.conf:30
msgid "Configuration"
msgstr "קונפיגורציה"
#: screen.py:454
msgid "Continue"
msgstr "המשך"
#: panels/job_status.py:269
msgid "Control"
msgstr "שליטה"
#: panels/preheat.py:54
msgid "Cooldown"
msgstr "קירור"
#: panels/temperature.py:53
msgid "Decrease"
msgstr "הקטן"
#: ks_includes/KlipperScreen.conf:101
msgid "Disable Motors"
msgstr "בטל מנועים"
#: panels/bed_level.py:101
msgid "Disable XY"
msgstr "בטל XY"
#: panels/settings.py:32
msgid "Displayed Macros"
msgstr ""
#: panels/zcalibrate.py:63
msgid "Distance (mm)"
msgstr "מרחק (מ''מ)"
#: panels/job_status.py:135
msgid "Elapsed:"
msgstr "זמן שעבר:"
#: panels/job_status.py:271
msgid "Emergency Stop"
msgstr "עצירת חירום"
#: panels/extrude.py:45 ks_includes/KlipperScreen.conf:74
#: ks_includes/KlipperScreen.conf:167
msgid "Extrude"
msgstr "אקסטרוזיה"
#: panels/fine_tune.py:57
msgid "Extrusion +"
msgstr "שיחול +"
#: panels/fine_tune.py:61
msgid "Extrusion -"
msgstr "שיחול -"
#: ks_includes/KlipperScreen.conf:79 ks_includes/KlipperScreen.conf:162
msgid "Fan"
msgstr "מאוורר"
#: panels/fan.py:35
msgid "Fan Off"
msgstr "כבה מאוורר"
#: panels/fan.py:38
msgid "Fan On"
msgstr "הפעל מאוורר"
#: panels/extrude.py:30
msgid "Fast"
msgstr "מהיר"
#: ks_includes/KlipperScreen.conf:157
msgid "Fine Tuning"
msgstr "כיולים עדינים"
#: panels/splash_screen.py:62 panels/system.py:24
msgid "Firmware Restart"
msgstr "התחל קושחה"
#: screen.py:284 panels/job_status.py:301
msgid "Go Back"
msgstr "חזרה"
#: panels/bed_level.py:98 panels/move.py:40 ks_includes/KlipperScreen.conf:39
msgid "Home All"
msgstr "איפוס XYZ"
#: ks_includes/KlipperScreen.conf:45
msgid "Home X"
msgstr "איפוס X"
#: ks_includes/KlipperScreen.conf:63
msgid "Home XY"
msgstr "איפוס XY"
#: ks_includes/KlipperScreen.conf:51
msgid "Home Y"
msgstr "איפוס Y"
#: ks_includes/KlipperScreen.conf:57
msgid "Home Z"
msgstr "איפוס Z"
#: panels/zcalibrate.py:29 ks_includes/KlipperScreen.conf:17
msgid "Homing"
msgstr "איפוס צירים"
#: panels/temperature.py:51
msgid "Increase"
msgstr "הגדל"
#. self._load_panels()
#: screen.py:136
msgid "Initializing"
msgstr "מאתחל"
#: panels/splash_screen.py:23
msgid "Initializing printer..."
msgstr "מאתחל מדפסת..."
#: ks_includes/config.py:26
msgid "Invert X"
msgstr ""
#: ks_includes/config.py:27
msgid "Invert Y"
msgstr ""
#: ks_includes/config.py:28
msgid "Invert Z"
msgstr ""
#: panels/system.py:22
msgid "Klipper Restart"
msgstr "אתחול קליפר"
#: panels/system.py:35
msgid "Klipper Version"
msgstr "גרסא של קליפר"
#: screen.py:384
msgid "Klipper has disconnected"
msgstr "קליפר התנתק"
#: screen.py:395
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr "בעיית תקשורת בין קליפר ללוח בקרה. אנא לקמפל קושחה ולצרובה מחדש. "
#: screen.py:399
msgid "Klipper has encountered an error."
msgstr "קילפר נתקל בבעיה."
#: screen.py:391
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"קליפר נתקל בבעיה. \n"
"נסה להריץ firmware_restart, כדי לפתור את הבעיה."
#: screen.py:417
msgid "Klipper has shutdown"
msgstr "קליפר נכבה"
#: screen.py:413
msgid "Klipper is attempting to start"
msgstr "קליפר מנסה לרוץ"
#: ks_includes/KlipperScreen.conf:141
msgid "Klipper will reboot"
msgstr "קליפר יבצע אתחול"
#: panels/system.py:39
msgid "KlipperScreen Version"
msgstr "גרסא של KlipperScreen"
#: panels/job_status.py:123
msgid "Left:"
msgstr "זמן שנותר:"
#: panels/system.py:57
msgid "Load Average"
msgstr "עומס ממוצע"
#: panels/zcalibrate.py:39
msgid "Lower Nozzle"
msgstr "הנמך דיזה"
#: ks_includes/KlipperScreen.conf:89
msgid "Macros"
msgstr "מקרואים"
#: panels/job_status.py:273 ks_includes/KlipperScreen.conf:14
msgid "Main Menu"
msgstr "תפריט ראשי"
#: panels/extrude.py:30
msgid "Medium"
msgstr "ממוצע"
#: ks_includes/KlipperScreen.conf:69
msgid "Move"
msgstr "הזזת צירים"
#: panels/move.py:86
msgid "Move Distance (mm)"
msgstr "מרחק הזזה (מ''מ)"
#: ks_includes/KlipperScreen.conf:124 ks_includes/KlipperScreen.conf:173
msgid "Network"
msgstr "רשת"
#: panels/network.py:31
msgid "Network Info"
msgstr "מידע על הרשת"
#: panels/temperature.py:55
msgid "Number Pad"
msgstr "פד נומרי"
#: panels/job_status.py:275
msgid "Pause"
msgstr "השהיה"
#: panels/job_status.py:454
msgid "Paused"
msgstr "מושהה"
#: ks_includes/KlipperScreen.conf:95
msgid "Power"
msgstr "הפעלה"
#: panels/splash_screen.py:59
msgid "Power On Printer"
msgstr "הפעל מדפסת"
#: ks_includes/KlipperScreen.conf:21
msgid "Preheat"
msgstr "חימום מראש"
#: panels/print.py:192 ks_includes/KlipperScreen.conf:34
msgid "Print"
msgstr "הדפס"
#: ks_includes/KlipperScreen.conf:149
msgid "Print Control"
msgstr "שליטה בהדפסה"
#: panels/print.py:122
msgid "Print Time"
msgstr "זמן הדפסה"
#: panels/job_status.py:231
msgid "Printing"
msgstr "מדפיס"
#: panels/zcalibrate.py:37
msgid "Raise Nozzle"
msgstr "הגבה"
#: panels/job_status.py:277 panels/splash_screen.py:60
msgid "Restart"
msgstr "אתחל"
#: panels/job_status.py:279
msgid "Resume"
msgstr "המשך"
#: panels/extrude.py:47
msgid "Retract"
msgstr "שיחול לאחור"
#: ks_includes/KlipperScreen.conf:134
msgid "Save Config"
msgstr "שמור קונפיג"
#: ks_includes/KlipperScreen.conf:139
msgid "Save configuration."
msgstr "שמור קונפיגורציה"
#: panels/bed_level.py:108
msgid "Screws Adjust"
msgstr "סידור ברגים"
#: panels/fan.py:42
msgid "Set Speed"
msgstr "קבע מהירות"
#: ks_includes/KlipperScreen.conf:144
#, fuzzy
msgid "Settings"
msgstr "הגדרות KS"
#: panels/print.py:120
msgid "Size"
msgstr "גודל"
#: panels/extrude.py:30
msgid "Slow"
msgstr "האט"
#: panels/fine_tune.py:47
msgid "Speed +"
msgstr "מהירות +"
#: panels/fine_tune.py:51
msgid "Speed -"
msgstr "מהירות -"
#: ks_includes/KlipperScreen.conf:129 ks_includes/KlipperScreen.conf:178
msgid "System"
msgstr "מערכת"
#: panels/extrude.py:49 ks_includes/KlipperScreen.conf:84
#: ks_includes/KlipperScreen.conf:152
msgid "Temperature"
msgstr "טמפרטורה"
#: panels/extrude.py:37
msgid "Tool"
msgstr "כלי"
#: panels/print.py:118
msgid "Uploaded"
msgstr "הועלה"
#: panels/move.py:25
msgid "X+"
msgstr "X+"
#: panels/move.py:27
msgid "X-"
msgstr "X-"
#: panels/move.py:30
msgid "Y+"
msgstr "Y+"
#: panels/move.py:32
msgid "Y-"
msgstr "Y-"
#: ks_includes/KlipperScreen.conf:118
msgid "Z Calibrate"
msgstr "כיול Z"
#: panels/zcalibrate.py:28
msgid "Z Offset"
msgstr "הפרז גובה Z"
#: panels/fine_tune.py:36 panels/move.py:35
msgid "Z+"
msgstr "Z+"
#: panels/fine_tune.py:40 panels/move.py:37
msgid "Z-"
msgstr "Z-"
#: panels/fine_tune.py:38
msgid "mm"
msgstr "מ''מ"
#~ msgid "Back"
#~ msgstr "חזור"
#~ msgid "Extrusion"
#~ msgstr "שיחול"
#~ msgid "Fan +"
#~ msgstr "מאוורר +"
#~ msgid "Fan -"
#~ msgstr "מאוורר -"
#~ msgid "Speed"
#~ msgstr "מהירות"
#~ msgid "System Information"
#~ msgstr "מידע אודות המערכת"
#~ msgid "Time Elapsed"
#~ msgstr "זמן שעבר"
#~ msgid "Time Left"
#~ msgstr "זמן שנשאר"
#~ msgid "Tool 1"
#~ msgstr "כלי 1"
@@ -0,0 +1,470 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-07 05:48+0000\n"
"PO-Revision-Date: 2021-01-06 00:35+0200\n"
"Last-Translator: Emanuel Sharvit <manu7irl@gmail.com>\n"
"Language-Team: \n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.4.2\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: panels/print.py:197
msgid "?"
msgstr "?"
#: panels/zcalibrate.py:70
msgid "Abort"
msgstr "中止"
#: panels/zcalibrate.py:67
msgid "Accept"
msgstr "接受"
#: ks_includes/KlipperScreen.conf:26
msgid "Actions"
msgstr "动作"
#: panels/print.py:197
msgid "Are you sure you want to print"
msgstr "您确定要打印吗"
#: panels/job_status.py:305
msgid "Are you sure you wish to cancel this print?"
msgstr "您要取消此打印吗?"
#: ks_includes/KlipperScreen.conf:107
msgid "Bed Level"
msgstr "床位"
#: ks_includes/KlipperScreen.conf:112
msgid "Bed Mesh"
msgstr "床网"
#: screen.py:455 panels/job_status.py:267 panels/print.py:193
msgid "Cancel"
msgstr "取消"
#: panels/fan.py:45
msgid "Cancel Change"
msgstr "取消变更"
#: panels/job_status.py:300
msgid "Cancel Print"
msgstr "取消列印"
#: screen.py:289
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"检查/tmp/KlipperScreen.log以获取更多信息。\n"
"请在GitHub上提交问题以寻求帮助。"
#: panels/bed_mesh.py:172 panels/temperature.py:149
msgid "Close"
msgstr "关"
#: ks_includes/KlipperScreen.conf:30
msgid "Configuration"
msgstr "组态"
#: screen.py:454
msgid "Continue"
msgstr "继续"
#: panels/job_status.py:269
msgid "Control"
msgstr "控制"
#: panels/preheat.py:54
msgid "Cooldown"
msgstr "冷却"
#: panels/temperature.py:53
msgid "Decrease"
msgstr "减少"
#: ks_includes/KlipperScreen.conf:101
msgid "Disable Motors"
msgstr "禁用马达"
#: panels/bed_level.py:101
msgid "Disable XY"
msgstr "禁用XY"
#: panels/settings.py:32
msgid "Displayed Macros"
msgstr ""
#: panels/zcalibrate.py:63
msgid "Distance (mm)"
msgstr "距离(毫米)"
#: panels/job_status.py:135
msgid "Elapsed:"
msgstr "过去"
#: panels/job_status.py:271
msgid "Emergency Stop"
msgstr "紧急停止"
#: panels/extrude.py:45 ks_includes/KlipperScreen.conf:74
#: ks_includes/KlipperScreen.conf:167
msgid "Extrude"
msgstr "拉伸"
#: panels/fine_tune.py:57
msgid "Extrusion +"
msgstr "挤压+"
#: panels/fine_tune.py:61
msgid "Extrusion -"
msgstr "挤压-"
#: ks_includes/KlipperScreen.conf:79 ks_includes/KlipperScreen.conf:162
msgid "Fan"
msgstr "风扇"
#: panels/fan.py:35
msgid "Fan Off"
msgstr "散开"
#: panels/fan.py:38
msgid "Fan On"
msgstr "扇上"
#: panels/extrude.py:30
msgid "Fast"
msgstr "快速"
#: ks_includes/KlipperScreen.conf:157
msgid "Fine Tuning"
msgstr "微调"
#: panels/splash_screen.py:62 panels/system.py:24
msgid "Firmware Restart"
msgstr "固件重启"
#: screen.py:284 panels/job_status.py:301
msgid "Go Back"
msgstr "回去"
#: panels/bed_level.py:98 panels/move.py:40 ks_includes/KlipperScreen.conf:39
msgid "Home All"
msgstr "全部回家"
#: ks_includes/KlipperScreen.conf:45
msgid "Home X"
msgstr "X家庭"
#: ks_includes/KlipperScreen.conf:63
msgid "Home XY"
msgstr "XY首页"
#: ks_includes/KlipperScreen.conf:51
msgid "Home Y"
msgstr "Y家"
#: ks_includes/KlipperScreen.conf:57
msgid "Home Z"
msgstr "Z家"
#: panels/zcalibrate.py:29 ks_includes/KlipperScreen.conf:17
msgid "Homing"
msgstr "归巢"
#: panels/temperature.py:51
msgid "Increase"
msgstr "增加"
#. self._load_panels()
#: screen.py:136
msgid "Initializing"
msgstr "Initializing"
#: panels/splash_screen.py:23
msgid "Initializing printer..."
msgstr "初始化打印机..."
#: ks_includes/config.py:26
msgid "Invert X"
msgstr ""
#: ks_includes/config.py:27
msgid "Invert Y"
msgstr ""
#: ks_includes/config.py:28
msgid "Invert Z"
msgstr ""
#: panels/system.py:22
msgid "Klipper Restart"
msgstr "快闪重启"
#: panels/system.py:35
msgid "Klipper Version"
msgstr "快艇版本"
#: screen.py:384
msgid "Klipper has disconnected"
msgstr "Klipper已断开连接"
#: screen.py:395
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
"Klipper的微控制器出错。\n"
"请重新编译并刷新。"
#: screen.py:399
msgid "Klipper has encountered an error."
msgstr "Klipper遇到错误。"
#: screen.py:391
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"Klipper遇到错误。\n"
"发出FIRMWARE_RESTART尝试解决此问题。"
#: screen.py:417
msgid "Klipper has shutdown"
msgstr "Klipper已关闭"
#: screen.py:413
msgid "Klipper is attempting to start"
msgstr "Klipper正在尝试启动"
#: ks_includes/KlipperScreen.conf:141
msgid "Klipper will reboot"
msgstr "Klipper将重新启动"
#: panels/system.py:39
msgid "KlipperScreen Version"
msgstr "KlipperScreen版本"
#: panels/job_status.py:123
msgid "Left:"
msgstr "剩下的时间"
#: panels/system.py:57
msgid "Load Average"
msgstr "平均负载"
#: panels/zcalibrate.py:39
msgid "Lower Nozzle"
msgstr "下喷嘴"
#: ks_includes/KlipperScreen.conf:89
msgid "Macros"
msgstr "巨集"
#: panels/job_status.py:273 ks_includes/KlipperScreen.conf:14
msgid "Main Menu"
msgstr "主菜单"
#: panels/extrude.py:30
msgid "Medium"
msgstr "中"
#: ks_includes/KlipperScreen.conf:69
msgid "Move"
msgstr "移动"
#: panels/move.py:86
msgid "Move Distance (mm)"
msgstr "移动距离(mm)"
#: ks_includes/KlipperScreen.conf:124 ks_includes/KlipperScreen.conf:173
msgid "Network"
msgstr "网络"
#: panels/network.py:31
msgid "Network Info"
msgstr "网络信息"
#: panels/temperature.py:55
msgid "Number Pad"
msgstr "数字键盘"
#: panels/job_status.py:275
msgid "Pause"
msgstr "暂停"
#: panels/job_status.py:454
msgid "Paused"
msgstr "已暂停"
#: ks_includes/KlipperScreen.conf:95
msgid "Power"
msgstr "功率"
#: panels/splash_screen.py:59
msgid "Power On Printer"
msgstr "开启打印机电源"
#: ks_includes/KlipperScreen.conf:21
msgid "Preheat"
msgstr "预热"
#: panels/print.py:192 ks_includes/KlipperScreen.conf:34
msgid "Print"
msgstr "打印"
#: ks_includes/KlipperScreen.conf:149
msgid "Print Control"
msgstr "打印控制"
#: panels/print.py:122
msgid "Print Time"
msgstr "打印时间"
#: panels/job_status.py:231
msgid "Printing"
msgstr "印刷"
#: panels/zcalibrate.py:37
msgid "Raise Nozzle"
msgstr "升高喷嘴"
#: panels/job_status.py:277 panels/splash_screen.py:60
msgid "Restart"
msgstr "重新开始"
#: panels/job_status.py:279
msgid "Resume"
msgstr "恢复"
#: panels/extrude.py:47
msgid "Retract"
msgstr "缩回"
#: ks_includes/KlipperScreen.conf:134
msgid "Save Config"
msgstr "保存配置"
#: ks_includes/KlipperScreen.conf:139
msgid "Save configuration."
msgstr "保存配置"
#: panels/bed_level.py:108
msgid "Screws Adjust"
msgstr "螺丝调整"
#: panels/fan.py:42
msgid "Set Speed"
msgstr "设定速度"
#: ks_includes/KlipperScreen.conf:144
#, fuzzy
msgid "Settings"
msgstr "KS设置"
#: panels/print.py:120
msgid "Size"
msgstr "尺寸"
#: panels/extrude.py:30
msgid "Slow"
msgstr "慢"
#: panels/fine_tune.py:47
msgid "Speed +"
msgstr "速度 +"
#: panels/fine_tune.py:51
msgid "Speed -"
msgstr "速度 -"
#: ks_includes/KlipperScreen.conf:129 ks_includes/KlipperScreen.conf:178
msgid "System"
msgstr "系统"
#: panels/extrude.py:49 ks_includes/KlipperScreen.conf:84
#: ks_includes/KlipperScreen.conf:152
msgid "Temperature"
msgstr "温度"
#: panels/extrude.py:37
msgid "Tool"
msgstr "工具"
#: panels/print.py:118
msgid "Uploaded"
msgstr "已上传"
#: panels/move.py:25
msgid "X+"
msgstr "X+"
#: panels/move.py:27
msgid "X-"
msgstr "X-"
#: panels/move.py:30
msgid "Y+"
msgstr "Y ="
#: panels/move.py:32
msgid "Y-"
msgstr "Y-"
#: ks_includes/KlipperScreen.conf:118
msgid "Z Calibrate"
msgstr "Z校准"
#: panels/zcalibrate.py:28
msgid "Z Offset"
msgstr "Z偏移"
#: panels/fine_tune.py:36 panels/move.py:35
msgid "Z+"
msgstr "Z+"
#: panels/fine_tune.py:40 panels/move.py:37
msgid "Z-"
msgstr "Z-"
#: panels/fine_tune.py:38
msgid "mm"
msgstr "毫米"
#~ msgid "Back"
#~ msgstr "背部"
#~ msgid "Extrusion"
#~ msgstr "挤压"
#~ msgid "Fan +"
#~ msgstr "风扇+"
#~ msgid "Fan -"
#~ msgstr "风扇-"
#~ msgid "Speed"
#~ msgstr "速度"
#~ msgid "System Information"
#~ msgstr "系统信息"
#~ msgid "Time Elapsed"
#~ msgstr "时间流逝"
#~ msgid "Time Left"
#~ msgstr "剩下的时间"
#~ msgid "Tool 1"
#~ msgstr "工具1"
+255
View File
@@ -0,0 +1,255 @@
import logging
logger = logging.getLogger("KlipperScreen.Printer")
class Printer:
state_callbacks = {
"disconnected": None,
"error": None,
"paused": None,
"printing": None,
"ready": None,
"startup": None,
"shutdown": None
}
def __init__(self, printer_info, data):
self.state = "disconnected"
self.power_devices = {}
def reinit(self, printer_info, data):
logger.debug("Moonraker object status: %s" % data)
self.config = data['configfile']['config']
self.toolcount = 0
self.extrudercount = 0
self.tools = []
self.devices = {}
self.data = data
self.klipper = {}
self.klipper = {
"version": printer_info['software_version']
}
for x in self.config.keys():
if x[0:8] == "extruder":
if x.startswith('extruder_stepper'):
continue
self.devices[x] = {
"temperature": 0,
"target": 0
}
self.tools.append(x)
self.tools = sorted(self.tools)
self.toolcount += 1
if "shared_heater" in self.config[x]:
continue
self.extrudercount += 1
if x.startswith('heater_bed'):
self.devices[x] = {
"temperature": 0,
"target": 0
}
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")]
self.process_update(data)
logger.info("Klipper version: %s", self.klipper['version'])
logger.info("### Toolcount: " + str(self.toolcount) + " Heaters: " + str(self.extrudercount))
def process_update(self, data):
keys = [
'bed_mesh',
'fan',
'gcode_move',
'idle_timeout',
'pause_resume',
'print_stats',
'toolhead',
'virtual_sdcard',
'webhooks'
]
for x in keys:
if x in data:
if x not in self.data:
self.data[x] = {}
for y in data[x]:
self.data[x][y] = data[x][y]
if "heater_bed" in data:
d = data["heater_bed"]
if "target" in d:
self.set_dev_stat("heater_bed", "target", d["target"])
if "temperature" in d:
self.set_dev_stat("heater_bed", "temperature", d["temperature"])
for x in self.get_tools():
if x in data:
d = data[x]
if "target" in d:
self.set_dev_stat(x, "target", d["target"])
if "temperature" in d:
self.set_dev_stat(x, "temperature", d["temperature"])
if "webhooks" in data or "idle_timeout" in data or "pause_resume" in data or "print_stats" in data:
self.evaluate_state()
def evaluate_state(self):
wh_state = self.data['webhooks']['state'] # possible values: startup, ready, shutdown, error
idle_state = self.data['idle_timeout']['state'].lower() # possible values: Idle, printing, ready
print_state = self.data['print_stats']['state'] # possible values: complete, paused, printing, standby
if wh_state == "ready":
new_state = "ready"
if idle_state == "printing" and print_state != "printing": # Not printing a file, toolhead moving
new_state = "busy"
elif idle_state == "printing" and print_state == "printing":
new_state = "printing"
elif print_state == "paused":
new_state = "paused"
if new_state != "busy":
self.change_state(new_state)
else:
self.change_state(wh_state)
def process_power_update(self, data):
if data['device'] in self.power_devices:
self.power_devices[data['device']]['status'] = data['status']
def change_state(self, state):
if state == self.state or state not in list(self.state_callbacks):
return
logger.debug("Changing state from '%s' to '%s'" % (self.state, state))
self.state = state
if self.state_callbacks[state] != None:
logger.debug("Running callback for state: %s" % state)
self.state_callbacks[state]()
def configure_power_devices(self, data):
self.power_devices = {}
logger.debug("Processing power devices: %s" % data)
for x in data['devices']:
logger.debug(x)
self.power_devices[x['device']] = {
"status": "on" if x['status'] == "on" else "off"
}
logger.debug("Power devices: %s" % self.power_devices)
def config_section_exists(self, section):
return section in list(self.config)
def get_config_section_list(self, search=""):
return [i for i in list(self.config) if i.startswith(search)]
def get_config_section(self, section):
if section not in self.config:
return False
return self.config[section]
def get_data(self):
return self.data
def get_gcode_macros(self):
return self.get_config_section_list("gcode_macro ")
def get_printer_status_data(self):
data = {
"printer": {
"bltouch": self.section_exists("bltouch"),
"gcode_macros": {
"count": len(self.get_gcode_macros())
},
"idle_timeout": self.get_stat("idle_timeout").copy(),
"pause_resume": self.get_stat("pause_resume").copy(),
"power_devices": {
"count": len(self.get_power_devices())
},
"probe": self.section_exists("probe")
}
}
sections = ["bed_mesh","bltouch","probe"]
for section in sections:
if self.config_section_exists(section):
data["printer"][section] = self.get_config_section(section).copy()
return data
def get_klipper_version(self):
return self.klipper['version']
def get_power_devices(self):
return list(self.power_devices)
def get_power_device_status(self, device):
if device not in self.power_devices:
return
return self.power_devices[device]['status']
def get_stat(self, stat, substat = None):
if stat not in self.data:
return None
if substat != None:
if substat in self.data[stat]:
return self.data[stat][substat]
return None
return self.data[stat]
def get_state(self):
return self.state
def set_dev_temps(self, dev, temp, target=None):
if dev in self.devices:
self.devices[dev]['temperature'] = temp
if target != None:
self.devices[dev]['target'] = target
def get_dev_stats(self, dev):
if dev in self.devices:
return self.devices[dev]
return None
def get_dev_stat(self, dev, stat):
if dev in self.devices and stat in self.devices[dev]:
return self.devices[dev][stat]
return None
def get_extruder_count(self):
return self.extrudercount
def get_tools(self):
return self.tools
def get_tool_number(self, tool):
return self.tools.index(tool)
def has_heated_bed(self):
if "heater_bed" in self.devices:
return True
def section_exists(self, section):
if section in self.get_config_section_list():
return True
return False
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
self.devices[dev][stat] = value
+110
View File
@@ -0,0 +1,110 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from jinja2 import Environment, Template
from ks_includes.KlippyGtk import KlippyGtk
from ks_includes.KlippyGcodes import KlippyGcodes
logger = logging.getLogger("KlipperScreen.ScreenPanel")
class ScreenPanel:
title_spacing = 50
control = {}
def __init__(self, screen, title, back=True):
self._screen = screen
self._config = screen._config
self._files = screen.files
self.lang = self._screen.lang
self._printer = screen.printer
self.labels = {}
self._gtk = screen.gtk
self.layout = Gtk.Layout()
self.layout.set_size(self._screen.width, self._screen.height)
button_scale = self._gtk.get_header_image_scale()
logger.debug("Button scale: %s" % button_scale)
if back == True:
self.control['back'] = self._gtk.ButtonImage('back', None, None, button_scale[0], button_scale[1])
self.control['back'].connect("clicked", self._screen._menu_go_back)
self.layout.put(self.control['back'], 0, 0)
self.control['home'] = self._gtk.ButtonImage('home', None, None, button_scale[0], button_scale[1])
self.control['home'].connect("clicked", self.menu_return, True)
self.layout.put(self.control['home'], self._screen.width - round(
self._gtk.get_image_width() * button_scale[0] * 1.45), 0)
self.control['estop'] = self._gtk.ButtonImage('emergency', None, None, button_scale[0], button_scale[1])
self.control['estop'].connect("clicked", self.emergency_stop)
self.layout.put(self.control['estop'], int(self._screen.width/4*3 - button_scale[0]/2), 0)
try:
env = Environment(extensions=["jinja2.ext.i18n"])
env.install_gettext_translations(self.lang)
j2_temp = env.from_string(title)
title = j2_temp.render()
except:
logger.debug("Error parsing jinja for title: %s" % title)
self.title = Gtk.Label()
self.title.set_size_request(self._screen.width, self.title_spacing)
self.title.set_hexpand(True)
self.title.set_halign(Gtk.Align.CENTER)
self.title.set_valign(Gtk.Align.CENTER)
self.set_title(title)
self.layout.put(self.title, 0, 0)
self.content = Gtk.Box(spacing=0)
self.content.set_size_request(self._screen.width, self._screen.height - self.title_spacing)
self.layout.put(self.content, 0, self.title_spacing)
def initialize(self, panel_name):
# Create gtk items here
return
def emergency_stop(self, widget):
self._screen._ws.klippy.emergency_stop()
def get(self):
return self.layout
def get_file_image(self, filename, width=1.6, height=1.6):
if not self._files.has_thumbnail(filename):
return None
return self._gtk.PixbufFromFile(self._files.get_thumbnail_location(filename), None, width, height)
def home(self, widget):
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
def menu_item_clicked(self, widget, panel, item):
print("### Creating panel "+ item['panel'])
if "items" in item:
self._screen.show_panel(self._screen._cur_panels[-1] + '_' + item['name'], item['panel'], item['name'],
1, False, items=item['items'])
return
self._screen.show_panel(self._screen._cur_panels[-1] + '_' + item['name'], item['panel'], item['name'],
1, False)
def menu_return(self, widget, home=False):
if home == False:
self._screen._menu_go_back()
return
self._screen._menu_go_home()
def set_title(self, title):
self.title.set_label(title)
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 update_temp(self, dev, temp, target):
if dev in self.labels:
self.labels[dev].set_label(self._gtk.formatTemperatureString(temp, target))
+89 -42
View File
@@ -5,41 +5,64 @@ import re
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGcodes import KlippyGcodes
from KlippyGtk import KlippyGtk
from panels.screen_panel import ScreenPanel
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.BedLevelPanel")
def create_panel(*args):
return BedLevelPanel(*args)
class BedLevelPanel(ScreenPanel):
def initialize(self, menu):
x_offset = 0
y_offset = 0
def initialize(self, panel_name):
_ = self.lang.gettext
self.panel_name = panel_name
self.screws = None
self.panel = KlippyGtk.HomogeneousGrid()
grid = self._gtk.HomogeneousGrid()
self.disabled_motors = False
screws = []
if "bed_screws" in self._screen.printer.get_config_section_list():
bed_screws = self._screen.printer.get_config_section("bed_screws")
for item in bed_screws:
if re.match(r"^[0-9\.]+,[0-9\.]+$", bed_screws[item]):
screws.append(bed_screws[item].split(","))
config_section_name = None
if "screws_tilt_adjust" in self._screen.printer.get_config_section_list():
config_section_name = "screws_tilt_adjust"
elif "bed_screws" in self._screen.printer.get_config_section_list():
config_section_name = "bed_screws"
if config_section_name != None:
config_section = self._screen.printer.get_config_section(config_section_name)
for item in config_section:
logger.debug("Screws section: %s" % config_section[item])
result = re.match(r"([0-9\.]+)\s*,\s*([0-9\.]+)", config_section[item])
if result:
screws.append([
round(float(result.group(1)),2),
round(float(result.group(2)),2)
])
screws = sorted(screws, key=lambda x: (float(x[1]), float(x[0])))
logger.debug("Bed screw locations [x,y]: %s", screws)
if "bltouch" in self._screen.printer.get_config_section_list():
if ("bltouch" in self._screen.printer.get_config_section_list() and
config_section_name == "screws_tilt_adjust"):
x_offset = 0
y_offset = 0
bltouch = self._screen.printer.get_config_section("bltouch")
if "x_offset" in bltouch:
x_offset = float(bltouch['x_offset'])
self.x_offset = float(bltouch['x_offset'])
if "y_offset" in bltouch:
y_offset = float(bltouch['y_offset'])
self.y_offset = float(bltouch['y_offset'])
new_screws = []
for screw in screws:
new_screws.append([float(screw[0]) + x_offset, float(screw[1]) + y_offset])
new_screws.append([
round(float(screw[0]) + self.x_offset,2),
round(float(screw[1]) + self.y_offset,2)
])
screws = new_screws
self.screws = screws
logger.debug("Screws: %s" % screws)
if len(screws) < 4:
logger.debug("bed_screws not configured, calculating locations")
@@ -47,7 +70,7 @@ class BedLevelPanel(ScreenPanel):
yconf = self._screen.printer.get_config_section("stepper_y")
x = int(int(xconf['position_max'])/4)
y = int(int(yconf['position_max'])/4)
screws = [
self.screws = [
[x, y],
[x*3, y],
[x, y*3],
@@ -58,36 +81,41 @@ class BedLevelPanel(ScreenPanel):
logger.debug("Configured screw locations [x,y]: %s", screws)
self.labels['tl'] = KlippyGtk.ButtonImage("bed-level-t-l")
self.labels['tl'].connect("clicked", self.go_to_position, self.screws[2])
self.labels['tr'] = KlippyGtk.ButtonImage("bed-level-t-r")
self.labels['tr'].connect("clicked", self.go_to_position, self.screws[3])
self.labels['bl'] = KlippyGtk.ButtonImage("bed-level-b-l")
self.labels['bl'].connect("clicked", self.go_to_position, self.screws[0])
self.labels['br'] = KlippyGtk.ButtonImage("bed-level-b-r")
self.labels['br'].connect("clicked", self.go_to_position, self.screws[1])
self.labels['bl'] = self._gtk.ButtonImage("bed-level-t-l", None, None, 3, 3)
self.labels['bl'].connect("clicked", self.go_to_position, self.screws[2])
self.labels['br'] = self._gtk.ButtonImage("bed-level-t-r", None, None, 3, 3)
self.labels['br'].connect("clicked", self.go_to_position, self.screws[3])
self.labels['fl'] = self._gtk.ButtonImage("bed-level-b-l", None, None, 3, 3)
self.labels['fl'].connect("clicked", self.go_to_position, self.screws[0])
self.labels['fr'] = self._gtk.ButtonImage("bed-level-b-r", None, None, 3, 3)
self.labels['fr'].connect("clicked", self.go_to_position, self.screws[1])
self.panel.attach(self.labels['tl'], 1, 0, 1, 1)
self.panel.attach(self.labels['tr'], 2, 0, 1, 1)
self.panel.attach(self.labels['bl'], 1, 1, 1, 1)
self.panel.attach(self.labels['br'], 2, 1, 1, 1)
grid.attach(self.labels['bl'], 1, 0, 1, 1)
grid.attach(self.labels['br'], 2, 0, 1, 1)
grid.attach(self.labels['fl'], 1, 1, 1, 1)
grid.attach(self.labels['fr'], 2, 1, 1, 1)
self.labels['home'] = KlippyGtk.ButtonImage("home","Home All","color2")
self.labels['home'] = self._gtk.ButtonImage("home",_("Home All"),"color2")
self.labels['home'].connect("clicked", self.home)
self.labels['dm'] = KlippyGtk.ButtonImage("motor-off", "Disable XY", "color3")
self.labels['dm'] = self._gtk.ButtonImage("motor-off", _("Disable XY"), "color3")
self.labels['dm'].connect("clicked", self.disable_motors)
self.panel.attach(self.labels['home'], 0, 0, 1, 1)
self.panel.attach(self.labels['dm'], 0, 1, 1, 1)
grid.attach(self.labels['home'], 0, 0, 1, 1)
grid.attach(self.labels['dm'], 0, 1, 1, 1)
self.labels['estop'] = KlippyGtk.ButtonImage("decrease","Emergency Stop","color4")
self.labels['estop'].connect("clicked", self.emergency_stop)
self.panel.attach(self.labels['estop'], 3, 0, 1, 1)
if self._printer.config_section_exists("screws_tilt_adjust"):
self.labels['screws'] = self._gtk.ButtonImage("refresh",_("Screws Adjust"),"color4")
self.labels['screws'].connect("clicked", self.screws_tilt_calculate)
grid.attach(self.labels['screws'], 3, 0, 1, 1)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
self.panel.attach(b, 3, 1, 1, 1)
self.content.add(grid)
def activate(self):
self.labels['bl'].set_label("")
self.labels['br'].set_label("")
self.labels['fl'].set_label("")
self.labels['fr'].set_label("")
def go_to_position(self, widget, position):
logger.debug("Going to position: %s", position)
@@ -111,10 +139,29 @@ class BedLevelPanel(ScreenPanel):
"M18" # Disable motors
)
def process_update(self, action, data):
if action == "notify_gcode_response":
result = re.match(
"^// (.*) : X ([0-9\.]+), Y ([0-9\.]+), Z [0-9\.]+ : Adjust -> ([CW]+ [0-9:]+)",
data
)
if result:
screw_labels = ['fl','fr','br','bl']
x = int(float(result.group(2)) + self.x_offset)
y = int(float(result.group(3)) + self.y_offset)
logger.debug(data)
logger.debug("X: %s Y: %s" % (x,y))
for i in range(len(self.screws)):
logger.debug(self.screws[i])
if x == int(float(self.screws[i][0])) and y == int(float(self.screws[i][1])):
break
self.labels[screw_labels[i]].set_label(result.group(4))
self.response_count += 1
if self.response_count >= len(self.screws)-1:
self._screen.remove_subscription(self.panel_name)
#for screw in screws:
# sorted(screws.items(), key=lambda x: (float(x[1].split(",")[0]), float(x[1].split(",")[1])))
def screws_tilt_calculate(self, widget):
self.response_count = 0
self._screen.add_subscription(self.panel_name)
self._screen._ws.klippy.gcode_script("SCREWS_TILT_CALCULATE")
+177
View File
@@ -0,0 +1,177 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.BedMeshPanel")
def create_panel(*args):
return BedMeshPanel(*args)
class BedMeshPanel(ScreenPanel):
active_mesh = None
graphs = {}
def initialize(self, panel_name):
_ = self.lang.gettext
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
# Create a grid for all profiles
self.labels['profiles'] = Gtk.Grid()
scroll.add(self.labels['profiles'])
# Create a box to contain all of the above
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
box.pack_start(scroll, True, True, 0)
self.load_meshes()
self.content.add(box)
self._screen.add_subscription(panel_name)
def activate(self):
am = self._screen.printer.get_stat("bed_mesh","profile_name")
self.activate_mesh(am)
def activate_mesh(self, profile):
if profile == "":
profile = None
logger.debug("Activating profile: %s %s" % (self.active_mesh, profile))
if profile != self.active_mesh:
if self.active_mesh != None:
a = self.profiles[self.active_mesh]
a['buttons'].remove(a['refresh'])
a['buttons'].pack_start(a['load'], False, False, 0)
self.active_mesh = profile
if self.active_mesh != None:
a = self.profiles[profile]
a['buttons'].remove(a['load'])
a['buttons'].pack_start(a['refresh'], False, False, 0)
self._screen.show_all()
def add_profile(self, profile):
frame = Gtk.Frame()
frame.set_property("shadow-type",Gtk.ShadowType.NONE)
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big>" % (profile))
name.set_hexpand(True)
name.set_vexpand(True)
name.set_halign(Gtk.Align.START)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
load = self._gtk.ButtonImage("load","Load","color2")
load.connect("clicked", self.send_load_mesh, profile)
load.set_size_request(60,0)
load.set_hexpand(False)
load.set_halign(Gtk.Align.END)
refresh = self._gtk.ButtonImage("refresh","Calibrate","color4")
refresh.connect("clicked", self.calibrate_mesh)
refresh.set_size_request(60,0)
refresh.set_hexpand(False)
refresh.set_halign(Gtk.Align.END)
info = self._gtk.ButtonImage("info",None,"color3")
info.connect("clicked", self.show_mesh, profile)
info.set_size_request(60,0)
info.set_hexpand(False)
info.set_halign(Gtk.Align.END)
save = self._gtk.ButtonImage("sd","Save","color3")
save.connect("clicked", self.send_save_mesh, profile)
save.set_size_request(60,0)
save.set_hexpand(False)
save.set_halign(Gtk.Align.END)
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_margin_top(10)
dev.set_margin_end(15)
dev.set_margin_start(15)
dev.set_margin_bottom(10)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.add(labels)
buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
logger.debug("Profile compare: '%s' '%s'" % (self.active_mesh, profile))
if self.active_mesh == profile:
buttons.pack_start(refresh, False, False, 0)
else:
buttons.pack_start(load, False, False, 0)
#buttons.pack_end(info, False, False, 0)
if profile != "default":
buttons.pack_end(save, False, False, 0)
dev.add(buttons)
frame.add(dev)
self.profiles[profile] = {
"box": dev,
"buttons": buttons,
"row": frame,
"load": load,
"refresh": refresh,
"save": save
}
profiles = sorted(self.profiles)
pos = profiles.index(profile)
self.labels['profiles'].insert_row(pos)
self.labels['profiles'].attach(self.profiles[profile]['row'], 0, pos, 1, 1)
self.labels['profiles'].show_all()
#Gdk.threads_add_idle(GLib.PRIORITY_LOW, self.create_graph, profile)
def calibrate_mesh(self, widget):
self._screen._ws.klippy.gcode_script(
"BED_MESH_CALIBRATE"
)
def load_meshes(self):
bm_profiles = self._screen.printer.get_config_section_list("bed_mesh ")
self.profiles = {}
for prof in bm_profiles:
self.add_profile(prof[9:])
def process_update(self, action, data):
if action == "notify_status_update":
if "bed_mesh" in data and "profile_name" in data['bed_mesh']:
if data['bed_mesh']['profile_name'] != self.active_mesh:
self.activate_mesh(data['bed_mesh']['profile_name'])
def send_load_mesh(self, widget, 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)
)
def show_mesh(self, widget, profile):
_ = self.lang.gettext
buttons = [
{"name": _("Close"), "response": Gtk.ResponseType.CANCEL}
]
dialog = self._gtk.Dialog(self._screen, buttons, self.graphs[profile], self._close_dialog)
def _close_dialog(self, widget, response):
widget.destroy()
+20 -13
View File
@@ -1,13 +1,20 @@
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
class ExamplePanel(ScreenPanel):
def initialize(self, panel_name):
# Create gtk items here
return
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.ExamplePanel")
def create_panel(*args):
return ExamplePanel(*args)
class ExamplePanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
# Create gtk items here
self.content.add(Gtk.Box())
+49 -30
View File
@@ -4,45 +4,55 @@ import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.ExtrudePanel")
def create_panel(*args):
return ExtrudePanel(*args)
class ExtrudePanel(ScreenPanel):
distance = 1
distances = ['1','5','10','25']
speed = "Medium"
speeds = ["Slow", "Medium", "Fast"]
speed_trans = {
"Slow": "300",
"Medium": "800",
"Fast": "1400"
}
def initialize(self, panel_name):
_ = self.lang.gettext
grid = KlippyGtk.HomogeneousGrid()
self.speed = "Medium"
self.speeds = ["Slow", "Medium", "Fast"]
self.speed_trans = {
"Slow": "300",
"Medium": "800",
"Fast": "1400"
}
# This line for translations only
speed_translations = [_("Slow"), _("Medium"), _("Fast")]
grid = self._gtk.HomogeneousGrid()
i = 0
self.current_extruder = self._printer.get_stat("toolhead","extruder")
for extruder in self._printer.get_tools():
self.labels[extruder] = self._gtk.ButtonImage("extruder-%s" % i,_("Tool") + " %s" %str(i),"color1")
self.labels[extruder].connect("clicked", self.change_extruder, extruder)
if extruder == self.current_extruder:
self.labels[extruder].get_style_context().add_class("button_active")
if i <= 3:
grid.attach(self.labels[extruder], i, 0, 1, 1)
i += 1
self.labels['tool0'] = KlippyGtk.ButtonImage("extruder-1","Tool 1","color1")
self.labels['tool0'].get_style_context().add_class("button_active")
self.labels['extrude'] = KlippyGtk.ButtonImage("extrude","Extrude","color3")
self.labels['extrude'] = self._gtk.ButtonImage("extrude",_("Extrude"),"color3")
self.labels['extrude'].connect("clicked", self.extrude, "+")
self.labels['retract'] = KlippyGtk.ButtonImage("extrude","Retract","color2")
self.labels['retract'] = self._gtk.ButtonImage("retract",_("Retract"),"color2")
self.labels['retract'].connect("clicked", self.extrude, "-")
self.labels['temperature'] = KlippyGtk.ButtonImage("heat-up","Temperature","color4")
self.labels['temperature'] = self._gtk.ButtonImage("heat-up",_("Temperature"),"color4")
self.labels['temperature'].connect("clicked", self.menu_item_clicked, "temperature", {
"name": "Temperature",
"panel": "temperature"
})
grid.attach(self.labels['tool0'], 0, 0, 1, 1)
grid.attach(self.labels['extrude'], 0, 1, 1, 1)
grid.attach(self.labels['retract'], 3, 1, 1, 1)
grid.attach(self.labels['temperature'], 0, 2, 1, 1)
@@ -51,7 +61,7 @@ class ExtrudePanel(ScreenPanel):
distgrid = Gtk.Grid()
j = 0;
for i in self.distances:
self.labels["dist"+str(i)] = KlippyGtk.ToggleButton(i)
self.labels["dist"+str(i)] = self._gtk.ToggleButton(i)
self.labels["dist"+str(i)].connect("clicked", self.change_distance, i)
ctx = self.labels["dist"+str(i)].get_style_context()
if j == 0:
@@ -69,7 +79,7 @@ class ExtrudePanel(ScreenPanel):
speedgrid = Gtk.Grid()
j = 0;
for i in self.speeds:
self.labels["speed"+str(i)] = KlippyGtk.ToggleButton(i)
self.labels["speed"+str(i)] = self._gtk.ToggleButton(_(i))
self.labels["speed"+str(i)].connect("clicked", self.change_speed, i)
ctx = self.labels["speed"+str(i)].get_style_context()
if j == 0:
@@ -90,23 +100,26 @@ class ExtrudePanel(ScreenPanel):
grid.attach(box, 1, 2, 2, 1)
b = KlippyGtk.ButtonImage("back", "Back")
b.connect("clicked", self._screen._menu_go_back)
grid.attach(b, 3, 2, 1, 1)
self.panel = grid
self.content.add(grid)
self._screen.add_subscription(panel_name)
def process_update(self, data):
def process_update(self, action, data):
if action != "notify_status_update":
return
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
self._printer.get_dev_stat(x,"target")
)
if ("toolhead" in data and "extruder" in data["toolhead"] and
data["toolhead"]["extruder"] != self.current_extruder):
for extruder in self._printer.get_tools():
self.labels[extruder].get_style_context().remove_class("button_active")
self.current_extruder = data["toolhead"]["extruder"]
self.labels[self.current_extruder].get_style_context().add_class("button_active")
def change_distance(self, widget, distance):
if self.distance == distance:
return
@@ -123,6 +136,12 @@ class ExtrudePanel(ScreenPanel):
continue
self.labels["dist"+str(i)].set_active(False)
def change_extruder(self, widget, extruder):
if extruder == self.current_extruder:
return
self._screen._ws.klippy.gcode_script("T%s" % self._printer.get_tool_number(extruder))
def change_speed(self, widget, speed):
if self.speed == speed:
return
+32 -25
View File
@@ -4,18 +4,22 @@ import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.FanPanel")
def create_panel(*args):
return FanPanel(*args)
class FanPanel(ScreenPanel):
fan_speed = 0
user_selecting = False
def initialize(self, panel_name):
# Create gtk items here
grid = KlippyGtk.HomogeneousGrid()
_ = self.lang.gettext
grid = self._gtk.HomogeneousGrid()
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
box.set_hexpand(True)
@@ -28,17 +32,17 @@ class FanPanel(ScreenPanel):
self.labels["scale"].get_style_context().add_class("fan_slider")
box.add(self.labels["scale"])
self.labels["fanoff"] = KlippyGtk.ButtonImage("fan-off", "Fan Off")
self.labels["fanoff"] = self._gtk.ButtonImage("fan-off", _("Fan Off"))
self.labels["fanoff"].get_style_context().add_class("color1")
self.labels["fanoff"].connect("clicked", self.set_fan_on, False)
self.labels["fanon"] = KlippyGtk.ButtonImage("fan", "Fan On")
self.labels["fanon"] = self._gtk.ButtonImage("fan", _("Fan On"))
self.labels["fanon"].get_style_context().add_class("color3")
self.labels["fanon"].connect("clicked", self.set_fan_on, True)
self.labels["apply"] = KlippyGtk.ButtonImage("resume", "Set Speed")
self.labels["apply"] = self._gtk.ButtonImage("resume", _("Set Speed"))
self.labels["apply"].get_style_context().add_class("color2")
self.labels["apply"].connect("clicked", self.set_fan_speed)
self.labels["cancel"] = KlippyGtk.ButtonImage("stop", "Cancel Change")
self.labels["cancel"] = self._gtk.ButtonImage("stop", _("Cancel Change"))
self.labels["cancel"].get_style_context().add_class("color4")
self.labels["cancel"].connect("clicked", self.cancel_select_fan_speed)
self.labels["cancel"].hide()
@@ -46,34 +50,35 @@ class FanPanel(ScreenPanel):
grid.attach(Gtk.Label(), 0, 0, 1, 1)
grid.attach(box, 0, 1, 4, 1)
grid.attach(self.labels["fanoff"], 0, 2, 1, 1)
grid.attach(self.labels["fanon"], 1, 2, 1, 1)
grid.attach(self.labels["fanon"], 3, 2, 1, 1)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
grid.attach(b,3,2,1,1)
self.panel = grid
self.grid = grid
self.content.add(grid)
self._screen.add_subscription(panel_name)
def process_update(self, data):
if "fan" in data and "speed" in data["fan"] and self.user_selecting == False:
def process_update(self, action, data):
if (action == "notify_status_update" and "fan" in data and "speed" in data["fan"] and
self.user_selecting == False):
self.fan_speed = float(int(float(data["fan"]["speed"]) * 100))
self.labels["scale"].disconnect_by_func(self.select_fan_speed)
self.labels["scale"].set_value(float(int(float(data["fan"]["speed"]) * 100)))
self.labels["scale"].set_value(self.fan_speed)
self.labels["scale"].connect("value-changed", self.select_fan_speed)
def select_fan_speed(self, widget):
if self.user_selecting == True:
return
self.user_selecting = True
self.panel.attach(self.labels["apply"], 3, 0, 1, 1)
self.panel.attach(self.labels["cancel"], 0, 0, 1, 1)
self.grid.attach(self.labels["apply"], 3, 0, 1, 1)
self.grid.attach(self.labels["cancel"], 0, 0, 1, 1)
self._screen.show_all()
def cancel_select_fan_speed(self, widget):
self.labels["scale"].set_value(self.fan_speed)
self.user_selecting = False
self.panel.remove(self.labels["apply"])
self.panel.remove(self.labels["cancel"])
self.grid.remove(self.labels["apply"])
self.grid.remove(self.labels["cancel"])
def set_fan_speed(self, widget):
@@ -82,7 +87,9 @@ class FanPanel(ScreenPanel):
def set_fan_on(self, widget, fanon):
speed = 100 if fanon == True else 0
self.labels["scale"].disconnect_by_func(self.select_fan_speed)
self.labels["scale"].set_value(speed)
self.labels["scale"].connect("value-changed", self.select_fan_speed)
self._screen._ws.klippy.gcode_script(KlippyGcodes.set_fan_speed(speed))
self.fan_speed = float(speed)
self.labels["scale"].disconnect_by_func(self.select_fan_speed)
self.labels["scale"].set_value(self.fan_speed)
self.labels["scale"].connect("value-changed", self.select_fan_speed)
self.cancel_select_fan_speed(widget)
+39 -65
View File
@@ -4,13 +4,15 @@ import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.FineTunePanel")
class FineTune(ScreenPanel):
def create_panel(*args):
return FineTunePanel(*args)
class FineTunePanel(ScreenPanel):
user_selecting = False
bs = 0
@@ -18,63 +20,56 @@ class FineTune(ScreenPanel):
bs_deltas = ["0.01","0.05"]
percent_delta = 1
percent_deltas = ['1','5','10','25']
fan = 100
extrusion = 0
speed = 0
def initialize(self, panel_name):
# Create gtk items here
grid = KlippyGtk.HomogeneousGrid()
_ = self.lang.gettext
grid = self._gtk.HomogeneousGrid()
grid.set_row_homogeneous(False)
logger.debug("FineTunePanel")
self.labels['z+'] = KlippyGtk.ButtonImage("move-z-", "Z+", "color1")
self.labels['z+'] = self._gtk.ButtonImage("move-z-", _("Z+"), "color1")
self.labels['z+'].connect("clicked", self.change_babystepping, "+")
self.labels['zoffset'] = Gtk.Label("Z Offset: 0.00mm")
self.labels['zoffset'] = Gtk.Label("0.00" + _("mm"))
self.labels['zoffset'].get_style_context().add_class('temperature_entry')
self.labels['z-'] = KlippyGtk.ButtonImage("move-z+", "Z-", "color1")
self.labels['z-'] = self._gtk.ButtonImage("move-z+", _("Z-"), "color1")
self.labels['z-'].connect("clicked", self.change_babystepping, "-")
grid.attach(self.labels['z+'], 0, 0, 1, 1)
grid.attach(self.labels['zoffset'], 0, 1, 1, 1)
grid.attach(self.labels['z-'], 0, 2, 1, 1)
self.labels['fan+'] = KlippyGtk.ButtonImage("fan-on", "Increase Fan", "color2")
self.labels['fan+'].connect("clicked", self.change_fan, "+")
self.labels['fanspeed'] = Gtk.Label("Fan: 100%")
self.labels['fanspeed'].get_style_context().add_class('temperature_entry')
self.labels['fan-'] = KlippyGtk.ButtonImage("fan-off", "Decrease Fan", "color2")
self.labels['fan-'].connect("clicked", self.change_fan, "-")
grid.attach(self.labels['fan+'], 1, 0, 1, 1)
grid.attach(self.labels['fanspeed'], 1, 1, 1, 1)
grid.attach(self.labels['fan-'], 1, 2, 1, 1)
self.labels['speed+'] = KlippyGtk.ButtonImage("speed-step", "Increase Speed", "color3")
self.labels['speed+'] = self._gtk.ButtonImage("speed-step", _("Speed +"), "color3")
self.labels['speed+'].connect("clicked", self.change_speed, "+")
self.labels['speedfactor'] = Gtk.Label("Speed: 100%")
self.labels['speedfactor'] = Gtk.Label("100%")
self.labels['speedfactor'].get_style_context().add_class('temperature_entry')
self.labels['speed-'] = KlippyGtk.ButtonImage("speed-step", "Decrease Speed", "color3")
self.labels['speed-'] = self._gtk.ButtonImage("speed-step", _("Speed -"), "color3")
self.labels['speed-'].connect("clicked", self.change_speed, "-")
grid.attach(self.labels['speed+'], 2, 0, 1, 1)
grid.attach(self.labels['speedfactor'], 2, 1, 1, 1)
grid.attach(self.labels['speed-'], 2, 2, 1, 1)
grid.attach(self.labels['speed+'], 1, 0, 1, 1)
grid.attach(self.labels['speedfactor'], 1, 1, 1, 1)
grid.attach(self.labels['speed-'], 1, 2, 1, 1)
self.labels['extrude+'] = KlippyGtk.ButtonImage("extrude", "Increase Extrusion", "color4")
self.labels['extrude+'] = self._gtk.ButtonImage("extrude", _("Extrusion +"), "color4")
self.labels['extrude+'].connect("clicked", self.change_extrusion, "+")
self.labels['extrudefactor'] = Gtk.Label("Extrusion: 100%")
self.labels['extrudefactor'] = Gtk.Label("100%")
self.labels['extrudefactor'].get_style_context().add_class('temperature_entry')
self.labels['extrude-'] = KlippyGtk.ButtonImage("retract", "Decrease Extrusion", "color4")
self.labels['extrude-'] = self._gtk.ButtonImage("retract", _("Extrusion -"), "color4")
self.labels['extrude-'].connect("clicked", self.change_extrusion, "-")
grid.attach(self.labels['extrude+'], 3, 0, 1, 1)
grid.attach(self.labels['extrudefactor'], 3, 1, 1, 1)
grid.attach(self.labels['extrude-'], 3, 2, 1, 1)
grid.attach(self.labels['extrude+'], 2, 0, 1, 1)
grid.attach(self.labels['extrudefactor'], 2, 1, 1, 1)
grid.attach(self.labels['extrude-'], 2, 2, 1, 1)
# babystepping grid
bsgrid = Gtk.Grid()
j = 0;
for i in self.bs_deltas:
self.labels[i] = KlippyGtk.ToggleButton(i)
self.labels[i] = self._gtk.ToggleButton(i)
self.labels[i].connect("clicked", self.change_bs_delta, i)
ctx = self.labels[i].get_style_context()
if j == 0:
@@ -93,7 +88,7 @@ class FineTune(ScreenPanel):
deltgrid = Gtk.Grid()
j = 0;
for i in self.percent_deltas:
self.labels[i] = KlippyGtk.ToggleButton("%s%%" % i)
self.labels[i] = self._gtk.ToggleButton("%s%%" % i)
self.labels[i].connect("clicked", self.change_percent_delta, i)
ctx = self.labels[i].get_style_context()
if j == 0:
@@ -111,30 +106,25 @@ class FineTune(ScreenPanel):
grid.attach(deltgrid, 1, 3, 2, 1)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
grid.attach(b,3,3,1,1)
self.panel = grid
#self.panel = grid
self.content.add(grid)
self._screen.add_subscription(panel_name)
def process_update(self, data):
def process_update(self, action, data):
_ = self.lang.gettext
if action != "notify_status_update":
return
if "gcode_move" in data:
if "homing_origin" in data["gcode_move"]:
self.labels['zoffset'].set_text("Z Offset: %.2fmm" % data["gcode_move"]["homing_origin"][2])
self.labels['zoffset'].set_text("%.2fmm" % data["gcode_move"]["homing_origin"][2])
if "extrude_factor" in data["gcode_move"]:
self.extrusion = int(data["gcode_move"]["extrude_factor"]*100)
self.labels['extrudefactor'].set_text("Extrusion: %3d%%" % self.extrusion)
self.labels['extrudefactor'].set_text("%3d%%" % self.extrusion)
if "speed_factor" in data["gcode_move"]:
self.speed = int(data["gcode_move"]["speed_factor"]*100)
self.labels['speedfactor'].set_text("Speed: %3d%%" % self.speed)
if "fan" in data and "speed" in data['fan']:
self.fan = int(round(data['fan']['speed'],2)*100)
self.labels['fanspeed'].set_text("Fan: %3d%%" % self.fan)
self.labels['speedfactor'].set_text("%3d%%" % self.speed)
def change_babystepping(self, widget, dir):
if dir == "+":
@@ -212,19 +202,3 @@ class FineTune(ScreenPanel):
if i == self.percent_delta:
continue
self.labels[str(i)].set_active(False)
#def
def select_fan_speed(self, widget):
if self.user_selecting == True:
return
self.user_selecting = True
self.panel.attach(self.labels["apply"], 3, 0, 1, 1)
self.panel.attach(self.labels["cancel"], 0, 0, 1, 1)
self._screen.show_all()
def cancel_select_fan_speed(self, widget):
self.user_selecting = False
self.panel.remove(self.labels["apply"])
self.panel.remove(self.labels["cancel"])
+106
View File
@@ -0,0 +1,106 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.Macro")
def create_panel(*args):
return MacroPanel(*args)
class MacroPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.macros = {}
self.loaded_macros = []
# Create a scroll window for the macros
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
# Create a grid for all macros
self.labels['macros'] = Gtk.Grid()
scroll.add(self.labels['macros'])
# Create a box to contain all of the above
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
box.pack_start(scroll, True, True, 0)
self.content.add(box)
def activate(self):
self.unload_gcode_macros()
self.load_gcode_macros()
def add_gcode_macro(self, macro):
frame = Gtk.Frame()
frame.set_property("shadow-type",Gtk.ShadowType.NONE)
frame.get_style_context().add_class("frame-item")
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big>" % (macro))
name.set_hexpand(True)
name.set_vexpand(True)
name.set_halign(Gtk.Align.START)
name.set_valign(Gtk.Align.CENTER)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
open = self._gtk.ButtonImage("open",None,"color3")
open.connect("clicked", self.run_gcode_macro, macro)
open.set_hexpand(False)
open.set_halign(Gtk.Align.END)
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.add(labels)
dev.add(open)
frame.add(dev)
self.macros[macro] = {
"row": frame
}
macros = sorted(self.macros)
pos = macros.index(macro)
self.loaded_macros.append(macro)
self.labels['macros'].insert_row(pos)
self.labels['macros'].attach(self.macros[macro]['row'], 0, pos, 1, 1)
self.labels['macros'].show_all()
def load_gcode_macros(self):
macros = self._screen.printer.get_gcode_macros()
for x in macros:
macro = x[12:]
if macro in self.loaded_macros:
continue
if ("displayed_macros" not in self._config.get_config().sections() or
self._config.get_config().getboolean("displayed_macros", macro, fallback=True)):
self.add_gcode_macro(macro)
def run_gcode_macro(self, widget, macro):
self._screen._ws.klippy.gcode_script(macro)
def unload_gcode_macros(self):
for macro in self.loaded_macros:
if ("displayed_macros" in self._config.get_config().sections() and
not self._config.get_config().getboolean("displayed_macros", macro, fallback=True)):
macros = sorted(self.macros)
pos = macros.index(macro)
self.labels['macros'].remove_row(pos)
self.labels['macros'].show_all()
+526 -201
View File
@@ -1,201 +1,526 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from panels.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.JobStatusPanel")
class JobStatusPanel(ScreenPanel):
is_paused = False
filename = None
def initialize(self, panel_name):
grid = KlippyGtk.HomogeneousGrid()
self.labels['progress'] = KlippyGtk.ProgressBar("printing-progress-bar")
#self.labels['progress'].set_vexpand(True)
#self.labels['progress'].set_valign(Gtk.Align.CENTER)
self.labels['progress'].set_show_text(False)
#self.labels['progress'].set_margin_top(10)
self.labels['progress'].set_margin_end(20)
self.labels['progress_text'] = Gtk.Label()
self.labels['progress_text'].get_style_context().add_class("printing-progress-text")
overlay = Gtk.Overlay()
overlay.add(self.labels['progress'])
overlay.add_overlay(self.labels['progress_text'])
self.labels['file'] = KlippyGtk.ImageLabel("file","",20,"printing-status-label")
self.labels['time_label'] = KlippyGtk.ImageLabel("speed-step","Time Elapsed",20,"printing-status-label")
self.labels['time'] = KlippyGtk.Label("Time Elapsed","printing-status-label")
self.labels['time_left_label'] = KlippyGtk.ImageLabel("speed-step","Time Left",20,"printing-status-label")
self.labels['time_left'] = KlippyGtk.Label("Time Left","printing-status-label")
timegrid = Gtk.Grid()
timegrid.attach(self.labels['time_label']['b'], 0, 0, 1, 1)
timegrid.attach(self.labels['time'], 0, 1, 1, 1)
timegrid.attach(self.labels['time_left_label']['b'], 1, 0, 1, 1)
timegrid.attach(self.labels['time_left'], 1, 1, 1, 1)
info = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
info.props.valign = Gtk.Align.CENTER
info.set_hexpand(True)
info.set_vexpand(True)
#info.add(self.labels['file']['b'])
#info.add(self.labels['time']['b'])
#info.add(self.labels['time_left']['b'])
#grid.attach(info,2,0,2,1)
pbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
pbox.pack_start(self.labels['file']['b'], False, True, 0)
pbox.pack_end(timegrid, False, False, 0)
#pbox.pack_end(self.labels['progress'], False, False, 0)
pbox.pack_end(overlay, False, False, 0)
grid.attach(pbox, 1, 0, 3, 2)
self.labels['extruder'] = KlippyGtk.ButtonImage("extruder-1", KlippyGtk.formatTemperatureString(0, 0))
self.labels['extruder'].set_sensitive(False)
grid.attach(self.labels['extruder'], 0, 0, 1, 1)
self.labels['heater_bed'] = KlippyGtk.ButtonImage("bed", KlippyGtk.formatTemperatureString(0, 0))
self.labels['heater_bed'].set_sensitive(False)
grid.attach(self.labels['heater_bed'], 0, 1, 1, 1)
self.labels['resume'] = KlippyGtk.ButtonImage("resume","Resume","color1")
self.labels['resume'].connect("clicked",self.resume)
self.labels['pause'] = KlippyGtk.ButtonImage("pause","Pause","color1" )
self.labels['pause'].connect("clicked",self.pause)
if self._printer.get_stat('pause_resume','is_paused') == True:
self.is_paused = True
grid.attach(self.labels['resume'], 0, 2, 1, 1)
else:
grid.attach(self.labels['pause'], 0, 2, 1, 1)
self.labels['cancel'] = KlippyGtk.ButtonImage("stop","Cancel","color2")
self.labels['cancel'].connect("clicked", self.cancel)
grid.attach(self.labels['cancel'], 1, 2, 1, 1)
self.labels['estop'] = KlippyGtk.ButtonImage("decrease","Emergency Stop","color4")
self.labels['estop'].connect("clicked", self.emergency_stop)
grid.attach(self.labels['estop'], 2, 2, 1, 1)
self.labels['control'] = KlippyGtk.ButtonImage("control","Control","color3")
self.labels['control'].connect("clicked", self._screen._go_to_submenu, "Control")
grid.attach(self.labels['control'], 3, 2, 1, 1)
self.panel = grid
self._screen.add_subscription(panel_name)
def resume(self, widget):
self.disable_button("pause","cancel")
self._screen._ws.klippy.print_resume(self._response_callback, "enable_button", "pause", "cancel")
self._screen.show_all()
def pause(self, widget):
self.disable_button("resume","cancel")
self._screen._ws.klippy.print_pause(self._response_callback, "enable_button", "resume", "cancel")
self._screen.show_all()
def cancel(self, widget):
dialog = KlippyGtk.ConfirmDialog(
self._screen,
"Are you sure you wish to cancel this print?",
[
{
"name": "Cancel Print",
"response": Gtk.ResponseType.OK
},
{
"name": "Go Back",
"response": Gtk.ResponseType.CANCEL
}
],
self.cancel_confirm
)
self.disable_button("pause","cancel")
def cancel_confirm(self, widget, response_id):
widget.destroy()
if response_id == Gtk.ResponseType.CANCEL:
self.enable_button("pause","cancel")
return
self._screen._ws.klippy.print_cancel(self._response_callback, "enable_button", "pause", "cancel")
def _response_callback(self, response, method, params, func, *args):
if func == "enable_button":
self.enable_button(*args)
def enable_button(self, *args):
for arg in args:
self.labels[arg].set_sensitive(True)
def disable_button(self, *args):
for arg in args:
self.labels[arg].set_sensitive(False)
def process_update(self, data):
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
self._printer.get_dev_stat(x,"target")
)
vsd = self._printer.get_stat("print_stats")
if "filename" in vsd and self.filename != vsd['filename']:
if vsd['filename'] != "":
self.filename = KlippyGtk.formatFileName(vsd['filename'])
self.update_image_text("file", self.filename)
else:
file = "Unknown"
self.update_image_text("file", "Unknown")
progress = 0 if self._printer.get_stat('virtual_sdcard','progress') == 0 else (vsd['print_duration'] /
self._printer.get_stat('virtual_sdcard','progress') - vsd['print_duration'])
self.update_text("time", str(KlippyGtk.formatTimeString(vsd['print_duration'])))
self.update_text("time_left", str(KlippyGtk.formatTimeString(
progress
)))
self.update_progress(self._printer.get_stat('virtual_sdcard','progress'))
if "pause_resume" in data:
if self.is_paused == True and data['pause_resume']['is_paused'] == False:
self.is_paused = False
self.panel.attach(self.labels['pause'], 0, 2, 1, 1)
self.panel.remove(self.labels['resume'])
self.panel.show_all()
if self.is_paused == False and data['pause_resume']['is_paused'] == True:
self.is_paused = True
self.panel.attach(self.labels['resume'], 0, 2, 1, 1)
self.panel.remove(self.labels['pause'])
self.panel.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 update_text(self, label, text):
if label in self.labels:
self.labels[label].set_text(text)
def update_progress (self, progress):
self.labels['progress'].set_fraction(progress)
self.labels['progress_text'].set_text("%s%%" % (str(int(progress*100))))
def update_temp(self, dev, temp, target):
if dev in self.labels:
self.labels[dev].set_label(KlippyGtk.formatTemperatureString(temp, target))
# -*- coding: utf-8 -*-
import gi
import logging
import math
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.JobStatusPanel")
def create_panel(*args):
return JobStatusPanel(*args)
class JobStatusPanel(ScreenPanel):
is_paused = False
filename = None
file_metadata = {}
progress = 0
state = "printing"
def initialize(self, panel_name):
_ = self.lang.gettext
self.layout = Gtk.Layout()
self.layout.set_size(self._screen.width, self._screen.height)
self.create_buttons()
grid = self._gtk.HomogeneousGrid()
grid.set_size_request(self._screen.width, self._screen.height)
fi_box = Gtk.VBox(spacing=0)
fi_box.set_hexpand(True)
fi_box.set_vexpand(False)
fi_box.set_halign(Gtk.Align.START)
self.labels['file'] = Gtk.Label(label="file")
self.labels['file'].set_halign(Gtk.Align.START)
self.labels['file'].set_vexpand(False)
self.labels['file'].get_style_context().add_class("printing-filename")
self.labels['file'].set_line_wrap(True)
self.labels['file'].set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
self.labels['status'] = Gtk.Label()
self.labels['status'].set_halign(Gtk.Align.START)
self.labels['status'].set_vexpand(False)
self.labels['status'].get_style_context().add_class("printing-status")
fi_box.add(self.labels['file']) #, True, True, 0)
fi_box.add(self.labels['status']) #, True, True, 0)
fi_box.set_valign(Gtk.Align.CENTER)
info = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
info.props.valign = Gtk.Align.CENTER
info.set_hexpand(True)
info.set_vexpand(True)
#info.add(self.labels['file']['b'])
#info.add(self.labels['time']['b'])
#info.add(self.labels['time_left']['b'])
#grid.attach(info,2,0,2,1)
#pbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
#pbox.pack_start(self.labels['file']['b'], False, True, 0)
#pbox.pack_end(timegrid, False, False, 0)
#pbox.pack_end(self.labels['progress'], False, False, 0)
#pbox.pack_end(overlay, False, False, 0)
#grid.attach(pbox, 0, 0, 4, 3)
self.labels['darea'] = Gtk.DrawingArea()
self.labels['darea'].connect("draw", self.on_draw)
box = Gtk.Box()
box.set_hexpand(True)
box.set_vexpand(True)
box.set_halign(Gtk.Align.CENTER)
self.labels['progress_text'] = Gtk.Label()
self.labels['progress_text'].get_style_context().add_class("printing-progress-text")
box.add(self.labels['progress_text'])
overlay = Gtk.Overlay()
overlay.set_hexpand(True)
overlay.set_vexpand(True)
overlay.add(self.labels['darea'])
overlay.add_overlay(box)
#self.labels['extruder'] = self._gtk.ButtonImage("extruder-1", self._gtk.formatTemperatureString(0, 0))
#self.labels['extruder'].set_sensitive(False)
#grid.attach(self.labels['extruder'], 0, 0, 1, 1)
#self.labels['heater_bed'] = self._gtk.ButtonImage("bed", self._gtk.formatTemperatureString(0, 0))
#self.labels['heater_bed'].set_sensitive(False)
#grid.attach(self.labels['heater_bed'], 0, 1, 1, 1)
self.labels['thumbnail'] = self._gtk.Image("file.svg", False, 1.6, 1.6)
i = 0
for extruder in self._printer.get_tools():
self.labels[extruder + '_box'] = Gtk.Box(spacing=0)
self.labels[extruder] = Gtk.Label(label="")
self.labels[extruder].get_style_context().add_class("printing-info")
if i <= 4:
ext_img = self._gtk.Image("extruder-%s.svg" % i, None, .6, .6)
self.labels[extruder + '_box'].add(ext_img)
self.labels[extruder + '_box'].add(self.labels[extruder])
i += 1
temp_grid = self._gtk.HomogeneousGrid()
self.current_extruder = self._printer.get_stat("toolhead","extruder")
temp_grid.attach(self.labels[self.current_extruder + '_box'], 0, 0, 1, 1)
if self._printer.has_heated_bed():
heater_bed = self._gtk.Image("bed.svg", None, .6, .6)
self.labels['heater_bed'] = Gtk.Label(label="")
self.labels['heater_bed'].get_style_context().add_class("printing-info")
heater_bed_box = Gtk.Box(spacing=0)
heater_bed_box.add(heater_bed)
heater_bed_box.add(self.labels['heater_bed'])
temp_grid.attach(heater_bed_box, 1, 0, 1, 1)
self.labels['temp_grid'] = temp_grid
# Create time remaining items
hourglass = self._gtk.Image("hourglass.svg", None, .6, .6)
self.labels['left'] = Gtk.Label(label=_("Left:"))
self.labels['left'].get_style_context().add_class("printing-info")
self.labels['time_left'] = Gtk.Label(label="0s")
self.labels['time_left'].get_style_context().add_class("printing-info")
itl_box = Gtk.Box(spacing=0)
itl_box.add(hourglass)
itl_box.add(self.labels['left'])
itl_box.add(self.labels['time_left'])
self.labels['itl_box'] = itl_box
# Create overall items
clock = self._gtk.Image("clock.svg", None, .6, .6)
self.labels['elapsed'] = Gtk.Label(label=_("Elapsed:"))
self.labels['elapsed'].get_style_context().add_class("printing-info")
self.labels['duration'] = Gtk.Label(label="0s")
self.labels['duration'].get_style_context().add_class("printing-info")
self.labels['est_time'] = Gtk.Label(label="/ 0s")
self.labels['est_time'].get_style_context().add_class("printing-info")
it_box = Gtk.Box(spacing=0)
it_box.add(clock)
it_box.add(self.labels['elapsed'])
it_box.add(self.labels['duration'])
it_box.add(self.labels['est_time'])
self.labels['it_box'] = it_box
position = self._gtk.Image("move.svg", None, .6, .6)
self.labels['pos_x'] = Gtk.Label(label="X: 0")
self.labels['pos_x'].get_style_context().add_class("printing-info")
self.labels['pos_y'] = Gtk.Label(label="Y: 0")
self.labels['pos_y'].get_style_context().add_class("printing-info")
self.labels['pos_z'] = Gtk.Label(label="Z: 0")
self.labels['pos_z'].get_style_context().add_class("printing-info")
pos_box = Gtk.Box(spacing=0)
posgrid = self._gtk.HomogeneousGrid()
posgrid.set_hexpand(True)
posgrid.attach(self.labels['pos_x'], 0, 0, 1, 1)
posgrid.attach(self.labels['pos_y'], 1, 0, 1, 1)
posgrid.attach(self.labels['pos_z'], 2, 0, 1, 1)
pos_box.add(position)
pos_box.add(posgrid)
self.labels['pos_box'] = pos_box
speed = self._gtk.Image("speed-step.svg", None, .6, .6)
self.labels['speed'] = Gtk.Label(label="")
self.labels['speed'].get_style_context().add_class("printing-info")
speed_box = Gtk.Box(spacing=0)
speed_box.add(speed)
speed_box.add(self.labels['speed'])
extrusion = self._gtk.Image("extrude.svg", None, .6, .6)
self.labels['extrusion'] = Gtk.Label(label="")
self.labels['extrusion'].get_style_context().add_class("printing-info")
extrusion_box = Gtk.Box(spacing=0)
extrusion_box.add(extrusion)
extrusion_box.add(self.labels['extrusion'])
fan = self._gtk.Image("fan.svg", None, .6, .6)
self.labels['fan'] = Gtk.Label(label="")
self.labels['fan'].get_style_context().add_class("printing-info")
fan_box = Gtk.Box(spacing=0)
fan_box.add(fan)
fan_box.add(self.labels['fan'])
sfe_grid = self._gtk.HomogeneousGrid()
sfe_grid.set_hexpand(True)
sfe_grid.attach(speed_box, 0, 0, 1, 1)
sfe_grid.attach(extrusion_box, 1, 0, 1, 1)
sfe_grid.attach(fan_box, 2, 0, 1, 1)
self.labels['sfe_grid'] = sfe_grid
self.labels['i1_box'] = Gtk.VBox(spacing=0)
self.labels['i1_box'].get_style_context().add_class("printing-info-box")
self.labels['i1_box'].set_valign(Gtk.Align.CENTER)
self.labels['i2_box'] = Gtk.VBox(spacing=0)
self.labels['i2_box'].get_style_context().add_class("printing-info-box")
grid.attach(overlay, 0, 0, 1, 1)
grid.attach(fi_box, 1, 0, 3, 1)
grid.attach(self.labels['i1_box'], 0, 1, 2, 2)
grid.attach(self.labels['i2_box'], 2, 1, 2, 2)
self.add_labels()
self.grid = grid
self.layout.put(grid, 0, 0)
self._screen.add_subscription(panel_name)
def on_draw(self, da, ctx):
w = da.get_allocated_width()
h = da.get_allocated_height()
r = min(w,h)*.4
ctx.set_source_rgb(0.6, 0.6, 0.6)
ctx.set_line_width(self._gtk.get_font_size() * .75)
ctx.translate(w / 2, h / 2)
ctx.arc(0, 0, r, 0, 2*math.pi)
ctx.stroke()
ctx.set_source_rgb(1, 0, 0)
ctx.arc(0, 0, r, 3/2*math.pi, 3/2*math.pi+(self.progress*2*math.pi))
ctx.stroke()
def activate(self):
_ = self.lang.gettext
self.progress = self._printer.get_stat('virtual_sdcard','progress')
self.update_progress()
self.enable_button("pause","cancel","resume")
state = "printing"
self.update_text("status",_("Printing"))
self.filename = self._printer.get_stat('print_stats','filename')
self.update_file_metadata()
self.grid.remove_row(3)
self.grid.insert_row(3)
ps = self._printer.get_stat("print_stats")
logger.debug("Act State: %s" % ps['state'])
self.set_state(ps['state'])
self.show_buttons_for_state()
def add_labels(self):
for child in self.labels['i1_box'].get_children():
self.labels['i1_box'].remove(child)
for child in self.labels['i2_box'].get_children():
self.labels['i2_box'].remove(child)
#if self.file_metadata == None:
# self.labels['i1_box'].add(self.labels['temp_grid'])
# self.labels['i1_box'].add(self.labels['pos_box'])
# self.labels['i1_box'].add(self.labels['sfe_grid'])
# self.labels['i2_box'].add(self.labels['it_box'])
# self.labels['i2_box'].add(self.labels['itl_box'])
#else:
self.labels['i1_box'].add(self.labels['thumbnail'])
self.labels['i2_box'].add(self.labels['temp_grid'])
self.labels['i2_box'].add(self.labels['pos_box'])
self.labels['i2_box'].add(self.labels['sfe_grid'])
self.labels['i2_box'].add(self.labels['it_box'])
self.labels['i2_box'].add(self.labels['itl_box'])
def create_buttons(self):
_ = self.lang.gettext
self.labels['cancel'] = self._gtk.ButtonImage("stop",_("Cancel"),"color2")
self.labels['cancel'].connect("clicked", self.cancel)
self.labels['control'] = self._gtk.ButtonImage("control",_("Control"),"color3")
self.labels['control'].connect("clicked", self._screen._go_to_submenu, "")
self.labels['estop'] = self._gtk.ButtonImage("emergency",_("Emergency Stop"),"color4")
self.labels['estop'].connect("clicked", self.emergency_stop)
self.labels['menu'] = self._gtk.ButtonImage("complete",_("Main Menu"),"color4")
self.labels['menu'].connect("clicked", self.close_panel)
self.labels['pause'] = self._gtk.ButtonImage("pause",_("Pause"),"color1" )
self.labels['pause'].connect("clicked",self.pause)
self.labels['restart'] = self._gtk.ButtonImage("restart",_("Restart"),"color3")
self.labels['restart'].connect("clicked", self.restart)
self.labels['resume'] = self._gtk.ButtonImage("resume",_("Resume"),"color1")
self.labels['resume'].connect("clicked",self.resume)
def restart(self, widget):
if self.filename != "none":
self._screen._ws.klippy.print_start(self.filename)
def resume(self, widget):
#self.disable_button("resume","cancel")
self._screen._ws.klippy.print_resume(self._response_callback, "enable_button", "pause", "cancel")
self._screen.show_all()
def pause(self, widget):
#self.disable_button("pause","cancel")
self._screen._ws.klippy.print_pause(self._response_callback, "enable_button", "resume", "cancel")
self._screen.show_all()
def cancel(self, widget):
_ = self.lang.gettext
buttons = [
{"name": _("Cancel Print"), "response": Gtk.ResponseType.OK},
{"name": _("Go Back"), "response": Gtk.ResponseType.CANCEL}
]
label = Gtk.Label()
label.set_markup(_("Are you sure you wish to cancel this print?"))
label.set_hexpand(True)
label.set_halign(Gtk.Align.CENTER)
label.set_line_wrap(True)
label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
dialog = self._gtk.Dialog(self._screen, buttons, label, self.cancel_confirm)
self.disable_button("pause","cancel")
def cancel_confirm(self, widget, response_id):
widget.destroy()
if response_id == Gtk.ResponseType.CANCEL:
self.enable_button("pause","cancel")
return
logger.debug("Canceling print")
self.disable_button("pause","resume","cancel")
self._screen._ws.klippy.print_cancel(self._response_callback)
def _response_callback(self, response, method, params, func, *args):
if func == "enable_button":
self.enable_button(*args)
def close_panel(self, widget=None):
if self._screen.is_printing():
self._screen.printer_ready()
return False
def enable_button(self, *args):
for arg in args:
self.labels[arg].set_sensitive(True)
def disable_button(self, *args):
for arg in args:
self.labels[arg].set_sensitive(False)
def _callback_metadata(self, newfiles, deletedfiles, modifiedfiles):
if self.file_metadata == None and self.filename in modifiedfiles:
self.update_file_metadata()
self._files.remove_file_callback(self._callback_metadata)
def process_update(self, action, data):
if action != "notify_status_update":
return
_ = self.lang.gettext
if self._printer.has_heated_bed():
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
self._printer.get_dev_stat(x,"target")
)
if "toolhead" in data:
if "extruder" in data["toolhead"]:
if data["toolhead"]["extruder"] != self.current_extruder:
self.labels['temp_grid'].remove_column(0)
self.labels['temp_grid'].insert_column(0)
self.current_extruder = data["toolhead"]["extruder"]
self.labels['temp_grid'].attach(self.labels[self.current_extruder + '_box'], 0, 0, 1, 1)
self._screen.show_all()
if "position" in data["toolhead"]:
self.labels['pos_x'].set_text("X: %.2f" % (data["toolhead"]["position"][0]))
self.labels['pos_y'].set_text("Y: %.2f" % (data["toolhead"]["position"][1]))
if "gcode_move" in data and "gcode_position" in data["gcode_move"]:
self.labels['pos_z'].set_text("Z: %.2f" % (data["gcode_move"]["gcode_position"][2]))
if "gcode_move" in data:
#if "homing_origin" in data["gcode_move"]:
# self.labels['zoffset'].set_text("%.2fmm" % data["gcode_move"]["homing_origin"][2])
if "extrude_factor" in data["gcode_move"]:
self.extrusion = int(data["gcode_move"]["extrude_factor"]*100)
self.labels['extrusion'].set_text("%3d%%" % self.extrusion)
if "speed_factor" in data["gcode_move"]:
self.speed = int(data["gcode_move"]["speed_factor"]*100)
self.labels['speed'].set_text("%3d%%" % self.speed)
if "fan" in data and "speed" in data['fan']:
self.fan = int(round(data['fan']['speed'],2)*100)
self.labels['fan'].set_text("%3d%%" % self.fan)
if "print_stats" in data or "virtual_sdcard" in data:
ps = self._printer.get_stat("print_stats")
vsd = self._printer.get_stat("virtual_sdcard")
if ps['state'] == "printing" and self.state != "printing":
self.set_state("printing")
self.show_buttons_for_state()
if ps['state'] == "complete" and self.state != "complete":
self.progress = 1
self.update_progress()
self.set_state("complete")
self.show_buttons_for_state()
timeout = self._config.get_main_config().getint("job_complete_timeout", 30)
if timeout != 0:
GLib.timeout_add(timeout * 1000, self.close_panel)
elif ps['state'] == "error" and self.state != "error":
logger.debug("Error!")
self.set_state("error")
self.labels['status'].set_text("Error - %s" % ps['message'])
self.show_buttons_for_state()
timeout = self._config.get_main_config().getint("job_error_timeout", 0)
if timeout != 0:
GLib.timeout_add(timeout * 1000, self.close_panel)
elif ps['state'] == "standby":
self.close_panel()
if self.filename != ps['filename']:
if ps['filename'] != "":
self.filename = ps['filename']
self.file_metadata = None
self.update_text("file", self.filename.split("/")[-1])
else:
file = "Unknown"
self.update_text("file", "Unknown file")
if self.file_metadata != None:
if "gcode_start_byte" in self.file_metadata:
progress = (max(vsd['file_position'] - self.file_metadata['gcode_start_byte'],0) /
(self.file_metadata['gcode_end_byte'] - self.file_metadata['gcode_start_byte']))
else:
progress = 0 if self._printer.get_stat('virtual_sdcard','progress') == 0 else (ps['print_duration']/
self._printer.get_stat('virtual_sdcard','progress') - ps['print_duration'])
progress = round(progress,2)
if progress != self.progress:
self.progress = progress
self.labels['darea'].queue_draw()
if ps['print_duration'] == 0:
time_left = self.file_metadata['estimated_time'] if "estimated_time" in self.file_metadata else 0
else:
est_time = self.file_metadata['estimated_time'] if "estimated_time" in self.file_metadata else 0
time_left = max(
est_time - ps['print_duration'] ,
0 #ps['print_duration'] / (vsd['progress'] if vsd['progress'] != 0 else 1)
)
self.update_text("duration", str(self._gtk.formatTimeString(ps['print_duration'])))
self.update_text("time_left", str(self._gtk.formatTimeString(time_left)))
self.update_progress()
if "pause_resume" in data and self.state != "complete":
if self.state == "paused" and data['pause_resume']['is_paused'] == False:
self.set_state("printing")
self.update_text("status",_("Paused"))
self.grid.attach(self.labels['pause'], 0, 3, 1, 1)
self.grid.remove(self.labels['resume'])
self.grid.show_all()
if self.state != "paused" and data['pause_resume']['is_paused'] == True:
self.set_state("paused")
self.grid.attach(self.labels['resume'], 0, 3, 1, 1)
self.grid.remove(self.labels['pause'])
self.grid.show_all()
def set_state(self, state):
self.state = state
self.update_text("status",state.capitalize())
def show_buttons_for_state(self):
self.grid.remove_row(3)
self.grid.insert_row(3)
if self.state == "printing":
self.grid.attach(self.labels['pause'], 0, 3, 1, 1)
self.grid.attach(self.labels['cancel'], 1, 3, 1, 1)
self.grid.attach(self.labels['estop'], 2, 3, 1, 1)
self.grid.attach(self.labels['control'], 3, 3, 1, 1)
elif self.state == "paused":
self.grid.attach(self.labels['resume'], 0, 3, 1, 1)
self.grid.attach(self.labels['cancel'], 1, 3, 1, 1)
self.grid.attach(self.labels['estop'], 2, 3, 1, 1)
self.grid.attach(self.labels['control'], 3, 3, 1, 1)
elif self.state == "error" or self.state == "complete":
self.grid.attach(self.labels['restart'], 2, 3, 1, 1)
self.grid.attach(self.labels['menu'], 3, 3, 1, 1)
self.show_all()
def show_file_thumbnail(self):
if self._files.has_thumbnail(self.filename):
pixbuf = self.get_file_image(self.filename, 7, 3.25)
if pixbuf != None:
self.labels['thumbnail'].set_from_pixbuf(pixbuf)
def update_file_metadata(self):
if self._files.file_metadata_exists(self.filename):
self.file_metadata = self._files.get_file_info(self.filename)
logger.debug("Parsing file metadata: %s" % list(self.file_metadata))
self.update_text("est_time","/ %s" % str(self._gtk.formatTimeString(self.file_metadata['estimated_time'])))
if "thumbnails" in self.file_metadata:
tmp = self.file_metadata['thumbnails'].copy()
for i in tmp:
i['data'] = ""
logger.debug("Thumbnails: %s" % list(tmp))
self.show_file_thumbnail()
else:
self.file_metadata = None
logger.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_text(self, label, text):
if label in self.labels:
self.labels[label].set_text(text)
def update_progress (self):
self.labels['progress_text'].set_text("%s%%" % (str( min(int(self.progress*100),100) )))
#def update_temp(self, dev, temp, target):
# if dev in self.labels:
# self.labels[dev].set_label(self._gtk.formatTemperatureString(temp, target))
def update_temp(self, x, temp, target):
self.labels[x].set_markup(
"%.1f<big>/</big>%.0f °C" % (temp, target)
)
+87 -63
View File
@@ -1,63 +1,87 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from panels.menu import MenuPanel
logger = logging.getLogger("KlipperScreen.MainMenu")
class MainPanel(MenuPanel):
def initialize(self, panel_name, items, extrudercount):
print("### Making MainMenu")
grid = KlippyGtk.HomogeneousGrid()
# Create Extruders and bed icons
eq_grid = KlippyGtk.HomogeneousGrid()
i = 0
for x in self._printer.get_tools():
if i > 3:
break
self.labels[x] = KlippyGtk.ButtonImage("extruder-"+str(i+1), KlippyGtk.formatTemperatureString(0, 0))
eq_grid.attach(self.labels[x], i%2, i/2, 1, 1)
i += 1
self.labels['heater_bed'] = KlippyGtk.ButtonImage("bed", KlippyGtk.formatTemperatureString(0, 0))
width = 2 if i > 1 else 1
eq_grid.attach(self.labels['heater_bed'], 0, i/2+1, width, 1)
grid.attach(eq_grid, 0, 0, 1, 1)
grid.attach(self.arrangeMenuItems(items, 2, True), 1, 0, 1, 1)
self.grid = grid
self.target_temps = {
"heater_bed": 0,
"extruder": 0
}
self._screen.add_subscription(panel_name)
def get(self):
return self.grid
def update_temp(self, dev, temp, target):
if dev in self.labels:
self.labels[dev].set_label(KlippyGtk.formatTemperatureString(temp, target))
def process_update(self, data):
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
self._printer.get_dev_stat(x,"target")
)
return
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from panels.menu import MenuPanel
logger = logging.getLogger("KlipperScreen.MainMenu")
def create_panel(*args):
return MainPanel(*args)
class MainPanel(MenuPanel):
def initialize(self, panel_name, items, extrudercount):
print("### Making MainMenu")
self.layout = Gtk.Layout()
self.layout.set_size(self._screen.width, self._screen.height)
grid = self._gtk.HomogeneousGrid()
grid.set_size_request(self._screen.width, self._screen.height)
# Create Extruders and bed icons
eq_grid = self._gtk.HomogeneousGrid()
i = 0
for x in self._printer.get_tools():
if i > 3:
break
self.labels[x] = self._gtk.ButtonImage("extruder-"+str(i), self._gtk.formatTemperatureString(0, 0))
col = 0 if len(self._printer.get_tools()) == 1 else (i%2 if self._screen.lang_ltr else 1 - i%2)
row = i/2
eq_grid.attach(self.labels[x], col, row, 1, 1)
i += 1
if self._printer.has_heated_bed():
self.labels['heater_bed'] = self._gtk.ButtonImage("bed", self._gtk.formatTemperatureString(0, 0))
width = 2 if i > 1 else 1
eq_grid.attach(self.labels['heater_bed'], 0, i/2+1, width, 1)
self.items = items
self.create_menu_items()
self.grid = Gtk.Grid()
self.grid.set_row_homogeneous(True)
self.grid.set_column_homogeneous(True)
if self._screen.lang_ltr:
grid.attach(eq_grid, 0, 0, 1, 1)
grid.attach(self.arrangeMenuItems(items, 2, True), 1, 0, 1, 1)
else:
grid.attach(eq_grid, 1, 0, 1, 1)
grid.attach(self.arrangeMenuItems(items, 2, True), 0, 0, 1, 1)
self.grid = grid
self.target_temps = {
"heater_bed": 0,
"extruder": 0
}
self.layout.put(grid, 0, 0)
self._screen.add_subscription(panel_name)
def activate(self):
return
def update_temp(self, dev, temp, target):
if dev in self.labels:
self.labels[dev].set_label(self._gtk.formatTemperatureString(temp, target))
def process_update(self, action, data):
if action != "notify_status_update":
return
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
self._printer.get_dev_stat(x,"target")
)
return
+100 -53
View File
@@ -1,53 +1,100 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from panels.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.MenuPanel")
class MenuPanel(ScreenPanel):
def initialize(self, panel_name, items):
print("### Making a new menu")
grid = self.arrangeMenuItems(items, 4)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
grid.attach(b, 3, 1, 1, 1)
self.panel = grid
def arrangeMenuItems (self, items, columns, expandLast=False):
grid = Gtk.Grid()
grid.set_row_homogeneous(True)
grid.set_column_homogeneous(True)
l = len(items)
i = 0
for i in range(l):
col = i % columns
row = int(i/columns)
width = 1
if expandLast == True and i+1 == l and l%2 == 1:
width = 2
b = KlippyGtk.ButtonImage(
items[i]['icon'], items[i]['name'], "color"+str((i%4)+1)
)
if "panel" in items[i]:
b.connect("clicked", self.menu_item_clicked, items[i]['panel'], items[i])
elif "items" in items[i]:
b.connect("clicked", self._screen._go_to_submenu, items[i]['name'])
elif "method" in items[i]:
params = items[i]['params'] if "params" in items[i] else {}
b.connect("clicked", self._screen._send_action, items[i]['method'], params)
grid.attach(b, col, row, width, 1)
i += 1
return grid
import gettext
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from jinja2 import Environment, Template
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.MenuPanel")
def create_panel(*args):
return MenuPanel(*args)
class MenuPanel(ScreenPanel):
i = 0
def initialize(self, panel_name, display_name, items):
_ = self.lang.gettext
self.items = items
self.create_menu_items()
self.grid = Gtk.Grid()
self.grid.set_row_homogeneous(True)
self.grid.set_column_homogeneous(True)
self.content.add(self.grid)
def activate(self):
self.j2_data = self._printer.get_printer_status_data()
self.arrangeMenuItems(self.items, 4)
def arrangeMenuItems (self, items, columns, expandLast=False):
for child in self.grid.get_children():
self.grid.remove(child)
l = len(items)
i = 0
for item in items:
key = list(item)[0]
logger.debug("Evaluating item: %s" % key)
if not self.evaluate_enable(item[key]['enable']):
continue
col = i % columns if self._screen.lang_ltr == True else (columns - (i % columns) - 1)
row = int(i/columns)
width = 1
if expandLast == True and i+1 == l and l%2 == 1:
width = 2
if not self._screen.lang_ltr:
col = col - 1
self.grid.attach(self.labels[key], col, row, width, 1)
i += 1
return self.grid
def create_menu_items(self):
for i in range(len(self.items)):
key = list(self.items[i])[0]
item = self.items[i][key]
env = Environment(extensions=["jinja2.ext.i18n"])
env.install_gettext_translations(self.lang)
j2_temp = env.from_string(item['name'])
parsed_name = j2_temp.render()
b = self._gtk.ButtonImage(
item['icon'], parsed_name, "color"+str((i%4)+1)
)
if item['panel'] != False:
b.connect("clicked", self.menu_item_clicked, item['panel'], item)
elif item['method'] != False:
params = item['params'] if item['params'] != False else {}
if item['confirm'] != False:
b.connect("clicked", self._screen._confirm_send_action, item['confirm'], item['method'], params)
else:
b.connect("clicked", self._screen._send_action, item['method'], params)
else:
b.connect("clicked", self._screen._go_to_submenu, key)
self.labels[key] = b
def evaluate_enable(self, enable):
if enable == True:
return True
if enable == False:
return False
try:
logger.debug("Template: '%s'" % enable)
logger.debug("Date: %s" % self.j2_data)
j2_temp = Template(enable)
result = j2_temp.render(self.j2_data)
if result == 'True':
return True
return False
except:
logger.debug("Error evaluating enable statement: %s", enable)
return False
+130 -131
View File
@@ -1,131 +1,130 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.MovePanel")
class MovePanel(ScreenPanel):
distance = 1
distances = ['.1','.5','1','5','10','25']
def initialize(self, panel_name):
grid = KlippyGtk.HomogeneousGrid()
self.labels['x+'] = KlippyGtk.ButtonImage("move-x+", "X+", "color1")
self.labels['x+'].connect("clicked", self.move, "X", "+")
self.labels['x-'] = KlippyGtk.ButtonImage("move-x-", "X-", "color1")
self.labels['x-'].connect("clicked", self.move, "X", "-")
self.labels['y+'] = KlippyGtk.ButtonImage("move-y+", "Y+", "color2")
self.labels['y+'].connect("clicked", self.move, "Y", "+")
self.labels['y-'] = KlippyGtk.ButtonImage("move-y-", "Y-", "color2")
self.labels['y-'].connect("clicked", self.move, "Y", "-")
self.labels['z+'] = KlippyGtk.ButtonImage("move-z-", "Z+", "color3")
self.labels['z+'].connect("clicked", self.move, "Z", "+")
self.labels['z-'] = KlippyGtk.ButtonImage("move-z+", "Z-", "color3")
self.labels['z-'].connect("clicked", self.move, "Z", "-")
self.labels['home'] = KlippyGtk.ButtonImage("home", "Home All")
self.labels['home'].connect("clicked", self.home)
grid.attach(self.labels['x+'], 2, 1, 1, 1)
grid.attach(self.labels['x-'], 0, 1, 1, 1)
grid.attach(self.labels['y+'], 1, 0, 1, 1)
grid.attach(self.labels['y-'], 1, 1, 1, 1)
grid.attach(self.labels['z+'], 3, 0, 1, 1)
grid.attach(self.labels['z-'], 3, 1, 1, 1)
grid.attach(self.labels['home'], 0, 0, 1, 1)
distgrid = Gtk.Grid()
j = 0;
for i in self.distances:
self.labels[i] = KlippyGtk.ToggleButton(i)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if j == 0:
ctx.add_class("distbutton_top")
elif j == len(self.distances)-1:
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
if i == "1":
ctx.add_class("distbutton_active")
distgrid.attach(self.labels[i], j, 0, 1, 1)
j += 1
self.labels["1"].set_active(True)
#space_grid = KlippyGtk.HomogeneousGrid()
#space_grid.attach(Gtk.Label("Distance (mm):"),0,0,1,1)
#space_grid.attach(distgrid,0,1,1,1)
#space_grid.attach(Gtk.Label(" "),0,2,1,1)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
bottomgrid = KlippyGtk.HomogeneousGrid()
self.labels['pos_x'] = Gtk.Label("X: 0")
self.labels['pos_y'] = Gtk.Label("Y: 0")
self.labels['pos_z'] = Gtk.Label("Z: 0")
self.labels['pos_x'].get_style_context().add_class("text")
self.labels['pos_y'].get_style_context().add_class("text")
self.labels['pos_z'].get_style_context().add_class("text")
bottomgrid.attach(self.labels['pos_x'], 0, 0, 1, 1)
bottomgrid.attach(self.labels['pos_y'], 1, 0, 1, 1)
bottomgrid.attach(self.labels['pos_z'], 2, 0, 1, 1)
box.pack_start(bottomgrid, True, True, 0)
self.labels['move_dist'] = Gtk.Label("Move Distance (mm)")
self.labels['move_dist'].get_style_context().add_class("text")
box.pack_start(self.labels['move_dist'], True, True, 0)
box.pack_start(distgrid, True, True, 0)
grid.attach(box, 0, 2, 3, 1)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
grid.attach(b, 3, 2, 1, 1)
self.panel = grid
self._screen.add_subscription(panel_name)
def process_update(self, data):
if "toolhead" in data and "position" in data["toolhead"]:
self.labels['pos_x'].set_text("X: %.2f" % (data["toolhead"]["position"][0]))
self.labels['pos_y'].set_text("Y: %.2f" % (data["toolhead"]["position"][1]))
self.labels['pos_z'].set_text("Z: %.2f" % (data["toolhead"]["position"][2]))
def change_distance(self, widget, distance):
if self.distance == distance:
return
logging.info("### Distance " + str(distance))
ctx = self.labels[str(self.distance)].get_style_context()
ctx.remove_class("distbutton_active")
self.distance = distance
ctx = self.labels[self.distance].get_style_context()
ctx.add_class("distbutton_active")
for i in self.distances:
if i == self.distance:
continue
self.labels[str(i)].set_active(False)
def move(self, widget, axis, dir):
dist = str(self.distance) if dir == "+" else "-" + str(self.distance)
logging.info("# Moving " + axis + " " + dist + "mm")
print("%s\n%s %s%s" % (KlippyGcodes.MOVE_RELATIVE, KlippyGcodes.MOVE, axis, dist))
self._screen._ws.klippy.gcode_script(
"%s\n%s %s%s" % (KlippyGcodes.MOVE_RELATIVE, KlippyGcodes.MOVE, axis, dist)
)
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.MovePanel")
def create_panel(*args):
return MovePanel(*args)
class MovePanel(ScreenPanel):
distance = 1
distances = ['.1','.5','1','5','10','25']
def initialize(self, panel_name):
_ = self.lang.gettext
grid = self._gtk.HomogeneousGrid()
self.labels['x+'] = self._gtk.ButtonImage("move-x+", _("X+"), "color1")
self.labels['x+'].connect("clicked", self.move, "X", "+")
self.labels['x-'] = self._gtk.ButtonImage("move-x-", _("X-"), "color1")
self.labels['x-'].connect("clicked", self.move, "X", "-")
self.labels['y+'] = self._gtk.ButtonImage("move-y+", _("Y+"), "color2")
self.labels['y+'].connect("clicked", self.move, "Y", "+")
self.labels['y-'] = self._gtk.ButtonImage("move-y-", _("Y-"), "color2")
self.labels['y-'].connect("clicked", self.move, "Y", "-")
self.labels['z+'] = self._gtk.ButtonImage("move-z-", _("Z+"), "color3")
self.labels['z+'].connect("clicked", self.move, "Z", "+")
self.labels['z-'] = self._gtk.ButtonImage("move-z+", _("Z-"), "color3")
self.labels['z-'].connect("clicked", self.move, "Z", "-")
self.labels['home'] = self._gtk.ButtonImage("home", _("Home All"))
self.labels['home'].connect("clicked", self.home)
grid.attach(self.labels['x+'], 2, 1, 1, 1)
grid.attach(self.labels['x-'], 0, 1, 1, 1)
grid.attach(self.labels['y+'], 1, 0, 1, 1)
grid.attach(self.labels['y-'], 1, 1, 1, 1)
grid.attach(self.labels['z+'], 3, 0, 1, 1)
grid.attach(self.labels['z-'], 3, 1, 1, 1)
grid.attach(self.labels['home'], 0, 0, 1, 1)
distgrid = Gtk.Grid()
j = 0;
for i in self.distances:
self.labels[i] = self._gtk.ToggleButton(i)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if j == 0:
ctx.add_class("distbutton_top")
elif j == len(self.distances)-1:
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
if i == "1":
ctx.add_class("distbutton_active")
distgrid.attach(self.labels[i], j, 0, 1, 1)
j += 1
self.labels["1"].set_active(True)
#space_grid = self._gtk.HomogeneousGrid()
#space_grid.attach(Gtk.Label("Distance (mm):"),0,0,1,1)
#space_grid.attach(distgrid,0,1,1,1)
#space_grid.attach(Gtk.Label(" "),0,2,1,1)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
bottomgrid = self._gtk.HomogeneousGrid()
self.labels['pos_x'] = Gtk.Label("X: 0")
self.labels['pos_y'] = Gtk.Label("Y: 0")
self.labels['pos_z'] = Gtk.Label("Z: 0")
bottomgrid.attach(self.labels['pos_x'], 0, 0, 1, 1)
bottomgrid.attach(self.labels['pos_y'], 1, 0, 1, 1)
bottomgrid.attach(self.labels['pos_z'], 2, 0, 1, 1)
box.pack_start(bottomgrid, True, True, 0)
self.labels['move_dist'] = Gtk.Label(_("Move Distance (mm)"))
box.pack_start(self.labels['move_dist'], True, True, 0)
box.pack_start(distgrid, True, True, 0)
grid.attach(box, 0, 2, 3, 1)
self.content.add(grid)
self._screen.add_subscription(panel_name)
def process_update(self, action, data):
if action != "notify_status_update":
return
if "toolhead" in data and "position" in data["toolhead"]:
self.labels['pos_x'].set_text("X: %.2f" % (data["toolhead"]["position"][0]))
self.labels['pos_y'].set_text("Y: %.2f" % (data["toolhead"]["position"][1]))
self.labels['pos_z'].set_text("Z: %.2f" % (data["toolhead"]["position"][2]))
def change_distance(self, widget, distance):
if self.distance == distance:
return
logging.info("### Distance " + str(distance))
ctx = self.labels[str(self.distance)].get_style_context()
ctx.remove_class("distbutton_active")
self.distance = distance
ctx = self.labels[self.distance].get_style_context()
ctx.add_class("distbutton_active")
for i in self.distances:
if i == self.distance:
continue
self.labels[str(i)].set_active(False)
def move(self, widget, axis, dir):
if self._config.get_config().getboolean("main", "invert_%s" % axis.lower(), False):
dir = "-" if dir == "+" else "+"
dist = str(self.distance) if dir == "+" else "-" + str(self.distance)
logging.info("# Moving " + axis + " " + dist + "mm")
print("%s\n%s %s%s" % (KlippyGcodes.MOVE_RELATIVE, KlippyGcodes.MOVE, axis, dist))
self._screen._ws.klippy.gcode_script(
"%s\n%s %s%s" % (KlippyGcodes.MOVE_RELATIVE, KlippyGcodes.MOVE, axis, dist)
)
+10 -10
View File
@@ -5,15 +5,18 @@ import os
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from panels.screen_panel import ScreenPanel
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.NetworkPanel")
def create_panel(*args):
return NetworkPanel(*args)
class NetworkPanel(ScreenPanel):
def initialize(self, menu):
# Create gtk items here
self.panel = KlippyGtk.HomogeneousGrid()
_ = self.lang.gettext
grid = self._gtk.HomogeneousGrid()
grid.set_hexpand(True)
# Get Hostname
stream = os.popen('hostname -A')
@@ -25,12 +28,9 @@ class NetworkPanel(ScreenPanel):
self.labels['networkinfo'] = Gtk.Label(
"Network Info\n\n%s%s" % (hostname, ip)
_("Network Info") + "\n\n%s%s" % (hostname, ip)
)
self.labels['networkinfo'].get_style_context().add_class('temperature_entry')
self.panel.attach(self.labels['networkinfo'], 1, 0, 1, 1)
grid.attach(self.labels['networkinfo'], 1, 0, 1, 1)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
self.panel.attach(b, 1, 1, 1, 1)
self.content.add(grid)
+104
View File
@@ -0,0 +1,104 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.PowerPanel")
def create_panel(*args):
return PowerPanel(*args)
class PowerPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.devices = {}
# Create a scroll window for the power devices
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
# Create a grid for all devices
self.labels['devices'] = Gtk.Grid()
scroll.add(self.labels['devices'])
# Create a box to contain all of the above
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
box.pack_start(scroll, True, True, 0)
self.load_power_devices()
self.content.add(box)
self._screen.add_subscription(panel_name)
def add_device(self, device):
frame = Gtk.Frame()
frame.set_property("shadow-type",Gtk.ShadowType.NONE)
frame.get_style_context().add_class("frame-item")
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big>" % (device))
name.set_hexpand(True)
name.set_vexpand(True)
name.set_halign(Gtk.Align.START)
name.set_valign(Gtk.Align.CENTER)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
switch = Gtk.Switch()
switch.set_hexpand(False)
switch.set_active(True if self._screen.printer.get_power_device_status(device) == "on" else False)
switch.connect("notify::active", self.on_switch, device)
switch.set_property("width-request", round(self._gtk.get_image_width()*2.5))
switch.set_property("height-request", round(self._gtk.get_image_height()*1.25))
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.add(labels)
dev.add(switch)
frame.add(dev)
self.devices[device] = {
"row": frame,
"switch": switch
}
devices = sorted(self.devices)
pos = devices.index(device)
self.labels['devices'].insert_row(pos)
self.labels['devices'].attach(self.devices[device]['row'], 0, pos, 1, 1)
self.labels['devices'].show_all()
def load_power_devices(self):
devices = self._screen.printer.get_power_devices()
for x in devices:
self.add_device(x)
def on_switch(self, switch, gparam, device):
logger.debug("Power toggled %s" % device)
if switch.get_active():
self._screen._ws.klippy.power_device_on(device)
else:
self._screen._ws.klippy.power_device_off(device)
def process_update(self, action, data):
if action != "notify_power_changed":
return
if data['device'] not in self.devices:
return
device = data['device']
self.devices[device]['switch'].disconnect_by_func(self.on_switch)
self.devices[device]['switch'].set_active(True if data['status'] == "on" else False)
self.devices[device]['switch'].connect("notify::active", self.on_switch, device)
+41 -27
View File
@@ -4,41 +4,46 @@ import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from panels.screen_panel import ScreenPanel
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.PreheatPanel")
def create_panel(*args):
return PreheatPanel(*args)
class PreheatPanel(ScreenPanel):
active_heaters = []
def initialize(self, panel_name):
self.preheat_options = self._screen._config['preheat_options']
_ = self.lang.gettext
self.preheat_options = self._screen._config.get_preheat_options()
logger.debug("Preheat options: %s" % self.preheat_options)
grid = KlippyGtk.HomogeneousGrid()
grid = self._gtk.HomogeneousGrid()
eq_grid = KlippyGtk.HomogeneousGrid()
eq_grid = self._gtk.HomogeneousGrid()
i = 0
for x in self._printer.get_tools():
if i > 3:
break
elif i == 0:
primary_tool = x
self.labels[x] = KlippyGtk.ToggleButtonImage("extruder-"+str(i+1), KlippyGtk.formatTemperatureString(0, 0))
self.labels[x] = self._gtk.ToggleButtonImage("extruder-"+str(i), self._gtk.formatTemperatureString(0, 0))
self.labels[x].connect('clicked', self.select_heater, x)
eq_grid.attach(self.labels[x], i%2, i/2, 1, 1)
i += 1
self.labels["heater_bed"] = KlippyGtk.ToggleButtonImage("bed", KlippyGtk.formatTemperatureString(0, 0))
self.labels["heater_bed"].connect('clicked', self.select_heater, "heater_bed")
width = 2 if i > 1 else 1
eq_grid.attach(self.labels["heater_bed"], 0, i/2+1, width, 1)
if self._printer.has_heated_bed():
self.labels["heater_bed"] = self._gtk.ToggleButtonImage("bed", self._gtk.formatTemperatureString(0, 0))
self.labels["heater_bed"].connect('clicked', self.select_heater, "heater_bed")
width = 2 if i > 1 else 1
eq_grid.attach(self.labels["heater_bed"], 0, i/2+1, width, 1)
self.labels["control_grid"] = KlippyGtk.HomogeneousGrid()
self.labels["control_grid"] = self._gtk.HomogeneousGrid()
i = 0
for option in self.preheat_options:
self.labels[option] = KlippyGtk.Button(option, "color%d" % ((i%4)+1))
self.labels[option] = self._gtk.Button(option, "color%d" % ((i%4)+1))
self.labels[option].connect("clicked", self.set_temperature, option)
self.labels['control_grid'].attach(
self.labels[option],
@@ -46,24 +51,28 @@ class PreheatPanel(ScreenPanel):
i += 1
cooldown = KlippyGtk.ButtonImage('cool-down', 'Cooldown')
cooldown = self._gtk.ButtonImage('cool-down', _('Cooldown'))
cooldown.connect("clicked", self.set_temperature, "cooldown")
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
row = int(i/2) if i%2 == 0 else int(i/2)+1
self.labels["control_grid"].attach(cooldown, 0, row, 1, 1)
self.labels["control_grid"].attach(b, 1, row, 1, 1)
self.labels["control_grid"].attach(cooldown, i%2, int(i/2), 1, 1)
grid.attach(eq_grid, 0, 0, 1, 1)
grid.attach(self.labels["control_grid"], 1, 0, 1, 1)
self.panel = grid
self.content.add(grid)
self._screen.add_subscription(panel_name)
def activate(self):
for x in self._printer.get_tools():
if x not in self.active_heaters:
self.select_heater(None, x)
if self._printer.has_heated_bed() and "heater_bed" not in self.active_heaters:
self.select_heater(None, "heater_bed")
def select_heater(self, widget, heater):
if heater in self.active_heaters:
self.active_heaters.pop(self.active_heaters.index(heater))
@@ -91,15 +100,20 @@ class PreheatPanel(ScreenPanel):
self._screen._ws.klippy.set_bed_temp(self.preheat_options[setting]["bed"])
self._printer.set_dev_stat(heater,"target", int(self.preheat_options[setting]["bed"]))
else:
print ("Setting %s to %d" % (heater, self.preheat_options[setting]['tool']))
self._screen._ws.klippy.set_tool_temp(heater, self.preheat_options[setting]["tool"])
self._printer.set_dev_stat(heater,"target", int(self.preheat_options[setting]["tool"]))
print ("Setting %s to %d" % (heater, self.preheat_options[setting]['extruder']))
self._screen._ws.klippy.set_tool_temp(self._printer.get_tool_number(heater),
self.preheat_options[setting]["extruder"])
self._printer.set_dev_stat(heater,"target", int(self.preheat_options[setting]["extruder"]))
def process_update(self, data):
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
def process_update(self, action, data):
if action != "notify_status_update":
return
if self._printer.has_heated_bed():
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
+31 -69
View File
@@ -3,15 +3,17 @@ import humanize
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from gi.repository import Gtk, Gdk, GLib, Pango
from datetime import datetime
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.PrintPanel")
def create_panel(*args):
return PrintPanel(*args)
class PrintPanel(ScreenPanel):
def initialize(self, panel_name):
self.labels['files'] = {}
@@ -24,24 +26,6 @@ class PrintPanel(ScreenPanel):
box.set_vexpand(True)
box.pack_start(scroll, True, True, 0)
bar = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
bar.set_hexpand(True)
bar.set_vexpand(False)
bar.set_halign(Gtk.Align.END)
bar.set_margin_top(5)
bar.set_margin_bottom(5)
bar.set_margin_end(5)
refresh = KlippyGtk.ButtonImage('refresh', None, None, 60, 60)
refresh.connect("clicked", self.reload_files)
#bar.add(refresh)
back = KlippyGtk.ButtonImage('back', None, None, 60, 60)
back.connect("clicked", self._screen._menu_go_back)
bar.add(back)
box.pack_end(bar, False, False, 0)
self.labels['filelist'] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.labels['filelist'].set_vexpand(True)
@@ -54,8 +38,7 @@ class PrintPanel(ScreenPanel):
scroll.add(self.labels['filelist'])
self.panel = box
self.content.add(box)
self._screen.files.add_file_callback(self._callback)
@@ -69,14 +52,17 @@ class PrintPanel(ScreenPanel):
frame = Gtk.Frame()
frame.set_property("shadow-type",Gtk.ShadowType.NONE)
frame.get_style_context().add_class("frame-item")
name = Gtk.Label()
#n = 50
#name.set_markup("<big>%s</big>" % ("\n".join([filename[i:i+n] for i in range(0, len(filename), n)])))
name.set_markup("<big>%s</big>" % (filename))
name.set_markup("<big><b>%s</b></big>" % (filename))
name.set_hexpand(True)
name.set_halign(Gtk.Align.START)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
info = Gtk.Label("Uploaded: blah - Size: blah")
info.set_halign(Gtk.Align.START)
@@ -88,20 +74,16 @@ class PrintPanel(ScreenPanel):
labels.set_valign(Gtk.Align.CENTER)
labels.set_halign(Gtk.Align.START)
actions = KlippyGtk.ButtonImage("print",None,"color3")
actions = self._gtk.ButtonImage("print",None,"color3")
actions.connect("clicked", self.confirm_print, filename)
actions.set_hexpand(False)
actions.set_halign(Gtk.Align.END)
file = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
file.set_margin_top(1)
file.set_margin_end(15)
file.set_margin_start(15)
file.set_margin_bottom(1)
file.set_hexpand(True)
file.set_vexpand(False)
icon = KlippyGtk.Image("file", False, 100, 100)
icon = self._gtk.Image("file.svg", False, 1.6, 1.6)
pixbuf = self.get_file_image(filename)
if pixbuf != None:
icon.set_from_pixbuf(pixbuf)
@@ -125,26 +107,19 @@ class PrintPanel(ScreenPanel):
self.labels['filelist'].attach(self.files[filename], 0, pos, 1, 1)
self.labels['filelist'].show_all()
def get_file_image(self, filename, width=100, height=100):
fileinfo = self._screen.files.get_file_info(filename)
if fileinfo == None:
return None
if "thumbnails" in fileinfo and len(fileinfo["thumbnails"]) > 0:
thumbnail = fileinfo['thumbnails'][0]
return KlippyGtk.PixbufFromFile("/tmp/.KS-thumbnails/%s-%s" % (fileinfo['filename'], thumbnail['size']),
None, width, height)
return None
def get_file_info_str(self, filename):
_ = self.lang.gettext
fileinfo = self._screen.files.get_file_info(filename)
if fileinfo == None:
return
return "<small>Uploaded: <b>%s</b> - Size: <b>%s</b> - Print Time: <b>%s</b></small>" % (
return "<small>%s: <b>%s</b> - %s: <b>%s</b>\n%s: <b>%s</b></small>" % (
_("Uploaded"),
datetime.fromtimestamp(fileinfo['modified']).strftime("%Y-%m-%d %H:%M"),
_("Size"),
humanize.naturalsize(fileinfo['size']),
_("Print Time"),
self.get_print_time(filename)
)
@@ -212,47 +187,34 @@ class PrintPanel(ScreenPanel):
self.update_file(file)
def confirm_print(self, widget, filename):
dialog = Gtk.Dialog()
#TODO: Factor other resolutions in
dialog.set_default_size(984, 580)
dialog.set_resizable(False)
dialog.set_transient_for(self._screen)
dialog.set_modal(True)
dialog.add_button(button_text="Print", response_id=Gtk.ResponseType.OK)
dialog.add_button(button_text="Cancel", response_id=Gtk.ResponseType.CANCEL)
dialog.connect("response", self.confirm_print_response, filename)
dialog.get_style_context().add_class("dialog")
content_area = dialog.get_content_area()
content_area.set_margin_start(15)
content_area.set_margin_end(15)
content_area.set_margin_top(15)
content_area.set_margin_bottom(15)
_ = self.lang.gettext
buttons = [
{"name":_("Print"), "response": Gtk.ResponseType.OK},
{"name":_("Cancel"),"response": Gtk.ResponseType.CANCEL}
]
label = Gtk.Label()
label.set_markup("%s <b>%s</b>%s" % (_("Are you sure you want to print"), filename, _("?")))
label.set_hexpand(True)
label.set_halign(Gtk.Align.CENTER)
label.set_line_wrap(True)
label.set_size_request(800, -1)
label.set_markup("Are you sure you want to print <b>%s</b>?\n\n" % (filename))
label.get_style_context().add_class("text")
label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
grid = Gtk.Grid()
grid.add(label)
grid.set_size_request(self._screen.width - 60, -1)
pixbuf = self.get_file_image(filename, 400, 350)
pixbuf = self.get_file_image(filename, 8, 3.2)
if pixbuf != None:
image = Gtk.Image.new_from_pixbuf(pixbuf)
grid.attach_next_to(image, label, Gtk.PositionType.BOTTOM, 1, 3)
#table.attach(label, 0, 1, 0, 1, Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)
grid.set_vexpand(True)
grid.set_halign(Gtk.Align.CENTER)
grid.set_valign(Gtk.Align.CENTER)
content_area.add(grid)
dialog.show_all()
dialog = self._gtk.Dialog(self._screen, buttons, grid, self.confirm_print_response, filename)
def confirm_print_response(self, widget, response_id, filename):
widget.destroy()
-43
View File
@@ -1,43 +0,0 @@
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
class ScreenPanel:
def __init__(self, screen):
self._screen = screen
self._printer = screen.printer
self.labels = {}
def initialize(self, panel_name):
# Create gtk items here
return
def emergency_stop(self, widget):
self._screen._ws.klippy.emergency_stop()
def get(self):
# Return gtk item
return self.panel
def home(self, widget):
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
def menu_item_clicked(self, widget, panel, item):
print("### Creating panel "+ item['panel'])
if "items" in item:
self._screen.show_panel(self._screen._cur_panels[-1] + '_' + item['name'], item['panel'], 1, False, items=item['items'])
return
self._screen.show_panel(self._screen._cur_panels[-1] + '_' + item['name'], item['panel'], 1, False)
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_temp(self, dev, temp, target):
if dev in self.labels:
self.labels[dev].set_label(KlippyGtk.formatTemperatureString(temp, target))
+181
View File
@@ -0,0 +1,181 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.Settings")
def create_panel(*args):
return SettingsPanel(*args)
class SettingsPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
self.settings = {}
self.macros = {}
self.menu_cur = 'main_box'
self.menu = ['main_box']
self.labels['main_box'] = self.create_box('main')
self.labels['macros_box'] = self.create_box('macros')
options = self._config.get_configurable_options()
for option in options:
name = list(option)[0]
self.add_option('main', self.settings, name, option[name])
self.add_option('main', self.settings, "macros", {
"name": _("Displayed Macros"),
"type": "menu",
"menu": "macros"
})
for macro in self._printer.get_config_section_list("gcode_macro "):
macro = macro[12:]
self.macros[macro] = {
"name": macro,
"section": "displayed_macros",
"type": "macro"
}
for macro in list(self.macros):
self.add_option('macros', self.macros, macro, self.macros[macro])
logger.debug("Macros: %s" % self.macros)
self.control['back'].disconnect_by_func(self._screen._menu_go_back)
self.control['back'].connect("clicked", self.back)
self.content.add(self.labels['main_box'])
def activate(self):
while len(self.menu) > 1:
self.unload_menu()
def back(self, widget):
if len(self.menu) > 1:
self.unload_menu()
else:
self._screen._menu_go_back()
def create_box(self, name):
# Create a scroll window for the macros
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
# Create a grid for all macros
self.labels[name] = Gtk.Grid()
scroll.add(self.labels[name])
# Create a box to contain all of the above
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
box.pack_start(scroll, True, True, 0)
return box
def add_option(self, boxname, opt_array, opt_name, option):
frame = Gtk.Frame()
frame.set_property("shadow-type",Gtk.ShadowType.NONE)
frame.get_style_context().add_class("frame-item")
name = Gtk.Label()
name.set_markup("<big><b>%s</b></big>" % (option['name']))
name.set_hexpand(True)
name.set_vexpand(True)
name.set_halign(Gtk.Align.START)
name.set_valign(Gtk.Align.CENTER)
name.set_line_wrap(True)
name.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
#open = self._gtk.ButtonImage("open",None,"color3")
#open.connect("clicked", self.run_gcode_macro, macro)
#open.set_hexpand(False)
#open.set_halign(Gtk.Align.END)
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
dev = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
dev.set_hexpand(True)
dev.set_vexpand(False)
dev.set_valign(Gtk.Align.CENTER)
dev.add(labels)
if option['type'] == "binary" or option['type'] == "macro":
box = Gtk.Box()
box.set_vexpand(False)
switch = Gtk.Switch()
switch.set_hexpand(False)
switch.set_vexpand(False)
if option['type'] == "macro":
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name, fallback=True))
else:
switch.set_active(self._config.get_config().getboolean(option['section'], opt_name))
switch.connect("notify::active", self.switch_config_option, option['section'], opt_name)
switch.set_property("width-request", round(self._gtk.get_image_width()*2.5))
switch.set_property("height-request", round(self._gtk.get_image_height()*1.25))
box.add(switch)
dev.add(box)
elif option['type'] == "menu":
open = self._gtk.ButtonImage("open",None,"color3")
open.connect("clicked", self.load_menu, option['menu'])
open.set_hexpand(False)
open.set_halign(Gtk.Align.END)
dev.add(open)
frame.add(dev)
opt_array[opt_name] = {
"row": frame
}
opts = sorted(opt_array)
pos = opts.index(opt_name)
self.labels[boxname].insert_row(pos)
self.labels[boxname].attach(opt_array[opt_name]['row'], 0, pos, 1, 1)
self.labels[boxname].show_all()
def load_menu(self, widget, name):
if ("%s_box" % name) not in self.labels:
return
for child in self.content.get_children():
self.content.remove(child)
self.menu.append('%s_box' % name)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def unload_menu(self, widget=None):
logger.debug("self.menu: %s" % self.menu)
if len(self.menu) <= 1 or self.menu[-2] not in self.labels:
return
self.menu.pop()
for child in self.content.get_children():
self.content.remove(child)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def switch_config_option(self, switch, gparam, section, option):
logger.debug("[%s] %s toggled %s" % (section, option, switch.get_active()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)
self._config.set(section, option, "True" if switch.get_active() else "False")
self._config.save_user_config_options()
def add_gcode_option(self):
macros = self._screen.printer.get_gcode_macros()
for x in macros:
self.add_gcode_macro("macros", self.macros, x, {
"name": x[12:],
"type": binary
})
def run_gcode_macro(self, widget, macro):
self._screen._ws.klippy.gcode_script(macro)
+84 -67
View File
@@ -1,67 +1,84 @@
import gi
import logging
import os
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from panels.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.SplashScreenPanel")
class SplashScreenPanel(ScreenPanel):
box = None
def initialize(self, panel_name):
image = Gtk.Image()
#TODO: update file reference
image.set_from_file(os.getcwd() + "/styles/z-bolt/images/klipper.png")
self.labels['text'] = Gtk.Label("Initializing printer...")
self.labels['text'].get_style_context().add_class("text")
self.labels['actions'] = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.labels['actions'].set_hexpand(True)
self.labels['actions'].set_vexpand(False)
self.labels['actions'].set_halign(Gtk.Align.END)
self.labels['actions'].set_margin_end(20)
main = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=15)
main.pack_start(image, True, True, 10)
main.pack_end(self.labels['actions'], False, False, 10)
main.pack_end(self.labels['text'], True, True, 10)
box = Gtk.VBox()
box.add(main)
self.panel = box
def update_text(self, text):
self.labels['text'].set_text(text)
self.clear_action_bar()
def clear_action_bar(self):
for child in self.labels['actions'].get_children():
self.labels['actions'].remove(child)
def show_restart_buttons(self):
if "firmware_restart" not in self.labels:
self.labels['restart'] = KlippyGtk.ButtonImage("reboot","Restart","color1")
self.labels['restart'].connect("clicked", self.restart)
self.labels['firmware_restart'] = KlippyGtk.ButtonImage("restart","Firmware Restart","color2")
self.labels['firmware_restart'].connect("clicked", self.firmware_restart)
self.clear_action_bar()
self.labels['actions'].add(self.labels['restart'])
self.labels['actions'].add(self.labels['firmware_restart'])
def firmware_restart(self, widget):
self._screen._ws.klippy.restart_firmware()
def restart(self, widget):
self._screen._ws.klippy.restart()
import gi
import logging
import os
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.SplashScreenPanel")
def create_panel(*args):
return SplashScreenPanel(*args)
class SplashScreenPanel(ScreenPanel):
box = None
def initialize(self, panel_name):
_ = self.lang.gettext
image = self._gtk.Image("klipper.png", None, 4, 3)
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)
self.labels['text'].set_halign(Gtk.Align.CENTER)
self.labels['actions'] = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.labels['actions'].set_hexpand(True)
self.labels['actions'].set_vexpand(False)
self.labels['actions'].set_halign(Gtk.Align.END)
self.labels['actions'].set_margin_end(20)
main = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=15)
main.pack_start(image, True, True, 10)
main.pack_end(self.labels['actions'], False, False, 10)
main.pack_end(self.labels['text'], True, True, 10)
box = Gtk.VBox()
box.add(main)
self.layout = box
def update_text(self, text):
self.labels['text'].set_text(text)
self.clear_action_bar()
def clear_action_bar(self):
for child in self.labels['actions'].get_children():
self.labels['actions'].remove(child)
def show_restart_buttons(self):
_ = self.lang.gettext
if "firmware_restart" not in self.labels:
self.labels['power'] = self._gtk.ButtonImage("reboot",_("Power On Printer"),"color3")
self.labels['restart'] = self._gtk.ButtonImage("reboot",_("Restart"),"color1")
self.labels['restart'].connect("clicked", self.restart)
self.labels['firmware_restart'] = self._gtk.ButtonImage("restart",_("Firmware Restart"),"color2")
self.labels['firmware_restart'].connect("clicked", self.firmware_restart)
self.clear_action_bar()
devices = [i for i in self._screen.printer.get_power_devices() if i.lower().startswith('printer')]
logger.debug("Power devices: %s" % devices)
if len(devices) > 0:
logger.debug("Adding power button")
self.labels['power'].connect("clicked", self.power_on, devices[0])
self.labels['actions'].add(self.labels['power'])
self.labels['actions'].add(self.labels['restart'])
self.labels['actions'].add(self.labels['firmware_restart'])
def firmware_restart(self, widget):
self._screen._ws.klippy.restart_firmware()
def power_on(self, widget, device):
self._screen._ws.klippy.power_device_on(device)
def restart(self, widget):
self._screen._ws.klippy.restart()
+21 -20
View File
@@ -5,61 +5,62 @@ import os
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.SystemPanel")
def create_panel(*args):
return SystemPanel(*args)
class SystemPanel(ScreenPanel):
def initialize(self, panel_name):
# Create gtk items here
_ = self.lang.gettext
grid = KlippyGtk.HomogeneousGrid()
grid = self._gtk.HomogeneousGrid()
restart = KlippyGtk.ButtonImage('reboot','Klipper Restart','color1')
restart = self._gtk.ButtonImage('reboot',_('Klipper Restart'),'color1')
restart.connect("clicked", self.restart_klippy)
firmrestart = KlippyGtk.ButtonImage('restart','Firmware Restart','color2')
firmrestart = self._gtk.ButtonImage('restart',_('Firmware Restart'),'color2')
firmrestart.connect("clicked", self.restart_klippy, "firmware")
back = KlippyGtk.ButtonImage('back', 'Back')
back.connect("clicked", self._screen._menu_go_back)
info = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
info.set_vexpand(True)
title = Gtk.Label("System Information")
title.set_margin_bottom(5)
title.set_margin_top(15)
self.labels['loadavg'] = Gtk.Label("temp")
self.update_system_load()
self.system_timeout = GLib.timeout_add(1000, self.update_system_load)
title.get_style_context().add_class('temperature_entry')
self.labels['loadavg'].get_style_context().add_class('temperature_entry')
self.labels['klipper_version'] = Gtk.Label(_("Klipper Version") +
(": %s" % self._screen.printer.get_klipper_version()))
self.labels['klipper_version'].set_margin_top(15)
self.labels['ks_version'] = Gtk.Label(_("KlipperScreen Version") + (": %s" % self._screen.version))
self.labels['ks_version'].set_margin_top(15)
info.add(title)
info.add(self.labels['loadavg'])
info.add(self.labels['klipper_version'])
info.add(self.labels['ks_version'])
grid.attach(info, 0, 0, 4, 2)
grid.attach(restart, 0, 2, 1, 1)
grid.attach(firmrestart, 1, 2, 1, 1)
grid.attach(back, 3, 2, 1, 1)
self.panel = grid
self.content.add(grid)
def update_system_load(self):
_ = self.lang.gettext
lavg = os.getloadavg()
self.labels['loadavg'].set_text(
"Load Average: %.2f %.2f %.2f" % (lavg[0], lavg[1], lavg[2])
_("Load Average") + (": %.2f %.2f %.2f" % (lavg[0], lavg[1], lavg[2]))
)
#TODO: Shouldn't need this
self.system_timeout = GLib.timeout_add(1000, self.update_system_load)
def restart_klippy(self, type=None):
def restart_klippy(self, widget, type=None):
if type == "firmware":
self._screen._ws.klippy.restart_firmware()
else:
+244 -236
View File
@@ -1,236 +1,244 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from panels.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.TemperaturePanel")
class TemperaturePanel(ScreenPanel):
active_heater = "extruder"
tempdeltas = ["1","5","10","25"]
tempdelta = "10"
def initialize(self, panel_name):
grid = KlippyGtk.HomogeneousGrid()
eq_grid = KlippyGtk.HomogeneousGrid()
i = 0
for x in self._printer.get_tools():
if i > 3:
break
elif i == 0:
primary_tool = x
self.labels[x] = KlippyGtk.ToggleButtonImage("extruder-"+str(i+1), KlippyGtk.formatTemperatureString(0, 0))
self.labels[x].connect('clicked', self.select_heater, x)
if i == 0:
self.labels[x].set_active(True)
eq_grid.attach(self.labels[x], i%2, i/2, 1, 1)
i += 1
print ("Primary tool: " + primary_tool)
self.labels[primary_tool].get_style_context().add_class('button_active')
self.labels["heater_bed"] = KlippyGtk.ToggleButtonImage("bed", KlippyGtk.formatTemperatureString(0, 0))
self.labels["heater_bed"].connect('clicked', self.select_heater, "heater_bed")
width = 2 if i > 1 else 1
eq_grid.attach(self.labels["heater_bed"], 0, i/2+1, width, 1)
self.labels["control_grid"] = KlippyGtk.HomogeneousGrid()
self.labels["increase"] = KlippyGtk.ButtonImage("increase", "Increase", "color1")
self.labels["increase"].connect("clicked",self.change_target_temp, "+")
self.labels["decrease"] = KlippyGtk.ButtonImage("decrease", "Decrease", "color3")
self.labels["decrease"].connect("clicked",self.change_target_temp, "-")
self.labels["npad"] = KlippyGtk.ButtonImage("settings", "Number Pad", "color2")
self.labels["npad"].connect("clicked", self.show_numpad)
tempgrid = Gtk.Grid()
j = 0;
for i in self.tempdeltas:
self.labels['deg'+ i] = KlippyGtk.ToggleButton(i)
self.labels['deg'+ i].connect("clicked", self.change_temp_delta, i)
ctx = self.labels['deg'+ i].get_style_context()
if j == 0:
ctx.add_class("tempbutton_top")
elif j == len(self.tempdeltas)-1:
ctx.add_class("tempbutton_bottom")
else:
ctx.add_class("tempbutton")
if i == "10":
ctx.add_class("distbutton_active")
tempgrid.attach(self.labels['deg'+ i], 0, j, 1, 1)
j += 1
self.labels["deg" + self.tempdelta].set_active(True)
self.labels["control_grid"].attach(tempgrid, 2, 0, 1, 2)
self.labels["control_grid"].attach(self.labels["increase"], 3, 0, 1, 1)
self.labels["control_grid"].attach(self.labels["decrease"], 3, 1, 1, 1)
self.labels["control_grid"].attach(self.labels["npad"], 2, 2, 1, 1)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
self.labels["control_grid"].attach(b, 3, 2, 1, 1)
grid.attach(eq_grid, 0, 0, 1, 1)
grid.attach(self.labels["control_grid"], 1, 0, 1, 1)
self.panel = grid
self._screen.add_subscription(panel_name)
self.update_temp("heater_bed",35,40)
def change_temp_delta(self, widget, tempdelta):
if self.tempdelta == tempdelta:
return
logging.info("### tempdelta " + str(tempdelta))
ctx = self.labels["deg" + str(self.tempdelta)].get_style_context()
ctx.remove_class("distbutton_active")
self.tempdelta = tempdelta
ctx = self.labels["deg" + self.tempdelta].get_style_context()
ctx.add_class("distbutton_active")
for i in self.tempdeltas:
if i == self.tempdeltas:
continue
self.labels["deg" + str(i)].set_active(False)
def show_numpad(self, widget):
numpad = KlippyGtk.HomogeneousGrid()
keys = [
['1','numpad_tleft'],
['2','numpad_top'],
['3','numpad_tright'],
['4','numpad_left'],
['5','numpad_button'],
['6','numpad_right'],
['7','numpad_left'],
['8','numpad_button'],
['9','numpad_right'],
['B','numpad_bleft'],
['0','numpad_bottom'],
['E','numpad_bright']
]
for i in range(len(keys)):
id = 'button_' + str(keys[i][0])
if keys[i][0] == "B":
self.labels[id] = KlippyGtk.ButtonImage("backspace")
elif keys[i][0] == "E":
self.labels[id] = KlippyGtk.ButtonImage("complete", None, None, 40, 40)
else:
self.labels[id] = Gtk.Button(keys[i][0])
self.labels[id].connect('clicked', self.update_entry, keys[i][0])
ctx=self.labels[id].get_style_context()
ctx.add_class(keys[i][1])
numpad.attach(self.labels[id], i%3, i/3, 1, 1)
self.labels["keypad"] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=3)
self.labels['entry'] = Gtk.Entry()
self.labels['entry'].props.xalign = 0.5
ctx = self.labels['entry'].get_style_context()
ctx.add_class('temperature_entry')
b = KlippyGtk.ButtonImage('back', 'Close')
b.connect("clicked", self.hide_numpad)
#numpad.attach(b, 0, 5, 3, 1)
#numpad.attach(self.labels['entry'], 0, 0, 3, 1)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box.add(self.labels['entry'])
box.add(numpad)
box.add(b)
self.labels["keypad"] = numpad
self.panel.remove_column(1)
#self.panel.attach(self.labels["keypad"], 1, 0, 1, 1)
self.panel.attach(box, 1, 0, 1, 1)
self.panel.show_all()
def hide_numpad(self, widget):
self.panel.remove_column(1)
self.panel.attach(self.labels["control_grid"], 1, 0, 1, 1)
self.panel.show_all()
def select_heater (self, widget, heater):
if self.active_heater == heater:
return
self.labels[self.active_heater].get_style_context().remove_class('button_active')
self.active_heater = heater
self.labels[heater].get_style_context().add_class("button_active")
if "entry" in self.labels:
self.labels['entry'].set_text("")
logging.info("### Active heater " + self.active_heater)
def process_update(self, data):
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
self._printer.get_dev_stat(x,"target")
)
return
def change_target_temp(self, widget, dir):
target = self._printer.get_dev_stat(self.active_heater, "target")
if dir == "+":
target += int(self.tempdelta)
if target > KlippyGcodes.MAX_EXT_TEMP:
target = KlippyGcodes.MAX_EXT_TEMP
else:
target -= int(self.tempdelta)
if target < 0:
target = 0
self._printer.set_dev_stat(self.active_heater, "target", target)
if self.active_heater == "heater_bed":
self._screen._ws.klippy.gcode_script( KlippyGcodes.set_bed_temp(
target
))
else:
self._screen._ws.klippy.gcode_script( KlippyGcodes.set_ext_temp(
target,
self._printer.get_tool_number(self.active_heater)
))
def update_entry(self, widget, digit):
text = self.labels['entry'].get_text()
if digit == 'B':
if len(text) < 1:
return
self.labels['entry'].set_text(text[0:-1])
elif digit == 'E':
if self.active_heater == "heater_bed":
temp = int(text)
temp = 0 if temp < 0 or temp > KlippyGcodes.MAX_BED_TEMP else temp
self._screen._ws.klippy.gcode_script(KlippyGcodes.set_bed_temp(temp))
else:
temp = int(text)
temp = 0 if temp < 0 or temp > KlippyGcodes.MAX_EXT_TEMP else temp
self._screen._ws.klippy.gcode_script( KlippyGcodes.set_ext_temp(
temp,
self._printer.get_tool_number(self.active_heater)
))
self._printer.set_dev_stat(self.active_heater, "target", temp)
self.labels['entry'].set_text("")
else:
if len(text) >= 3:
return
self.labels['entry'].set_text(text + digit)
# -*- coding: utf-8 -*-
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
logger = logging.getLogger("KlipperScreen.TemperaturePanel")
def create_panel(*args):
return TemperaturePanel(*args)
class TemperaturePanel(ScreenPanel):
active_heater = "extruder"
tempdeltas = ["1","5","10","25"]
tempdelta = "10"
def initialize(self, panel_name):
_ = self.lang.gettext
grid = self._gtk.HomogeneousGrid()
eq_grid = self._gtk.HomogeneousGrid()
i = 0
for x in self._printer.get_tools():
if i > 3:
break
elif i == 0:
primary_tool = x
self.labels[x] = self._gtk.ToggleButtonImage("extruder-"+str(i), self._gtk.formatTemperatureString(0, 0))
self.labels[x].connect('clicked', self.select_heater, x)
if i == 0:
self.labels[x].set_active(True)
eq_grid.attach(self.labels[x], i%2, i/2, 1, 1)
i += 1
print ("Primary tool: " + primary_tool)
self.labels[primary_tool].get_style_context().add_class('button_active')
if self._printer.has_heated_bed():
self.labels["heater_bed"] = self._gtk.ToggleButtonImage("bed", self._gtk.formatTemperatureString(0, 0))
self.labels["heater_bed"].connect('clicked', self.select_heater, "heater_bed")
width = 2 if i > 1 else 1
eq_grid.attach(self.labels["heater_bed"], 0, i/2+1, width, 1)
self.labels["control_grid"] = self._gtk.HomogeneousGrid()
self.labels["increase"] = self._gtk.ButtonImage("increase", _("Increase"), "color1")
self.labels["increase"].connect("clicked",self.change_target_temp, "+")
self.labels["decrease"] = self._gtk.ButtonImage("decrease", _("Decrease"), "color3")
self.labels["decrease"].connect("clicked",self.change_target_temp, "-")
self.labels["npad"] = self._gtk.ButtonImage("settings", _("Number Pad"), "color2")
self.labels["npad"].connect("clicked", self.show_numpad)
tempgrid = Gtk.Grid()
j = 0;
for i in self.tempdeltas:
self.labels['deg'+ i] = self._gtk.ToggleButton(i)
self.labels['deg'+ i].connect("clicked", self.change_temp_delta, i)
ctx = self.labels['deg'+ i].get_style_context()
if j == 0:
ctx.add_class("tempbutton_top")
elif j == len(self.tempdeltas)-1:
ctx.add_class("tempbutton_bottom")
else:
ctx.add_class("tempbutton")
if i == "10":
ctx.add_class("distbutton_active")
tempgrid.attach(self.labels['deg'+ i], 0, j, 1, 1)
j += 1
self.labels["deg" + self.tempdelta].set_active(True)
vbox = Gtk.VBox()
vbox.pack_start(Gtk.Label("Temp °C"), False, False, 4)
vbox.pack_end(tempgrid, True, True, 0)
self.labels["control_grid"].attach(vbox, 2, 0, 1, 3)
self.labels["control_grid"].attach(self.labels["increase"], 3, 0, 1, 1)
self.labels["control_grid"].attach(self.labels["decrease"], 3, 1, 1, 1)
self.labels["control_grid"].attach(self.labels["npad"], 3, 2, 1, 1)
grid.attach(eq_grid, 0, 0, 1, 1)
grid.attach(self.labels["control_grid"], 1, 0, 1, 1)
self.grid = grid
self.content.add(grid)
self._screen.add_subscription(panel_name)
self.update_temp("heater_bed",35,40)
def change_temp_delta(self, widget, tempdelta):
if self.tempdelta == tempdelta:
return
logging.info("### tempdelta " + str(tempdelta))
ctx = self.labels["deg" + str(self.tempdelta)].get_style_context()
ctx.remove_class("distbutton_active")
self.tempdelta = tempdelta
ctx = self.labels["deg" + self.tempdelta].get_style_context()
ctx.add_class("distbutton_active")
for i in self.tempdeltas:
if i == self.tempdeltas:
continue
self.labels["deg" + str(i)].set_active(False)
def show_numpad(self, widget):
_ = self.lang.gettext
numpad = self._gtk.HomogeneousGrid()
keys = [
['1','numpad_tleft'],
['2','numpad_top'],
['3','numpad_tright'],
['4','numpad_left'],
['5','numpad_button'],
['6','numpad_right'],
['7','numpad_left'],
['8','numpad_button'],
['9','numpad_right'],
['B','numpad_bleft'],
['0','numpad_bottom'],
['E','numpad_bright']
]
for i in range(len(keys)):
id = 'button_' + str(keys[i][0])
if keys[i][0] == "B":
self.labels[id] = Gtk.Button("B") #self._gtk.ButtonImage("backspace")
elif keys[i][0] == "E":
self.labels[id] = Gtk.Button("E") #self._gtk.ButtonImage("complete", None, None, .675, .675)
else:
self.labels[id] = Gtk.Button(keys[i][0])
self.labels[id].connect('clicked', self.update_entry, keys[i][0])
ctx=self.labels[id].get_style_context()
ctx.add_class(keys[i][1])
numpad.attach(self.labels[id], i%3, i/3, 1, 1)
self.labels["keypad"] = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.labels['entry'] = Gtk.Entry()
self.labels['entry'].props.xalign = 0.5
ctx = self.labels['entry'].get_style_context()
b = self._gtk.ButtonImage('back', _('Close'))
b.connect("clicked", self.hide_numpad)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
box.add(self.labels['entry'])
box.add(numpad)
box.add(b)
self.labels["keypad"] = numpad
self.grid.remove_column(1)
self.grid.attach(box, 1, 0, 1, 1)
self.grid.show_all()
def hide_numpad(self, widget):
self.grid.remove_column(1)
self.grid.attach(self.labels["control_grid"], 1, 0, 1, 1)
self.grid.show_all()
def select_heater (self, widget, heater):
if self.active_heater == heater:
return
self.labels[self.active_heater].get_style_context().remove_class('button_active')
self.active_heater = heater
self.labels[heater].get_style_context().add_class("button_active")
if "entry" in self.labels:
self.labels['entry'].set_text("")
logging.info("### Active heater " + self.active_heater)
def process_update(self, action, data):
if action != "notify_status_update":
return
if self._printer.has_heated_bed():
self.update_temp("heater_bed",
self._printer.get_dev_stat("heater_bed","temperature"),
self._printer.get_dev_stat("heater_bed","target")
)
for x in self._printer.get_tools():
self.update_temp(x,
self._printer.get_dev_stat(x,"temperature"),
self._printer.get_dev_stat(x,"target")
)
return
def change_target_temp(self, widget, dir):
target = self._printer.get_dev_stat(self.active_heater, "target")
if dir == "+":
target += int(self.tempdelta)
if target > KlippyGcodes.MAX_EXT_TEMP:
target = KlippyGcodes.MAX_EXT_TEMP
else:
target -= int(self.tempdelta)
if target < 0:
target = 0
self._printer.set_dev_stat(self.active_heater, "target", target)
if self.active_heater == "heater_bed":
self._screen._ws.klippy.gcode_script( KlippyGcodes.set_bed_temp(
target
))
else:
self._screen._ws.klippy.gcode_script( KlippyGcodes.set_ext_temp(
target,
self._printer.get_tool_number(self.active_heater)
))
def update_entry(self, widget, digit):
text = self.labels['entry'].get_text()
if digit == 'B':
if len(text) < 1:
return
self.labels['entry'].set_text(text[0:-1])
elif digit == 'E':
if self.active_heater == "heater_bed":
temp = int(text)
temp = 0 if temp < 0 or temp > KlippyGcodes.MAX_BED_TEMP else temp
self._screen._ws.klippy.gcode_script(KlippyGcodes.set_bed_temp(temp))
else:
temp = int(text)
temp = 0 if temp < 0 or temp > KlippyGcodes.MAX_EXT_TEMP else temp
self._screen._ws.klippy.gcode_script( KlippyGcodes.set_ext_temp(
temp,
self._printer.get_tool_number(self.active_heater)
))
self._printer.set_dev_stat(self.active_heater, "target", temp)
self.labels['entry'].set_text("")
else:
if len(text) >= 3:
return
self.labels['entry'].set_text(text + digit)
+39 -31
View File
@@ -3,42 +3,46 @@ import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from KlippyGtk import KlippyGtk
from KlippyGcodes import KlippyGcodes
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
import logging
logger = logging.getLogger("KlipperScreen.ZCalibratePanel")
class ZCalibratePanel:
def create_panel(*args):
return ZCalibratePanel(*args)
class ZCalibratePanel(ScreenPanel):
_screen = None
labels = {}
distance = 1
distances = ['.01','.05','.1','.5','1','5']
def __init__(self, screen):
self._screen = screen
def __init__(self, screen, title, back=True):
super().__init__(screen, title, False)
def initialize(self, panel_name):
grid = KlippyGtk.HomogeneousGrid()
_ = self.lang.gettext
grid = self._gtk.HomogeneousGrid()
label = Gtk.Label("Z Offset: ")
label.get_style_context().add_class('temperature_entry')
self.labels['zpos'] = Gtk.Label("Homing")
self.labels['zpos'].get_style_context().add_class('temperature_entry')
box = Gtk.Box()
label = Gtk.Label(_("Z Offset") + ": \n")
self.labels['zposition'] = Gtk.Label(_("Homing"))
box = Gtk.VBox()
box.set_vexpand(False)
box.set_valign(Gtk.Align.CENTER)
box.add(label)
box.add(self.labels['zpos'])
box.add(self.labels['zposition'])
zpos = KlippyGtk.ButtonImage('z-offset-decrease',"Raise Nozzle")
zpos = self._gtk.ButtonImage('z-offset-decrease',_("Raise Nozzle"))
zpos.connect("clicked", self.move, "+")
zneg = KlippyGtk.ButtonImage('z-offset-increase',"Lower Nozzle")
zneg = self._gtk.ButtonImage('z-offset-increase',_("Lower Nozzle"))
zneg.connect("clicked", self.move, "-")
distgrid = Gtk.Grid()
j = 0;
for i in self.distances:
self.labels[i] = KlippyGtk.ToggleButton(i)
self.labels[i] = self._gtk.ToggleButton(i)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if j == 0:
@@ -54,45 +58,49 @@ class ZCalibratePanel:
self.labels["1"].set_active(True)
space_grid = KlippyGtk.HomogeneousGrid()
space_grid.attach(Gtk.Label("Distance (mm):"),0,0,1,1)
space_grid = self._gtk.HomogeneousGrid()
space_grid.set_row_homogeneous(False)
space_grid.attach(Gtk.Label(_("Distance (mm)") + ":"),0,0,1,1)
space_grid.attach(distgrid,0,1,1,1)
space_grid.attach(Gtk.Label(" "),0,2,1,1)
complete = KlippyGtk.ButtonImage('complete','Accept','color2')
complete = self._gtk.ButtonImage('complete',_('Accept'),'color2')
complete.connect("clicked", self.accept)
b = KlippyGtk.ButtonImage('back', 'Abort')
b = self._gtk.ButtonImage('back', _('Abort'))
b.connect("clicked", self.abort)
grid.attach(zpos, 1, 0, 1, 1)
grid.attach(box, 0, 1, 2, 1)
grid.attach(zneg, 1, 1, 1, 1)
grid.attach(complete, 3, 1, 1, 1)
#grid.set_row_homogeneous(False)
grid.attach(zpos, 0, 0, 1, 1)
grid.attach(box, 1, 0, 2, 2)
grid.attach(zneg, 0, 1, 1, 1)
grid.attach(complete, 3, 0, 1, 1)
grid.attach(space_grid, 0, 2, 3, 1)
grid.attach(b, 3, 2, 1, 1)
self.grid = grid
self.content.add(grid)
self._screen.add_subscription(panel_name)
def activate(self):
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
if self._screen.printer.get_stat("toolhead","homed_axes") != "xyz":
self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME)
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_CALIBRATE)
def process_update(self, data):
def process_update(self, action, data):
if action != "notify_status_update":
return
if "toolhead" in data and "position" in data['toolhead']:
self.updatePosition(data['toolhead']['position'])
def updatePosition(self, position):
self.labels['zpos'].set_text(str(round(position[2],2)))
self.labels['zposition'].set_text(str(round(position[2],2)))
def change_distance(self, widget, distance):
if self.distance == distance:
return
print("### Distance " + str(distance))
ctx = self.labels[str(self.distance)].get_style_context()
ctx.remove_class("distbutton_active")
@@ -113,9 +121,9 @@ class ZCalibratePanel:
def abort(self, widget):
logger.info("Aborting Z calibrate")
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_ABORT)
self._screen._menu_go_back(widget)
self.menu_return(widget)
def accept(self, widget):
logger.info("Accepting Z calibrate")
self._screen._ws.klippy.gcode_script(KlippyGcodes.PROBE_ACCEPT)
self._screen._ws.klippy.gcode_script(KlippyGcodes.SAVE_CONFIG)
self.menu_return(widget)
-105
View File
@@ -1,105 +0,0 @@
import logging
class Printer:
def __init__(self, data):
self.config = data['configfile']['config']
logging.info("### Reading printer config")
self.toolcount = 0
self.extrudercount = 0
self.tools = []
self.devices = {}
self.state = data['print_stats']['state']
self.data = data
for x in self.config.keys():
if x.startswith('extruder'):
if x.startswith('extruder_stepper'):
continue
self.devices[x] = {
"temperature": 0,
"target": 0
}
self.tools.append(x)
if "shared_heater" in self.config[x]:
self.toolcount += 1
continue
self.extrudercount += 1
if x.startswith('heater_bed'):
self.devices[x] = {
"temperature": 0,
"target": 0
}
logging.info("### Toolcount: " + str(self.toolcount) + " Heaters: " + str(self.extrudercount))
def process_update(self, data):
keys = ['virtual_sdcard','pause_resume','idle_timeout','print_stats']
keys = ['fan','gcode_move','idle_timeout','pause_resume','print_stats','toolhead','virtual_sdcard']
for x in keys:
if x in data:
for y in data[x]:
self.data[x][y] = data[x][y]
if "heater_bed" in data:
d = data["heater_bed"]
if "target" in d:
self.set_dev_stat("heater_bed", "target", d["target"])
if "temperature" in d:
self.set_dev_stat("heater_bed", "temperature", d["temperature"])
for x in self.get_tools():
if x in data:
d = data[x]
if "target" in d:
self.set_dev_stat(x, "target", d["target"])
if "temperature" in d:
self.set_dev_stat(x, "temperature", d["temperature"])
def get_config_section_list(self):
return list(self.config)
def get_config_section(self, section):
if section not in self.config:
return False
return self.config[section]
def get_data(self):
return self.data
def get_stat(self, stat, substat = None):
if substat != None:
return self.data[stat][substat]
return self.data[stat]
def set_dev_temps(self, dev, temp, target=None):
if dev in self.devices:
self.devices[dev]['temperature'] = temp
if target != None:
self.devices[dev]['target'] = target
def get_dev_stats(self, dev):
if dev in self.devices:
return self.devices[dev]
return None
def get_dev_stat(self, dev, stat):
if dev in self.devices and stat in self.devices[dev]:
return self.devices[dev][stat]
return None
def get_extruder_count(self):
return self.extrudercount
def get_tools(self):
return self.tools
def get_tool_number(self, tool):
return self.tools.index(tool)
def set_dev_stat(self, dev, stat, value):
if dev not in self.devices:
return
self.devices[dev][stat] = value
+380 -234
View File
@@ -1,43 +1,32 @@
#!/usr/bin/python
import argparse
import gi
import gettext
import time
import threading
import json
import requests
import websocket
import importlib
import logging
import os
import asyncio
import re
import subprocess
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from gi.repository import Gtk, Gdk, GLib, Pango
from jinja2 import Environment, Template
from KlippyWebsocket import KlippyWebsocket
from KlippyRest import KlippyRest
from files import KlippyFiles
from KlippyGtk import KlippyGtk
from printer import Printer
from ks_includes.KlippyWebsocket import KlippyWebsocket
from ks_includes.KlippyRest import KlippyRest
from ks_includes.files import KlippyFiles
from ks_includes.KlippyGtk import KlippyGtk
from ks_includes.printer import Printer
# Do this better in the future
from panels.screen_panel import *
from panels.bed_level import *
from panels.extrude import *
from panels.fan import *
from panels.fine_tune import *
from panels.job_status import *
from panels.main_menu import *
from panels.menu import *
from panels.move import *
from panels.network import *
from panels.preheat import *
from panels.print import *
from panels.splash_screen import *
from panels.system import *
from panels.temperature import *
from panels.zcalibrate import *
from ks_includes.config import KlipperScreenConfig
# Create logging
logger = logging.getLogger('KlipperScreen')
@@ -61,22 +50,38 @@ logger.info("Config file: " + config)
class KlipperScreen(Gtk.Window):
""" Class for creating a screen for Klipper via HDMI """
currentPanel = None
bed_temp_label = None
number_tools = 1
panels = {}
_cur_panels = []
bed_temp_label = None
currentPanel = None
files = None
filename = ""
subscriptions = []
last_update = {}
shutdown = True
load_panel = {}
number_tools = 1
panels = {}
popup_message = None
printer = None
rtl_languages = ['he_il']
subscriptions = []
shutdown = True
def __init__(self):
self.read_config()
self.init_style()
self.version = get_software_version()
logger.info("KlipperScreen version: %s" % self.version)
parser = argparse.ArgumentParser(description="KlipperScreen - A GUI for Klipper")
parser.add_argument(
"-c","--configfile", default="~/KlipperScreen.conf", metavar='<configfile>',
help="Location of KlipperScreen configuration file"
)
args = parser.parse_args()
configfile = os.path.normpath(os.path.expanduser(args.configfile))
self.lang = gettext.translation('KlipperScreen', localedir='ks_includes/locales', fallback=True)
self._config = KlipperScreenConfig(configfile, self.lang)
self.printer = Printer({
"software_version": "Unknown"
}, {
'configfile': {
'config': {}
},
@@ -88,164 +93,222 @@ class KlipperScreen(Gtk.Window):
}
})
self.apiclient = KlippyRest("127.0.0.1",7125)
self.printer.set_callbacks({
"disconnected": self.state_disconnected,
"error": self.state_error,
"printing": self.state_printing,
"ready": self.state_ready,
"startup": self.state_startup,
"shutdown": self.state_shutdown
})
logger.debug("OS Language: %s" % os.getenv('LANG'))
self.lang_ltr = True
for lang in self.rtl_languages:
if os.getenv('LANG').lower().startswith(lang):
self.lang_ltr = False
logger.debug("Enabling RTL mode")
break
_ = self.lang.gettext
self.apiclient = KlippyRest(self._config.get_main_config_option("moonraker_host"),
self._config.get_main_config_option("moonraker_port"),
self._config.get_main_config_option("moonraker_api_key", False))
powerdevs = self.apiclient.send_request("machine/device_power/devices")
if powerdevs != False:
self.printer.configure_power_devices(powerdevs['result'])
Gtk.Window.__init__(self)
self.set_default_size(Gdk.Screen.get_width(Gdk.Screen.get_default()), Gdk.Screen.get_height(Gdk.Screen.get_default()))
self.width = self._config.get_main_config().getint("width", Gdk.Screen.get_width(Gdk.Screen.get_default()))
self.height = self._config.get_main_config().getint("height", Gdk.Screen.get_height(Gdk.Screen.get_default()))
self.set_default_size(self.width, self.height)
self.set_resizable(False)
logger.info("Screen resolution: %s", str(Gdk.Screen.get_width(Gdk.Screen.get_default()))+"x"+str(Gdk.Screen.get_height(Gdk.Screen.get_default())))
logger.info("Screen resolution: %sx%s" % (self.width, self.height))
self.printer_initializing("Connecting to Moonraker")
self.gtk = KlippyGtk(self.width, self.height)
self.init_style()
#self._load_panels()
self.printer_initializing(_("Initializing"))
self._ws = KlippyWebsocket(self,
{
"on_connect": self.init_printer,
"on_message": self._websocket_callback,
"on_close": self.printer_initializing
},
self._config.get_main_config_option("moonraker_host"),
self._config.get_main_config_option("moonraker_port")
)
self._ws.initial_connect()
# Disable DPMS
os.system("/usr/bin/xset -display :0 s off")
os.system("/usr/bin/xset -display :0 -dpms")
os.system("/usr/bin/xset -display :0 s noblank")
ready = False
return
try:
info = self.apiclient.get_info()
except Exception:
return
if info == False:
return
if not hasattr(self, "_ws"):
self.create_websocket()
print(info)
if info['result']['klippy_state'] == "disconnected":
self.printer_initializing("Klipper is not connected to moonraker")
return
if info['result']['klippy_state'] == "error":
logger.warning("Printer is emergency stopped")
self.printer_initializing("Shutdown due to Emergency Stop")
return
status_objects = [
'idle_timeout',
'configfile',
'gcode_move',
'fan',
'toolhead',
'virtual_sdcard',
'print_stats',
'heater_bed',
'extruder',
'pause_resume'
]
r = requests.get("http://127.0.0.1:7125/printer/objects/query?" + "&".join(status_objects))
#TODO: Check that we get good data
#print (r.content)
try:
data = json.loads(r.content)
except:
logger.info("Not able to load data. Klippy is most likely offline")
return
data = data['result']['status']
for x in data:
self.last_update[x] = data[x]
self.printer_config = data['configfile']['config']
#logger.debug("Printer config: %s" % json.dumps(self.printer_config, indent=2))
self.printer.__init__(data)
# Initialize target values. TODO: methodize this
self.printer.set_dev_stat("heater_bed", "target", data['heater_bed']['target'])
self.printer.set_dev_stat("extruder", "target", data['extruder']['target'])
print (info)
if (data['print_stats']['state'] == "printing" or data['print_stats']['state'] == "paused"):
self.printer_printing()
elif info['result']['klippy_state'] == "ready":
self.printer_ready()
self.files = KlippyFiles(self)
def ws_subscribe(self):
requested_updates = {
"objects": {
"bed_mesh": ["profile_name","mesh_max","mesh_min","probed_matrix"],
"configfile": ["config"],
"extruder": ["target","temperature","pressure_advance","smooth_time"],
"fan": ["speed"],
"gcode_move": ["homing_origin","extrude_factor","speed_factor"],
"gcode_move": ["extrude_factor","gcode_position","homing_origin","speed_factor"],
"heater_bed": ["target","temperature"],
"idle_timeout": ["state"],
"pause_resume": ["is_paused"],
"print_stats": ["print_duration","total_duration","filament_used","filename","state","message"],
"toolhead": ["homed_axes","estimated_print_time","print_time","position","extruder"],
"virtual_sdcard": ["file_position","is_active","progress"]
"virtual_sdcard": ["file_position","is_active","progress"],
"webhooks": ["state","state_message"]
}
}
for extruder in self.printer.get_tools():
requested_updates['objects'][extruder] = ["target","temperature","pressure_advance","smooth_time"]
self._ws.klippy.object_subscription(requested_updates)
def show_panel(self, panel_name, type, remove=None, pop=True, **kwargs):
def _load_panel(self, panel, *args):
if not panel in self.load_panel:
logger.debug("Loading panel: %s" % panel)
panel_path = os.path.join(os.path.dirname(__file__), 'panels', "%s.py" % panel)
logger.info("Panel path: %s" % panel_path)
if not os.path.exists(panel_path):
msg = f"Panel {panel} does not exist"
logger.info(msg)
raise Exception(msg)
module = importlib.import_module("panels.%s" % panel)
if not hasattr(module, "create_panel"):
msg = f"Cannot locate create_panel function for {panel}"
logger.info(msg)
raise Exception(msg)
self.load_panel[panel] = getattr(module, "create_panel")
try:
return self.load_panel[panel](*args)
except Exception:
msg = f"Unable to create panel {panel}"
logger.exception(msg)
raise Exception(msg)
def show_panel(self, panel_name, type, title, remove=None, pop=True, **kwargs):
if panel_name not in self.panels:
self.panels[panel_name] = self._load_panel(type, self, title)
try:
if kwargs != {}:
self.panels[panel_name].initialize(panel_name, **kwargs)
else:
self.panels[panel_name].initialize(panel_name)
except:
del self.panels[panel_name]
self.show_error_modal("Unable to load panel %s" % type)
return
if hasattr(self.panels[panel_name],"process_update"):
self.panels[panel_name].process_update("notify_status_update", self.printer.get_data())
if hasattr(self.panels[panel_name],"activate"):
self.panels[panel_name].activate()
if remove == 2:
self._remove_all_panels()
elif remove == 1:
self._remove_current_panel(pop)
if panel_name not in self.panels:
if type == "SplashScreenPanel":
self.panels[panel_name] = SplashScreenPanel(self)
elif type == "MainPanel":
self.panels[panel_name] = MainPanel(self)
elif type == "menu":
self.panels[panel_name] = MenuPanel(self)
elif type == "bed_level":
self.panels[panel_name] = BedLevelPanel(self)
elif type == "extrude":
self.panels[panel_name] = ExtrudePanel(self)
elif type == "finetune":
self.panels[panel_name] = FineTune(self)
elif type == "JobStatusPanel":
self.panels[panel_name] = JobStatusPanel(self)
elif type == "move":
self.panels[panel_name] = MovePanel(self)
elif type == "network":
self.panels[panel_name] = NetworkPanel(self)
elif type == "preheat":
self.panels[panel_name] = PreheatPanel(self)
elif type == "print":
self.panels[panel_name] = PrintPanel(self)
elif type == "temperature":
self.panels[panel_name] = TemperaturePanel(self)
elif type == "fan":
self.panels[panel_name] = FanPanel(self)
elif type == "system":
self.panels[panel_name] = SystemPanel(self)
elif type == "zcalibrate":
self.panels[panel_name] = ZCalibratePanel(self)
#Temporary for development
else:
self.panels[panel_name] = MovePanel(self)
if kwargs != {}:
self.panels[panel_name].initialize(panel_name, **kwargs)
else:
self.panels[panel_name].initialize(panel_name)
if hasattr(self.panels[panel_name],"process_update"):
self.panels[panel_name].process_update(self.printer.get_data())
if hasattr(self.panels[panel_name],"activate"):
self.panels[panel_name].activate()
self.add(self.panels[panel_name].get())
self.show_all()
self._cur_panels.append(panel_name)
logger.debug("Current panel hierarchy: %s", str(self._cur_panels))
def show_popup_message(self, message):
if self.popup_message != None:
self.close_popup_message()
def read_config (self):
with open(config) as config_file:
self._config = json.load(config_file)
box = Gtk.Box()
box.get_style_context().add_class("message_popup")
box.set_size_request(self.width, self.gtk.get_header_size())
label = Gtk.Label()
if "must home axis first" in message.lower():
message = "Must home all axis first."
label.set_text(message)
close = Gtk.Button.new_with_label("X")
close.set_can_focus(False)
close.props.relief = Gtk.ReliefStyle.NONE
close.connect("clicked", self.close_popup_message)
box.pack_start(label, True, True, 0)
box.pack_end(close, False, False, 0)
box.set_halign(Gtk.Align.CENTER)
cur_panel = self.panels[self._cur_panels[-1]]
for i in ['back','estop','home']:
if i in cur_panel.control:
cur_panel.control[i].set_sensitive(False)
cur_panel.get().put(box, 0,0)
self.show_all()
self.popup_message = box
GLib.timeout_add(10000, self.close_popup_message)
return False
def close_popup_message(self, widget=None):
if self.popup_message == None:
return
cur_panel = self.panels[self._cur_panels[-1]]
for i in ['back','estop','home']:
if i in cur_panel.control:
cur_panel.control[i].set_sensitive(True)
cur_panel.get().remove(self.popup_message)
self.popup_message = None
self.show_all()
def show_error_modal(self, err):
_ = self.lang.gettext
logger.exception("Showing error modal: %s", err)
buttons = [
{"name":_("Go Back"),"response": Gtk.ResponseType.CANCEL}
]
label = Gtk.Label()
label.set_markup(("%s \n\n" % err) +
_("Check /tmp/KlipperScreen.log for more information.\nPlease submit an issue on GitHub for help."))
label.set_hexpand(True)
label.set_halign(Gtk.Align.CENTER)
label.set_line_wrap(True)
label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
dialog = self.gtk.Dialog(self, buttons, label, self.error_modal_response)
def error_modal_response(self, widget, response_id):
widget.destroy()
def init_style(self):
style_provider = Gtk.CssProvider()
style_provider.load_from_path(klipperscreendir + "/style.css")
#style_provider.load_from_path(klipperscreendir + "/style.css")
css = open(klipperscreendir + "/styles/style.css")
css_data = css.read()
css.close()
css_data = css_data.replace("KS_FONT_SIZE",str(self.gtk.get_font_size()))
style_provider = Gtk.CssProvider()
style_provider.load_from_data(css_data.encode())
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
@@ -253,11 +316,8 @@ class KlipperScreen(Gtk.Window):
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
def create_websocket(self):
self._ws = KlippyWebsocket(self, self._websocket_callback)
self._ws.connect()
self._curr = 0
def is_printing(self):
return "job_status" in self._cur_panels
def _go_to_submenu(self, widget, name):
logger.info("#### Go to submenu " + str(name))
@@ -266,59 +326,43 @@ class KlipperScreen(Gtk.Window):
# Find current menu item
panels = list(self._cur_panels)
if "job_status" not in self._cur_panels:
cur_item = self._find_current_menu_item(name, self._config['mainmenu'], panels.pop(0))
menu = cur_item['items']
menu = "__main"
else:
menu = self._config['printmenu']
menu = "__print"
logger.info("#### Menu " + str(menu))
#self.show_panel("_".join(self._cur_panels) + '_' + name, "menu", 1, False, menu=menu)
disname = self._config.get_menu_name(menu, name)
menuitems = self._config.get_menu_items(menu, name)
if len(menuitems) == 0:
logger.info("No items in menu, returning.")
return
self.show_panel(self._cur_panels[-1] + '_' + name, "menu", 1, False, items=menu)
return
grid = self.arrangeMenuItems(menu, 4)
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._menu_go_back)
grid.attach(b, 4, 2, 1, 1)
self._cur_panels.append(cur_item['name']) #str(cur_item['name']))
self.panels[cur_item['name']] = grid
self.add(self.panels[cur_item['name']])
self.show_all()
def _find_current_menu_item(self, menu, items, names):
for item in items:
if item['name'] == menu:
return item
#TODO: Add error check
self.show_panel(self._cur_panels[-1] + '_' + name, "menu", disname, 1, False, display_name=disname,
items=menuitems)
def _remove_all_panels(self):
while len(self._cur_panels) > 0:
self._remove_current_panel()
self._remove_current_panel(True, False)
self.show_all()
def _remove_current_panel(self, pop=True):
def _remove_current_panel(self, pop=True, show=True):
if len(self._cur_panels) > 0:
self.remove(
self.panels[
self._cur_panels[-1]
].get()
)
self.remove(self.panels[self._cur_panels[-1]].get())
if pop == True:
self._cur_panels.pop()
if len(self._cur_panels) > 0:
self.add(self.panels[self._cur_panels[-1]].get())
self.show_all()
if show == True:
self.show_all()
def _menu_go_back (self, widget):
def _menu_go_back (self, widget=None):
logger.info("#### Menu go back")
self._remove_current_panel()
def _menu_go_home(self):
logger.info("#### Menu go home")
while len(self._cur_panels) > 1:
self._remove_current_panel()
def add_subscription (self, panel_name):
add = True
@@ -334,85 +378,184 @@ class KlipperScreen(Gtk.Window):
self.subscriptions.pop(i)
return
def state_disconnected(self):
_ = self.lang.gettext
logger.debug("### Going to disconnected")
self.printer_initializing(_("Klipper has disconnected"))
def state_error(self):
_ = self.lang.gettext
msg = self.printer.get_stat("webhooks","state_message")
if "FIRMWARE_RESTART" in msg:
self.printer_initializing(
_("Klipper has encountered an error.\nIssue a FIRMWARE_RESTART to attempt fixing the issue.")
)
elif "micro-controller" in msg:
self.printer_initializing(
_("Klipper has encountered an error with the micro-controller.\nPlease recompile and flash.")
)
else:
self.printer_initializing(
_("Klipper has encountered an error.")
)
def state_printing(self):
self.printer_printing()
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:
return
self.printer_ready()
def state_startup(self):
_ = self.lang.gettext
self.printer_initializing(_("Klipper is attempting to start"))
def state_shutdown(self):
_ = self.lang.gettext
self.printer_initializing(_("Klipper has shutdown"))
def _websocket_callback(self, action, data):
#print(json.dumps([action, data], indent=2))
_ = self.lang.gettext
if action == "notify_klippy_disconnected":
logger.info("### Going to disconnected state")
self.printer_initializing("Klipper has shutdown")
self.printer.change_state("disconnected")
return
elif action == "notify_klippy_ready":
logger.info("### Going to ready state")
self.printer_ready()
elif action == "notify_status_update":
self.printer.change_state("ready")
elif action == "notify_status_update" and self.printer.get_state() != "shutdown":
self.printer.process_update(data)
if "webhooks" in data and "state" in data['webhooks']:
if data['webhooks']['state'] == "ready":
logger.info("### Going to ready state")
self.printer_ready()
else:
active = self.printer.get_stat('virtual_sdcard','is_active')
paused = self.printer.get_stat('pause_resume','is_paused')
if "job_status" in self._cur_panels:
if active == False and paused == False:
self.printer_ready()
else:
if active == True or paused == True:
self.printer_printing()
elif action == "notify_filelist_changed":
logger.debug("Filelist changed: %s", json.dumps(data,indent=2))
#self.files.add_file()
elif action == "notify_metadata_update":
self.files.update_metadata(data['filename'])
else:
logger.debug(json.dumps([action, data], indent=2))
self.files.request_metadata(data['filename'])
elif action == "notify_power_changed":
logger.debug("Power status changed: %s", data)
self.printer.process_power_update(data)
elif self.printer.get_state() not in ["error","shutdown"] and action == "notify_gcode_response":
if "Klipper state: Shutdown" in data:
self.printer.change_state("shutdown")
if not (data.startswith("B:") and
re.search(r'B:[0-9\.]+\s/[0-9\.]+\sT[0-9]+:[0-9\.]+', data)):
if data.startswith("!! "):
self.show_popup_message(data[3:])
logger.debug(json.dumps([action, data], indent=2))
for sub in self.subscriptions:
self.panels[sub].process_update(data)
self.panels[sub].process_update(action, data)
def _confirm_send_action(self, widget, text, method, params):
_ = self.lang.gettext
buttons = [
{"name":_("Continue"), "response": Gtk.ResponseType.OK},
{"name":_("Cancel"),"response": Gtk.ResponseType.CANCEL}
]
try:
env = Environment(extensions=["jinja2.ext.i18n"])
env.install_gettext_translations(self.lang)
j2_temp = env.from_string(text)
text = j2_temp.render()
except:
logger.debug("Error parsing jinja for confirm_send_action")
label = Gtk.Label()
label.set_markup(text)
label.set_hexpand(True)
label.set_halign(Gtk.Align.CENTER)
label.set_line_wrap(True)
label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
dialog = self.gtk.Dialog(self, buttons, label, self._confirm_send_action_response, method, params)
def _confirm_send_action_response(self, widget, response_id, method, params):
if response_id == Gtk.ResponseType.OK:
self._send_action(widget, method, params)
widget.destroy()
def _send_action(self, widget, method, params):
self._ws.send_method(method, params)
def printer_initializing(self, text=None):
self.shutdown = True
self.show_panel('splash_screen',"SplashScreenPanel", 2)
self.close_popup_message()
self.show_panel('splash_screen',"splash_screen", "Splash Screen", 2)
if text != None:
self.panels['splash_screen'].update_text(text)
self.panels['splash_screen'].show_restart_buttons()
def printer_ready(self):
self.shutdown = False
def init_printer(self):
_ = self.lang.gettext
status_objects = [
'bed_mesh',
'idle_timeout',
'configfile',
'gcode_move',
'fan',
'toolhead',
'virtual_sdcard',
'print_stats',
'heater_bed',
'extruder',
'pause_resume'
'pause_resume',
'webhooks'
]
r = requests.get("http://127.0.0.1:7125/printer/objects/query?" + "&".join(status_objects))
#TODO: Check that we get good data
data = json.loads(r.content)
self.printer_config = data['result']['status']['configfile']['config']
#logger.debug("Printer config: %s" % json.dumps(self.printer_config, indent=2))
printer_info = self.apiclient.get_printer_info()
logger.debug("Sendingn request %s" % "printer/objects/query?" + "&".join(status_objects))
data = self.apiclient.send_request("printer/objects/query?" + "&".join(status_objects))
powerdevs = self.apiclient.send_request("machine/device_power/devices")
data = data['result']['status']
# Reinitialize printer, in case the printer was shut down and anything has changed.
self.printer.__init__(data['result']['status'])
self.printer.reinit(printer_info['result'], data)
self.ws_subscribe()
#logger.debug("Config sections: %s", self.printer.get_config_section_list())
#logger.debug("Bed_screws: %s", self.printer.get_config_section("bed_screws"))
if powerdevs != False:
self.printer.configure_power_devices(powerdevs['result'])
self.show_panel('main_panel', "MainPanel", 2, items=self._config['mainmenu'], extrudercount=self.printer.get_extruder_count())
if self.files == None:
self.files = KlippyFiles(self)
else:
self.files.add_timeout()
def printer_ready(self):
self.close_popup_message()
self.show_panel('main_panel', "main_menu", "Main Menu", 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"]
def printer_printing(self):
self.ws_subscribe()
self.show_panel('job_status',"JobStatusPanel", 2)
self.files.remove_timeout()
self.close_popup_message()
self.show_panel('job_status',"job_status", "Print Status", 2)
def get_software_version():
prog = ('git', '-C', os.path.dirname(__file__), 'describe', '--always',
'--tags', '--long', '--dirty')
try:
process = subprocess.Popen(prog, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
ver, err = process.communicate()
retcode = process.wait()
if retcode == 0:
version = ver.strip()
if isinstance(version, bytes):
version = version.decode()
return version
else:
logger.debug(f"Error getting git version: {err}")
except OSError:
logger.exception("Error runing git describe")
return "?"
def main():
@@ -423,4 +566,7 @@ def main():
if __name__ == "__main__":
main()
try:
main()
except:
logger.exception("Fatal error in main loop")
+3 -1
View File
@@ -41,11 +41,13 @@ install_systemd_service()
KSPATH_ESC=$(sed "s/\//\\\\\//g" <<< $KSPATH)
KSENV_ESC=$(sed "s/\//\\\\\//g" <<< $KSENV)
SERVICE=$(sed "s/KS_USER/$USER/g" <<< $SERVICE)
SERVICE=$(sed "s/KS_ENV/$KSENV_ESC/g" <<< $SERVICE)
SERVICE=$(sed "s/KS_DIR/$KSPATH_ESC/g" <<< $SERVICE)
echo "$SERVICE" | sudo tee /etc/systemd/system/KlipperScreen.service > /dev/null
sudo systemctl daemon-reload
sudo systemctl enable KlipperScreen
}
update_x11()
@@ -58,7 +60,7 @@ start_KlipperScreen() {
sudo systemctl start KlipperScreen
}
#install_packages
install_packages
create_virtualenv
install_systemd_service
update_x11
+3 -3
View File
@@ -1,5 +1,5 @@
websocket==0.2.1
requests==2.24.0
requests==2.25.1
vext==0.7.4
websocket-client==0.57.0
humanize==2.5.0
humanize==3.2.0
jinja2==2.11.2
+1 -2
View File
@@ -7,10 +7,9 @@ StartLimitIntervalSec=0
Type=simple
Restart=always
RestartSec=1
User=pi
User=KS_USER
WorkingDirectory=KS_DIR
ExecStart=/usr/bin/xinit KS_ENV/bin/python KS_DIR/screen.py
ExecStartPost=KS_DIR/scripts/disablescreenblank.sh
[Install]
WantedBy=multi-user.target
+47 -47
View File
@@ -1,47 +1,47 @@
#
import re
import base64
dir = "/home/pi/sdcard/"
file = "square_tower_0.2mm_PLA_ENDER3_46m.gcode"
#f = f.open(file, 'r')
thumbnails = []
cur_thumbnail = {}
state = 0
with open(dir + file, 'r') as f:
for line in f:
if state == 0:
match = re.match(r'^; thumbnail begin ([0-9]+)x([0-9]+) ([0-9]+)', line)
if match:
cur_thumbnail = {
"width": match.group(1),
"height": match.group(2),
"size": match.group(3),
"data": ""
}
state = 1
continue
elif state == 1:
if re.match (r'^; thumbnail end', line):
state = 0
thumbnails.append(cur_thumbnail)
continue
match = re.match(r'^; (\S+)$', line)
if match:
cur_thumbnail['data'] += match.group(1)
if len(thumbnails) > 0:
biggest = 0
for i in range(len(thumbnails)):
if i == 0:
continue
if thumbnails[i]['width'] > thumbnails[biggest]['width']:
biggest = i
image = base64.decodestring(thumbnails[biggest]['data'])
name = file.split('.gcod')[0] + ".png"
f = open(dir + name, 'wb')
f.write(image)
f.close()
#
import re
import base64
dir = "/home/pi/sdcard/"
file = "square_tower_0.2mm_PLA_ENDER3_46m.gcode"
#f = f.open(file, 'r')
thumbnails = []
cur_thumbnail = {}
state = 0
with open(dir + file, 'r') as f:
for line in f:
if state == 0:
match = re.match(r'^; thumbnail begin ([0-9]+)x([0-9]+) ([0-9]+)', line)
if match:
cur_thumbnail = {
"width": match.group(1),
"height": match.group(2),
"size": match.group(3),
"data": ""
}
state = 1
continue
elif state == 1:
if re.match (r'^; thumbnail end', line):
state = 0
thumbnails.append(cur_thumbnail)
continue
match = re.match(r'^; (\S+)$', line)
if match:
cur_thumbnail['data'] += match.group(1)
if len(thumbnails) > 0:
biggest = 0
for i in range(len(thumbnails)):
if i == 0:
continue
if thumbnails[i]['width'] > thumbnails[biggest]['width']:
biggest = i
image = base64.decodestring(thumbnails[biggest]['data'])
name = file.split('.gcod')[0] + ".png"
f = open(dir + name, 'wb')
f.write(image)
f.close()
+17
View File
@@ -0,0 +1,17 @@
#!/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
+13
View File
@@ -0,0 +1,13 @@
xgettext --keyword=_ --language=Python --add-comments --sort-output \
-o ks_includes/locales/KlipperScreen.pot \
*.py \
ks_includes/*.py \
panels/*.py \
ks_includes/KlipperScreen.conf
langs=(en fr_FR he_IL zh_CN)
for lang in ${langs[@]}; do
msgmerge ks_includes/locales/$lang/LC_MESSAGES/KlipperScreen.po \
ks_includes/locales/KlipperScreen.pot \
-o ks_includes/locales/$lang/LC_MESSAGES/KlipperScreen.po
done
-301
View File
@@ -1,301 +0,0 @@
/* * {
} */
window {
background-color: #13181C;
-gtk-icon-shadow: none;
font-size: 20px;
}
scrollbar, scrollbar button, scrollbar trough {
border: none;
background-color: #13181C;
}
scrollbar slider {
min-width: 60px;
border-radius: 15px;
background-color: #404E57;
}
frame {
color: #fff;
border-bottom: 1px solid #444;
}
.text {
color: #fff;
}
progress, trough {
min-height: 40px;
/*font-size: 50px;*/
background-color: #404E57;
color: #fff;
border: #000 1px solid;
}
progress {
background-color: #d47b00;
font-size: 50px;
font-weight: lighter;
}
.printing-progress-bar {
font-size: 25px;
color: #00C9B4;
}
.printing-progress-text {
font-size: 25px;
color: #fff;
}
.printing-state {
opacity: 0.5;
}
button {
background-image: none;
background-color: #13181C;
margin: 5px;
margin-bottom: 10px;
border-radius: 0;
border: 0px solid #000;
color: #fff;
-gtk-icon-shadow: none;
}
button:active {
background-color: #304C62;
}
.button_active {
background-color: #20303D;
}
button.color1 {
border-bottom: 8px solid #ED6500;
}
button.color2 {
border-bottom: 8px solid #B10080;
}
button.color3 {
border-bottom: 8px solid #009384;
}
button.color4 {
border-bottom: 8px solid #A7E100;
}
button.active {
background-color: #20303D;
}
button.file-list {
margin: 0px;
}
.distbutton_top {
border: 3px solid #fff;
border-right: 0px;
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
margin-right: 0px;
}
.distbutton {
border: 3px solid #fff;
border-left: 3px solid #ccc;
border-right: 0px;
margin-left: 0;
margin-right: 0px;
}
.distbutton_bottom {
border: 3px solid #fff;
border-left: 3px solid #ccc;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
margin-left: 0;
}
.tempbutton_top {
border: 3px solid #fff;
border-bottom: 0px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
margin-bottom: 0px;
}
.tempbutton {
border: 3px solid #fff;
border-top: 3px solid #ccc;
border-bottom: 0px;
margin-top: 0;
margin-bottom: 0px;
}
.tempbutton_bottom {
border: 3px solid #fff;
border-top: 3px solid #ccc;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
margin-top: 0;
}
.distbutton_active {
background-color: #20303D;
}
entry {
font-size: 30px;
background-color: #20292F;
border-radius: 0;
padding-left: 1em;
margin-left: 1em;
padding-right: 1em;
}
button.keyboard {
font-size: 30px;
margin: 0px;
/* margin-bottom:10px; */
}
.dialog {
border: 2px solid black;
font-size: 20px;
padding: 50px;
background-color: #000;
margin: 20px;
}
.dialog button {
padding: 30px 50px 30px 50px;
border-bottom: 8px solid #009384;
}
.message {
border: 2px solid #981E1F;
font-size: 20px;
padding: 50px;
color: #FFF;
background-color: #981E1F;
}
.message button {
background-color: #FFF;
color: #000;
padding: 40px 50px 40px 50px;
}
.notification {
background-clip: padding-box;
padding: 5px;
border-radius: 0 0 5px 5px;
opacity: 0.8;
}
.warning {
background-color: rgba(30, 204, 39, 0.7);
}
.error {
background-color: rgba(204, 30, 30, 0.7);
}
.printing-status-label {
padding-top: 5px;
padding-bottom: 3px;
color: #ccc;
font-size: 24px;
}
.hidden {
opacity: 0;
}
.temperature_entry {
border: 0px;
color: #fff;
margin: 10px 5px 5px 5px;
}
.numpad_tleft {
border-left: 3px solid #fff;
border-top: 3px solid #fff;
border-top-left-radius: 15px;
margin: 3px 0 0 3px;
}
.numpad_top {
border-left: 3px solid #ccc;
border-top: 3px solid #fff;
margin: 3px 0 0 0;
}
.numpad_tright {
border-left: 3px solid #fff;
border-right: 3px solid #fff;
border-top: 3px solid #fff;
border-top-right-radius: 15px;
margin: 3px 3px 0 0;
}
.numpad_left {
border-left: 3px solid #fff;
border-top: 3px solid #ccc;
margin: 0 0 0 3px;
}
.numpad_button {
border-left: 3px solid #ccc;
border-top: 3px solid #ccc;
margin: 0;
}
.numpad_right {
border-right: 3px solid #fff;
border-left: 3px solid #ccc;
border-top: 3px solid #ccc;
margin: 0 3px 0 0;
}
.numpad_bleft {
border-left: 3px solid #fff;
border-bottom: 3px solid #fff;
border-top: 3px solid #ccc;
border-bottom-left-radius: 15px;
margin: 0 0 3px 3px;
}
.numpad_bottom {
border-left: 3px solid #ccc;
border-bottom: 3px solid #fff;
border-top: 3px solid #ccc;
margin: 0 0 3px 0;
}
.numpad_bright {
border-left: 3px solid #ccc;
border-bottom: 3px solid #fff;
border-top: 3px solid #ccc;
border-right: 3px solid #ccc;
border-bottom-right-radius: 15px;
margin: 0 3px 3px 0;
}
.fan_slider {
margin: 20px;
color: #fff;
}
scale mark {
margin-top: 20px;
color: #fff;
}
+317
View File
@@ -0,0 +1,317 @@
* {
color: #fff;
font-size: KS_FONT_SIZEpx;
}
window {
background-color: #13181C;
-gtk-icon-shadow: none;
}
button {
background-image: none;
background-color: #13181C;
margin: .25em;
margin-bottom: .5em;
border-radius: 0;
border: 0 solid #000;
-gtk-icon-shadow: none;
}
button:active {
background-color: #304C62;
}
.button_active {
background-color: #20303D;
}
button.color1 {
border-bottom: .4em solid #ED6500;
}
button.color2 {
border-bottom: .4em solid #B10080;
}
button.color3 {
border-bottom: .4em solid #009384;
}
button.color4 {
border-bottom: .4em solid #A7E100;
}
button.active {
background-color: #20303D;
}
button.file-list {
margin: 0;
}
entry {
font-size: 1em;
background-color: #20292F;
border: 0;
padding: .25em;
}
frame {
color: #fff;
border-bottom: 1px solid #444;
}
label {
color: white;
}
progress, trough {
min-height: 2em;
background-color: #404E57;
color: #fff;
border: #000 1px solid;
}
progress {
background-color: #d47b00;
}
scale mark {
margin-top: 1em;
color: #fff;
}
scrollbar, scrollbar button, scrollbar trough {
border: none;
background-color: #13181C;
}
scrollbar slider {
min-width: 3em;
border-radius: .7em;
background-color: #404E57;
}
trough {
margin: .5em 1em;
}
.dialog {
border: .1em solid black;
padding: 2.5em;
background-color: #000;
margin: 1em;
}
.dialog button {
padding: 1.5em 2.5em 1.5em 2.5em;
border-bottom: .4em solid #009384;
}
.distbutton_active {
background-color: #20303D;
}
.distbutton_top {
border: .15em solid #fff;
border-right: 0;
border-top-left-radius: .75em;
border-bottom-left-radius: .75em;
margin-right: 0;
}
.distbutton {
border: .15em solid #fff;
border-left: .15em solid #ccc;
border-right: 0;
margin-left: 0;
margin-right: 0;
}
.distbutton_bottom {
border: .15em solid #fff;
border-left: .15em solid #ccc;
border-top-right-radius: .7em;
border-bottom-right-radius: .7em;
margin-left: 0;
}
.fan_slider {
margin: 1em;
color: #fff;
}
.frame-item {
min-height: 4.5em;
padding: .1em .75em;
}
.message_popup {
background-color: #367554;
border-bottom: .1em solid #fff;
}
.message_popup button {
background-color: #367554;
}
.numpad_tleft {
border-left: .15em solid #fff;
border-top: .15em solid #fff;
border-top-left-radius: .7em;
margin: .15em 0 0 .15em;
}
.numpad_top {
border-left: .15em solid #ccc;
border-top: .15em solid #fff;
margin: .15em 0 0 0;
}
.numpad_tright {
border-left: .15em solid #fff;
border-right: .15em solid #fff;
border-top: .15em solid #fff;
border-top-right-radius: .7em;
margin: .15em .15em 0 0;
}
.numpad_left {
border-left: .15em solid #fff;
border-top: .15em solid #ccc;
margin: 0 0 0 .15em;
}
.numpad_button {
border-left: .15em solid #ccc;
border-top: .15em solid #ccc;
margin: 0;
padding: 1em;
}
.numpad_right {
border-right: .15em solid #fff;
border-left: .15em solid #ccc;
border-top: .15em solid #ccc;
margin: 0 .15em 0 0;
}
.numpad_bleft {
border-left: .15em solid #fff;
border-bottom: .15em solid #fff;
border-top: .15em solid #ccc;
border-bottom-left-radius: .7em;
margin: 0 0 .15em .15em;
}
.numpad_bottom {
border-left: .15em solid #ccc;
border-bottom: .15em solid #fff;
border-top: .15em solid #ccc;
margin: 0 0 .15em 0;
}
.numpad_bright {
border-left: .15em solid #ccc;
border-bottom: .15em solid #fff;
border-top: .15em solid #ccc;
border-right: .15em solid #ccc;
border-bottom-right-radius: .7em;
margin: 0 .15em .15em 0;
}
.printing-filename {
font-size: 1.75em;
font-weight: bold;
margin: .25em .25em 0 0;
}
.printing-info {
font-size: 1.2em;
margin-left: .25em;
}
.printing-info-box {
padding-left: .25em;
}
.printing-info-box box {
margin-bottom: .5em;
}
.printing-status {
color: #f0f0f0;
font-style: italic;
margin: 0 0 0 0;
}
.printing-progress-bar {
color: #00C9B4;
}
.printing-progress-text {
font-size: 1.5em;
font-weight: bold;
color: #fff;
}
.printing-status-label {
padding-top: .25em;
padding-bottom: .15em;
color: #ccc;
font-size: 1.25em;
}
.tempbutton_top {
border: .15em solid #fff;
border-bottom: 0;
border-top-left-radius: .75em;
border-top-right-radius: .75em;
margin-bottom: 0;
}
.tempbutton {
border: .15em solid #fff;
border-top: .15em solid #ccc;
border-bottom: 0;
margin-top: 0;
margin-bottom: 0;
}
.tempbutton_bottom {
border: .15em solid #fff;
border-top: .15em solid #ccc;
border-bottom-left-radius: .7em;
border-bottom-right-radius: .7em;
margin-top: 0;
}
.message {
border: .1em solid #981E1F;
font-size: 1em;
padding: 2.5em;
color: #FFF;
background-color: #981E1F;
}
.message button {
background-color: #FFF;
color: #000;
padding: 2em 2.5em 2em 2.5em;
}
.notification {
background-clip: padding-box;
padding: .25em;
border-radius: 0 0 .25em .25em;
opacity: 0.8;
}
.warning {
background-color: rgba(30, 204, 39, 0.7);
}
.error {
background-color: rgba(204, 30, 30, 0.7);
}
+1
View File
@@ -0,0 +1 @@
<?xml version="1.0" ?><svg data-name="Layer 1" id="Layer_1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title/><path style="fill:#FFFFFF" d="M12,2A10,10,0,1,0,22,12,10,10,0,0,0,12,2Zm0,18a8,8,0,1,1,8-8A8,8,0,0,1,12,20ZM13,6H11v7h6V11H13Z"/></svg>

After

Width:  |  Height:  |  Size: 259 B

+99
View File
@@ -0,0 +1,99 @@
<?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"
sodipodi:docname="emergency.svg"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
version="1.1"
id="svg4160"
viewBox="0 0 60.137677 60.776516"
height="60.776516"
width="60.13768">
<defs
id="defs4162">
<rect
id="rect35"
height="75.089285"
width="56.160714"
y="3.7185006"
x="-24.056441" />
</defs>
<sodipodi:namedview
inkscape:document-rotation="0"
inkscape:snap-global="false"
inkscape:snap-bbox="true"
inkscape:window-maximized="1"
inkscape:window-y="-11"
inkscape:window-x="-11"
inkscape:window-height="2066"
inkscape:window-width="3840"
showguides="false"
units="in"
showgrid="true"
inkscape:current-layer="layer1"
inkscape:document-units="px"
inkscape:cy="30.217279"
inkscape:cx="2.3098192"
inkscape:zoom="11.313709"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base">
<inkscape:grid
originy="-29.820954"
originx="-9.9771178"
id="grid4712"
type="xygrid" />
</sodipodi:namedview>
<metadata
id="metadata4165">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-3.5328446,2.2636422)"
style="display:inline"
inkscape:label="Move"
id="layer2"
inkscape:groupmode="layer">
<g
id="g46"
transform="translate(-6.0411758,-15.071814)">
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 22.795553,16.619161 3.21242,-1.25 3.212421,1.25 v 47.687531 l -3.212421,0.892857 -3.21242,-0.892857 z"
id="rect4760-8"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<ellipse
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#d40000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4508"
cx="39.64286"
cy="43.19643"
rx="29.040764"
ry="29.130053" />
</g>
<text
transform="translate(47.1875,-4.8214286)"
style="font-style:normal;font-weight:normal;font-size:53px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect35);fill:#d40000;fill-opacity:1;stroke:none;"
id="text33"
xml:space="preserve"><tspan
x="-26"
y="52.376338"><tspan
style="font-weight:bold;font-size:53px;fill:#d40000">!</tspan></tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

+48
View File
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="77px" height="80px" viewBox="0 0 77 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 52.5 (67469) - http://www.bohemiancoding.com/sketch -->
<title>extruder1</title>
<desc>Created with Sketch.</desc>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Artboard" transform="translate(-62.000000, -173.000000)">
<g id="extruder-1" transform="translate(62.000000, 173.000000)">
<g id="Group" transform="translate(10.000000, 6.000000)" fill="#FFFFFF" stroke="#FFFFFF" stroke-linecap="round" stroke-width="2">
<path d="M0.5,3.5 L6,0.5" id="Line"></path>
<path d="M6,0.5 L14.5,0.5" id="Line-2"></path>
<path d="M14.5,0.5 L17.5,4.5" id="Line-3" stroke-linejoin="round"></path>
<path d="M0.5,3.5 L0.5,15.5" id="Line-5"></path>
<path d="M17.5,4.5 L29.5,4.5" id="Line-4"></path>
<path d="M0.5,15.5 L4,21.5" id="Line-6"></path>
<path d="M4,47.5 L0.5,52.5" id="Line-8"></path>
<path d="M0.5,52.5 L0.5,66.5" id="Line-9"></path>
<path d="M4,21.5 L4,47.5" id="Line-7"></path>
<path d="M0.5,66.5 L13.5,69" id="Line-10"></path>
<path d="M13.5,69 L17.5,64.5" id="Line-11"></path>
<path d="M17.5,64.5 L29.5,64.5" id="Line-12"></path>
</g>
<g id="Group" transform="translate(52.000000, 40.500000) scale(-1, 1) translate(-52.000000, -40.500000) translate(37.000000, 6.000000)" stroke="#FFFFFF" stroke-linecap="round" stroke-width="2">
<path d="M0.5,3.5 L6,0.5" id="Line"></path>
<path d="M6,0.5 L14.5,0.5" id="Line-2"></path>
<path d="M14.5,0.5 L17.5,4.5" id="Line-3" stroke-linejoin="round"></path>
<path d="M0.5,3.5 L0.5,15.5" id="Line-5"></path>
<path d="M17.5,4.5 L29.5,4.5" id="Line-4"></path>
<path d="M0.5,15.5 L4,21.5" id="Line-6"></path>
<path d="M4,47.5 L0.5,52.5" id="Line-8"></path>
<path d="M0.5,52.5 L0.5,66.5" id="Line-9"></path>
<path d="M4,21.5 L4,47.5" id="Line-7"></path>
<path d="M0.5,66.5 L13.5,69" id="Line-10"></path>
<path d="M13.5,69 L17.5,64.5" id="Line-11"></path>
<path d="M17.5,64.5 L29.5,64.5" id="Line-12"></path>
</g>
<circle id="Oval" stroke="#FFFFFF" stroke-width="2" cx="38.5" cy="35.5" r="19.5"></circle>
<circle id="Oval" stroke="#000000" stroke-width="0.5" fill="#FFFFFF" cx="55" cy="22" r="21"></circle>
<text id="1" font-family="OpenSans-SemiBold, Open Sans" font-size="26" font-weight="500" fill="#000000">
<tspan x="47.6188697" y="31">0</tspan>
</text>
<path d="M35.5,73.5 L38.5,77.5" id="Line-16" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"></path>
<path d="M38.5,77.5 L41.5,73.5" id="Line-17" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"></path>
<path d="M29.5,73.5 L47.5,73.5" id="Line-14" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

+1
View File
@@ -0,0 +1 @@
<?xml version="1.0" ?><svg data-name="Layer 1" id="Layer_1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title/><path style="fill:#FFFFFF" d="M19,6.76V2H6V6.76A4,4,0,0,0,7.17,9.59L9.59,12,7.17,14.41A4.06,4.06,0,0,0,6,17.24V22H19V17.24a4.06,4.06,0,0,0-1.17-2.83L15.41,12l2.42-2.41A4,4,0,0,0,19,6.76ZM8,4h9V6H8Zm8.41,11.83A2,2,0,0,1,17,17.24V20H8V17.24a2,2,0,0,1,.59-1.41l2.76-2.77L11.4,13h2.2l.05.06Zm-2.76-4.89L13.6,11H11.4l-.05-.06L8.59,8.17A1.22,1.22,0,0,1,8.44,8h8.12a1.22,1.22,0,0,1-.15.17Z"/></svg>

After

Width:  |  Height:  |  Size: 515 B