Compare commits

..
287 Commits
Author SHA1 Message Date
jordanruthe 7e3b919c62 Wifi manager (#148)
Updates to include ability to change wifi networks.
2021-05-13 20:53:58 -04:00
Alfredo Monclus e75a10a888 New Style - Solarized (#144)
* New Style solarized
2021-05-10 20:55:15 -04:00
Alexander Spassky 9951323e91 M117 messages display (#150)
* Added displaying M117 messages under printer state label on JobStatus panel
2021-05-10 19:46:07 -04:00
Jordan 5333218ec5 files: Compatability for key change from filename to path 2021-05-09 14:22:35 -04:00
dependabot[bot] 178abc2c9a build(deps): bump websocket-client from 0.58.0 to 0.59.0 (#147)
Bumps [websocket-client](https://github.com/websocket-client/websocket-client) from 0.58.0 to 0.59.0.
- [Release notes](https://github.com/websocket-client/websocket-client/releases)
- [Changelog](https://github.com/websocket-client/websocket-client/blob/master/ChangeLog)
- [Commits](https://github.com/websocket-client/websocket-client/compare/v0.58.0...v0.59.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-09 14:08:24 -04:00
dependabot[bot] 22528885ff build(deps): bump humanize from 3.4.1 to 3.5.0 (#145)
Bumps [humanize](https://github.com/jmoiron/humanize) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/jmoiron/humanize/releases)
- [Commits](https://github.com/jmoiron/humanize/compare/3.4.1...3.5.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-09 14:08:17 -04:00
Jordan 449f3274c6 preheat: Fix bug where temperature_sensor is tried to be activated 2021-05-09 13:57:32 -04:00
Jordan bd1650fd18 files: Updates to not cache thumbnails locally. Also get notified by inotify 2021-05-09 13:57:18 -04:00
Jordan f8ca339de5 printer: Fix NoneType issue
Fixes #143
2021-05-08 22:27:55 -04:00
Jordan ce8c8e44fc print: Fix error if new print starts while job_status is displayed
This may address some issues in #122
2021-05-08 22:24:28 -04:00
Jordan b27814845b print: Include refresh button for files 2021-05-08 21:40:27 -04:00
Jordan 96d252ba3c files: Convert away from thread
Convert files so it is not a thread, as it will become un-necessary with 
inotify from moonraker
2021-05-08 21:40:16 -04:00
Jordan 236fb0c4ff websocket: Change connect and logging statements to be more accurate 2021-05-08 21:38:51 -04:00
Jordan d2fea57c39 printer: Remove un-necessary logging statements 2021-05-08 21:25:43 -04:00
Jordan 7b9c98a0a8 Include temperature_sensor in listing of temperatures
This update will add temperature sensors to the main menu and 
temperature panels.
2021-05-08 14:31:50 -04:00
Jordan Ruthe c2c4e9c42e function: Add except hook for threads
This will log exceptions on different threads
2021-05-02 17:48:04 -04:00
Jordan Ruthe 7b6efa0521 logs: hide certain logging statements 2021-05-02 17:46:51 -04:00
Jordan Ruthe b39d433c46 bed_level: Fix other regex statement for screws Fixes another regex statement to allow negative values. Addresses #138 2021-04-26 20:55:24 -04:00
Jordan Ruthe 9dce74fac1 bed_level: Fix regex statement for screws
Regex statement for screws will now find screws in the negative 
position. Addresses #138
2021-04-25 19:10:50 -04:00
Alfredo Monclus a8fc7b6337 Initial Spanish translation (#139) 2021-04-25 19:03:37 -04:00
Markus 0ae0593907 word adaptation (#136)
de_DE: change wording
2021-04-21 21:44:19 -04:00
dependabot[bot] bb8689175e build(deps): bump humanize from 3.3.0 to 3.4.1 (#130)
Bumps [humanize](https://github.com/jmoiron/humanize) from 3.3.0 to 3.4.1.
- [Release notes](https://github.com/jmoiron/humanize/releases)
- [Commits](https://github.com/jmoiron/humanize/compare/3.3.0...3.4.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-19 00:23:10 -04:00
Jordan Ruthe e7b3b963c3 install: Check for existing service file
Don't overwrite service file for KlipperScreen on running install 
script.
2021-04-18 23:45:54 -04:00
Jordan Ruthe 0e1c30879b install: Change install command to PKGLIST
This enables moonraker update compatability for installing system 
packages
2021-04-18 23:42:04 -04:00
Jordan Ruthe 3494f8a7d4 screen: remove un-necessary logging line 2021-04-08 22:27:35 -04:00
Jordan Ruthe 02ea32506b screen: Fix problem where job_status does not update
Fixes a problem where a panel does not refresh data (such as extrusion 
rate, speed rate)
2021-04-08 22:25:56 -04:00
Jordan Ruthe bac2d9f23e install: Add missing dependency for libatlas 2021-04-08 07:18:09 -04:00
Jordan Ruthe 75cd4749d6 docs: Touchscreen calibration
Update touchscreen calibration docs to be more clear.
2021-04-08 00:04:26 -04:00
Jordan Ruthe c0cbe25531 bed_mesh: Include ability to view mesh
Added ability to visualize bed meshes. The active bed mesh will have 
more points available to view than inactive bed meshes.
2021-04-07 21:20:00 -04:00
dependabot[bot] 791b1c37d4 build(deps): bump humanize from 3.2.0 to 3.3.0 (#114)
Bumps [humanize](https://github.com/jmoiron/humanize) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/jmoiron/humanize/releases)
- [Commits](https://github.com/jmoiron/humanize/compare/3.2.0...3.3.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-30 21:27:25 -04:00
dependabot[bot] 40b9f4e56b build(deps): bump vext from 0.7.4 to 0.7.6 (#116)
Bumps [vext](https://github.com/stuaxo/vext) from 0.7.4 to 0.7.6.
- [Release notes](https://github.com/stuaxo/vext/releases)
- [Changelog](https://github.com/vext-python/vext/blob/master/HISTORY)
- [Commits](https://github.com/stuaxo/vext/commits)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-30 21:27:11 -04:00
Jordan Ruthe 86e2174152 docs: Put hardware on its own page. 2021-03-23 21:23:42 -04:00
Jordan Ruthe f3e7941acf readme: Update docs to readthedocs 2021-03-23 00:28:20 -04:00
Jordan Ruthe d61e5983da move and settings: Update settings panel to include configurable movement speed
This allows the user to set the speed in mm/s for the move panel

Completes #95
2021-03-23 00:09:36 -04:00
Jordan Ruthe 6fd25994d4 job_status: Update percent complete on creating job_status panel 2021-03-22 23:06:54 -04:00
Jordan Ruthe fe1721debd KlippyGcodes: fixes #110 2021-03-22 20:04:33 -04:00
Jordan Ruthe 543654b499 job_status: Fix error in displaying filename 2021-03-22 20:03:05 -04:00
Jordan Ruthe 496850faec readme: Update documentation link 2021-03-15 20:28:01 -04:00
Jordan Ruthe 7743f2aa63 job_status: Add missing variable declaration for gettext 2021-03-14 23:42:12 -04:00
Jordan Ruthe 47e233928e docs: Remove screenshot from readme 2021-03-14 23:39:09 -04:00
Jordan Ruthe 344df0a869 docs: Update to use mkdocs 2021-03-14 17:02:05 -04:00
Jordan Ruthe 84ca1ded7c readme: fix broken klipper link 2021-03-14 14:27:03 -04:00
Jordan Ruthe 396467d50f splash_screen: Hide change printer button if only one printer is configured 2021-03-13 17:05:20 -05:00
Jordan Ruthe 6f8ee80574 job_status Update estimated time values 2021-03-13 14:10:28 -05:00
Jordan Ruthe 029c59436c job_status: Logic updates for printing state 2021-03-12 12:35:33 -05:00
Jordan Ruthe 55193e227f system: Add KlipperScreen restart button 2021-03-12 11:47:39 -05:00
Jordan Ruthe 66570f4ac6 job_status: Include fine tuning button on panel rather than in menu 2021-03-07 17:21:34 -05:00
schpuntikandschpuntik b7ad50deff Update Russian locale (#107)
Co-authored-by: schpuntik <schpuntik@freenet.de>
2021-03-06 16:31:28 -05:00
Jordan Ruthe 3e505d7a71 config: Add include feature 2021-03-06 12:43:47 -05:00
jordanruthe 5e31e3cfa6 Multiple printers (#85)
* screen/printer_select/splash_screen: Updates to allow changing between moonraker instances

* Updates to multiple printers

* settings: Display printer endpoints

* Update macros to be on a per-printer basis

* files: Changes to clear out file cache on printer switch

* job_status: Redo page for action bar

* splash_screen: Change icon

* websocket: Actually close the websocket

* printer: Fix error case

* splash_screen: show buttons update

* readme update
2021-03-05 18:30:59 -05:00
dependabot[bot] dd08d3d9c8 build(deps): bump websocket-client from 0.57.0 to 0.58.0 (#105)
Bumps [websocket-client](https://github.com/websocket-client/websocket-client) from 0.57.0 to 0.58.0.
- [Release notes](https://github.com/websocket-client/websocket-client/releases)
- [Changelog](https://github.com/websocket-client/websocket-client/blob/master/ChangeLog)
- [Commits](https://github.com/websocket-client/websocket-client/compare/v0.57.0...v0.58.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-05 18:14:48 -05:00
dependabot[bot] 5c1a23914a build(deps): bump jinja2 from 2.11.2 to 2.11.3 (#69)
Bumps [jinja2](https://github.com/pallets/jinja) from 2.11.2 to 2.11.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/2.11.2...2.11.3)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-05 18:14:37 -05:00
Jordan Ruthe 8c7d9726d7 move: Keep abs/rel coordinates. Closes #106 2021-03-05 00:20:26 -05:00
Jordan Ruthe 78fd11c4f1 install: fix no-binary 2021-03-04 20:44:02 -05:00
Jordan Ruthe 5f931fa09d job_status: Fix error with non-existent metadata 2021-03-03 18:32:28 -05:00
Elektrickser b264719cd9 Z-Tilt integration and Update German Language (#100)
* Z-Tilt integration and Update German Language

- Update German language
- Integration Z-Tilt in Move-Menue

* Update KlipperScreen.po
2021-03-02 18:22:19 -05:00
Jordan Ruthe f3001f3c76 wifi: Remove scanning log message 2021-02-26 10:59:13 -05:00
Jordan Ruthe 988608f9d3 language: Remove location comments from po files. Update all po files 2021-02-26 10:58:13 -05:00
Jordan Ruthe f14f494fee splash_screen: fix issue with message popup 2021-02-26 10:52:55 -05:00
Jordan Ruthe f04b14c813 printer: Ensure callbacks don't run out of order #96 2021-02-26 10:49:27 -05:00
Jordan Ruthe e1f45b3c1a screen: Enable DPMS so screens can power down. 2021-02-22 19:46:41 -05:00
Jordan Ruthe 81477f4b0a functions: Fix log issue 2021-02-22 19:43:11 -05:00
Jordan Ruthe 90d115d1f4 job_status: Update states for paused 2021-02-22 17:35:19 -05:00
Jordan Ruthe fadf4488be temperature: fix another bug 2021-02-22 16:47:48 -05:00
Jordan Ruthe 774f273858 temperature: Fix problem with manually enterring tool temp 2021-02-22 15:34:39 -05:00
Jordan Ruthe cdfd25357f functions: Fix forgotten import 2021-02-22 15:33:13 -05:00
Jordan Ruthe f6f2f3f143 printer: Add quad_gantry_level/z_tilt_adjust to homing menu. Fixes #46 2021-02-22 15:19:23 -05:00
Jordan Ruthe b78ebea687 screen: Allow cursor to be displayed #51 2021-02-22 11:40:21 -05:00
Jordan Ruthe 3f2ed97385 fine_tune: Allow z babystep intervals to be configured 2021-02-22 11:10:19 -05:00
Jordan Ruthe a57ab7f9d5 docs: Update changelog 2021-02-22 10:42:23 -05:00
Jordan Ruthe a19661ca90 gtk: fix font ratio for insanely wide screens 2021-02-22 10:36:33 -05:00
Jordan Ruthe cd8929bcb0 files: remove needless logging statements 2021-02-22 10:36:26 -05:00
Jordan Ruthe aed61f4aba system: Fix buttons being off screen 2021-02-22 10:35:41 -05:00
Jordan Ruthe c0b4b464bd Changes to logging implementation 2021-02-21 12:19:30 -05:00
Jordan Ruthe c8fe6de747 screen: Fix cosmetic issue with mouse hover at startup 2021-02-21 11:58:14 -05:00
Jordan Ruthe 316ff627ac temperature: add heater_generic 2021-02-19 15:21:58 -05:00
Jordan Ruthe 0c73b3831b preheat: add heater_generic 2021-02-19 15:21:50 -05:00
Jordan Ruthe 56731e77f6 main_menu: Show all heaters 2021-02-19 15:05:12 -05:00
Jordan Ruthe da1bdcfb6c screen: websocket subscribe for extra heaters 2021-02-19 14:41:10 -05:00
Jordan Ruthe 106a72b8f5 screen_panel: Update update_temp method to include name 2021-02-19 14:40:48 -05:00
Jordan Ruthe 3326551d5e printer: Add get_heaters 2021-02-19 14:40:33 -05:00
gdachs 41e2008249 wireless-tools is a required package (#86)
Missing wireless-tools lead to a very high CPU usage
2021-02-19 00:49:48 -05:00
Jordan Ruthe b303c61c1b DefaultConfig: Add macros to print menu 2021-02-19 00:48:32 -05:00
Jordan Ruthe a02913d631 docs: Update panel images 2021-02-19 00:45:55 -05:00
Jordan Ruthe 3d234af67c style: remove border on action bar 2021-02-19 00:16:32 -05:00
Jordan Ruthe 41e5963ad7 print: Save sort order to fix #66 2021-02-19 00:13:57 -05:00
Jordan Ruthe cea0df8658 print: Add support for directories 2021-02-18 23:56:25 -05:00
Jordan Ruthe cfb24dd885 config: redact moonraker api key while logging with new printers option 2021-02-18 12:48:27 -05:00
Jordan Ruthe e41c330cf1 style: Change spacing between info boxes in job_status screen 2021-02-18 12:38:42 -05:00
Jordan Ruthe 0bfe649882 KlippyGtk: Enable word wrap on buttons 2021-02-18 12:38:05 -05:00
Jordan Ruthe 0efdd2ca06 job_status: Fix issues with homogeneous grids 2021-02-18 12:37:43 -05:00
Jordan Ruthe e111053a67 move: Fix bigger text strings 2021-02-18 12:36:43 -05:00
Jordan Ruthe 08b1e0d17a screen: Only process current panel's subscription 2021-02-18 12:35:00 -05:00
Jordan Ruthe 52e3f53333 screen: Add transition for paused state (mainly for startup) 2021-02-18 12:34:35 -05:00
Jordan Ruthe 693c45e2d7 wifi: remove asyncio 2021-02-18 11:59:59 -05:00
Jordan Ruthe 0a25b4e502 job_status: Fix case for no estimated time from slicer 2021-02-15 21:45:24 -05:00
Jordan 8a9072c5d0 sudo_fix: Fix sudo for no password on certain commands 2021-02-15 21:11:37 +00:00
Jordan Ruthe 0a5e931d17 bed_mesh: Updates to content to include action bar width 2021-02-15 15:53:39 -05:00
Jordan Ruthe f047830852 system: Change buttons for reduced width 2021-02-15 15:46:26 -05:00
Jordan Ruthe 2c87e096f4 docs: Update configuration and changelog for new features 2021-02-15 15:42:45 -05:00
Jordan Ruthe acbfd6e5c5 screen_panel: Add border on action panel 2021-02-15 15:37:35 -05:00
Jordan Ruthe 79eefbd170 network: Show wifi information 2021-02-15 15:35:13 -05:00
Jordan Ruthe a332556a51 files: Update logging and reduce metadata retrive time 2021-02-15 15:21:32 -05:00
Jordan Ruthe 874b74d59a screen_panel: Put icons on a side bar instead of on the header 2021-02-15 14:58:33 -05:00
Jordan Ruthe 49f7cf0e46 main_menu: Show printer name in main_menu 2021-02-15 14:52:09 -05:00
Jordan Ruthe 57aa7e6e85 screen: Initial update to allow several moonraker connections 2021-02-15 14:51:49 -05:00
Jordan Ruthe 054f7c72db Update emergency stop icon 2021-02-15 14:50:51 -05:00
Jordan Ruthe 1d746c074c screen: Catch errors on attaching panel 2021-02-15 14:25:07 -05:00
Jordan Ruthe 9f2a328b62 files: put files in it's own thread 2021-02-15 14:22:28 -05:00
Jordan Ruthe e1d01c81a2 config: Include multiple configured printers 2021-02-15 14:21:01 -05:00
Jordan Ruthe b251a2ebbb Websocket: changes to include closing websocket 2021-02-15 14:20:39 -05:00
Jordan Ruthe c3f0abd671 splash_screen: Fix none case for printer 2021-02-15 14:18:09 -05:00
schpuntikandschpuntik b6fb4c1da2 Add Russian locales (#79)
* add russian locale

* update script update_translation_files.sh

* Defining Python Source Code Encodings

* Update Russian locale

* Update German locale

* update to PO files for new changes

* fix typo

* Update Russian locale

Co-authored-by: schpuntik <schpuntik@freenet.de>
2021-02-14 12:09:19 -05:00
Jordan Ruthe 6228465fdd job_status: Fix divide by zero case 2021-02-05 21:25:58 +00:00
Elektrickser 05623b7a26 Added Language de_DE (#73)
added German Language
2021-02-05 21:25:52 +00:00
Jordan Ruthe b258d64fb4 KlippyGtk: Undo wrap word. Causing screen to be out of proportion. 2021-02-03 21:40:40 -05:00
Jordan Ruthe 7d1ec41f4b printer: Include quad_gantry_level 2021-01-31 15:24:22 -05:00
Jordan Ruthe 1e9aabec7d screen: Add required traceback module 2021-01-31 15:15:14 -05:00
Jordan Ruthe 7609cedda4 docs: fix typo 2021-01-29 22:37:49 -05:00
Jordan Ruthe f5a2d97842 KlippyGtk: Add word wrapping to buttons 2021-01-29 22:37:39 -05:00
Jordan Ruthe c2dc0fdb46 wifi: Initial wifi class 2021-01-29 22:37:05 -05:00
Jordan Ruthe faabceeafd KlippyRest: catch connection errors 2021-01-29 22:30:55 -05:00
Stefan Dej 4b4faaab88 tiny addition to the install doc (#65)
docs/Installation: Add git clone command
2021-01-29 22:18:01 -05:00
Jordan Ruthe 3e4ae3bdee screen: Enhanced error logging 2021-01-29 16:19:49 -05:00
Jordan Ruthe ad17131393 job_status: Fix issue with NoneType error 2021-01-29 15:46:01 -05:00
Jordan Ruthe d25f642716 docs/Installation: Updates to installation instructions 2021-01-25 20:48:14 -05:00
Jordan Ruthe f1ced2ac46 bed_level: Fix #50 2021-01-25 20:36:37 -05:00
jordanruthe 1137ddb265 Create FUNDING.yml 2021-01-24 14:43:17 -05:00
Jordan Ruthe 3f2fc93be4 KlipperScreen.conf: Add power to print menu 2021-01-24 11:01:43 -05:00
Jordan Ruthe d6bf77870b settings: Screen blanking settings 2021-01-24 11:01:37 -05:00
Jordan Ruthe 874dd509bf bed_mesh: Include add bed mesh 2021-01-21 21:49:57 -05:00
Jordan Ruthe 3ea8402303 screen: Force state into ready 2021-01-21 08:43:41 -05:00
Jordan Ruthe f297699396 job_status/settings: Allow different file estimation methods 2021-01-20 22:06:48 -05:00
Jordan Ruthe 52cadb7744 screen: bug fixes 2021-01-20 22:02:48 -05:00
Jordan Ruthe 90c84d5f17 menu: Fix issue in updating j2_data for moonraker connection 2021-01-20 16:27:02 -05:00
Jordan Ruthe a51360f372 printer: Optimize print states and more print state logging 2021-01-20 15:35:01 -05:00
Jordan Ruthe fc074c350f printer: More debugs for state changes 2021-01-19 13:22:07 -05:00
Jordan Ruthe c926184918 docs: Add commands for calibration 2021-01-19 13:19:39 -05:00
Jordan Ruthe a17c8665ac KlippyGtk: Allow different button image positions 2021-01-19 08:01:12 -05:00
Jordan Ruthe 6c252b0862 splash_screen: Enable menu to network, power, and system panels 2021-01-19 07:59:58 -05:00
Jordan Ruthe 30ed648934 gcode_macros: Updates to fix bugs in visibility of macros 2021-01-13 11:02:15 -05:00
Jordan Ruthe da9570a925 print: Allow sorting by date and name. 2021-01-12 18:35:24 -05:00
Jordan Ruthe 37f8a5d632 system: Add reboot and shutdown buttons 2021-01-10 14:22:18 -05:00
Jordan Ruthe 0453627d40 bed_level/move/temperature/zcalibrate: RTL support 2021-01-09 22:21:27 -05:00
Jordan Ruthe 4f929ba342 move: fix error in move function 2021-01-09 11:27:22 -05:00
Jordan Ruthe 8920516053 extrude: RTL support 2021-01-08 19:03:01 -05:00
Jordan Ruthe a087ecfa30 menu/main_menu: Better RTL support 2021-01-08 19:02:49 -05:00
Jordan Ruthe ab7cffe4d6 language: update to PO files for near-future changes 2021-01-08 11:21:15 -05:00
Jordan Ruthe 32ccfc125d install: Add check for Xwrapper.conf file. Add it if it does not exist 2021-01-08 11:09:34 -05:00
Jordan Ruthe ffb24a2ffd install: Add user to tty group 2021-01-08 10:34:26 -05:00
Jordan Ruthe 6e3965bf6c docs: Update installation on how to turn off base GUI 2021-01-08 10:25:02 -05:00
Jordan Ruthe b1f110c13a screen_panel: change panel name so it's not language localized in logging 2021-01-08 08:35:35 -05:00
Jordan Ruthe 6f15bb1d91 docs: Update changelog, Fix rename of KS Settings to Settings 2021-01-08 08:24:06 -05:00
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
256 changed files with 23442 additions and 7258 deletions

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: klipperscreen
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
-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
+8 -55
View File
@@ -1,62 +1,15 @@
# 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.
Current feature list:
- [x] Homing
- [x] Preheating
- [x] Job Status and control
- [x] Temperature control
- [x] Extrude control
- [x] Fan control
- [x] Disable steppers
- [x] Configure Z Offset using PROBE_CALIBRATE
- [ ] Print tuning (Z Babystepping, Speed Control, Flow Control)
- [ ] Better system panel
- [ ] Wifi selection
- [ ] Manual bed leveling assist
- [ ] Using thumbnails from prusa on job status page
- [ ] Scale UI based off of resolution
KlipperScreen is touchscreen GUI for Klipper based 3D printers. KlipperScreen interfaces with [Klipper](https://github.com/kevinOConnor/klipper) via [Moonraker](https://github.com/arksine/moonraker).
Multiple printers update is here! Please check the configuration information for specifying several printers.
More details to come...
### Documentation
### 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.
[Click here to access the documentation.](https://klipperscreen.readthedocs.io/en/latest/)
#### Configure Hardware
Screenshots are included in the documentation.
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.
### Inspiration
KlipperScreen was inspired by [OctoScreen](https://github.com/Z-Bolt/OctoScreen/) and the need for a touchscreen GUI that
will natively work with [Klipper](https://github.com/kevinOConnor/klipper) and [Moonraker](https://github.com/arksine/moonraker).
+109 -186
View File
@@ -1,207 +1,130 @@
# 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)
## Include files
```
{
"preheat_options",
"mainmenu",
"printmenu"
}
[include conf.d/*.conf]
# Include another configuration file. Wildcards (*) will expand to match anything.
```
## Main Options
```
[main]
# 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
# Allows the cursor to be displayed on the screen
show_cursor: False
#
# The following main options are deprecated and will be removed in the near future
#
# 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
```
## Printer Options
Multiple printers can be defined, currently only the first one will be used until an update in the near future.
```
# Define printer and name. Name is anything after the first printer word
[printer Ender 3 Pro]
# 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
# Define the z_babystep intervals in a CSV list. Currently only 2 are supported
z_babystep_values: 0.01, 0.05
```
## 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"}
```
+26
View File
@@ -0,0 +1,26 @@
# Hardware
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. 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.
#### Hardware known to work
[Click here](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35) to go to a post on the Klipper discourse server for known hardware or see the below list.
[BTT PI TFT50](https://www.biqu.equipment/collections/lcd/products/bigtreetech-pi-tft50-v1-0-tft-display-for-raspberry-pi-3d-printer-part)
[Raspberry PI 7" Touchscreen](https://www.raspberrypi.org/products/raspberry-pi-touch-display/)
+71
View File
@@ -0,0 +1,71 @@
# Installation
#### Setup Raspberry Pi
This install process is meant for Raspbian non-desktop version. If you have installed it on the GUI version, use
`sudo raspi-config` to set boot to console by choosing the following options in order:
* 1 System Options
* S5 Boot / Auto Login
* B1 Console
#### Klipper and Moonraker 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
```
If you wish to use the update manager feature of moonraker for KlipperScreen, add the following block into the moonraker
configuration:
```
[update_manager client KlipperScreen]
type: git_repo
path: /home/pi/KlipperScreen
origin: https://github.com/jordanruthe/KlipperScreen.git
env: /home/pi/.KlipperScreen-env/bin/python
requirements: scripts/KlipperScreen-requirements.txt
install_script: scripts/KlipperScreen-install.sh
```
#### KlipperScreen Installation
To clone and install execute the following commands:
```
cd ~/
git clone https://github.com/jordanruthe/KlipperScreen.git
cd ~/KlipperScreen
./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.
KlipperScreen will create a log file output at `/tmp/KlipperScreen.log`. If you are having issues and KlipperScreen has
not gotten to the point where the log file has been created. Run `journalctl -xe -u KlipperScreen` to view the ouput and
see any issues that may be happening.
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.
#### Touchscreen Calibration
Most people don't need to calibrate, but if you do need to calibrate your touchscreen, follow the below steps.
Run this command:
```
DISPLAY=:0 xinput_calibrator --list
```
It will output something such as:
```
Device "wch.cn USB2IIC_CTP_CONTROL" id=6
```
Find the ID of your display and put it in the following command:
```
DISPLAY=:0 xinput_calibrator -v --device <id from last command>
```
+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.
+113 -1
View File
@@ -1,4 +1,116 @@
## Changelog
# Changelog
#### 2021 03 07
* Move fine tuning from control menu to job_status screen for easier access.
#### 2021 03 06
* Added ability to include configuration files.
#### 2021 03 05
* Multiple printers are now available in the main branch.
#### 2021 02 22
* Add configurable z_babystep intervals
* Add QUAD_GANTRY_LEVEL and Z_TILT_ADJUST to Homing menu
* Fixed cursor issue on startup
* Fixed font ratio for large, but short screens
* Configurable cursor display
* Re-vamped logging system
#### 2021 02 19
* Added support for heater generic
#### 2021 02 18
* Add directory support to print panel
* Add macros to print menu
#### 2021 02 17
* Fix issues with word wrapping in different languages
#### 2021 02 15
* Added action bar to left side (moves the Back, E-stop, and Home buttons)
* Added wifi manager. Will show current wifi details in network panel. Will allow switching networks in the future.
* Show printer name in main menu (user will need to configure the printer)
#### 2021 01 21
* Configure screen blanking from settings panel
#### 2021 01 21
* !! Important. matchbox-keyboard must be installed. Install script has changed to include this
* Added onscreen keyboard
* Can now add bed mesh profiles
#### 2021 01 20
* Add different time estimation methods to settings panel
* Job status panel will use time estimation method selected from settings panel
* Bugfixes to state tracking
#### 2021 01 10
* Added system reboot/shutdown buttons to systems panel.
#### 2021 01 09
* Better RTL support (most panels now properly support RTL)
* Fixes to install script for latest version of raspbian.
#### 2021 01 08
* Added settings panel. Invert axis and hiding macros can now be configured from within KlipperScreen
#### 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 retrieved 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: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 86 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

+38
View File
@@ -0,0 +1,38 @@
# KlipperScreen
KlipperScreen is touchscreen GUI for Klipper based 3D printers. KlipperScreen interfaces with [Klipper](https://github.com/kevinOConnor/klipper) via [Moonraker](https://github.com/arksine/moonraker).
Multiple printers update is here! Please check the configuration information for specifying several printers.
[Changelog](changelog.md)
### Required Hardware
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.
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.
### Links
[Installation](Installation.md)
[Configuration](Configuration.md)
[Panels](panels.md)
### Sample Panels
Main Menu
![Main Menu](img/main_panel.png)
Job Status
![Job Status](img/job_status.png)
### Inspiration
KlipperScreen was inspired by [OctoScreen](https://github.com/Z-Bolt/OctoScreen/) and the need for a touchscreen GUI that
will natively work with [Klipper](https://github.com/kevinOConnor/klipper) and [Moonraker](https://github.com/arksine/moonraker).
+77 -9
View File
@@ -1,15 +1,83 @@
## Panels
### Index
* [Main menu](#main-menu)
* [Move](#move)
* [Preheat](#preheat)
# Panels
### 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/bed_level.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.
### Bed Mesh
type: bed_mesh
![Bed Mesh](img/bed_mesh.png)
### 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)
### Power
type: power
![Power](img/power.png)
### Preheat
![Preheat Panel](/docs/img/preheat.png)
type: preheat
![Preheat Panel](img/preheat.png)
### Print
type: print
![Print Panel](img/print.png)
### Settings
type: settings
![Settings](img/settings.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)
-105
View File
@@ -1,105 +0,0 @@
import logging
import asyncio
import json
import os
import base64
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
logger = logging.getLogger("KlipperScreen.KlippyFiles")
class KlippyFiles:
callbacks = []
filelist = []
files = {}
timeout = None
def __init__(self, screen):
self._screen = screen
self.timeout = GLib.timeout_add(2000, self.ret_files)
if not os.path.exists('/tmp/.KS-thumbnails'):
os.makedirs('/tmp/.KS-thumbnails')
GLib.idle_add(self.ret_files, False)
def _callback(self, result, method, params):
if method == "server.files.list":
if "result" in result and isinstance(result['result'],list):
newfiles = []
deletedfiles = self.filelist.copy()
for item in result['result']:
if item['filename'] in self.files:
deletedfiles.remove(item['filename'])
else:
newfiles.append(item['filename'])
logger.debug("New file: %s", item['filename'])
self.filelist.append(item['filename'])
self.files[item['filename']] = {
"size": item['size'],
"modified": item['modified']
}
self.update_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)
if len(deletedfiles) > 0:
logger.debug("Deleted files: %s", deletedfiles)
for file in deletedfiles:
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)
return
logger.debug("Got metadata for %s" % (result['result']['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.write(base64.b64decode(thumbnail['data']))
f.close()
for cb in self.callbacks:
cb([], [], [params['filename']])
def add_file_callback(self, callback):
self.callbacks.append(callback)
def ret_files(self, retval=True):
self._screen._ws.klippy.get_file_list(self._callback)
return retval
def ret_file_data (self, filename):
print("Getting file info for %s" % (filename))
self._screen._ws.klippy.get_file_metadata(filename, self._callback)
def get_file_list(self):
return self.filelist
def get_file_info(self, filename):
if filename not in self.files:
return None
return self.files[filename]
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)
+227
View File
@@ -0,0 +1,227 @@
[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: move
[menu __main config]
name: {{ gettext('Configuration') }}
icon: settings
[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 homing quad_gantry_level]
name: {{ gettext('Quad Gantry Level') }}
icon: home-z
method: printer.gcode.script
params: {"script":"QUAD_GANTRY_LEVEL"}
enable: {{ printer.quad_gantry_level is defined }}
[menu __main homing Z-Tilt]
name: {{ gettext('Z Tilt') }}
icon: z-tilt
method: printer.gcode.script
params: {"script":"Z_TILT_ADJUST"}
enable: {{ printer.z_tilt is defined }}
[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-farther
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 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 power]
name: {{ gettext('Power') }}
icon: shutdown
panel: power
enable: {{ printer.power_devices.count > 0 }}
[menu __print macros]
name: {{ gettext('Macros') }}
icon: custom-script
panel: gcode_macros
enable: {{ printer.gcode_macros.count > 0 }}
[menu __print network]
name: {{ gettext('Network') }}
icon: network
panel: network
[menu __print system]
name: {{ gettext('System') }}
icon: info
panel: system
[menu __print settings]
name: {{ gettext('Settings') }}
icon: settings
panel: settings
[menu __splashscreen]
name: {{ gettext('Menu') }}
[menu __splashscreen power]
name: {{ gettext('Power') }}
icon: shutdown
panel: power
enable: {{ printer.power_devices.count > 0 }}
[menu __splashscreen network]
name: {{ gettext('Network') }}
icon: network
panel: network
[menu __splashscreen system]
name: {{ gettext('System') }}
icon: info
panel: system
@@ -13,7 +13,7 @@ class KlippyGcodes:
EXTRUDE_REL = "M83"
SET_EXT_TEMP = "M104"
MAX_EXT_TEMP = 300
MAX_EXT_TEMP = 450
SET_BED_TEMP = "M140"
MAX_BED_TEMP = 150
@@ -34,16 +34,20 @@ 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_heater_temp(heater, temp):
return 'SET_HEATER_TEMPERATURE heater="%s" target=%s' % (heater, 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 +63,16 @@ 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_remove(profile):
return "BED_MESH_PROFILE REMOVE='%s'" % profile
@staticmethod
def bed_mesh_save(profile):
return "BED_MESH_PROFILE SAVE='%s'" % profile
+262
View File
@@ -0,0 +1,262 @@
# -*- coding: utf-8 -*-
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GdkPixbuf, Gio, GLib, Pango
import os
klipperscreendir = os.getcwd()
class KlippyGtk:
labels = {}
font_ratio = [51, 30]
width_ratio = 16
height_ratio = 9.375
def __init__(self, screen, width, height, theme):
self.screen = screen
self.width = width
self.height = height
self.theme = theme
self.font_size = int(min(
self.width / self.font_ratio[0],
self.height / self.font_ratio[1]
))
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.action_bar_width = int(self.width * .1)
self.header_image_scale_width = 1.2
self.header_image_scale_height = 1.4
logging.debug("img width: %s height: %s" % (self.img_width, self.img_height))
def get_action_bar_width(self):
return self.action_bar_width
def get_content_width(self):
return self.width - self.action_bar_width
def get_content_height(self):
return self.height - self.header_size
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=None):
l = Gtk.Label(label)
if style != None and 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/%s/images/%s.svg" % (klipperscreendir, self.theme, 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/%s/images/%s" % (klipperscreendir, self.theme, 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 PixbufFromHttp(self, resource, style=False, width_scale=1, height_scale=1):
response = self.screen.apiclient.get_thumbnail_stream(resource)
if response == False:
return None
stream = Gio.MemoryInputStream.new_from_data(response, None)
pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale(stream, 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,
position=Gtk.PositionType.TOP, word_wrap=True):
filename = "%s/styles/%s/images/%s.svg" % (klipperscreendir, self.theme, 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(position)
b.set_always_show_image(True)
b.props.relief = Gtk.ReliefStyle.NONE
if word_wrap is True:
try:
# Get the label object
child = b.get_children()[0].get_children()[0].get_children()[1]
child.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
child.set_line_wrap(True)
except:
pass
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/%s/images/%s.svg" % (klipperscreendir, self.theme, 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,1)) + "°C" #°C →"
return str(round(temp)) + " → " + str(round(target)) + "°C"
+49
View File
@@ -0,0 +1,49 @@
import json
import requests
import logging
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 get_thumbnail_stream(self, thumbnail):
url = "http://%s:%s/server/files/gcodes/%s" % (self.ip, self.port, thumbnail)
response = requests.get(url, stream=True)
if response.status_code == 200:
response.raw.decode_content = True
return response.content
return False
def send_request(self, method):
url = "http://%s:%s/%s" % (self.ip, self.port, method)
logging.debug("Sending request to %s" % url)
headers = {} if self.api_key == False else {"x-api-key":self.api_key}
try:
r = requests.get(url, headers=headers)
except:
return False
if r.status_code != 200:
return False
#TODO: Try/except
try:
data = json.loads(r.content)
except:
logging.exception("Unable to parse response from moonraker:\n %s" % r.content)
return False
return data
@@ -9,11 +9,10 @@ import requests
import websocket
import asyncio
import logging
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 +34,31 @@ 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.closing = False
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)
self.connect()
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:
logging.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 +69,14 @@ 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:
logging.debug("Error starting web socket")
def close(self):
self.closing = True
self.ws.close()
def is_connected(self):
return self.connected
@@ -86,16 +96,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,56 +120,78 @@ 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 ###")
logging.info("Moonraker Websocket Open")
logging.info("Self.connected = %s" % self.is_connected())
self.connected = True
if self.timeout != None:
GLib.source_remove(self.timeout)
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:
logging.debug("Connection already closed")
return
if self.closing == True:
logging.debug("Closing websocket")
self.ws.stop()
return
logging.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):
if self.is_connected():
logging.debug("Reconnected")
return False
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self._screen.printer_ready
)
logging.debug("Attempting to reconnect")
self.connect()
return True
def on_error(self, ws, error):
print(error)
logging.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):
self._ws = ws
def emergency_stop(self):
logger.info("Sending printer.emergency_stop")
self._ws.send_method(
logging.info("Sending printer.emergency_stop")
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(
logging.debug("Sending printer.gcode.script: %s", script)
return self._ws.send_method(
"printer.gcode.script",
{"script": script},
callback,
@@ -165,8 +200,8 @@ 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(
logging.debug("Sending server.files.list")
return self._ws.send_method(
"server.files.list",
{},
callback,
@@ -174,8 +209,8 @@ class MoonrakerApi:
)
def get_file_metadata(self, filename, callback=None, *args):
logger.debug("Sending server.files.metadata: %s", filename)
self._ws.send_method(
#logging.debug("Sending server.files.metadata: %s", filename)
return self._ws.send_method(
"server.files.metadata",
{"filename": filename},
callback,
@@ -183,15 +218,33 @@ class MoonrakerApi:
)
def object_subscription(self, updates):
logger.debug("Sending printer.objects.subscribe: %s", str(updates))
self._ws.send_method(
logging.debug("Sending printer.objects.subscribe: %s", str(updates))
return self._ws.send_method(
"printer.objects.subscribe",
updates
)
def power_device_off(self, device, callback=None, *args):
logging.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):
logging.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(
logging.debug("Sending printer.print.cancel")
return self._ws.send_method(
"printer.print.cancel",
{},
callback,
@@ -199,8 +252,8 @@ class MoonrakerApi:
)
def print_pause(self, callback=None, *args):
logger.debug("Sending printer.print.pause")
self._ws.send_method(
logging.debug("Sending printer.print.pause")
return self._ws.send_method(
"printer.print.pause",
{},
callback,
@@ -208,8 +261,8 @@ class MoonrakerApi:
)
def print_resume(self, callback=None, *args):
logger.debug("Sending printer.print.resume")
self._ws.send_method(
logging.debug("Sending printer.print.resume")
return self._ws.send_method(
"printer.print.resume",
{},
callback,
@@ -217,8 +270,8 @@ class MoonrakerApi:
)
def print_start(self, filename, callback=None, *args):
logger.debug("Sending printer.print.start")
self._ws.send_method(
logging.debug("Sending printer.print.start")
return self._ws.send_method(
"printer.print.start",
{
"filename": filename
@@ -229,8 +282,8 @@ 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(
logging.debug("Sending printer.gcode.script: %s", KlippyGcodes.set_bed_temp(target))
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_bed_temp(target)
@@ -239,10 +292,10 @@ class MoonrakerApi:
*args
)
else:
logger.debug("Sending printer.gcode.script: %s",
logging.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",""))
@@ -252,8 +305,8 @@ 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(
logging.debug("Sending set_bed_temp: %s", KlippyGcodes.set_bed_temp(target))
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_bed_temp(target)
@@ -262,9 +315,20 @@ class MoonrakerApi:
*args
)
def set_heater_temp(self, heater, target, callback=None, *args):
logging.debug("Sending heater %s to temp: %s", heater, target)
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_heater_temp(heater, target)
},
callback,
*args
)
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(
logging.debug("Sending set_tool_temp: %s", KlippyGcodes.set_ext_temp(target, tool))
return self._ws.send_method(
"printer.gcode.script",
{
"script": KlippyGcodes.set_ext_temp(target, tool)
@@ -274,13 +338,13 @@ class MoonrakerApi:
)
def restart(self):
logger.debug("Sending printer.restart")
self._ws.send_method(
logging.debug("Sending printer.restart")
return self._ws.send_method(
"printer.restart"
)
def restart_firmware(self):
logger.debug("Sending printer.firmware_restart")
self._ws.send_method(
logging.debug("Sending printer.firmware_restart")
return self._ws.send_method(
"printer.firmware_restart"
)
+360
View File
@@ -0,0 +1,360 @@
import configparser
import os
import logging
import json
import re
from io import StringIO
from os import path
SCREEN_BLANKING_OPTIONS = [
"300", #5 Minutes
"900", #15 Minutes
"1800", #30 Minutes
"3600", #1 Hour
"7200", #2 Hours
"14400", #4 Hours
]
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, screen=None):
_ = lang.gettext
_n = lang.ngettext
self.configurable_options = [
{"invert_x": {"section": "main", "name": _("Invert X"), "type": "binary", "value": "False"}},
{"invert_y": {"section": "main", "name": _("Invert Y"), "type": "binary", "value": "False"}},
{"invert_z": {"section": "main", "name": _("Invert Z"), "type": "binary", "value": "False"}},
{"move_speed": {"section": "main", "name": _("Move Speed (mm/s)"), "type": "scale", "value": "20",
"range": [5,100], "step": 1
}},
{"print_sort_dir": {"section": "main", "type": None, "value": "name_asc"}},
{"print_estimate_method": {"section": "main", "name": _("Estimated Time Method"), "type": "dropdown",
"value": "file","options":[
{"name": _("File Estimation (default)"), "value": "file"},
{"name": _("Duration Only"), "value": "duration"},
{"name": _("Filament Used"), "value": "filament"},
{"name": _("Slicer"), "value": "slicer"}
]}},
{"screen_blanking": {"section": "main", "name": _("Screen Power Off Time"), "type": "dropdown",
"value": "3600", "callback": screen.set_screenblanking_timeout, "options":[
{"name": _("Off"), "value": "off"}
]}},
{"theme": {"section": "main", "name": _("Icon Theme"), "type": "dropdown",
"value": "z-bolt","options":[
{"name": _("Z-bolt (default)"), "value": "z-bolt"},
{"name": _("Colorized"), "value": "colorized"}
]}}
#{"": {"section": "main", "name": _(""), "type": ""}}
]
index = self.configurable_options.index(
[i for i in self.configurable_options if list(i)[0]=="screen_blanking"][0])
for num in SCREEN_BLANKING_OPTIONS:
hour = int(int(num)/3600)
if hour > 0:
name = str(hour) + " " + _n("hour","hours", hour)
else:
name = str(int(int(num)/60)) + " " + _("minutes")
self.configurable_options[index]['screen_blanking']['options'].append({
"name": name,
"value": num
})
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)
logging.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)
includes = [i[8:] for i in self.defined_config.sections() if i.startswith("include ")]
for include in includes:
self._include_config("/".join(self.config_path.split("/")[:-1]),include)
self.log_config(self.defined_config)
self.config.read_string(user_def)
if saved_def != None:
self.config.read_string(saved_def)
logging.info("====== Saved Def ======\n%s\n=======================" % saved_def)
except KeyError:
raise ConfigError(f"Error reading config: {self.config_path}")
except:
logging.exception("Unknown error with config")
printers = sorted([i for i in self.config.sections() if i.startswith("printer ")])
self.printers = []
for printer in printers:
self.printers.append({
printer[8:]: {
"moonraker_host": self.config.get(printer, "moonraker_host", fallback="127.0.0.1"),
"moonraker_port": self.config.get(printer, "moonraker_port", fallback="7125"),
"moonraker_api_key": self.config.get(printer, "moonraker_api_key", fallback=False)
}
})
if len(printers) <= 0:
self.printers.append({
"Printer": {
"moonraker_host": self.config.get("main", "moonraker_host", fallback="127.0.0.1"),
"moonraker_port": self.config.get("main", "moonraker_port", fallback="7125"),
"moonraker_api_key": self.config.get("main", "moonraker_api_key", fallback="")
}
})
conf_printers_debug = self.printers.copy()
for printer in conf_printers_debug:
name = list(printer)[0]
item = conf_printers_debug[conf_printers_debug.index(printer)]
if item[list(printer)[0]]['moonraker_api_key'] != "":
item[list(printer)[0]]['moonraker_api_key'] = "redacted"
logging.debug("Configured printers: %s" % json.dumps(conf_printers_debug, indent=2))
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 _include_config(self, dir, path):
full_path = path if path[0] == "/" else "%s/%s" % (dir, path)
parse_files = []
if "*" in full_path:
parent_dir = "/".join(full_path.split("/")[:-1])
file = full_path.split("/")[-1]
if not os.path.exists(parent_dir):
logging.info("Config Error: Directory %s does not exist" % parent_dir)
return
files = os.listdir(parent_dir)
regex = "^%s$" % file.replace('*','.*')
for file in files:
if re.match(regex, file):
parse_files.append(os.path.join(parent_dir, file))
else:
if not os.path.exists(os.path.join(full_path)):
logging.info("Config Error: %s does not exist" % full_path)
return
parse_files.append(full_path)
logging.info("Parsing files: %s" % parse_files)
for file in parse_files:
config = configparser.ConfigParser()
config.read(file)
includes = [i[8:] for i in config.sections() if i.startswith("include ")]
for include in includes:
self._include_config("/".join(full_path.split("/")[:-1]), include)
self.config.read(file)
self.defined_config.read(file)
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):
logging.info("Passed config file: %s" % file)
if not path.exists(file):
file = "%s/%s" % (os.getcwd(), self.configfile_name)
if not path.exists(file):
file = self.default_config_path
logging.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_config(self, name):
if not name.startswith("printer "):
name = "printer %s" % name
if name not in self.config:
return None
return self.config[name]
def get_printer_power_name(self):
return self.config['settings'].get("printer_power_name", "printer")
def get_printers(self):
return self.printers
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))
macro_sections = [i for i in self.config.sections() if i.startswith("displayed_macros")]
for macro_sec in macro_sections:
for item in self.config.options(macro_sec):
value = self.config[macro_sec].getboolean(item, fallback=True)
if value == False or (self.defined_config != None and
macro_sec in self.defined_config.sections() and
self.defined_config[macro_sec].getboolean(item, fallback=True) == False and
self.defined_config[macro_sec].getboolean(item, fallback=True) != value):
if macro_sec not in save_config.sections():
save_config.add_section(macro_sec)
save_config.set(macro_sec, 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:
logging.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)
),
"======================="
]
logging.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:
logging.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),
"heater_generic": cfg.getint("heater_generic", 0)
}
return item
+181
View File
@@ -0,0 +1,181 @@
import logging
import json
import os
import base64
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
class KlippyFiles():
thumbnail_dir = "/tmp/.KS-thumbnails"
def __init__(self, screen):
self.loop = None
self._poll_task = None
self._screen = screen
self.callbacks = []
self.files = {}
self.filelist = []
self.metadata_timeout = {}
if not os.path.exists(self.thumbnail_dir):
os.makedirs(self.thumbnail_dir)
self.gcodes_path = None
def initialize(self):
self.gcodes_path = None
if "virtual_sdcard" in self._screen.printer.get_config_section_list():
vsd = self._screen.printer.get_config_section("virtual_sdcard")
if "path" in vsd:
self.gcodes_path = vsd['path']
logging.info("Gcodes path: %s" % self.gcodes_path)
def _callback(self, result, method, params):
if method == "server.files.list":
if "result" in result and isinstance(result['result'],list):
newfiles = []
deletedfiles = self.filelist.copy()
for item in result['result']:
file = item['filename'] if "filename" in item else item['path']
if file in self.files:
deletedfiles.remove(file)
else:
newfiles.append(file)
self.add_file(item, False)
if len(newfiles) > 0 or len(deletedfiles) > 0:
self.run_callbacks(newfiles, deletedfiles)
if len(deletedfiles) > 0:
for file in deletedfiles:
self.remove_file(file)
elif method == "server.files.metadata":
if "error" in result.keys():
logging.debug("Error in getting metadata for %s. Retrying in 6 seconds" %(params['filename']))
return
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']:
thumbnail['local'] = False
if self.gcodes_path != None:
fpath = os.path.join(self.gcodes_path, params['filename'])
fdir = os.path.dirname(fpath)
path = os.path.join(fdir, thumbnail['relative_path'])
if os.access(path, os.R_OK):
thumbnail['local'] = True
thumbnail['path'] = path
if thumbnail['local'] == False:
fdir = os.path.dirname(params['filename'])
thumbnail['path'] = os.path.join(fdir, thumbnail['relative_path'])
self.run_callbacks(mods=[params['filename']])
def add_file(self, item, notify=True):
if 'filename' not in item and 'path' not in item:
logging.info("Error adding item, unknown filename or path: %s" % item)
return
filename = item['path'] if "path" in item else item['filename']
if filename in self.filelist:
logging.info("File already exists: %s" % filename)
return
self.filelist.append(filename)
self.files[filename] = {
"size": item['size'],
"modified": item['modified']
}
self.request_metadata(filename)
if notify == True:
self.run_callbacks(newfiles=[filename])
def add_file_callback(self, callback):
try:
self.callbacks.append(callback)
except:
logging.debug("Callback not found: %s" % callback)
def process_update(self, data):
if 'item' in data and data['item']['root'] != 'gcodes':
return
if data['action'] == "create_file":
self.add_file(data['item'])
elif data['action'] == "delete_file":
self.remove_file(data['item']['path'])
elif data['action'] == "move_file":
self.add_file(data['item'], False)
self.remove_file(data['source_item']['path'], False)
self.run_callbacks(newfiles=[data['item']['path']], deletedfiles=[data['source_item']['path']])
def remove_file_callback(self, callback):
if callback in self.callbacks:
self.callbacks.pop(self.callbacks.index(callback))
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
thumb = self.files[filename]['thumbnails'][0]
if thumb['local'] == False:
return ['http', thumb['path']]
return ['file', thumb['path']]
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 request_metadata(self, filename):
if filename not in self.filelist:
return False
self._screen._ws.klippy.get_file_metadata(filename, self._callback)
def refresh_files(self):
self._screen._ws.klippy.get_file_list(self._callback)
def remove_file(self, filename, notify=True):
if filename not in self.filelist:
return
self.filelist.remove(filename)
self.files.pop(filename, None)
if notify == True:
self.run_callbacks(deletedfiles=[filename])
def ret_file_data (self, filename):
print("Getting file info for %s" % (filename))
self._screen._ws.klippy.get_file_metadata(filename, self._callback)
def run_callbacks(self, newfiles=[], deletedfiles=[], mods=[]):
if len(self.callbacks) <= 0:
return
for cb in self.callbacks:
GLib.idle_add(cb, newfiles, deletedfiles, mods)
def get_file_list(self):
return self.filelist
def get_file_info(self, filename):
if filename not in self.files:
return {"path":None,"modified":0,"size":0}
return self.files[filename]
+167
View File
@@ -0,0 +1,167 @@
import logging
import logging.handlers
import os
import re
import subprocess
import sys
import threading
import time
import traceback
from queue import SimpleQueue as Queue
import ctypes
import struct
dpms_loaded = False
try:
ctypes.cdll.LoadLibrary('libXext.so.6')
libXext = ctypes.CDLL('libXext.so.6')
class DPMS_State:
Fail = -1
On = 0
Standby = 1
Suspend = 2
Off = 3
def get_DPMS_state(display_name_in_byte_string=b':0'):
state = DPMS_State.Fail
if not isinstance(display_name_in_byte_string, bytes):
raise TypeError
display_name = ctypes.c_char_p()
display_name.value = display_name_in_byte_string
libXext.XOpenDisplay.restype = ctypes.c_void_p
display = ctypes.c_void_p(libXext.XOpenDisplay(display_name))
dummy1_i_p = ctypes.create_string_buffer(8)
dummy2_i_p = ctypes.create_string_buffer(8)
if display.value:
if libXext.DPMSQueryExtension(display, dummy1_i_p, dummy2_i_p)\
and libXext.DPMSCapable(display):
onoff_p = ctypes.create_string_buffer(1)
state_p = ctypes.create_string_buffer(2)
if libXext.DPMSInfo(display, state_p, onoff_p):
onoff = struct.unpack('B', onoff_p.raw)[0]
if onoff:
state = struct.unpack('H', state_p.raw)[0]
libXext.XCloseDisplay(display)
return state
dpms_loaded = True
except:
pass
def get_network_interfaces():
stream = os.popen("ip addr | grep ^'[0-9]' | cut -d ' ' -f 2 | grep -o '[a-zA-Z0-9\.]*'")
return [i for i in stream.read().strip().split('\n') if not i.startswith('lo')]
def get_wireless_interfaces():
p = subprocess.Popen(["which","iwconfig"], stdout=subprocess.PIPE)
while p.poll() is None:
time.sleep(.1)
if p.poll() != 0:
return None
try:
p = subprocess.Popen(["iwconfig"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = p.stdout.read().decode('ascii').split('\n')
except:
logging.info("Error with running iwconfig command")
return None
interfaces = []
for line in result:
match = re.search('^(\S+)\s+.*$', line)
if match:
interfaces.append(match.group(1))
return interfaces
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:
logging.debug(f"Error getting git version: {err}")
except OSError:
logging.exception("Error runing git describe")
return "?"
def patch_threading_excepthook():
"""Installs our exception handler into the threading modules Thread object
Inspired by https://bugs.python.org/issue1230540
"""
old_init = threading.Thread.__init__
def new_init(self, *args, **kwargs):
old_init(self, *args, **kwargs)
old_run = self.run
def run_with_excepthook(*args, **kwargs):
try:
old_run(*args, **kwargs)
except (KeyboardInterrupt, SystemExit):
raise
except:
sys.excepthook(*sys.exc_info(), thread_identifier=threading.get_ident())
self.run = run_with_excepthook
threading.Thread.__init__ = new_init
# Timed rotating file handler based on Klipper and Moonraker's implementation
class KlipperScreenLoggingHandler(logging.handlers.TimedRotatingFileHandler):
def __init__(self, software_version, filename, **kwargs):
super(KlipperScreenLoggingHandler, self).__init__(filename, **kwargs)
self.rollover_info = {
'header': f"{'-'*20}KlipperScreen Log Start{'-'*20}",
'version': f"Git Version: {software_version}",
}
lines = [line for line in self.rollover_info.values() if line]
if self.stream is not None:
self.stream.write("\n".join(lines) + "\n")
def set_rollover_info(self, name, item):
self.rollover_info[name] = item
def doRollover(self):
super(KlipperScreenLoggingHandler, self).doRollover()
lines = [line for line in self.rollover_info.values() if line]
if self.stream is not None:
self.stream.write("\n".join(lines) + "\n")
# Logging based on Arksine's logging setup
def setup_logging(log_file, software_version):
root_logger = logging.getLogger()
queue = Queue()
queue_handler = logging.handlers.QueueHandler(queue)
root_logger.addHandler(queue_handler)
root_logger.setLevel(logging.DEBUG)
stdout_hdlr = logging.StreamHandler(sys.stdout)
stdout_fmt = logging.Formatter(
'%(asctime)s [%(filename)s:%(funcName)s()] - %(message)s')
stdout_hdlr.setFormatter(stdout_fmt)
fh = None
if log_file:
fh = KlipperScreenLoggingHandler(software_version, log_file, when='midnight', backupCount=2)
formatter = logging.Formatter(
'%(asctime)s [%(filename)s:%(funcName)s()] - %(message)s')
fh.setFormatter(formatter)
listener = logging.handlers.QueueListener(
queue, fh, stdout_hdlr)
else:
listener = logging.handlers.QueueListener(
queue, stdout_hdlr)
listener.start()
def logging_exception_handler(type, value, tb, thread_identifier=None):
logging.exception("Uncaught exception %s: %s\nTraceback: %s" % (type, value, "\n".join(traceback.format_tb(tb))))
sys.excepthook = logging_exception_handler
logging.captureWarnings(True)
return listener, fh
+446
View File
@@ -0,0 +1,446 @@
# 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-02-26 15:56+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"
msgid "?"
msgstr ""
msgid "Abort"
msgstr ""
msgid "Accept"
msgstr ""
msgid "Actions"
msgstr ""
msgid "Add bed mesh profile"
msgstr ""
msgid "Are you sure you want to print"
msgstr ""
msgid "Are you sure you wish to cancel this print?"
msgstr ""
msgid "Are you sure you wish to reboot the system?"
msgstr ""
msgid "Are you sure you wish to shutdown the system?"
msgstr ""
msgid "Bed Level"
msgstr ""
msgid "Bed Mesh"
msgstr ""
msgid "Calibrate"
msgstr ""
msgid "Cancel"
msgstr ""
msgid "Cancel Change"
msgstr ""
msgid "Cancel Print"
msgstr ""
msgid "Cancelled"
msgstr ""
msgid "Channel"
msgstr ""
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
msgid "Close"
msgstr ""
msgid "Complete"
msgstr ""
msgid "Configuration"
msgstr ""
msgid "Connected"
msgstr ""
#, python-format
msgid "Connecting to %s"
msgstr ""
msgid "Continue"
msgstr ""
msgid "Control"
msgstr ""
msgid "Cooldown"
msgstr ""
msgid "Date"
msgstr ""
msgid "Decrease"
msgstr ""
msgid "Delete"
msgstr ""
msgid "Disable Motors"
msgstr ""
msgid "Disable XY"
msgstr ""
msgid "Disconnect"
msgstr ""
msgid "Displayed Macros"
msgstr ""
msgid "Distance (mm)"
msgstr ""
msgid "Duration Only"
msgstr ""
msgid "Elapsed:"
msgstr ""
msgid "Emergency Stop"
msgstr ""
msgid "Error"
msgstr ""
msgid "Estimated Time Method"
msgstr ""
msgid "Extrude"
msgstr ""
msgid "Extrusion +"
msgstr ""
msgid "Extrusion -"
msgstr ""
msgid "Fan"
msgstr ""
msgid "Fan Off"
msgstr ""
msgid "Fan On"
msgstr ""
msgid "Fast"
msgstr ""
msgid "Filament Used"
msgstr ""
msgid "File Estimation (default)"
msgstr ""
msgid "Fine Tuning"
msgstr ""
msgid "Firmware Restart"
msgstr ""
msgid "Go Back"
msgstr ""
msgid "Home All"
msgstr ""
msgid "Home X"
msgstr ""
msgid "Home XY"
msgstr ""
msgid "Home Y"
msgstr ""
msgid "Home Z"
msgstr ""
msgid "Homing"
msgstr ""
msgid "Hostname"
msgstr ""
msgid "IPv4"
msgstr ""
msgid "IPv6"
msgstr ""
msgid "Increase"
msgstr ""
msgid "Initializing"
msgstr ""
msgid "Initializing printer..."
msgstr ""
msgid "Interface"
msgstr ""
msgid "Invert X"
msgstr ""
msgid "Invert Y"
msgstr ""
msgid "Invert Z"
msgstr ""
msgid "Klipper Restart"
msgstr ""
msgid "Klipper Version"
msgstr ""
msgid "Klipper has disconnected"
msgstr ""
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
msgid "Klipper has encountered an error."
msgstr ""
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
msgid "Klipper has shutdown"
msgstr ""
msgid "Klipper is attempting to start"
msgstr ""
msgid "Klipper will reboot"
msgstr ""
msgid "KlipperScreen Version"
msgstr ""
msgid "Left:"
msgstr ""
msgid "Load"
msgstr ""
msgid "Load Average"
msgstr ""
msgid "Lower Nozzle"
msgstr ""
msgid "Macros"
msgstr ""
msgid "Main Menu"
msgstr ""
msgid "Medium"
msgstr ""
msgid "Menu"
msgstr ""
msgid "Modified"
msgstr ""
msgid "Move"
msgstr ""
msgid "Move Distance (mm)"
msgstr ""
msgid "Name"
msgstr ""
msgid "Network"
msgstr ""
msgid "Number Pad"
msgstr ""
msgid "Off"
msgstr ""
msgid "Pause"
msgstr ""
msgid "Paused"
msgstr ""
msgid "Power"
msgstr ""
msgid "Power On Printer"
msgstr ""
msgid "Preheat"
msgstr ""
msgid "Print"
msgstr ""
msgid "Print Control"
msgstr ""
msgid "Print Time"
msgstr ""
msgid "Printing"
msgstr ""
msgid "Profile Name:"
msgstr ""
msgid "Quad Gantry Level"
msgstr ""
msgid "Raise Nozzle"
msgstr ""
msgid "Restart"
msgstr ""
msgid "Resume"
msgstr ""
msgid "Retract"
msgstr ""
msgid "Save"
msgstr ""
msgid "Save Config"
msgstr ""
msgid "Save configuration."
msgstr ""
msgid "Screen Power Off Time"
msgstr ""
msgid "Screen will show in less than one second"
msgstr ""
msgid "Screws Adjust"
msgstr ""
msgid "Set Speed"
msgstr ""
msgid "Settings"
msgstr ""
msgid "Size"
msgstr ""
msgid "Slicer"
msgstr ""
msgid "Slow"
msgstr ""
msgid "Sort by: "
msgstr ""
msgid "Speed +"
msgstr ""
msgid "Speed -"
msgstr ""
msgid "System"
msgstr ""
msgid ""
"System\n"
"Restart"
msgstr ""
msgid ""
"System\n"
"Shutdown"
msgstr ""
msgid "Temperature"
msgstr ""
msgid "Tool"
msgstr ""
msgid "Uploaded"
msgstr ""
msgid "X+"
msgstr ""
msgid "X-"
msgstr ""
msgid "Y+"
msgstr ""
msgid "Y-"
msgstr ""
msgid "Z Calibrate"
msgstr ""
msgid "Z Offset"
msgstr ""
msgid "Z Tilt"
msgstr ""
msgid "Z+"
msgstr ""
msgid "Z-"
msgstr ""
msgid "dBm"
msgstr ""
msgid "minutes"
msgstr ""
msgid "mm"
msgstr ""
@@ -0,0 +1,467 @@
# 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 Elektrickser@gmail.com, 2021
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-02-26 15:56+0000\n"
"PO-Revision-Date: 2021-04-20 19:04+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\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"
msgid "?"
msgstr "?"
msgid "Abort"
msgstr "Abbrechen"
msgid "Accept"
msgstr "OK"
msgid "Actions"
msgstr "Aktionen"
msgid "Add bed mesh profile"
msgstr "Mesh-Level Profil hinzufügen"
msgid "Are you sure you want to print"
msgstr "Möchten Sie wirklich drucken"
msgid "Are you sure you wish to cancel this print?"
msgstr "Möchten Sie diesen Druck wirklich abbrechen?"
msgid "Are you sure you wish to reboot the system?"
msgstr "Möchten Sie das System wirklich neu starten?"
msgid "Are you sure you wish to shutdown the system?"
msgstr "Möchten Sie das System wirklich herunterfahren?"
msgid "Bed Level"
msgstr "Druckbett leveln"
msgid "Bed Mesh"
msgstr "Druckbett Mesh-Level"
msgid "Calibrate"
msgstr "Höheneinstellung"
msgid "Cancel"
msgstr "Abbruch"
msgid "Cancel Change"
msgstr "Änderung abbrechen"
msgid "Cancel Print"
msgstr "Druck abbrechen"
msgid "Cancelled"
msgstr "Abgebrochen"
msgid "Channel"
msgstr "Kanal"
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"Prüfe /tmp/KlipperScreen.log für weitere Informationen.\n"
"Bitte eröffne einen Fehlerbericht auf https://git.io/JLNn4 für Hilfe."
msgid "Close"
msgstr "Schließen"
msgid "Complete"
msgstr "Fertiggestellt"
msgid "Configuration"
msgstr "Einstellungen"
msgid "Connected"
msgstr "Verbunden"
#, python-format
msgid "Connecting to %s"
msgstr "Verbinden zu %s"
msgid "Continue"
msgstr "Fortsetzen"
msgid "Control"
msgstr "Steuerung"
msgid "Cooldown"
msgstr "Abkühlen"
msgid "Date"
msgstr "Datum"
msgid "Decrease"
msgstr "Verringern"
msgid "Delete"
msgstr "Löschen"
msgid "Disable Motors"
msgstr "Motoren deaktivieren"
msgid "Disable XY"
msgstr "Achse XY deaktivieren"
msgid "Disconnect"
msgstr "Nicht verbunden"
msgid "Displayed Macros"
msgstr "Aktive Macros"
msgid "Distance (mm)"
msgstr "Entfernung (mm)"
msgid "Duration Only"
msgstr "Reine Druckzeit"
msgid "Elapsed:"
msgstr "Druckzeit:"
msgid "Emergency Stop"
msgstr "NOT-STOP"
msgid "Error"
msgstr "Fehler"
msgid "Estimated Time Method"
msgstr "Druckzeit"
msgid "Extrude"
msgstr "Filament fördern"
msgid "Extrusion +"
msgstr "Extrusion +"
msgid "Extrusion -"
msgstr "Extrusion -"
msgid "Fan"
msgstr "Lüfter"
msgid "Fan Off"
msgstr "Lüfter Aus"
msgid "Fan On"
msgstr "Lüfter An"
msgid "Fast"
msgstr "Schnell"
msgid "Filament Used"
msgstr "Filamentverbrauch"
msgid "File Estimation (default)"
msgstr "Dateischätzung"
msgid "Fine Tuning"
msgstr "Feintuning"
msgid "Firmware Restart"
msgstr "Firmware neustarten"
msgid "Go Back"
msgstr "Zurück"
msgid "Home All"
msgstr ""
"Alle Achsen\n"
"zurücksetzen"
msgid "Home X"
msgstr ""
"Achse X\n"
"zurücksetzen"
msgid "Home XY"
msgstr ""
"Achse XY\n"
"zurücksetzen"
msgid "Home Y"
msgstr ""
"Achse Y\n"
"zurücksetzen"
msgid "Home Z"
msgstr ""
"Achse Z\n"
"zurücksetzen"
msgid "Homing"
msgstr "Grundposition"
msgid "Hostname"
msgstr "Hostname"
msgid "IPv4"
msgstr "IPv4"
msgid "IPv6"
msgstr "IPv6"
msgid "Increase"
msgstr "Erhöhen"
msgid "Initializing"
msgstr "Startvorgang"
msgid "Initializing printer..."
msgstr "Drucker wird initialisiert..."
msgid "Interface"
msgstr "Interface"
msgid "Invert X"
msgstr "Achse X invertieren"
msgid "Invert Y"
msgstr "Achse Y invertieren"
msgid "Invert Z"
msgstr "Achse Z invertieren"
msgid "Klipper Restart"
msgstr "Klipper neustarten"
msgid "Klipper Version"
msgstr "Klipper Version"
msgid "Klipper has disconnected"
msgstr "Klipper nicht verbunden"
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
"Klipper hat einen Fehler mit dem Mainboard festgestellt.\n"
"Bitte Mainboard neu programmieren."
msgid "Klipper has encountered an error."
msgstr "Klipper hat einen Fehler festgestellt."
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"Klipper hat einen Fehler festgestellt.\n"
"Führe einen FIRMWARE_RESTART durch um den Fehler zu beheben."
msgid "Klipper has shutdown"
msgstr "Klipper abgeschaltet"
msgid "Klipper is attempting to start"
msgstr "Klipper ist startbereit"
msgid "Klipper will reboot"
msgstr "Klipper startet neu"
msgid "KlipperScreen Version"
msgstr "KlipperScreen Version"
msgid "Left:"
msgstr "Restzeit:"
msgid "Load"
msgstr "Last"
msgid "Load Average"
msgstr "Durchschnittslast"
msgid "Lower Nozzle"
msgstr "Düse absenken"
msgid "Macros"
msgstr "Makros"
msgid "Main Menu"
msgstr "Hauptmenü"
msgid "Medium"
msgstr "Mittel"
msgid "Menu"
msgstr "Menü"
msgid "Modified"
msgstr "Modifiziert"
msgid "Move"
msgstr "Bewegen"
msgid "Move Distance (mm)"
msgstr "Bewegungsdistanz (mm)"
msgid "Name"
msgstr "Name"
msgid "Network"
msgstr "Netzwerk"
msgid "Number Pad"
msgstr "Nummernblock"
msgid "Off"
msgstr "Aus"
msgid "Pause"
msgstr "Pause"
msgid "Paused"
msgstr "Pausiert"
msgid "Power"
msgstr "Ein"
msgid "Power On Printer"
msgstr "Drucker einschalten"
msgid "Preheat"
msgstr "Vorheizen"
msgid "Print"
msgstr "Druck"
msgid "Print Control"
msgstr "Druck Steuerung"
msgid "Print Time"
msgstr "Druckzeit"
msgid "Printing"
msgstr "Drucken"
msgid "Profile Name:"
msgstr "Profilname:"
msgid "Quad Gantry Level"
msgstr "Quad Gantry Level"
msgid "Raise Nozzle"
msgstr "Düse anheben"
msgid "Restart"
msgstr "Neustart"
msgid "Resume"
msgstr "Fortsetzen"
msgid "Retract"
msgstr "Zurückziehen"
msgid "Save"
msgstr "Speichern"
msgid "Save Config"
msgstr "Einstellungen speichern"
msgid "Save configuration."
msgstr "Speichere Einstellungen."
msgid "Screen Power Off Time"
msgstr "Bildschirm abschalten in"
msgid "Screen will show in less than one second"
msgstr "Der Bildschirm wird in weniger als einer Sekunde angezeigt"
msgid "Screws Adjust"
msgstr "Schrauben Einstellen"
msgid "Set Speed"
msgstr "Geschwindigkeit einstellen"
msgid "Settings"
msgstr "Einstellungen"
msgid "Size"
msgstr "Größe"
msgid "Slicer"
msgstr "Slicer"
msgid "Slow"
msgstr "Langsam"
msgid "Sort by: "
msgstr "Sortierung:"
msgid "Speed +"
msgstr "Geschwindigkeit +"
msgid "Speed -"
msgstr "Geschwindigkeit -"
msgid "System"
msgstr "System"
msgid ""
"System\n"
"Restart"
msgstr ""
"Drucker\n"
"Neustarten"
msgid ""
"System\n"
"Shutdown"
msgstr ""
"Drucker\n"
"Ausschalten"
msgid "Temperature"
msgstr "Temperatur"
msgid "Tool"
msgstr "Druckkopf"
msgid "Uploaded"
msgstr "Hochgeladen"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "Y+"
msgstr "Y+"
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "Höhe Kalibrieren"
msgid "Z Offset"
msgstr "Z Offset"
msgid "Z Tilt"
msgstr "Z-Achse ausrichten"
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "dBm"
msgstr "dBm"
msgid "minutes"
msgstr "Minuten"
msgid "mm"
msgstr "mm"
Binary file not shown.
@@ -0,0 +1,427 @@
msgid "?"
msgstr ""
msgid "Abort"
msgstr "Abort"
msgid "Accept"
msgstr ""
msgid "Actions"
msgstr ""
msgid "Add bed mesh profile"
msgstr ""
msgid "Are you sure you want to print"
msgstr ""
msgid "Are you sure you wish to cancel this print?"
msgstr ""
msgid "Are you sure you wish to reboot the system?"
msgstr ""
msgid "Are you sure you wish to shutdown the system?"
msgstr ""
msgid "Bed Level"
msgstr ""
msgid "Bed Mesh"
msgstr ""
msgid "Calibrate"
msgstr ""
msgid "Cancel"
msgstr ""
msgid "Cancel Change"
msgstr ""
msgid "Cancel Print"
msgstr ""
msgid "Cancelled"
msgstr ""
msgid "Channel"
msgstr ""
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
msgid "Close"
msgstr ""
msgid "Complete"
msgstr ""
msgid "Configuration"
msgstr ""
msgid "Connected"
msgstr ""
#, python-format
msgid "Connecting to %s"
msgstr ""
msgid "Continue"
msgstr ""
msgid "Control"
msgstr ""
msgid "Cooldown"
msgstr ""
msgid "Date"
msgstr ""
msgid "Decrease"
msgstr ""
msgid "Delete"
msgstr ""
msgid "Disable Motors"
msgstr ""
msgid "Disable XY"
msgstr ""
msgid "Disconnect"
msgstr ""
msgid "Displayed Macros"
msgstr ""
msgid "Distance (mm)"
msgstr ""
msgid "Duration Only"
msgstr ""
msgid "Elapsed:"
msgstr ""
msgid "Emergency Stop"
msgstr ""
msgid "Error"
msgstr ""
msgid "Estimated Time Method"
msgstr ""
msgid "Extrude"
msgstr ""
msgid "Extrusion +"
msgstr ""
msgid "Extrusion -"
msgstr ""
msgid "Fan"
msgstr ""
msgid "Fan Off"
msgstr ""
msgid "Fan On"
msgstr ""
msgid "Fast"
msgstr ""
msgid "Filament Used"
msgstr ""
msgid "File Estimation (default)"
msgstr ""
msgid "Fine Tuning"
msgstr ""
msgid "Firmware Restart"
msgstr ""
msgid "Go Back"
msgstr ""
msgid "Home All"
msgstr ""
msgid "Home X"
msgstr ""
msgid "Home XY"
msgstr ""
msgid "Home Y"
msgstr ""
msgid "Home Z"
msgstr ""
msgid "Homing"
msgstr ""
msgid "Hostname"
msgstr ""
msgid "IPv4"
msgstr ""
msgid "IPv6"
msgstr ""
msgid "Increase"
msgstr ""
msgid "Initializing"
msgstr ""
msgid "Initializing printer..."
msgstr ""
msgid "Interface"
msgstr ""
msgid "Invert X"
msgstr ""
msgid "Invert Y"
msgstr ""
msgid "Invert Z"
msgstr ""
msgid "Klipper Restart"
msgstr ""
msgid "Klipper Version"
msgstr ""
msgid "Klipper has disconnected"
msgstr ""
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
msgid "Klipper has encountered an error."
msgstr ""
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
msgid "Klipper has shutdown"
msgstr ""
msgid "Klipper is attempting to start"
msgstr ""
msgid "Klipper will reboot"
msgstr ""
msgid "KlipperScreen Version"
msgstr ""
msgid "Left:"
msgstr ""
msgid "Load"
msgstr ""
msgid "Load Average"
msgstr ""
msgid "Lower Nozzle"
msgstr ""
msgid "Macros"
msgstr ""
msgid "Main Menu"
msgstr ""
msgid "Medium"
msgstr ""
msgid "Menu"
msgstr ""
msgid "Modified"
msgstr ""
msgid "Move"
msgstr ""
msgid "Move Distance (mm)"
msgstr ""
msgid "Name"
msgstr ""
msgid "Network"
msgstr ""
msgid "Number Pad"
msgstr ""
msgid "Off"
msgstr ""
msgid "Pause"
msgstr ""
msgid "Paused"
msgstr ""
msgid "Power"
msgstr ""
msgid "Power On Printer"
msgstr ""
msgid "Preheat"
msgstr ""
msgid "Print"
msgstr ""
msgid "Print Control"
msgstr ""
msgid "Print Time"
msgstr ""
msgid "Printing"
msgstr ""
msgid "Profile Name:"
msgstr ""
msgid "Quad Gantry Level"
msgstr ""
msgid "Raise Nozzle"
msgstr ""
msgid "Restart"
msgstr ""
msgid "Resume"
msgstr ""
msgid "Retract"
msgstr ""
msgid "Save"
msgstr ""
msgid "Save Config"
msgstr ""
msgid "Save configuration."
msgstr ""
msgid "Screen Power Off Time"
msgstr ""
msgid "Screen will show in less than one second"
msgstr ""
msgid "Screws Adjust"
msgstr ""
msgid "Set Speed"
msgstr ""
msgid "Settings"
msgstr ""
msgid "Size"
msgstr ""
msgid "Slicer"
msgstr ""
msgid "Slow"
msgstr ""
msgid "Sort by: "
msgstr ""
msgid "Speed +"
msgstr ""
msgid "Speed -"
msgstr ""
msgid "System"
msgstr ""
msgid ""
"System\n"
"Restart"
msgstr ""
msgid ""
"System\n"
"Shutdown"
msgstr ""
msgid "Temperature"
msgstr ""
msgid "Tool"
msgstr ""
msgid "Uploaded"
msgstr ""
msgid "X+"
msgstr ""
msgid "X-"
msgstr ""
msgid "Y+"
msgstr ""
msgid "Y-"
msgstr ""
msgid "Z Calibrate"
msgstr ""
msgid "Z Offset"
msgstr ""
msgid "Z Tilt Adjust"
msgstr ""
msgid "Z+"
msgstr ""
msgid "Z-"
msgstr ""
msgid "dBm"
msgstr ""
msgid "minutes"
msgstr ""
msgid "mm"
msgstr ""
Binary file not shown.
@@ -0,0 +1,456 @@
# 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-02-26 15:56+0000\n"
"PO-Revision-Date: 2021-04-25 11:23-0300\n"
"Last-Translator: alfrix\n"
"Language-Team: \n"
"Language: es\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"
msgid "?"
msgstr "?"
msgid "Abort"
msgstr "Cancelar"
msgid "Accept"
msgstr "Aceptar"
msgid "Actions"
msgstr "Acciones"
msgid "Add bed mesh profile"
msgstr "Agregar pefil de malla de cama"
msgid "Are you sure you want to print"
msgstr "Está seguro que desea imprimir"
msgid "Are you sure you wish to cancel this print?"
msgstr "Está seguro que desea cancelar esta impresión?"
msgid "Are you sure you wish to reboot the system?"
msgstr "Está seguro que desea reiniciar el sistema?"
msgid "Are you sure you wish to shutdown the system?"
msgstr "Está seguro que desea apagar el sistema?"
msgid "Bed Level"
msgstr "Nivelar cama"
msgid "Bed Mesh"
msgstr "Malla de cama"
msgid "Calibrate"
msgstr "Calibrar"
msgid "Cancel"
msgstr "Cancelar"
msgid "Cancel Change"
msgstr "Cancelar Cambio"
msgid "Cancel Print"
msgstr "Cancelar Impresión"
msgid "Cancelled"
msgstr "Cancelado"
msgid "Channel"
msgstr "Canal"
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"Revise /tmp/KlipperScreen.log para mas información.\n"
"Por favor crear un 'issue' en GitHub para ser ayudado."
msgid "Close"
msgstr "Cerrar"
msgid "Complete"
msgstr "Completado"
msgid "Configuration"
msgstr "Configuración"
msgid "Connected"
msgstr "Conectado"
#, python-format
msgid "Connecting to %s"
msgstr "Conectando a %s"
msgid "Continue"
msgstr "Continuar"
msgid "Control"
msgstr "Control"
msgid "Cooldown"
msgstr "Enfriar"
msgid "Date"
msgstr "Fecha"
msgid "Decrease"
msgstr "Disminuir"
msgid "Delete"
msgstr "Borrar"
msgid "Disable Motors"
msgstr "Desactivar Motores"
msgid "Disable XY"
msgstr "Desactivar XY"
msgid "Disconnect"
msgstr "Desconectar"
msgid "Displayed Macros"
msgstr "Macros Mostrados"
msgid "Distance (mm)"
msgstr "Distancia (mm)"
msgid "Duration Only"
msgstr "Duración Solamente"
msgid "Elapsed:"
msgstr "Transcurrido:"
msgid "Emergency Stop"
msgstr "Parada de Emergencia"
msgid "Error"
msgstr "Error"
msgid "Estimated Time Method"
msgstr "Metodo para Tiempo Estimado"
msgid "Extrude"
msgstr "Extruir"
msgid "Extrusion +"
msgstr "Extrusor +"
msgid "Extrusion -"
msgstr "Extrusor -"
msgid "Fan"
msgstr "Ventilador"
msgid "Fan Off"
msgstr "Apagar Ventilador"
msgid "Fan On"
msgstr "Encender Ventilador"
msgid "Fast"
msgstr "Rápido"
msgid "Filament Used"
msgstr "Filamento Usado"
msgid "File Estimation (default)"
msgstr "Estimación de Archivo (por defecto)"
msgid "Fine Tuning"
msgstr "Ajuste Fino"
msgid "Firmware Restart"
msgstr "Reiniciar Firmware"
msgid "Go Back"
msgstr "Volver"
msgid "Home All"
msgstr "Llevar al origen"
msgid "Home X"
msgstr "Origen X"
msgid "Home XY"
msgstr "Origen XY"
msgid "Home Y"
msgstr "Origen Y"
msgid "Home Z"
msgstr "Origen Z"
msgid "Homing"
msgstr "Llevar al origen"
msgid "Hostname"
msgstr "Hostname"
msgid "IPv4"
msgstr "IPv4"
msgid "IPv6"
msgstr "IPv6"
msgid "Increase"
msgstr "Aumentar"
msgid "Initializing"
msgstr "Iniciando"
msgid "Initializing printer..."
msgstr "Iniciando Impresora..."
msgid "Interface"
msgstr "Interfaz"
msgid "Invert X"
msgstr "Invertir X"
msgid "Invert Y"
msgstr "Invertir Y"
msgid "Invert Z"
msgstr "Invertir Z"
msgid "Klipper Restart"
msgstr "Reiniciar Klipper"
msgid "Klipper Version"
msgstr "Versión de Klipper"
msgid "Klipper has disconnected"
msgstr "Klipper se desconectó"
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
"Klipper encontró un error en el microcontrolador.\n"
"Por favor recompile y flasheelo."
msgid "Klipper has encountered an error."
msgstr "Klipper encontró un error."
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"Klipper encontró un error.\n"
"Ejecute FIRMWARE_RESTART para tratar de arreglarlo."
msgid "Klipper has shutdown"
msgstr "Klipper se apagó"
msgid "Klipper is attempting to start"
msgstr "Klipper está intentando iniciar"
msgid "Klipper will reboot"
msgstr "Klipper se reiniciará"
msgid "KlipperScreen Version"
msgstr "Versión de KlipperScreen"
msgid "Left:"
msgstr "Restante:"
msgid "Load"
msgstr "Cargar"
msgid "Load Average"
msgstr "Carga media"
msgid "Lower Nozzle"
msgstr "Bajar Boquilla"
msgid "Macros"
msgstr "Macros"
msgid "Main Menu"
msgstr "Menú Principal"
msgid "Medium"
msgstr "Medio"
msgid "Menu"
msgstr "Menú"
msgid "Modified"
msgstr "Modificado"
msgid "Move"
msgstr "Mover"
msgid "Move Distance (mm)"
msgstr "Mover Distancia (mm)"
msgid "Name"
msgstr "Nombre"
msgid "Network"
msgstr "Red"
msgid "Number Pad"
msgstr "Teclado Númerico"
msgid "Off"
msgstr "Apagar"
msgid "Pause"
msgstr "Pausar"
msgid "Paused"
msgstr "Pausado"
msgid "Power"
msgstr "Energía"
msgid "Power On Printer"
msgstr "Encender Impresora"
msgid "Preheat"
msgstr "Precalentar"
msgid "Print"
msgstr "Imprimir"
msgid "Print Control"
msgstr "Control de impresión"
msgid "Print Time"
msgstr "Tiempo de impresión"
msgid "Printing"
msgstr "Imprimiendo"
msgid "Profile Name:"
msgstr "Nombre del perfil:"
msgid "Quad Gantry Level"
msgstr "Nivelación cuádruple"
msgid "Raise Nozzle"
msgstr "Levantar Boquilla"
msgid "Restart"
msgstr "Reiniciar"
msgid "Resume"
msgstr "Continuar"
msgid "Retract"
msgstr "Retraer"
msgid "Save"
msgstr "Guardar"
msgid "Save Config"
msgstr "Guardar Config"
msgid "Save configuration."
msgstr "Guardar Configuración."
msgid "Screen Power Off Time"
msgstr "Apagar pantalla tras"
msgid "Screen will show in less than one second"
msgstr "La pantalla se mostrará en menos de un segundo"
msgid "Screws Adjust"
msgstr "Ajustar Tornillos"
msgid "Set Speed"
msgstr "Establecer Velocidad"
msgid "Settings"
msgstr "Opciones"
msgid "Size"
msgstr "Tamaño"
msgid "Slicer"
msgstr "Slicer"
msgid "Slow"
msgstr "Lento"
msgid "Sort by: "
msgstr "Ordenar por:"
msgid "Speed +"
msgstr "Velocidad +"
msgid "Speed -"
msgstr "Velocidad -"
msgid "System"
msgstr "Sistema"
msgid ""
"System\n"
"Restart"
msgstr ""
"Reiniciar\n"
"Sistema"
msgid ""
"System\n"
"Shutdown"
msgstr ""
"Apagar\n"
"Sistema"
msgid "Temperature"
msgstr "Temperatura"
msgid "Tool"
msgstr "Herrmienta"
msgid "Uploaded"
msgstr "Subido"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "Y+"
msgstr "Y+"
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "Calibrar Z"
msgid "Z Offset"
msgstr "Desfase Z"
msgid "Z Tilt"
msgstr "Inclinación Z"
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "dBm"
msgstr "dBm"
msgid "minutes"
msgstr "minutos"
msgid "mm"
msgstr "mm"
@@ -0,0 +1,494 @@
# 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-02-26 15:56+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"
msgid "?"
msgstr "?"
msgid "Abort"
msgstr "Annuler"
msgid "Accept"
msgstr "Accepter"
msgid "Actions"
msgstr "Actions"
msgid "Add bed mesh profile"
msgstr ""
msgid "Are you sure you want to print"
msgstr "Es tu sure de vouloir imprimer"
msgid "Are you sure you wish to cancel this print?"
msgstr "Es tu sure de vouloir annuler cette impression?"
#, fuzzy
msgid "Are you sure you wish to reboot the system?"
msgstr "Es tu sure de vouloir annuler cette impression?"
#, fuzzy
msgid "Are you sure you wish to shutdown the system?"
msgstr "Es tu sure de vouloir annuler cette impression?"
msgid "Bed Level"
msgstr "Nivelage du plateau"
msgid "Bed Mesh"
msgstr "Grille du plateau"
#, fuzzy
msgid "Calibrate"
msgstr "Calibration Z"
msgid "Cancel"
msgstr "Annuler"
msgid "Cancel Change"
msgstr "Annuler le changement"
msgid "Cancel Print"
msgstr "Annuler l'impression"
#, fuzzy
msgid "Cancelled"
msgstr "Annuler"
msgid "Channel"
msgstr ""
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"
msgid "Close"
msgstr "Fermer"
msgid "Complete"
msgstr ""
msgid "Configuration"
msgstr "Configuration"
msgid "Connected"
msgstr ""
#, python-format
msgid "Connecting to %s"
msgstr ""
msgid "Continue"
msgstr "Continuer"
msgid "Control"
msgstr "Controle"
msgid "Cooldown"
msgstr "Refroidir"
msgid "Date"
msgstr ""
msgid "Decrease"
msgstr "Diminuer"
msgid "Delete"
msgstr ""
msgid "Disable Motors"
msgstr "Déactiver les moteurs"
msgid "Disable XY"
msgstr "Deactiver XY"
msgid "Disconnect"
msgstr ""
msgid "Displayed Macros"
msgstr ""
msgid "Distance (mm)"
msgstr "Distance (mm)"
msgid "Duration Only"
msgstr ""
msgid "Elapsed:"
msgstr "Écoulé:"
msgid "Emergency Stop"
msgstr "Arret d'urgence"
msgid "Error"
msgstr ""
msgid "Estimated Time Method"
msgstr ""
msgid "Extrude"
msgstr "Extruder"
msgid "Extrusion +"
msgstr "Extrusion +"
msgid "Extrusion -"
msgstr "Extrusion +"
msgid "Fan"
msgstr "Ventilateur"
msgid "Fan Off"
msgstr "ventilateur éteint"
msgid "Fan On"
msgstr "Ventilateur en marche"
msgid "Fast"
msgstr "Rapide"
msgid "Filament Used"
msgstr ""
msgid "File Estimation (default)"
msgstr ""
msgid "Fine Tuning"
msgstr "Fin réglage"
msgid "Firmware Restart"
msgstr "Redemarrer le FW"
msgid "Go Back"
msgstr "Retourner"
msgid "Home All"
msgstr "Réinitialiser XYZ"
msgid "Home X"
msgstr "Réinitialiser X"
msgid "Home XY"
msgstr "Réinitialiser XY"
msgid "Home Y"
msgstr "Réinitialiser Y"
msgid "Home Z"
msgstr "Réinitialiser Z"
msgid "Homing"
msgstr "Réinitialisation"
msgid "Hostname"
msgstr ""
msgid "IPv4"
msgstr ""
msgid "IPv6"
msgstr ""
msgid "Increase"
msgstr "Augmenter"
msgid "Initializing"
msgstr "Initialisation"
msgid "Initializing printer..."
msgstr "Initialisation l'imprimante"
msgid "Interface"
msgstr ""
msgid "Invert X"
msgstr ""
msgid "Invert Y"
msgstr ""
msgid "Invert Z"
msgstr ""
msgid "Klipper Restart"
msgstr "Redémarrer klipper"
msgid "Klipper Version"
msgstr "Version de klipper"
msgid "Klipper has disconnected"
msgstr "Klipper s'est déconnecté"
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."
msgid "Klipper has encountered an error."
msgstr "Klipper a rencontré une erreur."
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."
msgid "Klipper has shutdown"
msgstr "Klipper s'est arrêté"
msgid "Klipper is attempting to start"
msgstr "Klipper tente de démarrer"
msgid "Klipper will reboot"
msgstr "Klipper va redémarrer"
msgid "KlipperScreen Version"
msgstr "Version de KlipperScreen"
msgid "Left:"
msgstr "Gauche:"
msgid "Load"
msgstr ""
msgid "Load Average"
msgstr "Charge moyenne"
msgid "Lower Nozzle"
msgstr "Rapprocher la buse"
msgid "Macros"
msgstr "Macros"
msgid "Main Menu"
msgstr "Menu principal"
msgid "Medium"
msgstr "Moyen"
#, fuzzy
msgid "Menu"
msgstr "Menu principal"
msgid "Modified"
msgstr ""
msgid "Move"
msgstr "Mouvement"
msgid "Move Distance (mm)"
msgstr "Distance de mouvement (mm)"
msgid "Name"
msgstr ""
msgid "Network"
msgstr "Réseau"
msgid "Number Pad"
msgstr "Pad numerique"
#, fuzzy
msgid "Off"
msgstr "ventilateur éteint"
msgid "Pause"
msgstr "Pause"
msgid "Paused"
msgstr "En pause"
msgid "Power"
msgstr "Energie"
msgid "Power On Printer"
msgstr "Allumer l'imrimante"
msgid "Preheat"
msgstr "Préchauffer"
msgid "Print"
msgstr "Imprimer"
msgid "Print Control"
msgstr "Controle de l'imprimante"
msgid "Print Time"
msgstr "Temps d'impression"
msgid "Printing"
msgstr "imprime"
msgid "Profile Name:"
msgstr ""
msgid "Quad Gantry Level"
msgstr ""
msgid "Raise Nozzle"
msgstr "Éloigner la buse"
msgid "Restart"
msgstr "Redémarrage"
msgid "Resume"
msgstr "Resumer"
msgid "Retract"
msgstr "Rétracter"
msgid "Save"
msgstr ""
msgid "Save Config"
msgstr "Enregistrer la config"
msgid "Save configuration."
msgstr "Enregistrer la configuration"
msgid "Screen Power Off Time"
msgstr ""
msgid "Screen will show in less than one second"
msgstr ""
msgid "Screws Adjust"
msgstr "Ajuster les vis"
msgid "Set Speed"
msgstr "Régler la vitesse"
#, fuzzy
msgid "Settings"
msgstr "Paramètres"
msgid "Size"
msgstr "dimensions"
msgid "Slicer"
msgstr ""
msgid "Slow"
msgstr "Lent"
msgid "Sort by: "
msgstr ""
msgid "Speed +"
msgstr "Vitesse+"
msgid "Speed -"
msgstr "Vitesse-"
msgid "System"
msgstr "Systeme"
#, fuzzy
msgid ""
"System\n"
"Restart"
msgstr "Redémarrage"
msgid ""
"System\n"
"Shutdown"
msgstr ""
msgid "Temperature"
msgstr "Temperature"
msgid "Tool"
msgstr "outil"
msgid "Uploaded"
msgstr "Telecharger"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "Y+"
msgstr "Y+"
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "Calibration Z"
msgid "Z Offset"
msgstr "Décalage Z"
msgid "Z Tilt Adjust"
msgstr ""
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "dBm"
msgstr ""
msgid "minutes"
msgstr ""
msgid "mm"
msgstr "mm"
#~ msgid "Network Info"
#~ msgstr "Information réseau "
#, fuzzy
#~ msgid "Klipper"
#~ msgstr "Redémarrer klipper"
#~ 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,494 @@
# 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-02-26 15:56+0000\n"
"PO-Revision-Date: 2021-01-08 08:21-0500\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"
msgid "?"
msgstr "?"
msgid "Abort"
msgstr "בטל"
msgid "Accept"
msgstr "אשר"
msgid "Actions"
msgstr "פעולות"
msgid "Add bed mesh profile"
msgstr ""
msgid "Are you sure you want to print"
msgstr "האם אתה בטוח שברצונך להדפיס"
msgid "Are you sure you wish to cancel this print?"
msgstr "האם אתה בטוח שברצונך לבטל את ההדפסה?"
#, fuzzy
msgid "Are you sure you wish to reboot the system?"
msgstr "האם אתה בטוח שברצונך לבטל את ההדפסה?"
#, fuzzy
msgid "Are you sure you wish to shutdown the system?"
msgstr "האם אתה בטוח שברצונך לבטל את ההדפסה?"
msgid "Bed Level"
msgstr "פילוס מיטה"
msgid "Bed Mesh"
msgstr "מיפוי מיטה"
#, fuzzy
msgid "Calibrate"
msgstr "כיול Z"
msgid "Cancel"
msgstr "ביטול"
msgid "Cancel Change"
msgstr "בטל שינוי"
msgid "Cancel Print"
msgstr "בטל הדפסה"
#, fuzzy
msgid "Cancelled"
msgstr "ביטול"
msgid "Channel"
msgstr ""
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"בדוק KlipperScreen.log, בתיקית tmp ליותר פרטים.\n"
"אנא שלח דוח תקלה ב- GITHUB, לעזרה."
msgid "Close"
msgstr "סגור"
msgid "Complete"
msgstr ""
msgid "Configuration"
msgstr "קונפיגורציה"
msgid "Connected"
msgstr ""
#, python-format
msgid "Connecting to %s"
msgstr ""
msgid "Continue"
msgstr "המשך"
msgid "Control"
msgstr "שליטה"
msgid "Cooldown"
msgstr "קירור"
msgid "Date"
msgstr ""
msgid "Decrease"
msgstr "הקטן"
msgid "Delete"
msgstr ""
msgid "Disable Motors"
msgstr "בטל מנועים"
msgid "Disable XY"
msgstr "בטל XY"
msgid "Disconnect"
msgstr ""
msgid "Displayed Macros"
msgstr ""
msgid "Distance (mm)"
msgstr "מרחק (מ''מ)"
msgid "Duration Only"
msgstr ""
msgid "Elapsed:"
msgstr "זמן שעבר:"
msgid "Emergency Stop"
msgstr "עצירת חירום"
msgid "Error"
msgstr ""
msgid "Estimated Time Method"
msgstr ""
msgid "Extrude"
msgstr "אקסטרוזיה"
msgid "Extrusion +"
msgstr "שיחול +"
msgid "Extrusion -"
msgstr "שיחול -"
msgid "Fan"
msgstr "מאוורר"
msgid "Fan Off"
msgstr "כבה מאוורר"
msgid "Fan On"
msgstr "הפעל מאוורר"
msgid "Fast"
msgstr "מהיר"
msgid "Filament Used"
msgstr ""
msgid "File Estimation (default)"
msgstr ""
msgid "Fine Tuning"
msgstr "כיולים עדינים"
msgid "Firmware Restart"
msgstr "התחל קושחה"
msgid "Go Back"
msgstr "חזרה"
msgid "Home All"
msgstr "איפוס XYZ"
msgid "Home X"
msgstr "איפוס X"
msgid "Home XY"
msgstr "איפוס XY"
msgid "Home Y"
msgstr "איפוס Y"
msgid "Home Z"
msgstr "איפוס Z"
msgid "Homing"
msgstr "איפוס צירים"
msgid "Hostname"
msgstr ""
msgid "IPv4"
msgstr ""
msgid "IPv6"
msgstr ""
msgid "Increase"
msgstr "הגדל"
msgid "Initializing"
msgstr "מאתחל"
msgid "Initializing printer..."
msgstr "מאתחל מדפסת..."
msgid "Interface"
msgstr ""
msgid "Invert X"
msgstr ""
msgid "Invert Y"
msgstr ""
msgid "Invert Z"
msgstr ""
msgid "Klipper Restart"
msgstr "אתחול קליפר"
msgid "Klipper Version"
msgstr "גרסא של קליפר"
msgid "Klipper has disconnected"
msgstr "קליפר התנתק"
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr "בעיית תקשורת בין קליפר ללוח בקרה. אנא לקמפל קושחה ולצרובה מחדש. "
msgid "Klipper has encountered an error."
msgstr "קילפר נתקל בבעיה."
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"קליפר נתקל בבעיה. \n"
"נסה להריץ firmware_restart, כדי לפתור את הבעיה."
msgid "Klipper has shutdown"
msgstr "קליפר נכבה"
msgid "Klipper is attempting to start"
msgstr "קליפר מנסה לרוץ"
msgid "Klipper will reboot"
msgstr "קליפר יבצע אתחול"
msgid "KlipperScreen Version"
msgstr "גרסא של KlipperScreen"
msgid "Left:"
msgstr "זמן שנותר:"
msgid "Load"
msgstr ""
msgid "Load Average"
msgstr "עומס ממוצע"
msgid "Lower Nozzle"
msgstr "הנמך דיזה"
msgid "Macros"
msgstr "מקרואים"
msgid "Main Menu"
msgstr "תפריט ראשי"
msgid "Medium"
msgstr "ממוצע"
#, fuzzy
msgid "Menu"
msgstr "תפריט ראשי"
msgid "Modified"
msgstr ""
msgid "Move"
msgstr "הזזת צירים"
msgid "Move Distance (mm)"
msgstr "מרחק הזזה (מ''מ)"
msgid "Name"
msgstr ""
msgid "Network"
msgstr "רשת"
msgid "Number Pad"
msgstr "פד נומרי"
#, fuzzy
msgid "Off"
msgstr "כבה מאוורר"
msgid "Pause"
msgstr "השהיה"
msgid "Paused"
msgstr "מושהה"
msgid "Power"
msgstr "הפעלה"
msgid "Power On Printer"
msgstr "הפעל מדפסת"
msgid "Preheat"
msgstr "חימום מראש"
msgid "Print"
msgstr "הדפס"
msgid "Print Control"
msgstr "שליטה בהדפסה"
msgid "Print Time"
msgstr "זמן הדפסה"
msgid "Printing"
msgstr "מדפיס"
msgid "Profile Name:"
msgstr ""
msgid "Quad Gantry Level"
msgstr ""
msgid "Raise Nozzle"
msgstr "הגבה"
msgid "Restart"
msgstr "אתחל"
msgid "Resume"
msgstr "המשך"
msgid "Retract"
msgstr "שיחול לאחור"
msgid "Save"
msgstr ""
msgid "Save Config"
msgstr "שמור קונפיג"
msgid "Save configuration."
msgstr "שמור קונפיגורציה"
msgid "Screen Power Off Time"
msgstr ""
msgid "Screen will show in less than one second"
msgstr ""
msgid "Screws Adjust"
msgstr "סידור ברגים"
msgid "Set Speed"
msgstr "קבע מהירות"
msgid "Settings"
msgstr "הגדרות"
msgid "Size"
msgstr "גודל"
msgid "Slicer"
msgstr ""
msgid "Slow"
msgstr "האט"
msgid "Sort by: "
msgstr ""
msgid "Speed +"
msgstr "מהירות +"
msgid "Speed -"
msgstr "מהירות -"
msgid "System"
msgstr "מערכת"
#, fuzzy
msgid ""
"System\n"
"Restart"
msgstr "אתחל"
msgid ""
"System\n"
"Shutdown"
msgstr ""
msgid "Temperature"
msgstr "טמפרטורה"
msgid "Tool"
msgstr "כלי"
msgid "Uploaded"
msgstr "הועלה"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "Y+"
msgstr "Y+"
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "כיול Z"
msgid "Z Offset"
msgstr "הפרז גובה Z"
msgid "Z Tilt Adjust"
msgstr ""
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "dBm"
msgstr ""
msgid "minutes"
msgstr ""
msgid "mm"
msgstr "מ''מ"
#~ msgid "Network Info"
#~ msgstr "מידע על הרשת"
#, fuzzy
#~ msgid "Klipper"
#~ 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"
+209
View File
@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
<keyboard>
<options>
<!-- not yet implemented -->
</options>
<layout id="defualt keyboard">
<row>
<key obey-caps='true'>
<default display="q" />
<shifted display="Q" />
<mod1 display="1" />
<mod2 display="~" />
</key>
<key obey-caps='true'>
<default display="w" />
<shifted display="W" />
<mod1 display="2" />
<mod2 display="`" />
</key>
<key obey-caps='true'>
<default display="e" />
<shifted display="E" />
<mod1 display="3" />
<mod2 display="|" />
</key>
<key obey-caps='true'>
<default display="r" />
<shifted display="R" />
<mod1 display="4" />
<mod2 display="•" />
</key>
<key obey-caps='true'>
<default display="t" />
<shifted display="T" />
<mod1 display="5" />
<mod2 display="√" />
</key>
<key obey-caps='true'>
<default display="y" />
<shifted display="Y" />
<mod1 display="6" />
<mod2 display="π" />
</key>
<key obey-caps='true'>
<default display="u" />
<shifted display="U" />
<mod1 display="7" />
<mod2 display="÷" />
</key>
<key obey-caps='true'>
<default display="i" />
<shifted display="I" />
<mod1 display="8" />
<mod2 display="×" />
</key>
<key obey-caps='true'>
<default display="o" />
<shifted display="O" />
<mod1 display="9" />
<mod2 display="¶" />
</key>
<key obey-caps='true'>
<default display="p" />
<shifted display="P" />
<mod1 display="0" />
<mod2 display="∆" />
</key>
</row>
<row>
<key obey-caps='true'>
<default display="Caps" action="modifier:caps" />
<shifted display="Caps" action="modifier:caps" />
<mod1 display="@" />
<mod2 display="£" />
</key>
<key obey-caps='true'>
<default display="a" />
<shifted display="A" />
<mod1 display="#" />
<mod2 display="¢" />
</key>
<key obey-caps='true'>
<default display="s" />
<shifted display="S" />
<mod1 display="$" />
<mod2 display="€" />
</key>
<key obey-caps='true'>
<default display="d" />
<shifted display="D" />
<mod1 display="_" />
<mod2 display="¥" />
</key>
<key obey-caps='true'>
<default display="f" />
<shifted display="F" />
<mod1 display="&amp;" />
<mod2 display="^" />
</key>
<key obey-caps='true'>
<default display="g" />
<shifted display="G" />
<mod1 display="-" />
<mod2 display="°" />
</key>
<key obey-caps='true'>
<default display="h" />
<shifted display="H" />
<mod1 display="+" />
<mod2 display="=" />
</key>
<key obey-caps='true'>
<default display="j" />
<shifted display="J" />
<mod1 display="(" />
<mod2 display="{" />
</key>
<key obey-caps='true'>
<default display="k" />
<shifted display="K" />
<mod1 display=")" />
<mod2 display="}" />
</key>
<key obey-caps='true'>
<default display="l" />
<shifted display="L" />
<mod1 display="/" />
<mod2 display="\" />
</key>
</row>
<row>
<key obey-caps='true'>
<default display="↑" action="modifier:shift" />
</key>
<key obey-caps='true'>
<default display="z" />
<shifted display="Z" />
<mod1 display="*" />
<mod2 display="%" />
</key>
<key obey-caps='true'>
<default display="x" />
<shifted display="X" />
<mod1 display='"' />
<mod2 display="©" />
</key>
<key obey-caps='true'>
<default display="c" />
<shifted display="C" />
<mod1 display="'" />
<mod2 display="®" />
</key>
<key obey-caps='true'>
<default display="v" />
<shifted display="V" />
<mod1 display=":" />
<mod2 display="™" />
</key>
<key obey-caps='true'>
<default display="b" />
<shifted display="B" />
<mod1 display=";" />
<mod2 display="✓" />
</key>
<key obey-caps='true'>
<default display="n" />
<shifted display="N" />
<mod1 display="!" />
<mod2 display="[" />
</key>
<key obey-caps='true'>
<default display="m" />
<shifted display="M" />
<mod1 display="?" />
<mod2 display="]" />
</key>
<key obey-caps='true'>
<default display="⌫" action="backspace" />
</key>
</row>
<row>
<key>
<default display="?123" action="modifier:mod1" />
</key>
<key>
<default display="=\&lt;" action="modifier:mod2" />
</key>
<key>
<default display="," />
<mod2 display="&lt;" />
</key>
<key width="6000" fill="true">
<default display=" " action="space" />
</key>
<key>
<default display="." />
<mod2 display="&gt;" />
</key>
<key width="1000">
<!-- <default display="◀┛" action="return"/> -->
<default display="◀┛" action="return"/>
</key>
</row>
</layout>
</keyboard>
@@ -0,0 +1,469 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
#
# Jakob Kais <schpuntik@freenet.de>, 2021.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-06 18:14+0100\n"
"PO-Revision-Date: 2021-03-06 22:09+0100\n"
"Last-Translator: Jakob Kais <schpuntik@freenet.de>\n"
"Language-Team: Russian <kde-i18n-de@kde.org>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n"
"X-Poedit-Flags-xgettext: --add-comments\n"
msgid "?"
msgstr "?"
msgid "Abort"
msgstr "Отменить"
msgid "Accept"
msgstr "Применить"
msgid "Actions"
msgstr "Действия"
msgid "Add Printer"
msgstr "Добавить принтер"
msgid "Add bed mesh profile"
msgstr "Добавить профиль сетки стола"
msgid "Are you sure you want to print"
msgstr "Вы хотите это распечатать"
msgid "Are you sure you wish to cancel this print?"
msgstr "Вы хотите отменить эту печать?"
msgid "Are you sure you wish to reboot the system?"
msgstr "Вы уверены что хотите перезагрузить систему?"
msgid "Are you sure you wish to shutdown the system?"
msgstr "Вы хотите выключить принтер?"
msgid "Bed Level"
msgstr "Уровень стола"
msgid "Bed Mesh"
msgstr "Сетка стола"
msgid "Calibrate"
msgstr "Калибровка"
msgid "Cancel"
msgstr "Отменить"
msgid "Cancel Change"
msgstr "Отменить изменения"
msgid "Cancel Print"
msgstr "Отменить печать"
msgid "Cancelled"
msgstr "Отменено"
msgid "Change Printer"
msgstr "Сменить принтер"
msgid "Channel"
msgstr "Канал"
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"Проверьте /tmp/KlipperScreen.log для дополнитольной информации.\n"
"Создайте issues на GitHub что-бы получить помощь."
msgid "Close"
msgstr "Закрыть"
msgid "Complete"
msgstr "Готово"
msgid "Configuration"
msgstr "Конфигурация"
msgid "Connected"
msgstr "Соединенный"
#, python-format
msgid "Connecting to %s"
msgstr "Соединенный с %s"
msgid "Continue"
msgstr "Продолжить"
msgid "Control"
msgstr "Управление"
msgid "Cooldown"
msgstr "Остудить"
msgid "Date"
msgstr "Дата"
msgid "Decrease"
msgstr "Уменьшить"
msgid "Delete"
msgstr "Удалить"
msgid "Disable Motors"
msgstr "Отключить моторы"
msgid "Disable XY"
msgstr "Отключить XY"
msgid "Disconnect"
msgstr "Отключить"
msgid "Displayed Macros"
msgstr "Показать макросы"
msgid "Distance (mm)"
msgstr "Расстояние (mm)"
msgid "Duration Only"
msgstr "Продолжительность печати"
msgid "Elapsed:"
msgstr "Прошло:"
msgid "Error"
msgstr "Ошибка"
msgid "Estimated Time Method"
msgstr "Расчётное время"
msgid "Extrude"
msgstr "Заправить"
msgid "Extrusion +"
msgstr "Экструзия +"
msgid "Extrusion -"
msgstr "Экструзия -"
msgid "Fan"
msgstr "Обдув"
msgid "Fan Off"
msgstr "Вентилятор выкл"
msgid "Fan On"
msgstr "Вентилятор вкл"
msgid "Fast"
msgstr "Быстро"
msgid "Filament Used"
msgstr "Использование филамента"
msgid "File Estimation (default)"
msgstr "По файлу (по умолчанию)"
msgid "Fine Tuning"
msgstr "Точная настройка"
msgid "Firmware Restart"
msgstr ""
"Перезагрузка\n"
"прошивки"
msgid "Go Back"
msgstr "Назад"
msgid "Home"
msgstr "Парковка"
msgid "Home All"
msgstr "Парковать все"
msgid "Home X"
msgstr "Парковать X"
msgid "Home XY"
msgstr "Парковать XY"
msgid "Home Y"
msgstr "Парковать Y"
msgid "Home Z"
msgstr "Парковать Z"
msgid "Homing"
msgstr "Парковка"
msgid "Hostname"
msgstr "Имя хоста"
msgid "IPv4"
msgstr "IPv4"
msgid "IPv6"
msgstr "IPv6"
msgid "Increase"
msgstr "Поднять"
msgid "Initializing"
msgstr "Запуск"
msgid "Initializing printer..."
msgstr "Принтер стартует..."
msgid "Interface"
msgstr "Интерфейс"
msgid "Invert X"
msgstr "Инвертировать X"
msgid "Invert Y"
msgstr "Инвертировать Y"
msgid "Invert Z"
msgstr "Инвертировать Z"
msgid "Klipper Restart"
msgstr ""
"Перезагрузка\n"
"Klipper"
msgid "Klipper Version"
msgstr "Версия Klipper"
msgid "Klipper has disconnected"
msgstr "Нет связи с Klipper"
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
"Klipper определил ошибку в микроконтроллере.\n"
"Прошейте заново."
msgid "Klipper has encountered an error."
msgstr "Klipper обнаружил ошибку."
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"Klipper обнаружил ошибку.\n"
"Выполните перезагрузку прошивки, чтобы попытаться исправить проблему."
msgid "Klipper has shutdown"
msgstr "Klipper отключился"
msgid "Klipper is attempting to start"
msgstr "Klipper готов"
msgid "Klipper will reboot"
msgstr "Klipper перезагружается"
msgid "KlipperScreen Version"
msgstr "Версия KlipperScreen"
msgid "Left:"
msgstr "Осталось:"
msgid "Load"
msgstr "Загрузить"
msgid "Load Average"
msgstr "Средняя нагрузка"
msgid "Lower Nozzle"
msgstr "Опустить сопло"
msgid "Macros"
msgstr "Макросы"
msgid "Main Menu"
msgstr "Главное меню"
msgid "Medium"
msgstr "Среднее"
msgid "Menu"
msgstr "Меню"
msgid "Modified"
msgstr "Изменено"
msgid "Move"
msgstr "Двигать"
msgid "Move Distance (mm)"
msgstr "Дистанция перемещения (mm)"
msgid "Name"
msgstr "Имя"
msgid "Network"
msgstr "Сеть"
msgid "Number Pad"
msgstr "Номер блока"
msgid "Off"
msgstr "Выкл"
msgid "Pause"
msgstr "Пауза"
msgid "Paused"
msgstr "Приостановлено"
msgid "Power"
msgstr "Включено"
msgid "Power On Printer"
msgstr "Включить принтер"
msgid "Preheat"
msgstr "Разогрев"
msgid "Print"
msgstr "Печать"
msgid "Print Control"
msgstr "Управление печатью"
msgid "Print Time"
msgstr "Время печати"
msgid "Printer Connections"
msgstr "Подключение принтера"
msgid "Printing"
msgstr "Печатается"
msgid "Profile Name:"
msgstr "Имя профиля:"
msgid "Quad Gantry Level"
msgstr "Уровень Quad Gantry"
msgid "Raise Nozzle"
msgstr "Поднять сопло"
msgid "Restart"
msgstr "Перезагрузка"
msgid "Resume"
msgstr "Продолжить"
msgid "Retract"
msgstr "Выгрузить"
msgid "Save"
msgstr "Сохранить"
msgid "Save Config"
msgstr "Сохранить настройки"
msgid "Save configuration."
msgstr "Настройки сохраняются."
msgid "Screen Power Off Time"
msgstr "Время выключения экрана"
msgid "Screen will show in less than one second"
msgstr "Экран отобразится менее чем через одну секунду"
msgid "Screws Adjust"
msgstr "Настроить винты"
msgid "Set Speed"
msgstr "Скорость"
msgid "Settings"
msgstr "Настройки"
msgid "Size"
msgstr "Размер"
msgid "Slicer"
msgstr "Slicer"
msgid "Slow"
msgstr "Медленно"
msgid "Sort by: "
msgstr "Сортировать по: "
msgid "Speed +"
msgstr "Скорость +"
msgid "Speed -"
msgstr "Скорость -"
msgid "System"
msgstr "Система"
msgid ""
"System\n"
"Restart"
msgstr ""
"Перегрузить\n"
"Систему"
msgid ""
"System\n"
"Shutdown"
msgstr "Выключить"
msgid "Temperature"
msgstr "Температура"
msgid "Tool"
msgstr "Инструмент"
msgid "Uploaded"
msgstr "Загружено"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "Y+"
msgstr "Y+"
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "Калибровка Z"
msgid "Z Offset"
msgstr "Офсет Z"
msgid "Z Tilt"
msgstr "Z Наклон"
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "dBm"
msgstr "dBm"
msgid "minutes"
msgstr "минут"
msgid "mm"
msgstr "mm"
@@ -0,0 +1,495 @@
# 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-02-26 15:56+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"
msgid "?"
msgstr "?"
msgid "Abort"
msgstr "中止"
msgid "Accept"
msgstr "接受"
msgid "Actions"
msgstr "动作"
msgid "Add bed mesh profile"
msgstr ""
msgid "Are you sure you want to print"
msgstr "您确定要打印吗"
msgid "Are you sure you wish to cancel this print?"
msgstr "您要取消此打印吗?"
#, fuzzy
msgid "Are you sure you wish to reboot the system?"
msgstr "您要取消此打印吗?"
#, fuzzy
msgid "Are you sure you wish to shutdown the system?"
msgstr "您要取消此打印吗?"
msgid "Bed Level"
msgstr "床位"
msgid "Bed Mesh"
msgstr "床网"
#, fuzzy
msgid "Calibrate"
msgstr "Z校准"
msgid "Cancel"
msgstr "取消"
msgid "Cancel Change"
msgstr "取消变更"
msgid "Cancel Print"
msgstr "取消列印"
#, fuzzy
msgid "Cancelled"
msgstr "取消"
msgid "Channel"
msgstr ""
msgid ""
"Check /tmp/KlipperScreen.log for more information.\n"
"Please submit an issue on GitHub for help."
msgstr ""
"检查/tmp/KlipperScreen.log以获取更多信息。\n"
"请在GitHub上提交问题以寻求帮助。"
msgid "Close"
msgstr "关"
msgid "Complete"
msgstr ""
msgid "Configuration"
msgstr "组态"
msgid "Connected"
msgstr ""
#, python-format
msgid "Connecting to %s"
msgstr ""
msgid "Continue"
msgstr "继续"
msgid "Control"
msgstr "控制"
msgid "Cooldown"
msgstr "冷却"
msgid "Date"
msgstr ""
msgid "Decrease"
msgstr "减少"
msgid "Delete"
msgstr ""
msgid "Disable Motors"
msgstr "禁用马达"
msgid "Disable XY"
msgstr "禁用XY"
msgid "Disconnect"
msgstr ""
msgid "Displayed Macros"
msgstr ""
msgid "Distance (mm)"
msgstr "距离(毫米)"
msgid "Duration Only"
msgstr ""
msgid "Elapsed:"
msgstr "过去"
msgid "Emergency Stop"
msgstr "紧急停止"
msgid "Error"
msgstr ""
msgid "Estimated Time Method"
msgstr ""
msgid "Extrude"
msgstr "拉伸"
msgid "Extrusion +"
msgstr "挤压+"
msgid "Extrusion -"
msgstr "挤压-"
msgid "Fan"
msgstr "风扇"
msgid "Fan Off"
msgstr "散开"
msgid "Fan On"
msgstr "扇上"
msgid "Fast"
msgstr "快速"
msgid "Filament Used"
msgstr ""
msgid "File Estimation (default)"
msgstr ""
msgid "Fine Tuning"
msgstr "微调"
msgid "Firmware Restart"
msgstr "固件重启"
msgid "Go Back"
msgstr "回去"
msgid "Home All"
msgstr "全部回家"
msgid "Home X"
msgstr "X家庭"
msgid "Home XY"
msgstr "XY首页"
msgid "Home Y"
msgstr "Y家"
msgid "Home Z"
msgstr "Z家"
msgid "Homing"
msgstr "归巢"
msgid "Hostname"
msgstr ""
msgid "IPv4"
msgstr ""
msgid "IPv6"
msgstr ""
msgid "Increase"
msgstr "增加"
msgid "Initializing"
msgstr "Initializing"
msgid "Initializing printer..."
msgstr "初始化打印机..."
msgid "Interface"
msgstr ""
msgid "Invert X"
msgstr ""
msgid "Invert Y"
msgstr ""
msgid "Invert Z"
msgstr ""
msgid "Klipper Restart"
msgstr "快闪重启"
msgid "Klipper Version"
msgstr "快艇版本"
msgid "Klipper has disconnected"
msgstr "Klipper已断开连接"
msgid ""
"Klipper has encountered an error with the micro-controller.\n"
"Please recompile and flash."
msgstr ""
"Klipper的微控制器出错。\n"
"请重新编译并刷新。"
msgid "Klipper has encountered an error."
msgstr "Klipper遇到错误。"
msgid ""
"Klipper has encountered an error.\n"
"Issue a FIRMWARE_RESTART to attempt fixing the issue."
msgstr ""
"Klipper遇到错误。\n"
"发出FIRMWARE_RESTART尝试解决此问题。"
msgid "Klipper has shutdown"
msgstr "Klipper已关闭"
msgid "Klipper is attempting to start"
msgstr "Klipper正在尝试启动"
msgid "Klipper will reboot"
msgstr "Klipper将重新启动"
msgid "KlipperScreen Version"
msgstr "KlipperScreen版本"
msgid "Left:"
msgstr "剩下的时间"
msgid "Load"
msgstr ""
msgid "Load Average"
msgstr "平均负载"
msgid "Lower Nozzle"
msgstr "下喷嘴"
msgid "Macros"
msgstr "巨集"
msgid "Main Menu"
msgstr "主菜单"
msgid "Medium"
msgstr "中"
#, fuzzy
msgid "Menu"
msgstr "主菜单"
msgid "Modified"
msgstr ""
msgid "Move"
msgstr "移动"
msgid "Move Distance (mm)"
msgstr "移动距离(mm)"
msgid "Name"
msgstr ""
msgid "Network"
msgstr "网络"
msgid "Number Pad"
msgstr "数字键盘"
#, fuzzy
msgid "Off"
msgstr "散开"
msgid "Pause"
msgstr "暂停"
msgid "Paused"
msgstr "已暂停"
msgid "Power"
msgstr "功率"
msgid "Power On Printer"
msgstr "开启打印机电源"
msgid "Preheat"
msgstr "预热"
msgid "Print"
msgstr "打印"
msgid "Print Control"
msgstr "打印控制"
msgid "Print Time"
msgstr "打印时间"
msgid "Printing"
msgstr "印刷"
msgid "Profile Name:"
msgstr ""
msgid "Quad Gantry Level"
msgstr ""
msgid "Raise Nozzle"
msgstr "升高喷嘴"
msgid "Restart"
msgstr "重新开始"
msgid "Resume"
msgstr "恢复"
msgid "Retract"
msgstr "缩回"
msgid "Save"
msgstr ""
msgid "Save Config"
msgstr "保存配置"
msgid "Save configuration."
msgstr "保存配置"
msgid "Screen Power Off Time"
msgstr ""
msgid "Screen will show in less than one second"
msgstr ""
msgid "Screws Adjust"
msgstr "螺丝调整"
msgid "Set Speed"
msgstr "设定速度"
#, fuzzy
msgid "Settings"
msgstr "设置"
msgid "Size"
msgstr "尺寸"
msgid "Slicer"
msgstr ""
msgid "Slow"
msgstr "慢"
msgid "Sort by: "
msgstr ""
msgid "Speed +"
msgstr "速度 +"
msgid "Speed -"
msgstr "速度 -"
msgid "System"
msgstr "系统"
#, fuzzy
msgid ""
"System\n"
"Restart"
msgstr "重新开始"
msgid ""
"System\n"
"Shutdown"
msgstr ""
msgid "Temperature"
msgstr "温度"
msgid "Tool"
msgstr "工具"
msgid "Uploaded"
msgstr "已上传"
msgid "X+"
msgstr "X+"
msgid "X-"
msgstr "X-"
msgid "Y+"
msgstr "Y ="
msgid "Y-"
msgstr "Y-"
msgid "Z Calibrate"
msgstr "Z校准"
msgid "Z Offset"
msgstr "Z偏移"
msgid "Z Tilt Adjust"
msgstr ""
msgid "Z+"
msgstr "Z+"
msgid "Z-"
msgstr "Z-"
msgid "dBm"
msgstr ""
msgid "minutes"
msgstr ""
msgid "mm"
msgstr "毫米"
#~ msgid "Network Info"
#~ msgstr "网络信息"
#, fuzzy
#~ msgid "Klipper"
#~ 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"
+278
View File
@@ -0,0 +1,278 @@
import gi
import logging
gi.require_version("Gtk", "3.0")
from gi.repository import Gdk, GLib
from ks_includes.KlippyGcodes import KlippyGcodes
class Printer:
data = {}
devices = {}
power_devices = {}
state_callbacks = {
"disconnected": None,
"error": None,
"paused": None,
"printing": None,
"ready": None,
"startup": None,
"shutdown": None
}
tools = []
def __init__(self, printer_info, data):
self.state = "disconnected"
self.power_devices = {}
def reinit(self, printer_info, data):
logging.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 == 'heater_bed' or x.startswith('heater_generic ') or x.startswith('temperature_sensor '):
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)
logging.info("Klipper version: %s", self.klipper['version'])
logging.info("### Toolcount: " + str(self.toolcount) + " Heaters: " + str(self.extrudercount))
def process_update(self, data):
keys = [
'bed_mesh',
'display_status',
'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]
for x in (self.get_tools() + self.get_heaters()):
if x in data:
d = data[x]
for i in d:
self.set_dev_stat(x, i, d[i])
if "webhooks" in data or "idle_timeout" in data or "print_stats" in data:
self.evaluate_state()
def get_updates(self):
updates = self.data.copy()
updates.update(self.devices)
return updates
def evaluate_state(self):
wh_state = self.data['webhooks']['state'].lower() # 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'].lower() # possible values: complete, paused, printing, standby
if wh_state == "ready":
new_state = "ready"
if print_state == "paused":
new_state = "paused"
elif idle_state == "printing":
if print_state == "complete":
new_state = "ready"
elif print_state != "printing": # Not printing a file, toolhead moving
new_state = "busy"
else:
new_state = "printing"
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
logging.debug("Changing state from '%s' to '%s'" % (self.state, state))
self.state = state
if self.state_callbacks[state] != None:
logging.debug("Adding callback for state: %s" % state)
Gdk.threads_add_idle(
GLib.PRIORITY_HIGH_IDLE,
self.state_callbacks[state]
)
def configure_power_devices(self, data):
self.power_devices = {}
logging.debug("Processing power devices: %s" % data)
for x in data['devices']:
self.power_devices[x['device']] = {
"status": "on" if x['status'] == "on" else "off"
}
logging.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=""):
if not hasattr(self, "config"):
return []
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_heaters(self):
heaters = []
if self.has_heated_bed():
heaters.append("heater_bed")
for h in self.get_config_section_list("heater_generic "):
heaters.append(h)
for h in self.get_config_section_list("temperature_sensor "):
heaters.append(h)
return heaters
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","quad_gantry_level","z_tilt"]
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 {}
if substat != None:
if substat in self.data[stat]:
return self.data[stat][substat]
return {}
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
+146
View File
@@ -0,0 +1,146 @@
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
class ScreenPanel:
title_spacing = 50
control = {}
def __init__(self, screen, title, back=True, action_bar=True, printer_name=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)
action_bar_width = self._gtk.get_action_bar_width() if action_bar == True else 0
if action_bar == True:
self.control_grid = self._gtk.HomogeneousGrid()
self.control_grid.set_size_request(action_bar_width - 2, self._screen.height)
self.control_grid.get_style_context().add_class('action_bar')
button_scale = self._gtk.get_header_image_scale()
logging.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.control_grid.attach(self.control['back'], 0, 0, 1, 1)
self.control['home'] = self._gtk.ButtonImage('main', None, None, button_scale[0], button_scale[1])
self.control['home'].connect("clicked", self.menu_return, True)
self.control_grid.attach(self.control['home'], 0, 1, 1, 1)
else:
for i in range(2):
self.control['space%s' % i] = Gtk.Label("")
self.control_grid.attach(self.control['space%s' % i], 0, i, 1, 1)
if len(self._config.get_printers()) > 1:
self.control['printer_select'] = self._gtk.ButtonImage(
'shuffle', None, None, button_scale[0], button_scale[1])
self.control['printer_select'].connect("clicked", self._screen.show_printer_select)
else:
self.control['printer_select'] = Gtk.Label("")
self.control_grid.attach(self.control['printer_select'], 0, 2, 1, 1)
self.control['estop'] = self._gtk.ButtonImage('emergency', None, None, button_scale[0], button_scale[1])
self.control['estop'].connect("clicked", self.emergency_stop)
self.control_grid.attach(self.control['estop'], 0, 3, 1, 1)
#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:
logging.debug("Error parsing jinja for title: %s" % title)
self.title = Gtk.Label()
self.title.set_size_request(self._screen.width - action_bar_width, self.title_spacing)
self.title.set_hexpand(True)
self.title.set_halign(Gtk.Align.CENTER)
self.title.set_valign(Gtk.Align.CENTER)
if printer_name == True:
self.set_title("%s | %s" % (self._screen.connected_printer, title))
else:
self.set_title(title)
self.content = Gtk.Box(spacing=0)
self.content.set_size_request(self._screen.width - action_bar_width, self._screen.height - self.title_spacing)
if action_bar == True:
self.layout.put(self.control_grid, 0, 0)
self.layout.put(self.title, action_bar_width, 0)
self.layout.put(self.content, action_bar_width, 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
loc = self._files.get_thumbnail_location(filename)
if loc == None:
return None
if loc[0] == "file":
return self._gtk.PixbufFromFile(loc[1], None, width, height)
if loc[0] == "http":
return self._gtk.PixbufFromHttp(loc[1], None, width, height)
return None
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'] + " : %s %s" % (panel, item))
if "items" in item:
self._screen.show_panel(self._screen._cur_panels[-1] + '_' + panel, item['panel'], item['name'],
1, False, items=item['items'])
return
self._screen.show_panel(self._screen._cur_panels[-1] + '_' + panel, 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, name=None):
if dev in self.labels:
if name == None:
self.labels[dev].set_label(self._gtk.formatTemperatureString(temp, target))
else:
self.labels[dev].set_label("%s\n%s" % (name, self._gtk.formatTemperatureString(temp, target)))
+472
View File
@@ -0,0 +1,472 @@
import os, signal
import json
import logging
import re
import socket
import subprocess
import threading
import time
from contextlib import suppress
from threading import Thread
from subprocess import PIPE, Popen, STDOUT
from queue import Queue, Empty
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
RESCAN_INTERVAL = 180
KS_SOCKET_FILE = "/tmp/.KS_wpa_supplicant"
class WifiManager():
networks_in_supplicant = []
connected = False
_stop_loop = False
thread = None
def __init__(self, interface, *args, **kwargs):
super().__init__(*args, **kwargs)
self.loop = None
self._poll_task = None
self._scanning = False
self._callbacks = {
"connected": [],
"connecting_status": [],
"scan_results": []
}
self._stop_loop = False
self.connected = False
self.connected_ssid = None
self.connecting_info = []
self.event = threading.Event()
self.initialized = False
self.interface = interface
self.networks = {}
self.supplicant_networks = {}
self.queue = Queue()
self.tasks = []
self.timeout = None
self.scan_time = 0
if os.path.exists(KS_SOCKET_FILE):
os.remove(KS_SOCKET_FILE)
try:
self.soc = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
self.soc.bind(KS_SOCKET_FILE)
self.soc.connect("/var/run/wpa_supplicant/%s" % interface)
except:
logging.info("Error connecting to wifi socket: %s" % interface)
return
self.wpa_thread = WpaSocket(self, self.queue, self.callback)
self.wpa_thread.start()
self.initialized = True
self.wpa_cli("ATTACH", False)
self.wpa_cli("SCAN", False)
GLib.idle_add(self.read_wpa_supplicant)
self.timeout = GLib.timeout_add_seconds(RESCAN_INTERVAL, self.rescan)
def add_callback(self, name, callback):
if name in self._callbacks and callback not in self._callbacks[name]:
self._callbacks[name].append(callback)
def add_network(self, ssid, psk):
for id in list(self.supplicant_networks):
if self.supplicant_networks[id]['ssid'] == ssid:
#Modify network
return
# TODO: Add wpa_cli error checking
network_id = self.wpa_cli("ADD_NETWORK")
commands = [
'ENABLE_NETWORK %s' % (network_id),
'SET_NETWORK %s ssid "%s"' % (network_id, ssid.replace('"','\"')),
'SET_NETWORK %s psk "%s"' % (network_id, psk.replace('"','\"'))
]
self.wpa_cli_batch(commands)
self.read_wpa_supplicant()
id = None
for i in list(self.supplicant_networks):
if self.supplicant_networks[i]['ssid'] == ssid:
id = i
break
if id == None:
logging.info("Error adding network")
return False
self.save_wpa_conf()
return True
def callback(self, type, msg):
if type in self._callbacks:
for cb in self._callbacks[type]:
Gdk.threads_add_idle(
GLib.PRIORITY_DEFAULT_IDLE,
cb,
msg)
def connect(self, ssid):
id = None
for netid, net in self.supplicant_networks.items():
if net['ssid'] == ssid:
id = netid
break
if id == None:
logging.info("Wifi network is not defined in wpa_supplicant")
return False
logging.info("Attempting to connect to wifi: %s" % id)
self.connecting_info = ["Attempting to connect to %s" % ssid]
self.wpa_cli("SELECT_NETWORK %s" % id)
self.save_wpa_conf()
def delete_network(self, ssid):
id = None
for i in list(self.supplicant_networks):
if self.supplicant_networks[i]['ssid'] == ssid:
id = i
break
if id == None:
logging.debug("Unable to find network in wpa_supplicant")
return
self.wpa_cli("REMOVE_NETWORK %s" % id)
for id in list(self.supplicant_networks):
if self.supplicant_networks[id]['ssid'] == ssid:
del self.supplicant_networks[id]
break
self.save_wpa_conf()
def get_connected_ssid(self):
return self.connected_ssid
def get_current_wifi(self, interface="wlan0"):
logging.info("Getting current wifi information")
status = self.wpa_cli("STATUS").split('\n')
vars = {}
for line in status:
arr = line.split('=')
vars[arr[0]] = "=".join(arr[1:])
prev_ssid = self.connected_ssid
if "ssid" in vars and "bssid" in vars:
self.connected = True
self.connected_ssid = vars['ssid']
for ssid, val in self.networks.items():
if ssid == vars['ssid']:
self.networks[ssid]['connected'] = True
else:
self.networks[ssid]['connected'] = False
if prev_ssid != self.connected_ssid:
for cb in self._callbacks['connected']:
Gdk.threads_add_idle(
GLib.PRIORITY_DEFAULT_IDLE,
cb, self.connected_ssid, prev_ssid)
return [vars['ssid'], vars['bssid']]
else:
logging.info("Resetting connected_ssid")
self.connected = False
self.connected_ssid = None
for ssid, val in self.networks.items():
self.networks[ssid]['connected'] = False
if prev_ssid != self.connected_ssid:
for cb in self._callbacks['connected']:
Gdk.threads_add_idle(
GLib.PRIORITY_DEFAULT_IDLE,
cb, self.connected_ssid, prev_ssid)
return None
def get_current_wifi_idle_add(self):
self.get_current_wifi()
return False
def get_network_info(self, ssid=None, mac=None):
if ssid is not None and ssid in self.networks:
return self.networks[ssid]
if mac is not None and ssid is None:
for net in self.networks:
if mac == net['mac']:
return net
return None
def get_networks(self):
return list(self.networks)
def get_supplicant_networks(self):
return self.supplicant_networks
def is_connected(self):
return self.connected
def is_initialized(self):
return self.initialized
def read_wpa_supplicant(self):
results = self.wpa_cli("LIST_NETWORKS").split('\n')
results.pop(0)
self.supplicant_networks = {}
self.networks_in_supplicant = []
for net in [n.split('\t') for n in results]:
self.supplicant_networks[net[0]] = {
"ssid": net[1],
"bssid": net[2],
"flags": net[3] if len(net) == 4 else ""
}
self.networks_in_supplicant.append(self.supplicant_networks[net[0]])
def remove_callback(self, name, callback):
if name in self._callbacks and callback in self._callbacks[name]:
self._callbacks[name].remove(callback)
def rescan(self):
self.wpa_cli("SCAN", False)
return True
def save_wpa_conf(self):
logging.info("Saving WPA config")
self.wpa_cli("SAVE_CONFIG")
def scan_results(self, interface='wlan0'):
new_networks = []
deleted_networks = list(self.networks)
logging.info("Trying to get scan results")
results = self.wpa_cli("SCAN_RESULTS").split('\n')
results.pop(0)
aps = []
for res in results:
match = re.match("^([a-f0-9:]+)\s+([0-9]+)\s+([\-0-9]+)\s+(\S+)\s+(.+)?", res)
if match:
net = {
"mac": match.group(1),
"channel": WifiChannels.lookup(match.group(2))[1],
"connected": False,
"configured": False,
"frequency": match.group(2),
"flags": match.group(4),
"signal_level_dBm": match.group(3),
"ssid": match.group(5)
}
if "WPA2" in net['flags']:
net['encryption'] = "WPA2"
elif "WPA" in net['flags']:
net['encryption'] = "WPA"
elif "WEP" in net['flags']:
net['encryption'] = "WEP"
else:
net['encryption'] = "off"
aps.append(net)
cur_info = self.get_current_wifi()
self.networks = {}
for ap in aps:
self.networks[ap['ssid']] = ap
if cur_info is not None and cur_info[0] == ap['ssid'] and cur_info[1].lower() == ap['mac'].lower():
self.networks[ap['ssid']]['connected'] = True
for net in list(self.networks):
if net in deleted_networks:
deleted_networks.remove(net)
else:
new_networks.append(net)
if len(new_networks) > 0 or len(deleted_networks) > 0:
for cb in self._callbacks['scan_results']:
Gdk.threads_add_idle(
GLib.PRIORITY_DEFAULT_IDLE,
cb, new_networks, deleted_networks)
def wpa_cli(self, command, wait=True):
if wait == False:
self.wpa_thread.skip_command()
self.soc.send(command.encode())
if wait == True:
resp = self.queue.get()
return resp
def wpa_cli_batch(self, commands):
for cmd in commands:
self.wpa_cli(cmd)
class WpaSocket(Thread):
def __init__ (self, wm, queue, callback):
super().__init__()
self.queue = queue
self.callback = callback
self.soc = wm.soc
self._stop_loop = False
self.skip_commands = 0
self.wm = wm
def run(self):
event = threading.Event()
logging.debug("Setting up wifi event loop")
while self._stop_loop == False:
try:
msg = self.soc.recv(4096).decode().strip()
except:
# TODO: Socket error
continue
if msg.startswith("<"):
if "CTRL-EVENT-SCAN-RESULTS" in msg:
logging.info("Adding scan_results to callbacks")
Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.wm.scan_results)
elif "CTRL-EVENT-DISCONNECTED" in msg:
self.callback("connecting_status", msg)
match = re.match('<3>CTRL-EVENT-DISCONNECTED bssid=(\S+) reason=3 locally_generated=1', msg)
if match:
for net in self.wm.networks:
if self.wm.networks[net]['mac'] == match.group(1):
self.wm.networks[net]['connected'] = False
break
elif "Trying to associate" in msg:
self.callback("connecting_status", msg)
elif "CTRL-EVENT-REGDOM-CHANGE" in msg:
self.callback("connecting_status", msg)
elif "CTRL-EVENT-CONNECTED" in msg:
Gdk.threads_add_idle(GLib.PRIORITY_DEFAULT_IDLE, self.wm.get_current_wifi_idle_add)
self.callback("connecting_status", msg)
else:
if self.skip_commands > 0:
self.skip_commands = self.skip_commands - 1
else:
self.queue.put(msg)
logging.info("Wifi event loop ended")
def skip_command(self):
self.skip_commands = self.skip_commands + 1
def stop(self):
self._stop_loop = True
class WifiChannels:
@staticmethod
def lookup(freq):
if freq == "2412":
return ("2.4","1")
if freq == "2417":
return ("2.4","2")
if freq == "2422":
return ("2.4","3")
if freq == "2427":
return ("2.4","4")
if freq == "2432":
return ("2.4","5")
if freq == "2437":
return ("2.4","6")
if freq == "2442":
return ("2.4","7")
if freq == "2447":
return ("2.4","8")
if freq == "2452":
return ("2.4","9")
if freq == "2457":
return ("2.4","10")
if freq == "2462":
return ("2.4","11")
if freq == "2467":
return ("2.4","12")
if freq == "2472":
return ("2.4","13")
if freq == "2484":
return ("2.4","14")
if freq == "5035":
return ("5","7")
if freq == "5040":
return ("5","8")
if freq == "5045":
return ("5","9")
if freq == "5055":
return ("5","11")
if freq == "5060":
return ("5","12")
if freq == "5080":
return ("5","16")
if freq == "5170":
return ("5","34")
if freq == "5180":
return ("5","36")
if freq == "5190":
return ("5","38")
if freq == "5200":
return ("5","40")
if freq == "5210":
return ("5","42")
if freq == "5220":
return ("5","44")
if freq == "5230":
return ("5","46")
if freq == "5240":
return ("5","48")
if freq == "5260":
return ("5","52")
if freq == "5280":
return ("5","56")
if freq == "5300":
return ("5","60")
if freq == "5320":
return ("5","64")
if freq == "5500":
return ("5","100")
if freq == "5520":
return ("5","104")
if freq == "5540":
return ("5","108")
if freq == "5560":
return ("5","112")
if freq == "5580":
return ("5","116")
if freq == "5600":
return ("5","120")
if freq == "5620":
return ("5","124")
if freq == "5640":
return ("5","128")
if freq == "5660":
return ("5","132")
if freq == "5680":
return ("5","136")
if freq == "5700":
return ("5","140")
if freq == "5720":
return ("5","144")
if freq == "5745":
return ("5","149")
if freq == "5765":
return ("5","153")
if freq == "5785":
return ("5","157")
if freq == "5805":
return ("5","161")
if freq == "5825":
return ("5","165")
if freq == "4915":
return ("5","183")
if freq == "4920":
return ("5","184")
if freq == "4925":
return ("5","185")
if freq == "4935":
return ("5","187")
if freq == "4940":
return ("5","188")
if freq == "4945":
return ("5","189")
if freq == "4960":
return ("5","192")
if freq == "4980":
return ("5","196")
return None;
+11
View File
@@ -0,0 +1,11 @@
site_name: KlipperScreen
nav:
- Hardware.md
- Installation.md
- Configuration.md
- changelog.md
- panels.md
theme: readthedocs
repo_url: https://github.com/jordanruthe/KlipperScreen/
plugins:
- search
+99 -48
View File
@@ -5,92 +5,124 @@ 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:
logging.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():
logging.debug("Bed screw locations [x,y]: %s", screws)
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
logging.debug("Screws: %s" % screws)
if len(screws) < 4:
logger.debug("bed_screws not configured, calculating locations")
logging.debug("bed_screws not configured, calculating locations")
xconf = self._screen.printer.get_config_section("stepper_x")
yconf = self._screen.printer.get_config_section("stepper_y")
x = int(int(xconf['position_max'])/4)
y = int(int(yconf['position_max'])/4)
screws = [
self.screws = [
[x, y],
[x*3, y],
[x, y*3],
[x*3, y*3],
]
logger.debug("Calculated screw locations [x,y]: %s", screws)
logging.debug("Calculated screw locations [x,y]: %s", screws)
else:
logger.debug("Configured screw locations [x,y]: %s", screws)
logging.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)
if self._screen.lang_ltr:
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)
else:
grid.attach(self.labels['bl'], 2, 0, 1, 1)
grid.attach(self.labels['br'], 1, 0, 1, 1)
grid.attach(self.labels['fl'], 2, 1, 1, 1)
grid.attach(self.labels['fr'], 1, 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)
logging.debug("Going to position: %s", position)
script = [
"%s" % KlippyGcodes.MOVE_ABSOLUTE,
"G1 Z7 F800\n",
@@ -111,10 +143,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','bl','br']
x = int(float(result.group(2)) + self.x_offset)
y = int(float(result.group(3)) + self.y_offset)
logging.debug(data)
logging.debug("X: %s Y: %s" % (x,y))
for i in range(len(self.screws)):
logging.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")
+380
View File
@@ -0,0 +1,380 @@
import gi
import logging
import numpy as np
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib, Pango
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib import rc
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.backends.backend_gtk3cairo import FigureCanvasGTK3Cairo as FigureCanvas
from matplotlib.ticker import LinearLocator
from ks_includes.KlippyGcodes import KlippyGcodes
from ks_includes.screen_panel import ScreenPanel
def create_panel(*args):
return BedMeshPanel(*args)
class BedMeshPanel(ScreenPanel):
active_mesh = None
graphs = {}
def initialize(self, panel_name):
_ = self.lang.gettext
self.show_create = False
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'])
addprofile = self._gtk.ButtonImage("increase"," %s" % _("Add bed mesh profile"),
"color1", .5, .5, Gtk.PositionType.LEFT, False)
addprofile.connect("clicked", self.show_create_profile)
addprofile.set_size_request(60,0)
addprofile.set_hexpand(False)
addprofile.set_halign(Gtk.Align.END)
abox = Gtk.Box(spacing=0)
abox.set_vexpand(False)
abox.add(addprofile)
# 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(abox, False, False, 0)
box.pack_end(scroll, True, True, 0)
self.load_meshes()
self.labels['main_box'] = box
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'])
self._screen.add_subscription(panel_name)
def activate(self):
for child in self.content.get_children():
self.content.remove(child)
self.content.add(self.labels['main_box'])
am = self._screen.printer.get_stat("bed_mesh","profile_name")
self.activate_mesh(am)
def activate_mesh(self, profile):
if profile == "":
profile = None
logging.debug("Activating profile: %s %s" % (self.active_mesh, profile))
if profile != self.active_mesh:
if profile not in self.profiles:
self.add_profile(profile)
if self.active_mesh != None and self.active_mesh in self.profiles:
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):
_ = self.lang.gettext
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)
view = self._gtk.ButtonImage("bed-level",_("View Mesh"),"color1")
view.connect("clicked", self.show_mesh, profile)
view.set_size_request(60,0)
view.set_hexpand(False)
view.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)
delete = self._gtk.ButtonImage("cancel",_("Delete"),"color3")
delete.connect("clicked", self.send_remove_mesh, profile)
delete.set_size_request(60,0)
delete.set_hexpand(False)
delete.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)
logging.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)
buttons.pack_end(delete, False, False, 0)
buttons.pack_end(view, False, False, 0)
dev.add(buttons)
frame.add(dev)
self.profiles[profile] = {
"box": dev,
"buttons": buttons,
"row": frame,
"load": load,
"refresh": refresh,
"save": save,
"view": view,
}
l = list(self.profiles)
if "default" in l:
l.remove('default')
profiles = sorted(l)
pos = profiles.index(profile)+1 if profile != "default" else 0
self.labels['profiles'].insert_row(pos)
self.labels['profiles'].attach(self.profiles[profile]['row'], 0, pos, 1, 1)
self.labels['profiles'].show_all()
#Gdk.threads_add_idle(GLib.PRIORITY_LOW, self.create_graph, profile)
def back(self, widget):
if self.show_create == True:
self.remove_create()
else:
self._screen._menu_go_back()
def create_profile(self, widget):
name = self.labels['profile_name'].get_text()
if " " in name:
name = '"%s"' % name
self._screen._ws.klippy.gcode_script("BED_MESH_PROFILE SAVE=%s" % name)
self.remove_create()
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 remove_create(self):
if self.show_create == False:
return
self._screen.remove_keyboard()
for child in self.content.get_children():
self.content.remove(child)
self.show_create = False
self.content.add(self.labels['main_box'])
self.content.show()
def remove_profile(self, profile):
if profile not in self.profiles:
return
l = list(self.profiles)
if "default" in l:
l.remove('default')
profiles = sorted(l)
pos = profiles.index(profile)+1 if profile != "default" else 0
self.labels['profiles'].remove_row(pos)
del self.profiles[profile]
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 send_remove_mesh(self, widget, profile):
self._screen._ws.klippy.gcode_script(
KlippyGcodes.bed_mesh_remove(profile)
)
self.remove_profile(profile)
def show_create_profile(self, widget):
_ = self.lang.gettext
for child in self.content.get_children():
self.content.remove(child)
if "create_profile" not in self.labels:
self.labels['create_profile'] = Gtk.VBox()
self.labels['create_profile'].set_valign(Gtk.Align.START)
box = Gtk.Box(spacing=5)
box.set_size_request(self._gtk.get_content_width(), self._gtk.get_content_height() -
self._screen.keyboard_height - 20)
box.set_hexpand(True)
box.set_vexpand(False)
self.labels['create_profile'].add(box)
l = self._gtk.Label(_("Profile Name:"))
l.set_hexpand(False)
entry = Gtk.Entry()
entry.set_hexpand(True)
save = self._gtk.ButtonImage("sd",_("Save"),"color3")
save.set_hexpand(False)
save.connect("clicked", self.create_profile)
self.labels['profile_name'] = entry
box.pack_start(l, False, False, 5)
box.pack_start(entry, True, True, 5)
box.pack_start(save, False, False, 5)
self.show_create = True
self.labels['profile_name'].set_text('')
self.content.add(self.labels['create_profile'])
self.content.show()
self._screen.show_keyboard()
self.labels['profile_name'].grab_focus_without_selecting()
def show_mesh(self, widget, profile):
_ = self.lang.gettext
bm = self._printer.get_config_section("bed_mesh %s" % profile)
if bm == False:
logging.info("Unable to load profile: %s" % profile)
return
if profile == self.active_mesh:
abm = self._printer.get_stat("bed_mesh")
if abm == None:
logging.info("Unable to load active mesh: %s" % profile)
return
x_range = [int(abm['mesh_min'][0]), int(abm['mesh_max'][0])]
y_range = [int(abm['mesh_min'][1]), int(abm['mesh_max'][1])]
z_range = [min(min(abm['mesh_matrix'])), max(max(abm['mesh_matrix']))]
counts = [len(abm['mesh_matrix'][0]), len(abm['mesh_matrix'])]
deltas = [(x_range[1] - x_range[0] )/ (counts[0]-1), (y_range[1] - y_range[0]) / (counts[1]-1)]
x = [(i*deltas[0])+x_range[0] for i in range(counts[0])]
y = [(i*deltas[0])+y_range[0] for i in range(counts[1])]
x, y = np.meshgrid(x, y)
z = np.asarray(abm['mesh_matrix'])
else:
x_range = [int(bm['min_x']), int(bm['max_x'])]
y_range = [int(bm['min_y']), int(bm['max_y'])]
z_range = [min(min(bm['points'])), max(max(bm['points']))]
deltas = [(x_range[1] - x_range[0] )/ (int(bm['x_count'])-1), (y_range[1] - y_range[0]) / (int(bm['y_count'])-1)]
x = [(i*deltas[0])+x_range[0] for i in range(bm['x_count'])]
y = [(i*deltas[0])+y_range[0] for i in range(bm['y_count'])]
x, y = np.meshgrid(x, y)
z = np.asarray(bm['points'])
rc('axes', edgecolor="#fff", labelcolor="#fff")
rc(('xtick','ytick'), color="#fff")
fig = plt.figure()
fig.patch.set_facecolor("black")
ax = Axes3D(fig, auto_add_to_figure=False)
ax.set_facecolor("black")
ax.set(title=profile, xlabel="X", ylabel="Y")
ax.spines['bottom'].set_color("#fff")
fig.add_axes(ax)
surf = ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.coolwarm)
ax.set_zlim(z_range[0], z_range[1])
ax.zaxis.set_major_locator(LinearLocator(10))
# A StrMethodFormatter is used automatically
ax.zaxis.set_major_formatter('{x:.02f}')
fig.colorbar(surf, shrink=0.5, aspect=5)
box = Gtk.VBox()
box.set_hexpand(True)
box.set_vexpand(True)
title = Gtk.Label()
title.set_markup("<b>%s</b>" % profile)
title.set_hexpand(True)
title.set_halign(Gtk.Align.CENTER)
canvas_box = Gtk.Box()
canvas_box.set_hexpand(True)
canvas_box.set_vexpand(True)
box.add(title)
box.add(canvas_box)
buttons = [
{"name": _("Close"), "response": Gtk.ResponseType.CANCEL}
]
dialog = self._gtk.Dialog(self._screen, buttons, box, self._close_dialog)
alloc = canvas_box.get_allocation()
canvas = FigureCanvas(fig)
canvas.set_size_request(alloc.width, self._screen.height/3*2)
canvas_box.add(canvas)
canvas_box.show_all()
def _close_dialog(self, widget, response):
widget.destroy()
+18 -13
View File
@@ -1,13 +1,18 @@
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
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())
+56 -35
View File
@@ -4,45 +4,53 @@ 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,12 +59,14 @@ 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:
if ((self._screen.lang_ltr == True and j == 0) or
(self._screen.lang_ltr == False and j == len(self.distances)-1)):
ctx.add_class("distbutton_top")
elif j == len(self.distances)-1:
elif ((self._screen.lang_ltr == False and j == 0) or
(self._screen.lang_ltr == True and j == len(self.distances)-1)):
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
@@ -69,12 +79,14 @@ 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:
if ((self._screen.lang_ltr == True and j == 0) or
(self._screen.lang_ltr == False and j == len(self.speeds)-1)):
ctx.add_class("distbutton_top")
elif j == len(self.speeds)-1:
elif ((self._screen.lang_ltr == False and j == 0) or
(self._screen.lang_ltr == True and j == len(self.speeds)-1)):
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
@@ -90,23 +102,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 +138,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
+33 -28
View File
@@ -4,18 +4,20 @@ 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,52 +30,53 @@ 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", _("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-on", _("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"].get_style_context().add_class("color2")
self.labels["apply"] = self._gtk.ButtonImage("complete", _("Set Speed"))
self.labels["apply"].get_style_context().add_class("color4")
self.labels["apply"].connect("clicked", self.set_fan_speed)
self.labels["cancel"] = KlippyGtk.ButtonImage("stop", "Cancel Change")
self.labels["cancel"].get_style_context().add_class("color4")
self.labels["cancel"] = self._gtk.ButtonImage("cancel", _("Cancel Change"))
self.labels["cancel"].get_style_context().add_class("color2")
self.labels["cancel"].connect("clicked", self.cancel_select_fan_speed)
self.labels["cancel"].hide()
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 +85,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)
+51 -67
View File
@@ -1,16 +1,17 @@
import gi
import logging
import re
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")
def create_panel(*args):
return FineTunePanel(*args)
class FineTune(ScreenPanel):
class FineTunePanel(ScreenPanel):
user_selecting = False
bs = 0
@@ -18,63 +19,67 @@ 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()
logger.debug("FineTunePanel")
_ = self.lang.gettext
grid = self._gtk.HomogeneousGrid()
grid.set_row_homogeneous(False)
logging.debug("FineTunePanel")
print_cfg = self._config.get_printer_config(self._screen.connected_printer)
if print_cfg is not None:
bs = print_cfg.get("z_babystep_values","0.01, 0.05")
if re.match(r'^[0-9,\.\s]+$', bs):
bs = [str(i.strip()) for i in bs.split(',')]
if len(bs) <= 2:
self.bs_deltas = bs
else:
self.bs_deltas = [bs[0], bs[-1]]
self.bs_delta = self.bs_deltas[0]
self.labels['z+'] = KlippyGtk.ButtonImage("move-z-", "Z+", "color1")
self.labels['z+'] = self._gtk.ButtonImage("z-farther", _("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("z-closer", _("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+", _("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-", _("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("flow+", _("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("flow-", _("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 +98,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 +116,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 +212,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"])
+108
View File
@@ -0,0 +1,108 @@
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
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("resume",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()
section_name = "displayed_macros %s" % self._screen.connected_printer
logging.info("Macro section name [%s]" % section_name)
for x in macros:
macro = x[12:].strip()
if macro in self.loaded_macros:
continue
if (section_name not in self._config.get_config().sections() or
self._config.get_config().getboolean(section_name, macro.lower(), fallback=True)):
self.add_gcode_macro(macro)
def run_gcode_macro(self, widget, macro):
self._screen._ws.klippy.gcode_script(macro)
def unload_gcode_macros(self):
section_name = "displayed_macros %s" % self._screen.connected_printer
for macro in self.loaded_macros:
if (section_name in self._config.get_config().sections() and
not self._config.get_config().getboolean(section_name, macro.lower(), fallback=True)):
macros = sorted(self.macros)
pos = macros.index(macro)
self.labels['macros'].remove_row(pos)
self.labels['macros'].show_all()
+610 -201
View File
@@ -1,201 +1,610 @@
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
def create_panel(*args):
return JobStatusPanel(*args)
class JobStatusPanel(ScreenPanel):
is_paused = False
filename = None
file_metadata = {}
progress = 0
state = "printing"
def __init__(self, screen, title, back=False):
super().__init__(screen, title, False)
def initialize(self, panel_name):
_ = self.lang.gettext
self.timeleft_type = "file"
self.timeout = None
self.close_timeouts = []
self.create_buttons()
grid = self._gtk.HomogeneousGrid()
grid.set_row_homogeneous(False)
self.labels['button_grid'] = self._gtk.HomogeneousGrid()
self.labels['button_grid'].set_vexpand(False)
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")
self.labels['lcdmessage'] = Gtk.Label("")
self.labels['lcdmessage'].set_halign(Gtk.Align.START)
self.labels['lcdmessage'].set_vexpand(False)
self.labels['lcdmessage'].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.add(self.labels['lcdmessage']) #, 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)
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['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+.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.HBox(spacing=0)
self.labels['i1_box'].set_vexpand(True)
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'].set_vexpand(True)
self.labels['i2_box'].get_style_context().add_class("printing-info-box")
self.labels['i2_box'].set_valign(Gtk.Align.CENTER)
self.labels['info_grid'] = self._gtk.HomogeneousGrid()
self.labels['info_grid'].attach(self.labels['i1_box'], 0, 0, 1, 1)
self.labels['info_grid'].attach(self.labels['i2_box'], 1, 0, 1, 1)
grid.attach(overlay, 0, 0, 1, 1)
grid.attach(fi_box, 1, 0, 3, 1)
grid.attach(self.labels['info_grid'], 0, 1, 4, 2)
grid.attach(self.labels['button_grid'], 0, 3, 4, 1)
self.add_labels()
self.grid = grid
self.content.add(grid)
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 = 0
self.enable_button("pause","cancel","resume")
state = "printing"
self.update_text("status",_("Printing"))
ps = self._printer.get_stat("print_stats")
logging.debug("Act State: %s" % ps['state'])
self.set_state(ps['state'])
self.show_buttons_for_state()
if self.timeout == None:
GLib.timeout_add(500, self.state_check)
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("settings",_("Settings"),"color3")
self.labels['control'].connect("clicked", self._screen._go_to_submenu, "")
self.labels['fine_tune'] = self._gtk.ButtonImage("fine-tune",_("Fine Tuning"),"color4")
self.labels['fine_tune'].connect("clicked", self.menu_item_clicked, "fine_tune",{
"panel": "fine_tune", "name": _("Fine Tuning")})
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("refresh",_("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)
for to in self.close_timeouts:
GLib.source_remove(to)
self.close_timeouts.remove(to)
if self.timeout == None:
self.timeout = GLib.timeout_add(500, self.state_check)
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
logging.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=None, *args):
if func == "enable_button":
self.enable_button(*args)
def close_panel(self, widget=None):
logging.debug("Closing job_status panel")
for to in self.close_timeouts:
GLib.source_remove(to)
self.close_timeouts.remove(to)
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 bool(self.file_metadata) == False and self.filename in modifiedfiles:
self.update_file_metadata()
self._files.remove_file_callback(self._callback_metadata)
def new_print(self):
if self.state in ["cancelled","complete","error"]:
for to in self.close_timeouts:
GLib.source_remove(to)
self.close_timeouts.remove(to)
if self.timeout == None:
GLib.timeout_add(500, self.state_check)
self.state_check()
def process_update(self, action, data):
if action == "notify_gcode_response":
if "action:cancel" in data:
self.set_state("cancelling")
elif "action:paused" in data:
self.set_state("paused")
return
elif 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")
)
ps = self._printer.get_stat("print_stats")
vsd = self._printer.get_stat("virtual_sdcard")
if 'display_status' in data and 'message' in data['display_status']:
self.update_message()
if "print_stats" in data and "filename" in data['print_stats']:
if data['print_stats']['filename'] != self.filename and self.state not in ["cancelling","cancelled","complete"]:
logging.debug("filename: '%s' '%s' status: %s" % (self.filename, data['print_stats']['filename'], self.state))
self.update_filename()
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 self.state in ["cancelling","cancelled","complete","error"]:
return
self.update_percent_complete()
self.update_text("duration", str(self._gtk.formatTimeString(ps['print_duration'])))
timeleft_type = self._config.get_config()['main'].get('print_estimate_method','file')
if timeleft_type != self.timeleft_type:
if self.timeleft_type == "duration":
self.labels['it_box'].add(self.labels['est_time'])
elif timeleft_type == "duration":
self.labels['it_box'].remove(self.labels['est_time'])
self.timeleft_type = timeleft_type
if timeleft_type in ['filament','file','slicer']:
duration = ps['print_duration']
if timeleft_type == "filament":
estimated_filament = (self.file_metadata['filament_total'] if "filament_total" in self.file_metadata
else 1)
total_duration = duration / (max(ps['filament_used'],0.0001) / max(estimated_filament, 0.0001))
elif timeleft_type == "file":
total_duration = duration / max(self.progress, 0.0001)
elif timeleft_type == "slicer":
total_duration = (self.file_metadata['estimated_time'] if "estimated_time" in self.file_metadata
else duration)
time_left = max(total_duration - duration, 0)
self.update_text("time_left", str(self._gtk.formatTimeString(time_left)))
self.update_text("est_time","/ %s" % str(self._gtk.formatTimeString(total_duration)))
def state_check(self):
ps = self._printer.get_stat("print_stats")
if ps['state'] == self.state:
return True
_ = self.lang.gettext
if ps['state'] == "printing" and self.state != "printing" and self.state != "cancelling":
self.set_state("printing")
elif ps['state'] == "complete" and self.state != "complete":
self.progress = 1
self.update_progress()
self.set_state("complete")
timeout = self._config.get_main_config().getint("job_complete_timeout", 30)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add(timeout * 1000, self.close_panel))
return False
elif ps['state'] == "error" and self.state != "error":
logging.debug("Error!")
self.set_state("error")
self.labels['status'].set_text("%s - %s" % (_("Error"), ps['message']))
timeout = self._config.get_main_config().getint("job_error_timeout", 0)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add(timeout * 1000, self.close_panel))
return False
elif ps['state'] == "standby":
# Print was cancelled
self.set_state("cancelled")
timeout = self._config.get_main_config().getint("job_cancelled_timeout", 0)
if timeout != 0:
self.close_timeouts.append(GLib.timeout_add(timeout * 1000, self.close_panel))
return False
elif ps['state'] == "paused":
self.set_state("paused")
# TODO: Remove this in the future
if self.filename != ps['filename']:
if ps['filename'] != "":
self.filename = ps['filename']
self.file_metadata = {}
self.update_text("file", self.filename.split("/")[-1])
else:
file = "Unknown"
self.update_text("file", "Unknown file")
return True
def set_state(self, state):
_ = self.lang.gettext
if self.state == state:
return
logging.debug("Changing job_status state from '%s' to '%s'" % (self.state, state))
self.state = state
if state == "paused":
self.update_text("status",_("Paused"))
elif state == "printing":
self.update_text("status",_("Printing"))
elif state == "cancelling":
self.update_text("status",_("Cancelling"))
elif state == "cancelled":
self.update_text("status",_("Cancelled"))
elif state == "complete":
self.update_text("status",_("Complete"))
self.show_buttons_for_state()
def show_buttons_for_state(self):
self.labels['button_grid'].remove_row(0)
self.labels['button_grid'].insert_row(0)
if self.state == "printing":
self.labels['button_grid'].attach(self.labels['pause'], 0, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['cancel'], 1, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['fine_tune'], 2, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['control'], 3, 0, 1, 1)
elif self.state == "paused":
self.labels['button_grid'].attach(self.labels['resume'], 0, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['cancel'], 1, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['fine_tune'], 2, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['control'], 3, 0, 1, 1)
elif self.state == "cancelling":
self.labels['button_grid'].attach(Gtk.Label(""), 0, 0, 1, 1)
self.labels['button_grid'].attach(Gtk.Label(""), 1, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['fine_tune'], 2, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['control'], 3, 0, 1, 1)
elif self.state == "error" or self.state == "complete" or self.state == "cancelled":
self.labels['button_grid'].attach(Gtk.Label(""), 0, 0, 1, 1)
self.labels['button_grid'].attach(Gtk.Label(""), 1, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['restart'], 2, 0, 1, 1)
self.labels['button_grid'].attach(self.labels['menu'], 3, 0, 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_filename(self):
self.filename = self._printer.get_stat('print_stats','filename')
self.update_text("file", self._printer.get_stat('print_stats','filename'))
self.update_percent_complete()
self.update_file_metadata()
def update_file_metadata(self):
if self._files.file_metadata_exists(self.filename):
self.file_metadata = self._files.get_file_info(self.filename)
logging.debug("Parsing file metadata: %s" % list(self.file_metadata))
if "estimated_time" in self.file_metadata and self.timeleft_type == "slicer":
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'] = ""
logging.debug("Thumbnails: %s" % list(tmp))
self.show_file_thumbnail()
else:
self.file_metadata = {}
logging.debug("Cannot find file metadata. Listening for updated metadata")
self._screen.files.add_file_callback(self._callback_metadata)
def update_image_text(self, label, text):
if label in self.labels and 'l' in self.labels[label]:
self.labels[label]['l'].set_text(text)
def update_percent_complete(self):
if self.state in ["cancelling","cancelled","complete","error"]:
return
if "gcode_start_byte" in self.file_metadata:
progress = (max(self._printer.get_stat('virtual_sdcard','file_position') -
self.file_metadata['gcode_start_byte'],0) / (self.file_metadata['gcode_end_byte'] -
self.file_metadata['gcode_start_byte']))
else:
progress = self._printer.get_stat('virtual_sdcard','progress')
progress = round(progress,2)
if progress != self.progress:
self.progress = progress
self.labels['darea'].queue_draw()
self.update_progress()
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_message (self):
msg = self._printer.get_stat("display_status", "message")
self.labels['lcdmessage'].set_text("" if msg == None else msg)
#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)
)
+91 -63
View File
@@ -1,63 +1,91 @@
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
def create_panel(*args):
return MainPanel(*args)
class MainPanel(MenuPanel):
def __init__(self, screen, title, back=False):
super().__init__(screen, title, False)
def initialize(self, panel_name, items, extrudercount):
print("### Making MainMenu")
grid = self._gtk.HomogeneousGrid()
grid.set_hexpand(True)
grid.set_vexpand(True)
# Create Extruders and bed icons
eq_grid = Gtk.Grid()
eq_grid.set_hexpand(True)
eq_grid.set_vexpand(True)
self.heaters = []
i = 0
for x in self._printer.get_tools():
self.labels[x] = self._gtk.ButtonImage("extruder-"+str(i), self._gtk.formatTemperatureString(0, 0))
self.heaters.append(x)
i += 1
add_heaters = self._printer.get_heaters()
for h in add_heaters:
if h == "heater_bed":
self.labels[h] = self._gtk.ButtonImage("bed", self._gtk.formatTemperatureString(0, 0))
else:
name = " ".join(h.split(" ")[1:])
self.labels[h] = self._gtk.ButtonImage("heat-up", name)
self.heaters.append(h)
i = 0
cols = 3 if len(self.heaters) > 4 else (1 if len(self.heaters) <= 2 else 2)
for h in self.heaters:
eq_grid.attach(self.labels[h], i%cols, int(i/cols), 1, 1)
i += 1
self.items = items
self.create_menu_items()
self.grid = Gtk.Grid()
self.grid.set_row_homogeneous(True)
self.grid.set_column_homogeneous(True)
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.content.add(self.grid)
self.layout.show_all()
self._screen.add_subscription(panel_name)
def activate(self):
return
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")
)
for h in self._printer.get_heaters():
self.update_temp(h,
self._printer.get_dev_stat(h,"temperature"),
self._printer.get_dev_stat(h,"target"),
None if h == "heater_bed" else " ".join(h.split(" ")[1:])
)
return
+99 -53
View File
@@ -1,53 +1,99 @@
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
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.j2_data.update({
'moonraker_connected': self._screen._ws.is_connected()
})
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]
logging.debug("Evaluating item: %s" % key)
if not self.evaluate_enable(item[key]['enable']):
continue
col = i % columns
row = int(i/columns)
width = 1
if expandLast == True and i+1 == l and l%2 == 1:
width = 2
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:
logging.debug("Template: '%s'" % enable)
logging.debug("Data: %s" % self.j2_data)
j2_temp = Template(enable)
result = j2_temp.render(self.j2_data)
if result == 'True':
return True
return False
except:
logging.debug("Error evaluating enable statement: %s", enable)
return False
+133 -131
View File
@@ -1,131 +1,133 @@
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
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 = Gtk.Grid()
self.labels['x+'] = self._gtk.ButtonImage("arrow-right", _("X+"), "color1")
self.labels['x+'].connect("clicked", self.move, "X", "+")
self.labels['x-'] = self._gtk.ButtonImage("arrow-left", _("X-"), "color1")
self.labels['x-'].connect("clicked", self.move, "X", "-")
self.labels['y+'] = self._gtk.ButtonImage("arrow-up", _("Y+"), "color2")
self.labels['y+'].connect("clicked", self.move, "Y", "+")
self.labels['y-'] = self._gtk.ButtonImage("arrow-down", _("Y-"), "color2")
self.labels['y-'].connect("clicked", self.move, "Y", "-")
self.labels['z+'] = self._gtk.ButtonImage("z-farther", _("Z+"), "color3")
self.labels['z+'].connect("clicked", self.move, "Z", "+")
self.labels['z-'] = self._gtk.ButtonImage("z-closer", _("Z-"), "color3")
self.labels['z-'].connect("clicked", self.move, "Z", "-")
self.labels['home'] = self._gtk.ButtonImage("home", _("Home All"))
self.labels['home'].connect("clicked", self.home)
if self._screen.lang_ltr:
grid.attach(self.labels['x+'], 2, 1, 1, 1)
grid.attach(self.labels['x-'], 0, 1, 1, 1)
else:
grid.attach(self.labels['x+'], 0, 1, 1, 1)
grid.attach(self.labels['x-'], 2, 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].set_direction(Gtk.TextDirection.LTR)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_top")
elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and j == len(self.distances)-1):
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()
bottomgrid.set_direction(Gtk.TextDirection.LTR)
self.labels['pos_x'] = Gtk.Label("X: 0")
self.labels['pos_y'] = Gtk.Label("Y: 0")
self.labels['pos_z'] = Gtk.Label("Z: 0")
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()['main'].getboolean("invert_%s" % axis.lower(), False):
dir = "-" if dir == "+" else "+"
dist = str(self.distance) if dir == "+" else "-" + str(self.distance)
speed = self._config.get_config()['main'].getint("move_speed", 20)
speed = min(max(1,speed),200) # Cap movement speed between 1-200mm/s
self._screen._ws.klippy.gcode_script(
"%s\n%s %s%s F%s%s" % (KlippyGcodes.MOVE_RELATIVE, KlippyGcodes.MOVE, axis, dist, speed*60,
"\nG90" if self._printer.get_stat("gcode_move", "absolute_coordinates") == True else "")
)
+393 -17
View File
@@ -1,36 +1,412 @@
import gi
import json
import logging
import netifaces
import os
import re
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk, GLib
from gi.repository import Gtk, Gdk, GLib, Pango
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):
networks = {}
network_list = []
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')
hostname = stream.read()
# Get IP Address
stream = os.popen('hostname -I')
ip = stream.read()
gws = netifaces.gateways()
if "default" in gws and netifaces.AF_INET in gws["default"]:
self.interface = gws["default"][netifaces.AF_INET][1]
else:
ints = netifaces.interfaces()
if 'lo' in ints:
ints.pop('lo')
self.interfaces = ints[0]
res = netifaces.ifaddresses(self.interface)
if netifaces.AF_INET in res and len(res[netifaces.AF_INET]) > 0:
ip = res[netifaces.AF_INET][0]['addr']
else:
ip = "0.0.0.0"
self.labels['networks'] = {}
self.labels['interface'] = Gtk.Label()
self.labels['interface'].set_text(" %s: %s" % (_("Interface"), self.interface))
self.labels['disconnect'] = self._gtk.Button(_("Disconnect"), "color2")
self.labels['networkinfo'] = Gtk.Label(
"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)
sbox = Gtk.Box()
sbox.set_hexpand(True)
sbox.set_vexpand(False)
sbox.add(self.labels['interface'])
#sbox.add(self.labels['disconnect'])
b = KlippyGtk.ButtonImage('back', 'Back')
b.connect("clicked", self._screen._menu_go_back)
self.panel.attach(b, 1, 1, 1, 1)
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
self.labels['networklist'] = Gtk.Grid()
self.files = {}
if self._screen.wifi != None and self._screen.wifi.is_initialized():
box.pack_start(sbox, False, False, 0)
box.pack_start(scroll, True, True, 0)
GLib.idle_add(self.load_networks)
scroll.add(self.labels['networklist'])
self._screen.wifi.add_callback("connected", self.connected_callback)
self._screen.wifi.add_callback("scan_results", self.scan_callback)
self.timeout = GLib.timeout_add_seconds(5, self.update_all_networks)
else:
self.labels['networkinfo'] = Gtk.Label("")
self.labels['networkinfo'].get_style_context().add_class('temperature_entry')
box.pack_start(self.labels['networkinfo'], False, False, 0)
self.update_single_network_info()
self.timeout = GLib.timeout_add_seconds(5, self.update_single_network_info)
self.content.add(box)
self.labels['main_box'] = box
def load_networks(self):
networks = self._screen.wifi.get_networks()
conn_ssid = self._screen.wifi.get_connected_ssid()
if conn_ssid in networks:
networks.remove(conn_ssid)
self.add_network(conn_ssid, False)
for net in networks:
self.add_network(net, False)
self.update_all_networks()
self.content.show_all()
def add_network(self, ssid, show=True):
_ = self.lang.gettext
if ssid == None:
return
ssid = ssid.strip()
if ssid in list(self.networks):
logging.info("SSID already listed")
return
netinfo = self._screen.wifi.get_network_info(ssid)
if netinfo == None:
logging.debug("Couldn't get netinfo")
return
configured_networks = self._screen.wifi.get_supplicant_networks()
network_id = -1
for net in list(configured_networks):
if configured_networks[net]['ssid'] == ssid:
network_id = net
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>" % (ssid))
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()
info.set_halign(Gtk.Align.START)
#info.set_markup(self.get_file_info_str(ssid))
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
labels.add(info)
labels.set_vexpand(True)
labels.set_valign(Gtk.Align.CENTER)
labels.set_halign(Gtk.Align.START)
connect = self._gtk.ButtonImage("load",None,"color3")
connect.connect("clicked", self.connect_network, ssid)
connect.set_hexpand(False)
connect.set_halign(Gtk.Align.END)
delete = self._gtk.ButtonImage("delete","","color3")
delete.connect("clicked", self.remove_wifi_network, ssid)
delete.set_size_request(60,0)
delete.set_hexpand(False)
delete.set_halign(Gtk.Align.END)
network = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
network.set_hexpand(True)
network.set_vexpand(False)
network.add(labels)
buttons = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
if network_id != -1:
buttons.pack_end(delete, False, False, 0)
if netinfo['connected'] == False:
buttons.pack_end(connect, False, False, 0)
network.add(buttons)
self.networks[ssid] = frame
frame.add(network)
reverse = False
pos = 0
if netinfo['connected'] == True:
pos = 0
else:
connected_ssid = self._screen.wifi.get_connected_ssid()
nets = list(self.networks)
if connected_ssid != None:
if connected_ssid in nets:
nets.remove(connected_ssid)
nets = sorted(nets, reverse=reverse)
pos = nets.index(ssid)
if connected_ssid != None:
pos += 1
self.labels['networks'][ssid] = {
"connect": connect,
"delete": delete,
"info": info,
"name": name,
"row": network
}
self.labels['networklist'].insert_row(pos)
self.labels['networklist'].attach(self.networks[ssid], 0, pos, 1, 1)
if show == True:
self.labels['networklist'].show()
def add_new_network(self, widget, ssid, connect=False):
networks = self._screen.wifi.get_networks()
psk = self.labels['network_psk'].get_text()
result = self._screen.wifi.add_network(ssid, psk)
self.close_add_network(widget, ssid)
if connect == True:
if result == True:
self.connect_network(widget, ssid, False)
else:
self._screen.show_popup_message("Error adding network %s" % ssid)
def check_missing_networks(self):
networks = self._screen.wifi.get_networks()
for net in list(self.networks):
if net in networks:
networks.remove(net)
for net in networks:
self.add_network(net)
self.labels['networklist'].show_all()
def close_add_network(self, widget, ssid):
for child in self.content.get_children():
self.content.remove(child)
self.content.add(self.labels['main_box'])
self.content.show()
def close_dialog(self, widget, response_id):
widget.destroy()
def connected_callback(self, ssid, prev_ssid):
logging.info("Now connected to a new network")
if ssid != None:
self.remove_network(ssid)
if prev_ssid != None:
self.remove_network(prev_ssid)
self.check_missing_networks()
def connect_network(self, widget, ssid, showadd=True):
_ = self.lang.gettext
snets = self._screen.wifi.get_supplicant_networks()
isdef = False
for id, net in snets.items():
if net['ssid'] == ssid:
isdef = True
break
if isdef == False:
if showadd == True:
self.show_add_network(widget, ssid)
return
self.prev_network = self._screen.wifi.get_connected_ssid()
buttons = [
{"name": _("Close"), "response": Gtk.ResponseType.CANCEL}
]
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_hexpand(True)
scroll.set_vexpand(True)
scroll.set_size_request(800,400)
self.labels['connecting_info'] = Gtk.Label(_("Starting WiFi Re-association"))
self.labels['connecting_info'].set_halign(Gtk.Align.START)
self.labels['connecting_info'].set_valign(Gtk.Align.START)
scroll.add(self.labels['connecting_info'])
dialog = self._gtk.Dialog(self._screen, buttons, scroll, self.close_dialog)
self._screen.show_all()
if ssid in self.networks:
self.remove_network(ssid)
if self.prev_network in self.networks:
self.remove_network(self.prev_network)
#GLib.timeout_add(500, self.add_network, self.prev_network)
self._screen.wifi.add_callback("connecting_status", self.connecting_status_callback)
self._screen.wifi.connect(ssid)
def connecting_status_callback(self, msg):
self.labels['connecting_info'].set_text(self.labels['connecting_info'].get_text() + "\n" + msg)
self.labels['connecting_info'].show_all()
def remove_network(self, ssid, show=True):
if ssid not in self.networks:
return
i = 0
while self.labels['networklist'].get_child_at(0, i) != None:
if self.networks[ssid] == self.labels['networklist'].get_child_at(0, i):
self.labels['networklist'].remove_row(i)
self.labels['networklist'].show()
del self.networks[ssid]
del self.labels['networks'][ssid]
return
i = i+1
return
def remove_network_wid(self, widget, ssid):
self.remove_network(ssid)
def remove_wifi_network(self, widget, ssid):
self._screen.wifi.delete_network(ssid)
self.remove_network(ssid)
self.check_missing_networks()
def scan_callback(self, new_networks, old_networks):
for net in old_networks:
self.remove_network(net, False)
for net in new_networks:
self.add_network(net, False)
self.content.show_all()
def show_add_network(self, widget, ssid):
_ = self.lang.gettext
for child in self.content.get_children():
self.content.remove(child)
if "add_network" in self.labels:
del self.labels['add_network']
self.labels['add_network'] = Gtk.VBox()
self.labels['add_network'].set_valign(Gtk.Align.START)
box = Gtk.Box(spacing=5)
box.set_size_request(self._gtk.get_content_width(), self._gtk.get_content_height() -
self._screen.keyboard_height - 20)
box.set_hexpand(True)
box.set_vexpand(False)
self.labels['add_network'].add(box)
l = self._gtk.Label("%s %s:" % (_("PSK for"), ssid))
l.set_hexpand(False)
entry = Gtk.Entry()
entry.set_hexpand(True)
save = self._gtk.ButtonImage("sd",_("Save"),"color3")
save.set_hexpand(False)
save.connect("clicked", self.add_new_network, ssid, True)
self.labels['network_psk'] = entry
box.pack_start(l, False, False, 5)
box.pack_start(entry, True, True, 5)
box.pack_start(save, False, False, 5)
self.show_create = True
self.labels['network_psk'].set_text('')
self.content.add(self.labels['add_network'])
self.content.show()
self._screen.show_keyboard()
self.labels['network_psk'].grab_focus_without_selecting()
def update_all_networks(self):
for network in list(self.networks):
self.update_network_info(network)
return True
def update_network_info(self, ssid):
_ = self.lang.gettext
if ssid not in self.networks or ssid not in self.labels['networks']:
return
netinfo = self._screen.wifi.get_network_info(ssid)
if netinfo == None:
logging.debug("Couldn't get netinfo for update")
return
connected = ""
if netinfo['connected'] == True:
stream = os.popen('hostname -f')
hostname = stream.read().strip()
ifadd = netifaces.ifaddresses(self.interface)
ipv4 = ""
ipv6 = ""
if netifaces.AF_INET in ifadd and len(ifadd[netifaces.AF_INET]) > 0:
ipv4 = "<b>%s:</b> %s " % (_("IPv4"), ifadd[netifaces.AF_INET][0]['addr'])
if netifaces.AF_INET6 in ifadd and len(ifadd[netifaces.AF_INET6]) > 0:
ipv6 = ipv6 = "<b>%s:</b> %s " % (_("IPv6"), ifadd[netifaces.AF_INET6][0]['addr'].split('%')[0])
connected = "<b>%s</b>\n<b>%s:</b> %s\n%s%s\n" % (_("Connected"),_("Hostname"),hostname, ipv4, ipv6)
elif "psk" in netinfo:
connected = "Password saved."
freq = "2.4 GHz" if netinfo['frequency'][0:1] == "2" else "5 Ghz"
self.labels['networks'][ssid]['info'].set_markup("%s%s <small>%s %s %s %s%s</small>" % ( connected,
"" if netinfo['encryption'] == "off" else netinfo['encryption'].upper(),
freq, _("Channel"), netinfo['channel'], netinfo['signal_level_dBm'], _("dBm")
))
self.labels['networks'][ssid]['info'].show_all()
def update_single_network_info(self):
_ = self.lang.gettext
stream = os.popen('hostname -f')
hostname = stream.read().strip()
ifadd = netifaces.ifaddresses(self.interface)
ipv4 = ""
ipv6 = ""
if netifaces.AF_INET in ifadd and len(ifadd[netifaces.AF_INET]) > 0:
ipv4 = "<b>%s:</b> %s " % (_("IPv4"), ifadd[netifaces.AF_INET][0]['addr'])
if netifaces.AF_INET6 in ifadd and len(ifadd[netifaces.AF_INET6]) > 0:
ipv6 = ipv6 = "<b>%s:</b> %s " % (_("IPv6"), ifadd[netifaces.AF_INET6][0]['addr'].split('%')[0])
connected = "<b>%s</b>\n\n<small><b>%s</b></small>\n<b>%s:</b> %s\n%s\n%s\n" % (self.interface, _("Connected"),_("Hostname"),
hostname, ipv4, ipv6)
self.labels['networkinfo'].set_markup(connected)
self.labels['networkinfo'].show_all()
+102
View File
@@ -0,0 +1,102 @@
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
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):
logging.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)
+71 -35
View File
@@ -4,41 +4,58 @@ 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()
logging.debug("Preheat options: %s" % self.preheat_options)
grid = KlippyGtk.HomogeneousGrid()
grid = self._gtk.HomogeneousGrid()
eq_grid = KlippyGtk.HomogeneousGrid()
eq_grid = Gtk.Grid()
eq_grid.set_hexpand(True)
eq_grid.set_vexpand(True)
self.heaters = []
i = 0
for x in self._printer.get_tools():
if i > 3:
break
elif i == 0:
if 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)
eq_grid.attach(self.labels[x], i%2, i/2, 1, 1)
self.labels[x] = self._gtk.ToggleButtonImage("extruder-"+str(i), self._gtk.formatTemperatureString(0, 0))
self.heaters.append(x)
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)
add_heaters = self._printer.get_heaters()
for h in add_heaters:
if h.startswith("temperature_sensor "):
continue
if h == "heater_bed":
self.labels[h] = self._gtk.ButtonImage("bed", self._gtk.formatTemperatureString(0, 0))
else:
name = " ".join(h.split(" ")[1:])
self.labels[h] = self._gtk.ButtonImage("heat-up", name)
self.heaters.append(h)
self.labels["control_grid"] = KlippyGtk.HomogeneousGrid()
i = 0
cols = 3 if len(self.heaters) > 4 else (1 if len(self.heaters) <= 2 else 2)
for h in self.heaters:
self.labels[h].connect('clicked', self.select_heater, h)
eq_grid.attach(self.labels[h], i%cols, int(i/cols), 1, 1)
i += 1
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 +63,31 @@ 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)
for h in self._printer.get_heaters():
if h.startswith("temperature_sensor "):
continue
if h not in self.active_heaters:
self.select_heater(None, h)
def select_heater(self, widget, heater):
if heater in self.active_heaters:
self.active_heaters.pop(self.active_heaters.index(heater))
@@ -77,7 +101,9 @@ class PreheatPanel(ScreenPanel):
if setting == "cooldown":
for heater in self.active_heaters:
print ("Setting %s to %d" % (heater, 0))
if heater.startswith('heater_bed'):
if heater.startswith('heater_generic '):
self._screen._ws.klippy.set_heater_temp(" ".join(heater.split(" ")[1:]), 0)
elif heater.startswith('heater_bed'):
self._screen._ws.klippy.set_bed_temp(0)
self._printer.set_dev_stat(heater,"target", 0)
else:
@@ -86,22 +112,32 @@ class PreheatPanel(ScreenPanel):
return
for heater in self.active_heaters:
if heater.startswith('heater_bed'):
if heater.startswith('heater_generic '):
print ("Setting %s to %d" % (heater, self.preheat_options[setting]['heater_generic']))
self._screen._ws.klippy.set_heater_temp(" ".join(heater.split(" ")[1:]),
self.preheat_options[setting]["heater_generic"])
elif heater.startswith('heater_bed'):
print ("Setting %s to %d" % (heater, self.preheat_options[setting]['bed']))
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, action, data):
if action != "notify_status_update":
return
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")
)
for h in self._printer.get_heaters():
self.update_temp(h,
self._printer.get_dev_stat(h,"temperature"),
self._printer.get_dev_stat(h,"target"),
None if h == "heater_bed" else " ".join(h.split(" ")[1:])
)
+324 -163
View File
@@ -1,150 +1,366 @@
# -*- coding: utf-8 -*-
import gi
import json
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):
cur_directory = "gcodes"
dir_panels = {}
filelist = {'gcodes':{'directories':[],'files':[]}}
def initialize(self, panel_name):
_ = self.lang.gettext
self.labels['directories'] = {}
self.labels['files'] = {}
self.sort_items = {
"name": _("Name"),
"date": _("Date")
}
self.sort_char = ["↑","↓"]
sortdir = self._config.get_main_config_option("print_sort_dir","name_asc")
sortdir = sortdir.split('_')
if sortdir[0] not in ["name","date"] or sortdir[1] not in ["asc","desc"]:
sortdir = ["name","asc"]
self.sort_current = [sortdir[0], 0 if sortdir[1] == "asc" else 1] # 0 for asc, 1 for desc
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
sort = Gtk.Label()
sort.set_text(_("Sort by: "))
sbox = Gtk.Box(spacing=0)
sbox.set_vexpand(False)
sbox.add(sort)
i = 1
for name, val in self.sort_items.items():
s = self._gtk.Button(val, "color%s" % (i%4))
s.set_label(val)
if name == sortdir[0]:
s.set_label("%s %s" % (s.get_label(), self.sort_char[self.sort_current[1]]))
s.connect("clicked", self.change_sort, name)
self.labels['sort_%s' % name] = s
sbox.add(s)
i += 1
refresh = self._gtk.ButtonImage("refresh", None, None, .5, .5)
refresh.connect('clicked', self._refresh_files)
sbox.add(refresh)
sbox.set_hexpand(True)
sbox.set_vexpand(False)
pbox = Gtk.Box(spacing=0)
pbox.set_hexpand(True)
pbox.set_vexpand(False)
self.labels['path'] = Gtk.Label(" /")
pbox.add(self.labels['path'])
self.labels['path_box'] = pbox
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
box.set_vexpand(True)
box.pack_start(sbox, False, False, 0)
box.pack_start(pbox, False, False, 0)
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)
#self.labels['filelist'] = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL)
#self.labels['filelist'].set_vexpand(True)
self.labels['filelist'] = Gtk.Grid()
self.dir_panels['gcodes'] = Gtk.Grid()
self.files = {}
self.reload_files()
self.directories = {}
scroll.add(self.labels['filelist'])
self.panel = box
GLib.idle_add(self.reload_files)
scroll.add(self.dir_panels['gcodes'])
self.scroll = scroll
self.control['back'].disconnect_by_func(self._screen._menu_go_back)
self.control['back'].connect("clicked", self.back)
self.content.add(box)
self._screen.files.add_file_callback(self._callback)
return
def add_file(self, filename):
fileinfo = self._screen.files.get_file_info(filename)
def activate(self):
if self.cur_directory != "gcodes":
self.change_dir(None, "gcodes")
def add_directory(self, directory, show=True):
parent_dir = '/'.join(directory.split('/')[:-1])
if directory not in self.filelist:
self.filelist[directory] = {'directories':[],'files':[],'modified': 0}
self.filelist[parent_dir]['directories'].append(directory)
if directory not in self.labels['directories']:
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>" % (directory.split("/")[-1]))
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()
info.set_halign(Gtk.Align.START)
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
labels.add(info)
labels.set_vexpand(True)
labels.set_valign(Gtk.Align.CENTER)
labels.set_halign(Gtk.Align.START)
actions = self._gtk.ButtonImage("load",None,"color3")
actions.connect("clicked", self.change_dir, directory)
actions.set_hexpand(False)
actions.set_halign(Gtk.Align.END)
file = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
file.set_hexpand(True)
file.set_vexpand(False)
icon = self._gtk.Image("folder.svg", False, 1, 1)
file.add(icon)
file.add(labels)
file.add(actions)
frame.add(file)
self.directories[directory] = frame
self.labels['directories'][directory] = {
"icon": icon,
"info": info,
"name": name
}
self.dir_panels[directory] = Gtk.Grid()
reverse = False if self.sort_current[1] == 0 else True
if self.sort_current[0] == "date":
dirs = sorted(self.filelist[parent_dir]['directories'], reverse=reverse,
key=lambda item: self.filelist[item]['modified'])
else:
dirs = sorted(self.filelist[parent_dir]['directories'], reverse=reverse)
pos = dirs.index(directory)
self.dir_panels[parent_dir].insert_row(pos)
self.dir_panels[parent_dir].attach(self.directories[directory], 0, pos, 1, 1)
if show == True:
self.dir_panels[parent_dir].show_all()
def add_file(self, filepath, show=True):
_ = self.lang.gettext
fileinfo = self._screen.files.get_file_info(filepath)
if fileinfo == None:
return
frame = Gtk.Frame()
frame.set_property("shadow-type",Gtk.ShadowType.NONE)
dir = ("gcodes/%s" % filepath).split('/')[:-1]
directory = '/'.join(dir)
filename = filepath.split('/')[-1]
for i in range(1, len(dir)):
curdir = "/".join(dir[0:i])
newdir = "/".join(dir[0:i+1])
if newdir not in self.filelist[curdir]['directories']:
self.add_directory(newdir)
if filename not in self.filelist[directory]['files']:
for i in range(1, len(dir)):
curdir = "/".join(dir[0:i+1])
if curdir != "gcodes" and fileinfo['modified'] > self.filelist[curdir]['modified']:
self.filelist[curdir]['modified'] = fileinfo['modified']
self.labels['directories'][curdir]['info'].set_markup("<small>%s: <b>%s</b></small>" %
(_("Modified"), datetime.fromtimestamp(fileinfo['modified']).strftime("%Y-%m-%d %H:%M")))
self.filelist[directory]['files'].append(filename)
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_hexpand(True)
name.set_halign(Gtk.Align.START)
if filepath not in self.files:
frame = Gtk.Frame()
frame.set_property("shadow-type",Gtk.ShadowType.NONE)
frame.get_style_context().add_class("frame-item")
info = Gtk.Label("Uploaded: blah - Size: blah")
info.set_halign(Gtk.Align.START)
info.set_markup(self.get_file_info_str(filename))
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
labels.add(info)
labels.set_vexpand(True)
labels.set_valign(Gtk.Align.CENTER)
labels.set_halign(Gtk.Align.START)
name = Gtk.Label()
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)
actions = KlippyGtk.ButtonImage("print",None,"color3")
actions.connect("clicked", self.confirm_print, filename)
actions.set_hexpand(False)
actions.set_halign(Gtk.Align.END)
info = Gtk.Label()
info.set_halign(Gtk.Align.START)
info.set_markup(self.get_file_info_str(filepath))
labels = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
labels.add(name)
labels.add(info)
labels.set_vexpand(True)
labels.set_valign(Gtk.Align.CENTER)
labels.set_halign(Gtk.Align.START)
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)
actions = self._gtk.ButtonImage("print",None,"color3")
actions.connect("clicked", self.confirm_print, filepath)
actions.set_hexpand(False)
actions.set_halign(Gtk.Align.END)
icon = KlippyGtk.Image("file", False, 100, 100)
pixbuf = self.get_file_image(filename)
if pixbuf != None:
icon.set_from_pixbuf(pixbuf)
file = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
file.set_hexpand(True)
file.set_vexpand(False)
file.add(icon)
file.add(labels)
file.add(actions)
frame.add(file)
icon = self._gtk.Image("file.svg", False, 1.6, 1.6)
pixbuf = self.get_file_image(filepath)
if pixbuf != None:
icon.set_from_pixbuf(pixbuf)
self.files[filename] = frame
files = sorted(self.files)
file.add(icon)
file.add(labels)
file.add(actions)
frame.add(file)
self.files[filepath] = frame
self.labels['files'][filepath] = {
"icon": icon,
"info": info,
"name": name
}
reverse = False if self.sort_current[1] == 0 else True
if self.sort_current[0] == "date":
files = sorted(self.filelist[directory]['files'], reverse=reverse,
key=lambda item: self._screen.files.get_file_info(("%s/%s" %(directory,item))[7:])['modified'])
else:
files = sorted(self.filelist[directory]['files'], reverse=reverse)
pos = files.index(filename)
pos += len(self.filelist[directory]['directories'])
self.labels['files'][filename] = {
"icon": icon,
"info": info,
"name": name
}
self.dir_panels[directory].insert_row(pos)
self.dir_panels[directory].attach(self.files[filepath], 0, pos, 1, 1)
if show == True:
self.dir_panels[directory].show_all()
self.labels['filelist'].insert_row(pos)
self.labels['filelist'].attach(self.files[filename], 0, pos, 1, 1)
self.labels['filelist'].show_all()
def back(self, widget):
if len(self.cur_directory.split('/')) > 1:
self.change_dir(None, '/'.join(self.cur_directory.split('/')[:-1]))
else:
self._screen._menu_go_back()
def get_file_image(self, filename, width=100, height=100):
fileinfo = self._screen.files.get_file_info(filename)
if fileinfo == None:
return None
def change_dir(self, widget, directory):
if directory not in self.dir_panels:
return
logging.debug("Changing dir to %s" % directory)
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
for child in self.scroll.get_children():
self.scroll.remove(child)
self.cur_directory = directory
self.labels['path'].set_text(" /%s" % self.cur_directory[7:])
self.scroll.add(self.dir_panels[directory])
self.content.show_all()
def change_sort(self, widget, key):
if self.sort_current[0] == key:
self.sort_current[1] = (self.sort_current[1] + 1) % 2
else:
oldkey = self.sort_current[0]
logging.info("Changing %s to %s" % ('sort_%s' % oldkey, self.sort_items[self.sort_current[0]]))
self.labels['sort_%s' % oldkey].set_label("%s" % self.sort_items[oldkey])
self.labels['sort_%s' % oldkey].show_all()
self.sort_current = [key, 0]
self.labels['sort_%s' % key].set_label("%s %s" % (self.sort_items[key], self.sort_char[self.sort_current[1]]))
self.labels['sort_%s' % key].show()
GLib.idle_add(self.reload_files)
self._config.set("main", "print_sort_dir", "%s_%s" % (key, "asc" if self.sort_current[1] == 0 else "desc"))
self._config.save_user_config_options()
def confirm_print(self, widget, filename):
_ = 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_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, 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)
dialog = self._gtk.Dialog(self._screen, buttons, grid, self.confirm_print_response, filename)
def confirm_print_response(self, widget, response_id, filename):
widget.destroy()
if response_id == Gtk.ResponseType.CANCEL:
return
logging.info("Starting print: %s" % (filename))
self._screen._ws.klippy.print_start(filename)
def delete_file(self, filename):
dir_parts = ("gcodes/%s" % filename).split('/')[:-1]
directory = '/'.join(dir_parts)
self.filelist[directory]["files"].pop(self.filelist[directory]["files"].index(filename.split('/')[-1]))
i = len(dir_parts)
while i > 1:
cur_dir = '/'.join(dir_parts[0:i])
if len(self.filelist[cur_dir]['directories']) > 0 or len(self.filelist[cur_dir]['files']) > 0:
break
par_dir = '/'.join(cur_dir.split('/')[:-1])
if self.cur_directory == cur_dir:
self.change_dir(None, par_dir)
del self.filelist[cur_dir]
self.filelist[par_dir]['directories'].pop(self.filelist[par_dir]['directories'].index(cur_dir))
self.dir_panels[par_dir].remove(self.directories[cur_dir])
del self.directories[cur_dir]
del self.labels['directories'][cur_dir]
self.dir_panels[par_dir].show_all()
i -= 1
self.dir_panels[directory].remove(self.files[filename])
self.dir_panels[directory].show_all()
self.files.pop(filename)
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)
)
@@ -172,6 +388,16 @@ class PrintPanel(ScreenPanel):
return print_str
return "Unavailable"
def reload_files(self, widget=None):
self.filelist = {'gcodes':{'directories':[],'files':[]}}
for dirpan in self.dir_panels:
for child in self.dir_panels[dirpan].get_children():
self.dir_panels[dirpan].remove(child)
flist = sorted(self._screen.files.get_file_list(), key=lambda item: '/' in item)
for file in flist:
GLib.idle_add(self.add_file, file)
def update_file(self, filename):
if filename not in self.labels['files']:
return
@@ -184,81 +410,16 @@ class PrintPanel(ScreenPanel):
if pixbuf != None:
self.labels['files'][filename]['icon'].set_from_pixbuf(pixbuf)
def delete_file(self, filename):
files = sorted(self.files)
pos = files.index(filename)
self.labels['filelist'].remove_row(pos)
self.labels['filelist'].show_all()
self.files.pop(filename)
def reload_files(self, widget=None):
for child in self.labels['filelist'].get_children():
self.labels['filelist'].remove(child)
self.labels['filelist'].show_all()
for file in self._screen.files.get_file_list():
#TODO: Change priority on this
GLib.idle_add(self.add_file, file)
def _callback(self, newfiles, deletedfiles, updatedfiles=[]):
logger.debug("newfiles: %s", newfiles)
logging.debug("newfiles: %s", newfiles)
for file in newfiles:
self.add_file(file)
logger.debug("deletedfiles: %s", deletedfiles)
logging.debug("deletedfiles: %s", deletedfiles)
for file in deletedfiles:
self.delete_file(file)
logger.debug("updatefiles: %s", updatedfiles)
logging.debug("updatefiles: %s", updatedfiles)
for file in updatedfiles:
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)
label = Gtk.Label()
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")
grid = Gtk.Grid()
grid.add(label)
pixbuf = self.get_file_image(filename, 400, 350)
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()
def confirm_print_response(self, widget, response_id, filename):
widget.destroy()
if response_id == Gtk.ResponseType.CANCEL:
return
logging.info("Starting print: %s" % (filename))
self._screen._ws.klippy.print_start(filename)
def _refresh_files(self, widget):
self._files.refresh_files()
+33
View File
@@ -0,0 +1,33 @@
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.PrinterSelect")
def create_panel(*args):
return PrinterSelect(*args)
class PrinterSelect(ScreenPanel):
def __init__(self, screen, title, back=True, action_bar=True, printer_name=True):
super().__init__(screen, title, False, False, False)
def initialize(self, panel_name):
_ = self.lang.gettext
printers = self._config.get_printers()
box = Gtk.Box()
self.content.add(box)
i = 1
for printer in printers:
name = list(printer)[0]
self.labels[name] = self._gtk.ButtonImage("extruder",name,"color%s" % (i%4))
self.labels[name].connect("clicked", self._screen.connect_printer_widget, name)
box.add(self.labels[name])
i += 1
-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))
+26
View File
@@ -0,0 +1,26 @@
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
def create_panel(*args):
return ScreenSaverPanel(*args)
class ScreenSaverPanel(ScreenPanel):
def initialize(self, panel_name):
_ = self.lang.gettext
box = Gtk.Box()
box.set_hexpand(True)
box.set_vexpand(True)
box.set_halign(Gtk.Align.CENTER)
l = Gtk.Label(_("Screen will show in less than one second"))
box.add(l)
self.layout = box
+258
View File
@@ -0,0 +1,258 @@
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
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')
printbox = Gtk.Box(spacing=0)
printbox.set_vexpand(False)
self.labels['add_printer_button'] = self._gtk.Button(_("Add Printer"), "color1")
#printbox.add(self.labels['add_printer_button'])
self.labels['printers_box'] = self.create_box('printers', printbox)
options = self._config.get_configurable_options().copy()
options.append({"macros": {
"name": _("Displayed Macros"),
"type": "menu",
"menu": "macros"}
})
options.append({"printers": {
"name": _("Printer Connections"),
"type": "menu",
"menu": "printers"
}})
for option in options:
name = list(option)[0]
self.add_option('main', self.settings, name, option[name])
for macro in self._printer.get_config_section_list("gcode_macro "):
macro = macro[12:]
self.macros[macro] = {
"name": macro,
"section": "displayed_macros %s" % self._screen.connected_printer,
"type": "macro"
}
for macro in list(self.macros):
self.add_option('macros', self.macros, macro, self.macros[macro])
self.printers = {}
for printer in self._config.get_printers():
logging.debug("Printer: %s" % printer)
pname = list(printer)[0]
self.printers[pname] = {
"name": pname,
"section": "printer %s" % pname,
"type": "printer",
"moonraker_host": printer[pname]['moonraker_host'],
"moonraker_port": printer[pname]['moonraker_port'],
}
self.add_option("printers", self.printers, pname, self.printers[pname])
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, insert=None):
# 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)
if insert is not None:
box.pack_start(insert, False, False, 0)
box.pack_start(scroll, True, True, 0)
return box
def add_option(self, boxname, opt_array, opt_name, option):
if option['type'] == None:
return
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("resume",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'] == "dropdown":
dropdown = Gtk.ComboBoxText()
i = 0
for opt in option['options']:
dropdown.append(opt['value'], opt['name'])
if opt['value'] == self._config.get_config()[option['section']].get(opt_name, option['value']):
dropdown.set_active(i)
i += 1
dropdown.connect("changed", self.on_dropdown_change, option['section'], opt_name,
option['callback'] if "callback" in option else None)
#dropdown.props.relief = Gtk.ReliefStyle.NONE
dropdown.set_entry_text_column(0)
dev.add(dropdown)
logging.debug("Children: %s" % dropdown.get_children())
elif option['type'] == "scale":
val = int(self._config.get_config().get(option['section'], opt_name, fallback=option['value']))
adj = Gtk.Adjustment(val, option['range'][0], option['range'][1], option['step'], option['step']*5)
scale = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, adjustment=adj)
scale.set_hexpand(True)
scale.set_digits(0)
scale.connect("value-changed", self.scale_moved, option['section'], opt_name)
dev.add(scale)
elif option['type'] == "printer":
logging.debug("Option: %s" % option)
box = Gtk.Box()
box.set_vexpand(False)
label = Gtk.Label()
url = "%s:%s" % (option['moonraker_host'], option['moonraker_port'])
label.set_markup("<big>%s</big>\n%s" % (option['name'], url))
box.add(label)
dev.add(box)
elif option['type'] == "menu":
open = self._gtk.ButtonImage("settings",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)
frame.show_all()
opt_array[opt_name] = {
"name": option['name'],
"row": frame
}
opts = sorted(opt_array)
opts = sorted(list(opt_array), key=lambda x: opt_array[x]['name'])
pos = opts.index(opt_name)
self.labels[boxname].insert_row(pos)
self.labels[boxname].attach(opt_array[opt_name]['row'], 0, pos, 1, 1)
self.labels[boxname].show_all()
def load_menu(self, widget, name):
if ("%s_box" % name) not in self.labels:
return
for child in self.content.get_children():
self.content.remove(child)
self.menu.append('%s_box' % name)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def unload_menu(self, widget=None):
logging.debug("self.menu: %s" % self.menu)
if len(self.menu) <= 1 or self.menu[-2] not in self.labels:
return
self.menu.pop()
for child in self.content.get_children():
self.content.remove(child)
self.content.add(self.labels[self.menu[-1]])
self.content.show_all()
def on_dropdown_change(self, combo, section, option, callback=None):
tree_iter = combo.get_active_iter()
if tree_iter is not None:
model = combo.get_model()
value = model[tree_iter][1]
logging.debug("[%s] %s changed to %s" % (section, option, value))
self._config.set(section, option, value)
self._config.save_user_config_options()
if callback is not None:
callback(value)
def scale_moved(self, widget, section, option):
logging.debug("[%s] %s changed to %s" % (section, option, widget.get_value()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)
self._config.set(section, option, str(int(widget.get_value())))
self._config.save_user_config_options()
def switch_config_option(self, switch, gparam, section, option):
logging.debug("[%s] %s toggled %s" % (section, option, switch.get_active()))
if section not in self._config.get_config().sections():
self._config.get_config().add_section(section)
self._config.set(section, option, "True" if switch.get_active() else "False")
self._config.save_user_config_options()
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)
+98 -67
View File
@@ -1,67 +1,98 @@
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
def create_panel(*args):
return SplashScreenPanel(*args)
class SplashScreenPanel(ScreenPanel):
box = None
def __init__(self, screen, title, back=True):
super().__init__(screen, title, back)
self.layout = Gtk.Layout()
self.layout.set_size(self._screen.width, self._screen.height)
def initialize(self, panel_name):
_ = self.lang.gettext
image = self._gtk.Image("klipper.svg", None, 4, 4)
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)
box.set_size_request(self._screen.width, self._screen.height)
self.layout.put(box, 0, 0)
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['printer_select'] = self._gtk.ButtonImage("shuffle",_("Change Printer"))
self.labels['printer_select'].connect("clicked", self._screen.show_printer_select)
self.labels['menu'] = self._gtk.ButtonImage("settings",_("Menu"),"color4")
self.labels['menu'].connect("clicked", self._screen._go_to_submenu, "")
self.labels['power'] = self._gtk.ButtonImage("shutdown",_("Power On Printer"),"color3")
self.labels['restart'] = self._gtk.ButtonImage("refresh",_("Restart"),"color1")
self.labels['restart'].connect("clicked", self.restart)
self.labels['firmware_restart'] = self._gtk.ButtonImage("refresh",_("Firmware Restart"),"color2")
self.labels['firmware_restart'].connect("clicked", self.firmware_restart)
self.clear_action_bar()
devices = [i for i in self._printer.get_power_devices() if i.lower().startswith('printer')] if (
self._printer is not None) else []
logging.debug("Power devices: %s" % devices)
if len(devices) > 0:
logging.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'])
self.labels['actions'].add(self.labels['menu'])
if len(self._config.get_printers()) > 1:
self.labels['actions'].add(self.labels['printer_select'])
self.labels['actions'].show_all()
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()
+39 -22
View File
@@ -5,62 +5,79 @@ 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()
grid.set_row_homogeneous(False)
restart = KlippyGtk.ButtonImage('reboot','Klipper Restart','color1')
restart = self._gtk.ButtonImage('refresh',"\n".join(_('Klipper Restart').split(' ')),'color1')
restart.connect("clicked", self.restart_klippy)
firmrestart = KlippyGtk.ButtonImage('restart','Firmware Restart','color2')
firmrestart = self._gtk.ButtonImage('refresh',"\n".join(_('Firmware Restart').split(' ')),'color2')
firmrestart.connect("clicked", self.restart_klippy, "firmware")
back = KlippyGtk.ButtonImage('back', 'Back')
back.connect("clicked", self._screen._menu_go_back)
ks_restart = self._gtk.ButtonImage('refresh',"\n".join(_('Restart Klipper Screen').split(' ')))
ks_restart.connect("clicked", self.restart_ks)
reboot = self._gtk.ButtonImage('refresh',_('System\nRestart'),'color3')
reboot.connect("clicked", self._screen._confirm_send_action,
_("Are you sure you wish to reboot the system?"), "machine.reboot")
shutdown = self._gtk.ButtonImage('shutdown',_('System\nShutdown'),'color4')
shutdown.connect("clicked", self._screen._confirm_send_action,
_("Are you sure you wish to shutdown the system?"), "machine.shutdown")
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)
info.set_valign(Gtk.Align.CENTER)
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(info, 0, 0, 5, 2)
grid.attach(restart, 0, 2, 1, 1)
grid.attach(firmrestart, 1, 2, 1, 1)
grid.attach(back, 3, 2, 1, 1)
grid.attach(ks_restart, 2, 2, 1, 1)
grid.attach(reboot, 3, 2, 1, 1)
grid.attach(shutdown, 4, 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:
self._screen._ws.klippy.restart()
def restart_ks(self, widget):
os.system("sudo systemctl restart KlipperScreen")
+252 -236
View File
@@ -1,236 +1,252 @@
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
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 = Gtk.Grid()
eq_grid.set_hexpand(True)
eq_grid.set_vexpand(True)
self.heaters = []
i = 0
for x in self._printer.get_tools():
if i == 0:
primary_tool = x
self.labels[x] = self._gtk.ToggleButtonImage("extruder-"+str(i), self._gtk.formatTemperatureString(0, 0))
if i == 0:
self.labels[x].set_active(True)
self.heaters.append(x)
i += 1
self.labels[primary_tool].get_style_context().add_class('button_active')
add_heaters = self._printer.get_heaters()
for h in add_heaters:
if h == "heater_bed":
self.labels[h] = self._gtk.ButtonImage("bed", self._gtk.formatTemperatureString(0, 0))
else:
name = " ".join(h.split(" ")[1:])
self.labels[h] = self._gtk.ButtonImage("heat-up", name)
self.heaters.append(h)
i = 0
cols = 3 if len(self.heaters) > 4 else (1 if len(self.heaters) <= 2 else 2)
for h in self.heaters:
if not (h.startswith("temperature_sensor")):
self.labels[h].connect('clicked', self.select_heater, h)
eq_grid.attach(self.labels[h], i%cols, int(i/cols), 1, 1)
i += 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("hashtag", _("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()
numpad.set_direction(Gtk.TextDirection.LTR)
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] = self._gtk.ButtonImage("backspace")
elif keys[i][0] == "E":
self.labels[id] = self._gtk.ButtonImage("complete")
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('cancel', _('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
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")
)
for h in self._printer.get_heaters():
self.update_temp(h,
self._printer.get_dev_stat(h,"temperature"),
self._printer.get_dev_stat(h,"target"),
None if h == "heater_bed" else " ".join(h.split(" ")[1:])
)
return
def change_target_temp(self, widget, dir):
logging.debug("Dev stats %s: %s" % (self.active_heater, self._printer.get_dev_stats(self.active_heater)))
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.startswith("heater_generic "):
self._screen._ws.klippy.set_heater_temp(" ".join(self.active_heater.split(" ")[1:]), target)
elif self.active_heater == "heater_bed":
self._screen._ws.klippy.set_bed_temp(target)
else:
self._screen._ws.klippy.set_tool_temp(self._printer.get_tool_number(self.active_heater), target)
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.startswith('heater_generic '):
temp = int(text)
self._screen._ws.klippy.set_heater_temp(" ".join(self.active_heater.split(" ")[1:]), temp)
elif 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.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.set_tool_temp(self._printer.get_tool_number(self.active_heater), temp)
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)
+45 -37
View File
@@ -3,47 +3,51 @@ 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-farther',_("Raise Nozzle"))
zpos.connect("clicked", self.move, "+")
zneg = KlippyGtk.ButtonImage('z-offset-increase',"Lower Nozzle")
zneg = self._gtk.ButtonImage('z-closer',_("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].set_direction(Gtk.TextDirection.LTR)
self.labels[i].connect("clicked", self.change_distance, i)
ctx = self.labels[i].get_style_context()
if j == 0:
if (self._screen.lang_ltr and j == 0) or (not self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_top")
elif j == len(self.distances)-1:
elif (not self._screen.lang_ltr and j == 0) or (self._screen.lang_ltr and j == len(self.distances)-1):
ctx.add_class("distbutton_bottom")
else:
ctx.add_class("distbutton")
@@ -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'),'color4')
complete.connect("clicked", self.accept)
b = KlippyGtk.ButtonImage('back', 'Abort')
b = self._gtk.ButtonImage('cancel', _('Abort'),'color2')
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")
@@ -107,15 +115,15 @@ class ZCalibratePanel:
def move(self, widget, dir):
dist = str(self.distance) if dir == "+" else "-" + str(self.distance)
logger.info("# Moving %s", KlippyGcodes.probe_move(dist))
logging.info("# Moving %s", KlippyGcodes.probe_move(dist))
self._screen._ws.klippy.gcode_script(KlippyGcodes.probe_move(dist))
def abort(self, widget):
logger.info("Aborting Z calibrate")
logging.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")
logging.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
+629 -275
View File
File diff suppressed because it is too large. Load diff
+27 -15
View File
@@ -4,23 +4,17 @@ SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
KSPATH=$(sed 's/\/scripts//g' <<< $SCRIPTPATH)
KSENV="${HOME}/.KlipperScreen-env"
PKGLIST="xserver-xorg-video-fbturbo xdotool xinit xinput x11-xserver-utils python3-distutils python3-gi"
PKGLIST="${PKGLIST} python3-gi-cairo python3-virtualenv gir1.2-gtk-3.0 virtualenv matchbox-keyboard wireless-tools"
PKGLIST="${PKGLIST} libatlas-base-dev"
install_packages()
{
echo "Update package data"
sudo apt update
echo "Installing package dependencies"
sudo apt install -y \
xserver-xorg-video-fbturbo \
xinit \
xinput \
x11-xserver-utils \
python3-distutils \
python3-gi \
python3-gi-cairo \
python3-virtualenv \
gir1.2-gtk-3.0 \
virtualenv
sudo apt install -y $PKGLIST
}
create_virtualenv()
@@ -29,37 +23,55 @@ create_virtualenv()
[ ! -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/pip install --no-binary :all: "vext.gi==0.7.4"
${KSENV}/bin/vext -e
}
install_systemd_service()
{
if [ -f "/etc/systemd/system/KlipperScreen.service" ]; then
echo "KlipperScreen unit file already installed"
return
fi
echo "Installing KlipperScreen unit file"
SERVICE=$(<$SCRIPTPATH/KlipperScreen.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
}
modify_user()
{
sudo usermod -a -G tty $USER
}
update_x11()
{
echo "Updating X11 configuration"
sudo sed -i 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
if [ -e /etc/X11/Xwrapper.conf ]
then
echo "Updating X11 Xwrapper"
sudo sed -i 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
else
echo "Adding X11 Xwrapper"
echo 'allowed_users=anybody' | sudo tee /etc/X11/Xwrapper.config
fi
}
start_KlipperScreen() {
sudo systemctl start KlipperScreen
}
#install_packages
install_packages
create_virtualenv
modify_user
install_systemd_service
update_x11
start_KlipperScreen
+7 -5
View File
@@ -1,5 +1,7 @@
websocket==0.2.1
requests==2.24.0
vext==0.7.4
websocket-client==0.57.0
humanize==2.5.0
humanize==3.5.0
jinja2==2.11.3
matplotlib==3.4.1
netifaces==0.10.9
requests==2.25.1
vext==0.7.6
websocket-client==0.59.0
+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
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
IMGDIR=$SCRIPTPATH/../docs/img
for file in $IMGDIR/*
do
res=$(identify $file | cut -d ' ' -f 3)
if [ "$res" != "1532x898" ]; then
echo "Converting $file"
convert $file -crop 1532x898+2+48 $file
fi
done
+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()
+178
View File
@@ -0,0 +1,178 @@
#!/bin/bash
# KlipperScreen sudo fix. Modified from moonraker-sudo
# moonraker-sudo (mnrkrsudo)
# Provides a specified Group that is intended to elevate user privileges
# to help moonraker with sudo actions, if in CustomPIOS Images with
# Module "password-for-sudo".
#
# Partially used functions from Arcsine
#
# Copyright (C) 2020 Stephan Wendel <me@stephanwe.de>
#
# This file may be distributed under the terms of the GNU GPLv3 license
### Exit on Errors
set -e
### Configuration
SUDOERS_DIR='/etc/sudoers.d'
SUDOERS_FILE='021-sudo-for-klipperscreen'
NEW_GROUP='klipperscreensudo'
### Functions
verify_ready()
{
if [ "$EUID" -eq 0 ]; then
echo "This script must not run as root"
exit -1
fi
}
create_sudoers_file()
{
SCRIPT_TEMP_PATH=/tmp
report_status "Creating ${SUDOERS_FILE} ..."
sudo rm -f $SCRIPT_TEMP_PATH/$SUDOERS_FILE
sudo sed "s/GROUPNAME/$NEW_GROUP/g" > $SCRIPT_TEMP_PATH/$SUDOERS_FILE << '#EOF'
### Elevate moonraker API rights
### Do NOT allow Command Parts only Full Commands
### for example
###
### /sbin/systemctl "reboot", /sbin/apt "update", .....
Cmnd_Alias IWLIST = /sbin/iwlist wlan[0-9] scan
Cmnd_Alias IWCONFIG = /sbin/iwconfig wlan[0-9]
Cmnd_Alias SYSTEMCTL_KS_RESTART = /bin/systemctl restart KlipperScreen
%GROUPNAME ALL=(ALL) NOPASSWD: IWCONFGI, IWLIST, SYSTEMCTL_KS_RESTART
#EOF
report_status "\e[1;32m...done\e[0m"
}
update_env()
{
report_status "Export System Variable: DEBIAN_FRONTEND=noninteractive"
sudo /bin/sh -c 'echo "DEBIAN_FRONTEND=noninteractive" >> /etc/environment'
}
verify_syntax()
{
report_status "\e[1;33mVerifying Syntax of ${SUDOERS_FILE}\e[0m\n"
if [ $(LANG=C visudo -cf $SCRIPT_TEMP_PATH/$SUDOERS_FILE | grep -c "OK" ) -eq 1 ];
then
VERIFY_STATUS=0
report_status "\e[1;32m$(LANG=C visudo -cf $SCRIPT_TEMP_PATH/$SUDOERS_FILE)\e[0m"
else
report_status "\e[1;31mSyntax Error:\e[0m Check File: $SCRIPT_TEMP_PATH/$SUDOERS_FILE"
exit 1
fi
}
install_sudoers_file()
{
verify_syntax
if [ $VERIFY_STATUS -eq 0 ];
then
report_status "Copying $SCRIPT_TEMP_PATH/$SUDOERS_FILE to $SUDOERS_DIR/$SUDOERS_FILE"
sudo chmod 0440 $SCRIPT_TEMP_PATH/$SUDOERS_FILE
sudo cp --preserve=mode $SCRIPT_TEMP_PATH/$SUDOERS_FILE $SUDOERS_DIR/$SUDOERS_FILE
else
exit 1
fi
}
check_update_sudoers_file()
{
if [ -e "$SUDOERS_DIR/$SUDOERS_FILE" ];
then
create_sudoers_file
if [ -z $(sudo diff $SCRIPT_TEMP_PATH/$SUDOERS_FILE $SUDOERS_DIR/$SUDOERS_FILE) ]
then
report_status "No need to update $SUDOERS_DIR/$SUDOERS_FILE"
else
report_status "$SUDOERS_DIR/$SUDOERS_FILE needs to be updated."
install_sudoers_file
fi
fi
}
add_new_group()
{
sudo addgroup --system $NEW_GROUP &> /dev/null
report_status "\e[1;32m...done\e[0m"
}
add_user_to_group()
{
sudo usermod -aG $NEW_GROUP $USER &> /dev/null
report_status "\e[1;32m...done\e[0m"
}
adduser_hint()
{
report_status "\e[1;31mYou have to REBOOT to take changes effect!\e[0m"
}
# Helper functions
report_status()
{
echo -e "\n\n###### $1"
}
clean_temp()
{
sudo rm -f $SCRIPT_TEMP_PATH/$SUDOERS_FILE
}
### Main
verify_ready
if [ -e "$SUDOERS_DIR/$SUDOERS_FILE" ] && [ $(sudo cat /etc/gshadow | grep -c "${NEW_GROUP}") -eq 1 ] && [ $(groups | grep -c "$NEW_GROUP") -eq 1 ];
then
check_update_sudoers_file
report_status "\e[1;32mEverything is setup, nothing to do...\e[0m\n"
exit 0
else
if [ -e "$SUDOERS_DIR/$SUDOERS_FILE" ];
then
report_status "\e[1;32mFile exists:\e[0m ${SUDOERS_FILE}"
check_update_sudoers_file
else
report_status "\e[1;31mFile not found:\e[0m ${SUDOERS_FILE}\n"
create_sudoers_file
install_sudoers_file
fi
if [ $(sudo cat /etc/gshadow | grep -c "${NEW_GROUP}") -eq 1 ];
then
report_status "Group ${NEW_GROUP} already exists..."
else
report_status "Group ${NEW_GROUP} will be added..."
add_new_group
fi
if [ $(groups | grep -c "$NEW_GROUP") -eq 1 ];
then
report_status "User ${USER} is already in $NEW_GROUP..."
else
report_status "Adding User ${USER} to Group $NEW_GROUP..."
add_user_to_group
adduser_hint
fi
fi
update_env
clean_temp
exit 0
+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 --no-location --sort-output \
-o ks_includes/locales/KlipperScreen.pot \
*.py \
ks_includes/*.py \
panels/*.py \
ks_includes/KlipperScreen.conf
langs=(de_DE en fr_FR he_IL ru_RU 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;
}
+65
View File
@@ -0,0 +1,65 @@
<?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"
width="64"
height="64"
viewBox="0 0 63.999997 64"
id="svg4160"
version="1.1"
sodipodi:docname="arrow-down.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview8"
showgrid="false"
inkscape:zoom="7.4010512"
inkscape:cx="31.760514"
inkscape:cy="33.021137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer2"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid832" />
</sodipodi:namedview>
<defs
id="defs4162" />
<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 />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer2"
style="display:inline;stroke:none"
transform="translate(-3.5328446,2.2636422)">
<path
id="rect852"
style="opacity:0.998;fill:#fdf6e3;stroke:none;stroke-width:1.99999;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;font-variation-settings:normal;vector-effect:none;fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stop-color:#000000;stop-opacity:1"
d="m 48.844942,33.511174 c 0,0.511239 -0.196153,1.022326 -0.58789,1.414063 l -8.486328,8.484375 -2.828126,2.830078 c -0.783474,0.783474 -2.04465,0.783474 -2.828124,0 L 31.286348,43.409612 22.80002,34.925237 c -0.783474,-0.783474 -0.783474,-2.044651 0,-2.828125 l 2.828125,-2.828125 c 0.783475,-0.783474 2.046604,-0.783474 2.830079,0 l 2.070312,2.070312 V 14.653752 c 0,-1.107999 0.892,-2 2,-2 h 6 c 1.108,10e-7 2,0.892002 2,2 v 16.685547 l 2.070312,-2.070312 c 0.783475,-0.783474 2.046604,-0.783474 2.830079,0 l 2.828125,2.828126 c 0.391737,0.391737 0.58789,0.902824 0.58789,1.414061 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+65
View File
@@ -0,0 +1,65 @@
<?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"
width="64"
height="64"
viewBox="0 0 63.999997 64"
id="svg4160"
version="1.1"
sodipodi:docname="arrow-left.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview8"
showgrid="false"
inkscape:zoom="7.4010512"
inkscape:cx="31.760514"
inkscape:cy="33.021137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer2"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid832" />
</sodipodi:namedview>
<defs
id="defs4162" />
<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 />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer2"
style="display:inline;stroke:none"
transform="translate(-3.5328446,2.2636422)">
<path
id="rect852"
style="opacity:0.998;fill:#fdf6e3;stroke:none;stroke-width:1.99999;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;font-variation-settings:normal;vector-effect:none;fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stop-color:#000000;stop-opacity:1"
d="m 31.758028,16.42426 c -0.511239,0 -1.022326,0.196153 -1.414063,0.58789 l -8.484375,8.486328 -2.830078,2.828126 c -0.783474,0.783474 -0.783474,2.04465 0,2.828124 l 2.830078,2.828126 8.484375,8.486328 c 0.783474,0.783474 2.044651,0.783474 2.828125,0 l 2.828125,-2.828125 c 0.783474,-0.783475 0.783474,-2.046604 0,-2.830079 L 33.929903,34.740666 H 50.61545 c 1.108,0 2,-0.892 2,-2 v -6 c -1e-6,-1.108 -0.892001,-2 -2,-2 H 33.929903 l 2.070312,-2.070312 c 0.783474,-0.783475 0.783474,-2.046604 0,-2.830079 L 33.17209,17.01215 c -0.391737,-0.391737 -0.902824,-0.58789 -1.414062,-0.58789 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+65
View File
@@ -0,0 +1,65 @@
<?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"
width="64"
height="64"
viewBox="0 0 63.999997 64"
id="svg4160"
version="1.1"
sodipodi:docname="arrow-right.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview8"
showgrid="false"
inkscape:zoom="7.4010512"
inkscape:cx="31.760514"
inkscape:cy="33.021137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer2"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid832" />
</sodipodi:namedview>
<defs
id="defs4162" />
<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 />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer2"
style="display:inline;stroke:none"
transform="translate(-3.5328446,2.2636422)">
<path
id="rect852"
style="opacity:0.998;fill:#fdf6e3;stroke:none;stroke-width:1.99999;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;font-variation-settings:normal;vector-effect:none;fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stop-color:#000000;stop-opacity:1"
d="m 39.307661,16.42426 c 0.511239,0 1.022326,0.196153 1.414063,0.58789 l 8.484375,8.486328 2.830078,2.828126 c 0.783474,0.783474 0.783474,2.04465 0,2.828124 l -2.830078,2.828126 -8.484375,8.486328 c -0.783474,0.783474 -2.044651,0.783474 -2.828125,0 l -2.828125,-2.828125 c -0.783474,-0.783475 -0.783474,-2.046604 0,-2.830079 l 2.070312,-2.070312 H 20.450239 c -1.108,0 -2,-0.892 -2,-2 v -6 c 1e-6,-1.108 0.892001,-2 2,-2 h 16.685547 l -2.070312,-2.070312 c -0.783474,-0.783475 -0.783474,-2.046604 0,-2.830079 l 2.828125,-2.828125 c 0.391737,-0.391737 0.902824,-0.58789 1.414062,-0.58789 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+65
View File
@@ -0,0 +1,65 @@
<?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"
width="64"
height="64"
viewBox="0 0 63.999997 64"
id="svg4160"
version="1.1"
sodipodi:docname="arrow-up.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview8"
showgrid="false"
inkscape:zoom="7.4010512"
inkscape:cx="31.760514"
inkscape:cy="33.021137"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer2"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid832" />
</sodipodi:namedview>
<defs
id="defs4162" />
<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 />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer2"
style="display:inline;stroke:none"
transform="translate(-3.5328446,2.2636422)">
<path
id="rect852"
style="opacity:0.998;fill:#fdf6e3;stroke:none;stroke-width:1.99999;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;font-variation-settings:normal;vector-effect:none;fill-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stop-color:#000000;stop-opacity:1"
d="m 22.220747,25.961541 c 0,-0.511239 0.196153,-1.022326 0.58789,-1.414063 l 8.486328,-8.484375 2.828126,-2.830078 c 0.783474,-0.783474 2.04465,-0.783474 2.828124,0 l 2.828126,2.830078 8.486328,8.484375 c 0.783474,0.783474 0.783474,2.044651 0,2.828125 l -2.828125,2.828125 c -0.783475,0.783474 -2.046604,0.783474 -2.830079,0 l -2.070312,-2.070312 v 16.685547 c 0,1.108 -0.892,2 -2,2 h -6 c -1.108,-10e-7 -2,-0.892001 -2,-2 V 28.133416 l -2.070312,2.070312 c -0.783475,0.783474 -2.046604,0.783474 -2.830079,0 l -2.828125,-2.828125 c -0.391737,-0.391737 -0.58789,-0.902824 -0.58789,-1.414062 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+86
View File
@@ -0,0 +1,86 @@
<?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"
width="64"
height="64"
viewBox="0 0 63.999997 64"
id="svg4160"
version="1.1"
sodipodi:docname="back.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<sodipodi:namedview
pagecolor="#bfbfbf"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview8"
showgrid="false"
inkscape:zoom="7.4010512"
inkscape:cx="31.760514"
inkscape:cy="31.11819"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="g861"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid832" />
</sodipodi:namedview>
<defs
id="defs4162" />
<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
id="layer2"
style="display:inline;stroke:none"
transform="translate(-3.5328446,2.2636422)">
<g
id="g861"
transform="matrix(1.5,0,0,1.5,-11.429726,-11.868178)"
style="fill:#eee8d5;stroke-width:0.666667">
<rect
style="opacity:0.998;fill:#eee8d5;stroke-width:1.33333;stroke-linecap:round;stroke-linejoin:round"
id="rect854"
width="20"
height="8"
x="-4.4741983"
y="34.750935"
rx="1.3333334"
ry="1.3333334"
transform="rotate(-45)" />
<rect
style="opacity:0.998;fill:#eee8d5;stroke-width:1.33333;stroke-linecap:round;stroke-linejoin:round"
id="rect856"
width="20"
height="8"
x="34.750935"
y="-4.4741983"
rx="1.3333334"
ry="1.3333334"
transform="matrix(0.70710678,0.70710678,0.70710678,-0.70710678,0,0)" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

+90
View File
@@ -0,0 +1,90 @@
<?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"
width="64"
height="64"
viewBox="0 0 63.999997 64"
id="svg4160"
version="1.1"
sodipodi:docname="backspace.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview8"
showgrid="true"
inkscape:zoom="5.2333335"
inkscape:cx="18.847826"
inkscape:cy="23.569119"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="layer2"
inkscape:document-rotation="0">
<inkscape:grid
type="xygrid"
id="grid832" />
</sodipodi:namedview>
<defs
id="defs4162" />
<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
id="layer2"
style="display:inline;stroke:none"
transform="translate(-3.5328446,2.2636422)">
<g
id="g837"
transform="translate(2.0000002,2)">
<path
id="rect838"
style="opacity:0.998;fill:#fdf6e3;fill-opacity:1;stroke:#fdf6e3;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"
d="m 8.532829,27.736358 16,19 h 34 V 8.7363577 h -34 z"
sodipodi:nodetypes="cccccc" />
<rect
style="opacity:0.998;fill:#073642;stroke-width:1.99999;stroke-linecap:round;stroke-linejoin:round"
id="rect852"
width="30"
height="10"
x="-8.0728378"
y="41.152298"
rx="2"
ry="2"
transform="rotate(-45)" />
<rect
style="display:inline;opacity:0.998;fill:#073642;stroke:none;stroke-width:1.99999;stroke-linecap:round;stroke-linejoin:round"
id="rect852-6"
width="30"
height="10"
x="-61.152298"
y="-11.92716"
rx="2"
ry="2"
transform="matrix(-0.70710678,-0.70710678,-0.70710678,0.70710678,0,0)" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

+83
View File
@@ -0,0 +1,83 @@
<?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"
width="64"
height="64"
viewBox="0 0 64 64"
version="1.1"
id="svg17"
sodipodi:docname="bed-level-b-l.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<metadata
id="metadata23">
<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>bed-level-b-l</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs21" />
<sodipodi:namedview
pagecolor="#bfbfbf"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="837"
id="namedview19"
showgrid="false"
inkscape:pagecheckerboard="false"
inkscape:zoom="6.4410258"
inkscape:cx="32.901639"
inkscape:cy="34.055387"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg17"
inkscape:document-rotation="0" />
<!-- Generator: Sketch 52.5 (67469) - http://www.bohemiancoding.com/sketch -->
<title
id="title2">bed-level-b-l</title>
<desc
id="desc4">Created with Sketch.</desc>
<g
id="g886"
transform="translate(-6.5619787,-0.3922527)">
<g
id="Oval"
style="opacity:1;stroke:none;stroke-width:4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#fdf6e3;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="m 32.253906,35.222656 c -3.215114,6e-5 -5.821627,2.648543 -5.822265,5.916016 -4.23e-4,3.268236 2.606401,5.917909 5.822265,5.917969 3.215865,-5.9e-5 5.822689,-2.649733 5.822266,-5.917969 -6.38e-4,-3.267474 -2.607152,-5.915957 -5.822266,-5.916016 z"
id="path872" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#fdf6e3;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="m 32.253906,33.222656 c -4.313438,8e-5 -7.821419,3.585136 -7.822265,7.916016 -5.61e-4,4.331872 3.50784,7.917888 7.822265,7.917969 4.314427,-8e-5 7.822826,-3.586097 7.822266,-7.917969 -8.46e-4,-4.33088 -3.508827,-7.915936 -7.822266,-7.916016 z m 0,4 c 2.11679,3.9e-5 3.821835,1.711949 3.822266,3.916016 2.85e-4,2.2046 -1.704962,3.91793 -3.822266,3.917969 -2.117303,-4e-5 -3.822551,-1.713369 -3.822265,-3.917969 4.3e-4,-2.204067 1.705476,-3.915976 3.822265,-3.916016 z"
id="path874" />
</g>
<path
style="fill:none;stroke:#fdf6e3;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 61.194389,55.061809 45.78223,55.235844 39.103627,61.32707 H 16.670372 L 16.499126,27.216205 26.431407,16.077963 V 3.0253363"
id="path877" />
<path
style="fill:none;stroke:#fdf6e3;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 47.494692,2.8513013 61.194389,16.948138"
id="path879"
sodipodi:nodetypes="cc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.0 KiB

Loaded 100 of 256 files, more files were not shown because too many files have changed in this diff. Show more