Compare commits

..
9 Commits
Author SHA1 Message Date
Alfredo Monclus 0a9180d482 Graph (#357)
* Add theme graph colors

* Fix graph not applying colors
2021-12-07 20:56:32 -05:00
Jordan e1fcfdc9c7 Main menu hide 'set temp' for devices that don't have a heater. 2021-12-06 19:30:02 -05:00
Jordan c37acb5c00 Fix graph error and make colors configurable 2021-12-05 20:35:37 -05:00
Jordan 8f71eb7ca8 Create keypad widget and include set temp on the main menu 2021-12-04 15:13:31 -05:00
Jordan e9ed33c580 Move graph location 2021-12-04 15:11:16 -05:00
Jordan bf76132a0f graph: Add ability to hide/show sensors. 2021-12-04 15:11:16 -05:00
Alfredo Monclus df32787dc0 tweaks (#291) 2021-12-04 15:11:16 -05:00
Jordan 7ffc394366 Updates to graphing.
Modify heaters to show only ones available in the temp store. Add 
ability to hide/show heaters.
2021-12-04 15:11:16 -05:00
Jordan 44c417bc85 Adding graph capability to main menu 2021-12-04 15:11:16 -05:00
327 changed files with 10877 additions and 35435 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: klipperscreen
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']
-54
View File
@@ -1,54 +0,0 @@
name: Bug report
description: Create a report to help us improve
title: "[BUG] <title>"
labels: 'bug'
body:
- type: markdown
attributes:
value: >-
## Thank you for choosing KlipperScreen
This is a bug report, If you need general support, please visit us on [Discord](https://discord.klipper3d.org/)
#### The LOG file is REQUIRED. Without the logfile your issue will be closed
if you need help to find the log file:
Read the [Documentation](https://klipperscreen.readthedocs.io/en/latest/Troubleshooting/)
#### This is an Open Source project developed voluntarily, there are no Warranties, or ETA.
[License](https://github.com/KlipperScreen/KlipperScreen/blob/master/LICENSE)
- type: textarea
id: what-happened
attributes:
label: 'What happened?'
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: 'What did you expect to happen instead?'
description: A clear and concise description of what you expected to happen instead.
validations:
required: true
- type: textarea
id: repro-steps
attributes:
label: 'How to reproduce this bug?'
description: A clear and concise description with precise steps to reproduce this bug.
validations:
required: true
- type: textarea
id: additional-info
attributes:
label: 'Additional information:'
description: Any additional info, screenshots or recordings which help to describe the issue.
- type: textarea
id: logs
attributes:
label: Log output
description: Please attach the FULL klipperscreen.log and if needed xorg.log or the tail of journalctl.
render: shell
validations:
required: true
-8
View File
@@ -1,8 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Klipper Discord Server
url: https://discord.klipper3d.org/
about: If you have questions or need general support.
- name: KlipperScreen Discussions
url: https://github.com/KlipperScreen/KlipperScreen/discussions
about: If you have questions or need general support.
@@ -1,44 +0,0 @@
name: Feature request
description: Suggest an idea for this project
title: "[FR] <title>"
body:
- type: markdown
attributes:
value: >-
## Thank you for choosing KlipperScreen
This form is for feature requests of KlipperScreen
Requesting a feature does not mean it will be worked on, it's taken as a suggestion.
#### This is an Open Source project developed voluntarily, there are no Warranties, or ETA.
[License](https://github.com/KlipperScreen/KlipperScreen/blob/master/LICENSE)
- type: textarea
id: solution
attributes:
label: 'Requested feature'
description: A clear and concise description of what you want.
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: 'Is your feature request related to a problem?'
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: false
- type: textarea
id: alternative
attributes:
label: 'Describe alternatives you have considered'
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
id: info
attributes:
label: 'Additional information'
description: Add any other context drawings or screenshots about the feature.
validations:
required: false
-82
View File
@@ -1,82 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '32 21 * * 5'
jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
+2 -2
View File
@@ -2,7 +2,7 @@ name: test-code
on: [push, pull_request]
jobs:
lint-python-code:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: ricardochaves/python-lint@v1.4.0
@@ -14,4 +14,4 @@ jobs:
use-black: false
use-mypy: false
use-isort: false
extra-pycodestyle-options: "--ignore=E402,W503,W504 --max-line-length=120 --max-doc-length=120"
extra-pycodestyle-options: "--ignore=E226,E301,E302,E303,E402,W503,W504 --max-line-length=120 --max-doc-length=120"
-8
View File
@@ -1,8 +0,0 @@
.idea/
KlipperScreen.conf
__pycache__/
*.py[cod]
*$py.class
dist/
build/
venv/
-15
View File
@@ -1,15 +0,0 @@
# Read the Docs configuration file for MkDocs projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
mkdocs:
configuration: mkdocs.yml
# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
+6 -25
View File
@@ -1,34 +1,15 @@
# KlipperScreen
KlipperScreen is a touchscreen GUI that interfaces with [Klipper](https://github.com/kevinOConnor/klipper) via [Moonraker](https://github.com/arksine/moonraker). It can switch between multiple printers to access them from a single location, and it doesn't even need to run on the same host, you can install it on another device and configure the IP address to access the printer.
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).
### Documentation [![Documentation Status](https://readthedocs.org/projects/klipperscreen/badge/?version=latest)](https://klipperscreen.readthedocs.io/en/latest/?badge=latest)
Multiple printers update is here! Please check the configuration information for specifying several printers.
### Documentation
[Click here to access the documentation.](https://klipperscreen.readthedocs.io/en/latest/)
Screenshots are included in the documentation.
### 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).
[![Main Menu](docs/img/panels/main_panel.png)](https://klipperscreen.readthedocs.io/en/latest/Panels/)
[More Screenshots](https://klipperscreen.readthedocs.io/en/latest/Panels/)
### About the project
KlipperScreen has been created and maintained by Jordan Ruthe from 2020 to 2021
|Donate to Jordan|
|-|
|[Patreon](https://www.patreon.com/klipperscreen)|
|[Ko-fi](https://ko-fi.com/klipperscreen)|
The current maintainer is Alfredo Monclus (alfrix) from 2021 onwards
|Dontate to Alfrix|
|-|
|[Ko-fi](https://ko-fi.com/alfrix)|
thanks to all the people who helped along the way.
[Contributors](https://github.com/KlipperScreen/KlipperScreen/graphs/contributors)
-106
View File
@@ -1,106 +0,0 @@
# Android
This article describes how to use KlipperScreen from an android device
!!! warning
The experience may not be equal to run KlipperScreen natively.
Depending on the device or the network you may encounter performance degradation or other issues.
!!! bug
Some [users have found](https://github.com/KlipperScreen/KlipperScreen/issues/862) that using this method causes memory-leaks
1. [First installl KlipperScreen on the Pi](Installation.md)
2. Install [XServer-XSDL](https://play.google.com/store/apps/details?id=x.org.server) on the android device
3. Choose [USB(ADB)](#adb) or [WIFI](#wifi)
### ADB
!!! warning
Leaving the phone always connected it's not recommended, remove the battery to avoid issues.
* Install ADB on the Pi
```bash
sudo apt-get install android-tools-adb
```
* Put your Android phone/tablet in Debug mode.
Usually it involves enabling developer mode and "USB debugging" but this varies on different vendors and versions of the device
search "how to enable android debugging on device-model-and-brand"
* Copy the launcher script
```bash
cd ~/KlipperScreen/scripts
cp sample-android-adb.sh launch_KlipperScreen.sh
chmod +x launch_KlipperScreen.sh
```
* Go to [Startup](#startup)
### WIFI
* Create a launcher script
```bash
cd ~/KlipperScreen/scripts
touch launch_KlipperScreen.sh
chmod +x launch_KlipperScreen.sh
nano launch_KlipperScreen.sh
```
* Paste this into the script (replace the example IP)
```bash
DISPLAY=192.168.150.122:0 $KS_XCLIENT
```
!!! important
It's recommended to use a static address, because if the address changes your connection will stop working.
* Go to [Startup](#startup)
## Startup
Start Xserver-XSDL On the android device
On the splash-screen of the app go to:
```
“CHANGE DEVICE CONFIGURATION”
└──Mouse Emulation Modde
└──Desktop, No Emulation
```
if you missed it, restart the app.
on the Pi
```bash
sudo service KlipperScreen stop
sudo service KlipperScreen start
```
## Stop Screen Blanking in Xserver-XSDL
Even after enabling the "Stay Awake" option in the Developer/USB Debugging options of your Android device, the Xserver-XSDL may still go to a black screen but keep the backlight of your device on. To keep the screen always active, upon start up of Xserver-XSDL app, select the `Change Device Configuration` at the top of the splash screen and then select the `Command line parameters, one argument per line` option. Append the following argument (must be on seperate lines):
```
-s
0
```
This will disable the screen-saver in Xserver and keep KlipperScreen always active.
## Migration from other tutorials
KlipperScreen says error option "service" is not supported anymore.
Stop the other service and Remove it, for example if the service is `KlippyScreenAndroid`:
```bash
sudo service KlippyScreenAndroid stop
sudo rm /etc/systemd/system/KlippyScreenAndroid.service
```
Follow this guide on how to setup the new launcher script with [USB(ADB)](#adb) or [WIFI](#wifi) and restart KS.
## Help
[The Discourse thread has old instructions but you may get some help if needed](https://klipper.discourse.group/t/how-to-klipperscreen-on-android-smart-phones/1196)
[#klipper-screen channel on Discord](https://discord.klipper3d.org/)
-27
View File
@@ -1,27 +0,0 @@
# Changelog
Breaking changes will be listed here.
#### [2022 03 21](https://github.com/jordanruthe/KlipperScreen/commit/bc34b3c8d6761c27a0b0c62fc4dfa11442b417f6)
* Default configuration is now merged again.
Fixing [2021 05 20](https://github.com/jordanruthe/KlipperScreen/commit/eb801486928bf02709033dcbc5f0a45ca43b23c1)
#### [2022 03 10](https://github.com/jordanruthe/KlipperScreen/commit/490dc929bd11e3c4200b999ce7204d84fa0bc184)
* The "Power On Printer" button now requires power_devices under the printer section in KlipperScreen.conf
the power_devices allowed are those defined in the config of moonraker of the printer
The "Power" panel will be in the Menu if there are power devices found
#### [2022 03 01](https://github.com/jordanruthe/KlipperScreen/commit/49ab84e8d51535d3469d97fdee53099cca6abc39)
* The "Power On Printer" button now requires that the printer name in KlipperScreen.conf
and the power device in moonraker.conf to have the same name.
The "Power" panel will be in the Menu if there are power devices found
#### [2022 01 11](https://github.com/jordanruthe/KlipperScreen/commit/8a8c6c064cc6d097b1b34a5c42b4001367e545a6)
* The Preheat panel has been deprecated in favor of an all in one Temperature panel
Remove preheat panel from your Klipperscreen.conf or replace the occurrences of preheat with temperature
#### [2021 05 20](https://github.com/jordanruthe/KlipperScreen/commit/eb801486928bf02709033dcbc5f0a45ca43b23c1)
* Default configuration is not merged if a user configuration is set for a specific option
For instance, if `menu __main` is user defined, the main menu will not have any defaults.
+42 -129
View File
@@ -1,160 +1,90 @@
# Configuration
Usually you don't need to create a configuration file, but if you need to change something that is not changeable in the UI
create a blank file in `~/printer_data/config/KlipperScreen.conf`, if the file already exist then just edit it.
Write in the file only the options that need to be changed, and restart KlipperScreen.
!!! failure "Critical"
Each configuration option should be on a newline, as they are presented here.
The line endings should be of UNIX style (LF).
Create a blank file in `~/klipper_config/KlipperScreen.conf_`, if the file already exist then just edit it.
Write in the file only the options that need to be changed.
## Include files
```ini
```
[include conf.d/*.conf]
# Include another configuration file. Wildcards (*) will expand to match anything.
```
## Main Options
The options listed here are not changeable from within the ui.
```ini
```
[main]
# Time in seconds before the Job Status page closes itself after a successful job/print
# 0 means disabled
job_complete_timeout: 0
# Invert axis in move panel. Default is False. Change to true to invert
invert_x: False
invert_y: False
invert_z: False
# Time in seconds before the Job Status closes itself if an error is encountered
# 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
# Specify the language
# The language can be specified here instead of using the system default language.
language: en
# Allows the cursor to be displayed on the screen
show_cursor: False
# If multiple printers are defined, this can be set the name of the one to show at startup.
default_printer: Ender 3 Pro
# To define a full set of custom menues (instead of merging user entries with default entries)
# set this to False. See Menu section below.
use_default_menu: True
# Define one or more moonraker power devices that turn on/off with the screensaver (CSV list)
screen_on_devices: example1, example2
screen_off_devices: example1, example2
```
## Printer Options
Multiple printers can be defined
```ini
```
# 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
# ports 443 and 7130 will use https/wss
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
```
# Override the movement speed and set a specific for this printer.
# These setting overrides the settings configured in the UI. If specified,
# the values configured in the UI will not be used.
move_speed_xy: 500
move_speed_z: 300
# Define one or more moonraker power devices that turn on this printer (CSV list)
# Default is the printer name
power_devices: example1, example2
# Define what items should be shown in titlebar besides the extruder and bed
# the name must be the same as defined in the klipper config
# valid options are temperature_sensors or temperature_fans, or heater_generic
titlebar_items: chamber, MCU, Pi
# The style of the user defined items in the titlebar
# Can be 'full' indicating that the full name is shown, 'short' for the first letter, or None (default) for no name
titlebar_name_type: None
# Z probe calibrate position
# By default is the middle of the bed
## Z probe calibrate Option
If for any reason the XYZ home position is not suitable for calibrating the probe Z offset, you can enter the coordinates for the desired position here.
```
[z_calibrate_position]
# The specified positions must be> 0 otherwise this option is ignored.
# the center of the print bed is a good value
calibrate_x_position: 100
calibrate_y_position: 100
# Bed Screws
# define the screw positons required for odd number of screws in a comma separated list
# possible values are: bl, br, bm, fl, fr, fm, lm, rm, center
# they correspond to back-left, back-right, back-middle, front-left, front-right, front-middle, left-middle, right-middle
# example:
screw_positions: bl, br, fm
# Rotation is useful if the screen is not directly in front of the machine.
# Valid values are 0 90 180 270
screw_rotation: 0
# Define distances and speeds for the extrude panel. CSV list 2 to 4 integers
extrude_distances: 5, 10, 15, 25
extrude_speeds: 1, 2, 5, 25
# Camera needs to be configured in moonraker:
# https://moonraker.readthedocs.io/en/latest/configuration/#webcam
```
## Preheat Options
!!! question "Added one the others disappeared, Is this normal?"
Adding a custom preheat section will cause the defaults to not load, this is
the intended behaviour.
```ini
```
[preheat my_temp_setting]
# Temperature for the heated bed
bed: 40
# Temperature for the tools
extruder: 195
extruder1: 60
heater_bed: 40
# Use the name
chamber: 60
# or the full name
heater_generic chamber: 60
# or for example apply the same temp to devices of the same type
temperature_fan: 40
heater_generic: 60
# Temperature for generic heaters
heater_generic: 40
# optional GCode to run when the option is selected
gcode: MY_HEATSOAK_MACRO
```
There is a special preheat setting named cooldown to do additional things when the _cooldown_ button is pressed
for example:
```ini
[preheat cooldown]
gcode: M107
```
## 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. 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.
!!! info
A predefined set of menus is already provided and it's recommended to be used
A menu item is configured as follows:
```ini
```
[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
# Optional Parameters
#
# Icon name to be used, it can be any image in the directory:
# KlipperScreen/styles/{theme}/images/ where {theme} is your current theme
# Supported formats svg or png
icon: home
# Icon style, defined as "button.mycolor4" (for example) in the theme css
style: mycolor4
# Optional Parameters
# Panel from the panels listed below
panel: preheat
# Moonraker method to call when the item is selected
@@ -165,36 +95,21 @@ params: {"script":"G28 X"}
# Available variables are listed below.
enable: {{ printer.power_devices.count > 0 }}
```
Available panels are listed here: [docs/panels.md](Panels.md)
Available panels are listed here: [docs/panels.md](panels.md)
Certain variables are available for conditional testing of the enable statement:
```ini
printer.extruders.count # Number of extruders
printer.temperature_devices.count # Number of temperature related devices that are not extruders
printer.fans.count # Number of fans
printer.power_devices.count # Number of power devices configured in Moonraker
printer.gcode_macros.count # Number of gcode macros
printer.output_pins.count # Number of fans
```
printer.bltouch # Available if bltouch section defined in config
printer.probe # Available if probe section defined in config
printer.bed_mesh # Available if bed_mesh section defined in config
printer.quad_gantry_level # Available if quad_gantry_level section defined in config
printer.z_tilt # Available if z_tilt section defined in config
printer.firmware_retraction # True if defined in config
printer.input_shaper # True if defined in config
printer.bed_screws # True if defined in config
printer.screws_tilt_adjust # True if 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:
```ini
```
[menu __main homing]
name: Homing
icon: home
@@ -222,15 +137,13 @@ KlipperScreen will search for a configuration file in the following order:
1. _~/KlipperScreen.conf_
2. _${KlipperScreen_Directory}/KlipperScreen.conf_
3. _~/printer_data/config/KlipperScreen.conf_
4. _~/klipper_config/KlipperScreen.conf_
3. _~/klipper_config/KlipperScreen.conf_
If you need a custom location for the configuration file, you can add -c or --configfile to the systemd file and specify
the location of your configuration file.
If one of those files are found, it will be merged with the default configuration.
Default Preheat options will be discarded if a custom preheat is found.
If include files are defined then, they will be merged first.
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: (do not edit use as reference)
_${KlipperScreen_Directory}/ks_includes/default.conf_
+6 -16
View File
@@ -1,23 +1,13 @@
# Contact
There are several ways to contact people who can assist with issues.
Discord is probably going to provide the quickest response as there are more people in the chat who can help.
There are several ways to contact people who can assist with issues. Discord is going to be the quickest response as
there will be more people in the chat who can help.
## GitHub Issues
You may submit a GitHub issue request for any problems you are having.
## Klipper Community Discord
[Look for the channel `#klipper-screen`](https://discord.klipper3d.org/)
The invite link: https://discord.klipper3d.org/
## Issues or improvements to the docs or the application
You may submit a GitHub issue request for any bugs you encounter.
or a Pull Request with translations, features, doc fixes.
or open an issue describing the changes.
or even provide ideas for a feature.
[Github repository](https://github.com/KlipperScreen/KlipperScreen/)
Look for the channel `#klipper-screen`
-59
View File
@@ -1,59 +0,0 @@
# Developer Guide
Basic setup for an enviroment to do development of KlipperScreen.
!!! note "Alfrix Note:"
I use a standard Linux distro with a desktop enviroment.
## Clone the repo
Clone your fork, for example:
```
cd ~
git clone https://github.com/klipperscreen/klipperscreen.git
```
## Install the dependencies on the host
The X11 or Wayland dependencies should not be needed if you are running a desktop GNU/Linux distro.
See [scripts/system-dependencies.json](https://github.com/KlipperScreen/KlipperScreen/blob/master/scripts/system-dependencies.json)
## Create a virtual environment
For example:
```bash
virtualenv -p /usr/bin/python3 ~/.KlipperScreen-env
source ~/.KlipperScreen-env/bin/activate
cd ~/KlipperScreen
pip install -r scripts/klipperscreen-requirements.txt
```
# Set configurations
Create klipperscreen.conf and place it on the repo folder
```
[main]
show_cursor=True
# disable screen timeouts
use_dpms=False
screen_blanking=off
# disable Fullscreen and start in a specified size
# 480 x 320 is the minimum size to target
width=480
height=320
# setting width or height will disable fullscreen and it's the intended behavior
```
At this point you can add your actual printer section with the IP (and port of needed) to the config or/and add a virtual printer
# Optional: Virtual printer
You may use a virtual printer like it's described in the [klipper docs](https://www.klipper3d.org/Debugging.html#testing-with-simulavr),
or it's [alternative that uses docker](https://github.com/mainsail-crew/virtual-klipper-printer)
Using a Virtual printer will need klipper and moonraker need to be installed in the machine too.
!!! note
The virtual printer has various limitations,
like constant temperature and limited availability of pins,
it's not a limitation of klipperscreen
## Optional: Configure the IDE
* Set interpreter to the virtual environment created
* Set the run configuration to `KlipperScreen/screen.py`
+50 -96
View File
@@ -1,127 +1,81 @@
# Hardware
There are no recommended screens, but the minimum supported resolution is 480x320.
There are no recommended screens, but here are some guidelines:
In general, if the device can show a GNU/Linux desktop, then KlipperScreen should work too.
* There is no support for vertical/portrait mode, only widescreen
* Minimum resolution of 480x320
#### Hardware known to work
* [BTT PI TFT50](https://www.biqu.equipment/collections/lcd/products/bigtreetech-pi-tft50-v1-0-tft-display-for-raspberry-pi-3d-printer-part)
* [BTT HDMI5/7](https://biqu.equipment/products/bigtreetech-hdmi5-v1-0-hdmi7-v1-0)
* [Raspberry PI 7" Touchscreen](https://www.raspberrypi.org/products/raspberry-pi-touch-display/)
* [Hyperpixel 4](https://shop.pimoroni.com/products/hyperpixel-4)
* [3.5" Elegoo](https://www.elegoo.com/de/products/elegoo-3-5-inch-tft-lcd-screen)
* [3.5" RPi Display](http://www.lcdwiki.com/3.5inch_RPi_Display)
* [5" HDMI Display-B](http://lcdwiki.com/5inch_HDMI_Display-B)
* [VoCore](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35/7)
* [Android Phone](https://klipper.discourse.group/t/how-to-klipperscreen-on-android-smart-phones/1196)
* [WAVESHARE 4.3 inch DSI LCD](https://www.waveshare.com/4.3inch-dsi-lcd.htm)
* [DFrobot DFR0550](https://wiki.dfrobot.com/5%27%27TFT-Display_with_Touchscreen_V1.0_SKU_DFR0550)
* [Android phone](Android.md)
* [More known hardware in the klipper discourse](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35)
### Configuration
#### Configuration
Follow the manufacturer instructions on how to install your screen. In general if you see a white screen, then it's not properly installed, ensure that you at least see a console, Then [install](Installation.md) KlipperScreen, if you are having troubles refer to the [troubleshooting page](Troubleshooting.md) for further information.
Follow the manufacturer instructions on how to install your screen. In general if you see a white screen, then it's not properly installed, ensure that you at least see a console, Then ![install](Installation.md) KlipperScreen, if you are having troubles refer to the ![troubleshooting page](Troubleshooting.md) for further information.
## Screen rotation
Configure the server to start in the desired orientation, there are many ways to achieve this,
here are some examples:
#### Touchscreen Calibration
Most people don't need to calibrate, but if you do need to calibrate your touchscreen, follow the below steps.
!!! warning
Rotation is handled by the OS and not by KlipperScreen,
if you can't rotate your screen it's usually an issue with the OS configuration
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>
```
???+ example
#### Touchscreen touch rotation
If your touchscreen isn't registering touches properly after the screen has been rotated, you will need to apply a
transformation matrix. You can have the matrix be one of the following:
Create /usr/share/X11/xorg.conf.d/90-monitor.conf
```bash
sudo nano /usr/share/X11/xorg.conf.d/90-monitor.conf
```
* 0°: `1 0 0 0 1 0 0 0 1`
* 90° Clockwise: `0 -1 1 1 0 0 0 0 1`
* 90° Counter-Clockwise: `0 1 0 -1 0 1 0 0 1`
* 180°: `-1 0 1 0 -1 1 0 0 1`
Paste this section modifying the options to suit your needs:
```
Section "Monitor"
Identifier "DPI-1"
# This identifier would be the same as the name of the connector printed by xrandr.
# it can be "HDMI-0" "DisplayPort-0", "DSI-0", "DVI-0", "DPI-0" etc
To check the current matrix, you will need your `<screen name>`
(which can be found via the last section, ex: "wch.cn USB2IIC_CTP_CONTROL").
Run the following command: `xinput list-props "wch.cn USB2IIC_CTP_CONTROL"`
Option "Rotate" "left"
# Valid rotation options are normal,inverted,left,right
It will output something such as:
```
Device '<screen name>':
Device Enabled (115): 1
Coordinate Transformation Matrix (116): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix (247): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (248): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (249): 1, 0
libinput Send Events Mode Enabled (250): 0, 0
libinput Send Events Mode Enabled Default (251): 0, 0
Device Node (252): "/dev/input/event0"
Device Product ID (253): 6790, 58083
```
You can verify by checking that the 'Coordinate Transformation Matrix' or 'libinput Calibration Matrix'.
Option "PreferredMode" "1920x1080"
# May be necesary if you are not getting your prefered resolution.
EndSection
```
Save the file and restart KlipperScreen.
You can test a change by running: `xinput set-prop "<screen name>" 'Coordinate Transformation Matrix' <matrix>`
```bash
sudo service KlipperScreen restart
```
Replace matrix with one of the options above, such as: `1 0 0 0 1 0 0 0 1`
??? example "Using Waveshare screen that is installed with LCD-show"
To make this permanent, modify the file `/etc/udev/rules.d/51-touchscreen.rules` and add following line:
```bash
cd LCD-show/
sudo ./LCD43-show 270 lite
```
??? example "Using a screen installed with goodtft-LCD-show"
```bash
cd LCD-show/
sudo ./rotate.sh 90
```
??? example "Raspberry Pi"
To set screen orientation when in console mode, you will need to edit the kernel command line to pass the required orientation to the system.
```bash
sudo nano /boot/cmdline.txt
```
To rotate by 90 degrees clockwise, add the following to the cmdline, making sure everything is on the same line, do not add any carriage returns. Possible rotation values are 0, 90, 180 and 270.
```bash
video=DSI-1:800x480@60,rotate=90
```
Other values can be "HDMI-0" "HDMI-1, "DPI-0" etc
[Read the official docs for more info](https://www.raspberrypi.com/documentation/computers/config_txt.html)
[Raspberry Display docs](https://www.raspberrypi.com/documentation/accessories/display.html)
??? example "Raspberry Pi legacy mode (works with vc4-fkms-v3d)"
add to config.txt
```bash
display_lcd_rotate=2
```
Reboot
!!! warning
Pi4 doesn't support 90 and 270 degrees with this method, [see the official docs](https://www.raspberrypi.com/documentation/computers/config_txt.html#display_hdmi_rotate)
| Value | result |
| ---------- | ---------- |
| 0 | no rotation |
| 1 | rotate 90 degrees clockwise |
| 2 | rotate 180 degrees clockwise |
| 3 | rotate 270 degrees clockwise |
| 0x10000h | horizontal flip |
| 0x20000 | vertical flip |
[Read the official docs for more info](https://www.raspberrypi.com/documentation/computers/config_txt.html)
## Touchscreen touch rotation
[Moved to Touch issues](./Troubleshooting/Touch_issues.md)
```
ACTION=="add", ATTRS{name}=="<screen name>", ENV{LIBINPUT_CALIBRATION_MATRIX}="<matrix>"
```
+32 -60
View File
@@ -1,43 +1,44 @@
# Installation
## First steps
#### Setup Raspberry Pi
This install process is meant for Raspbian non-desktop version aka Raspbian Lite.
Install the screen, following the instructions provided by the manufacturer, Some screens don't neeed extra software but some need to be installed with a script.
It's strongly recommended to test it and ensure your hardware is working with RaspberryOS, Ubuntu or any distro you like.
Once you have established that the screen is working, then proceed installing KlipperScreen.
If you have installed it on the GUI version, then use `sudo raspi-config` to set boot to console by choosing the following options in order:
## Setup
This install process is meant for a non-desktop version of the OS for example RaspberryOS Lite, but it should work on other debian derivatives.
* 1 System Options
* S5 Boot / Auto Login
* B1 Console
If you installed a desktop (GUI version) of the OS and want to run KlipperScreen exclusively then do:
```sh title="Boot to console / KlipperScreen"
sudo systemctl set-default multi-user.target
sudo reboot
#### Klipper and Moonraker Installation
Follow the instructions to install Klipper and Moonraker.
* klipper: https://www.klipper3d.org/Installation.html
* moonraker: https://moonraker.readthedocs.io/en/latest/installation/
In moonraker.conf ensure that 127.0.0.1 is a trusted client for moonraker, such as in this example:
```
to undo and go back to the desktop environment:
```sh title="Boot to the desktop"
sudo systemctl set-default graphical.target
sudo reboot
[authorization]
trusted_clients:
127.0.0.1
```
Note: `force_logins: true` requires the moonraker api key in [KlipperScreen.conf](Configuration.md)
## Auto install
If you wish to use the update manager feature of moonraker for KlipperScreen, add the following block into the moonraker
configuration:
```
[update_manager KlipperScreen]
type: git_repo
path: ~/KlipperScreen
origin: https://github.com/jordanruthe/KlipperScreen.git
env: ~/.KlipperScreen-env/bin/python
requirements: scripts/KlipperScreen-requirements.txt
install_script: scripts/KlipperScreen-install.sh
```
[KIAUH](https://github.com/th33xitus/kiauh) is a tool that helps you install or upgrade Klipper, Moonraker, Mainsail, and other extensions.
![Screenshot](img/install/KIAUH.png)
You can visit [KIAUH on GitHub](https://github.com/th33xitus/kiauh) to learn more and view its documentation.
## Manual Install
First install [Klipper](https://www.klipper3d.org/Installation.html) and [Moonraker](https://moonraker.readthedocs.io/en/latest/installation/).
### KlipperScreen Installation
#### KlipperScreen Installation
Execute the following commands:
```sh
```
cd ~/
git clone https://github.com/jordanruthe/KlipperScreen.git
cd ~/KlipperScreen
@@ -45,38 +46,9 @@ cd ~/KlipperScreen
```
This script will install packages that are listed under manual install, create a python virtual environment at
`~/.KlipperScreen-env` and install a systemd service file.
~/.KlipperScreen-env and install a systemd service file.
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.
At this point KlipperScreen should be working, if it doesn't start then go to the [troubleshooting page](Troubleshooting.md)
## Moonraker configuration
In moonraker.conf ensure that the IP of the device is a trusted client:
```ini title="moonraker.conf"
[authorization]
trusted_clients:
127.0.0.1
```
!!! warning
having `force_logins: true` in this section or if you don't want to use `trusted_clients`
Will require the [moonraker api key](https://moonraker.readthedocs.io/en/latest/installation/#retrieving-the-api-key) in [KlipperScreen.conf](Configuration.md)
If you wish to use the update manager feature of moonraker for KlipperScreen, add the following block to the moonraker.conf:
```ini title="moonraker.conf"
[update_manager KlipperScreen]
type: git_repo
path: ~/KlipperScreen
origin: https://github.com/KlipperScreen/KlipperScreen.git
virtualenv: ~/.KlipperScreen-env
requirements: scripts/KlipperScreen-requirements.txt
system_dependencies: scripts/system-dependencies.json
managed_services: KlipperScreen
```
!!! tip
If you see warnings in other UIs ignore them until KlipperScreen finishes installing, and Moonraker is restarted.
At this point KlipperScreen should be working, check out the [hardware page](Hardware.md) if you still haven't installed the screen, or head to the [troubleshooting page](Troubleshooting.md) if you are having problems
-127
View File
@@ -1,127 +0,0 @@
# Panels
### Main Menu
![Main Menu](img/panels/main_panel.png)
### [Job Status](Panels/Job_status.md)
```py
panel: job_status
```
[![Job Status](img/panels/job_status.png)](Panels/Job_status.md)
### [Bed Level](Panels/Screws.md)
```py
panel: bed_level
```
[![Bed Level](img/panels/bed_level.png)](Panels/Screws.md)
### Bed Mesh
```py
panel: bed_mesh
```
![Bed Mesh](img/panels/bed_mesh.png)
### Console
```py
panel: console
```
![Console](img/panels/console.png)
### Extrude
```py
panel: extrude theme:material-dark
```
![Extrude](img/panels/extrude.png)
### Fan
```py
panel: fan
```
![Fan](img/panels/fan.png)
### Fine Tune
```py
panel: fine_tune
```
![Fine Tune Panel](img/panels/fine_tune.png)
### Gcode Macros
```py
panel: gcode_macros
```
![Gcode Macros Panel](img/panels/gcode_macros.png)
### Input Shapers
```py
panel: input_shaper
```
![Limits](img/panels/input_shaper.png)
### Limits
```py
panel: limits
```
![Limits](img/panels/limits.png)
### Menu
![Menu Panel](img/panels/menu.png)
### Move
```py
panel: move
```
![Move Panel](img/panels/move.png)
### Network
```py
panel: network
```
![Network Panel](img/panels/network.png)
### Power
```py
panel: power
```
![Power](img/panels/power.png)
### Print
```py
panel: print
```
![Print Panel](img/panels/print.png)
### Retraction
```py
panel: retraction
```
![Limits](img/panels/retraction.png)
### Settings
```py
panel: settings
```
![Settings](img/panels/settings.png)
### System
```py
panel: system
```
![System Panel](img/panels/system.png)
### Spoolman
```py
panel: spoolman
```
![Spoolman](img/panels/spoolman.png)
### [Temperature](Panels/Temperature.md)
```py
panel: temperature
```
[![Temperature](img/panels/temperature.png)](Panels/Temperature.md)
### [Z Calibrate](Panels/Zcalibrate.md)
```py
panel: zcalibrate
```
[![Z Calibrate](img/panels/zcalibrate.png)](Panels/Zcalibrate.md)
-28
View File
@@ -1,28 +0,0 @@
# Job Status
Also known as "Print Status" or the "printing panel" shows the relevant information of the current print.
![Screenshot](../img/panels/job_status.png)
!!! tip
the third row shows the LCD message (`M117`)
This panel has more information than it shows by default, just click/tap the corresponding the status buttons to access the extra information
## Position info
![speed_screenshot](../img/panels/job_status_speed.png)
!!! note
Layer is calculated from object height, it may not be accurate if variable layer is used
If that is the case use the Layer Progress method described in the [Quicktips](../Quicktips.md#layer-progress)
## Extrusion info
![extrusion_screenshot](../img/panels/job_status_extrusion.png)
## Time info
![time_screenshot](../img/panels/job_status_time.png)
## Extra temperature items
By default only extruder and bed temperatures will be available but additional items can be defined
using ["titlebar_items" in the config](../Configuration.md#printer-options)
-45
View File
@@ -1,45 +0,0 @@
# Bed level
![Bed Level](../img/panels/bed_level.png)
For this panel to appear in the menu `[bed_screws]` or `[screws_tilt_adjust]` need to be defined in Klipper config (printer.cfg)
!!! Important
* `[bed_screws]` uses nozzle positions (nozzle above the screw) [Read Klipper doc entry](https://www.klipper3d.org/Config_Reference.html#bed_screws)
* `[screws_tilt_adjust]` uses probe positions (probe above the screw) [Read Klipper doc entry](https://www.klipper3d.org/Config_Reference.html#screws_tilt_adjust)
The corner buttons in KlipperScreen place the nozzle above the screw to do the ["paper test"](https://www.klipper3d.org/Bed_Level.html?h=paper#the-paper-test).
When `[screws_tilt_adjust]` is defined a couple of things happen:
* A button named "Screws adjust" appears, it runs `SCREWS_TILT_CALCULATE` when is pressed,
and reports the amount to be adjusted into the labels of the corner buttons.
* `[bed_screws]` is now ignored by KlipperScreen. (explained below)
* The corner buttons are now `[screws_tilt_adjust]` coordinates with the probe offset applied. (explained below)
### Why `[bed_screws]` are ignored/not used?
Because if the probe offset is changed or the difference between `[bed_screws]` and `[screws_tilt_adjust]` wasn't calculated correctly,
the "Screws adjust" button stops working.
### Why the probe offset is applied to `[screws_tilt_adjust]`?
Because the corner buttons in KlipperScreen should place the nozzle above the screw to do the ["paper test"](https://www.klipper3d.org/Bed_Level.html?h=paper#the-paper-test). It doesn't affect the function of `SCREWS_TILT_CALCULATE`, which will go to the defined positions.
## Not supported for auto-detection
This message will appear if you are using 3 or 5 screws and didn't define them in KlipperScreen.conf.
See "screw_positions" in the [printer options](https://klipperscreen.readthedocs.io/en/latest/Configuration/#printer-options)
## Limitations
The panel doesn't support more than 9 screws. if there is a center screw define the positions to avoid issues.
See "screw_positions" in the [printer options](https://klipperscreen.readthedocs.io/en/latest/Configuration/#printer-options)
## Is there an alternative?
If you have a reliable probe, define `[bed_mesh]` in Klipper config, remove the springs
and use some thread-locker or locking nuts to fix the bed to the gantry, let the probe do a mesh save it and forget about this.
-23
View File
@@ -1,23 +0,0 @@
# Temperature
This panel is available when there is at least one device with a temperature sensor asociated,
this includes extruders, heaters, sensors and temperature_fans.
There are 3 main modes of operation:
## Preheat
[Define profiles](../Configuration.md#preheat-options) to quickly change the target temperature of multiple selected devices.
This is the default mode when not printing.
![Preheat_screenshot](../img/panels/temperature.png)
## Delta adjust
Change the target of the selected devices, the amount is selectable.
This is the default mode while printing
![Delta_screenshot](../img/panels/temperature_delta.png)
## Direct input with keypad
Allows to set the exact temperature using the keypad.
![Keypad_screenshot](../img/panels/temperature_keypad.png)
-44
View File
@@ -1,44 +0,0 @@
# Zcalibrate
This panel supports various modes of operation to assist in the calibration of the Z axis of the machine.
It's strongly suggested to read Klipper documentation about [Bed level](https://www.klipper3d.org/Bed_Level.html)
![Screenshot](../img/panels/zcalibrate.png)
## Buttons
* "Start" will initiate the only method available, or ask the user if multiple methods are available.
!!! note
KlipperScreen will home if needed and move to the middle of the bed,
but the location can be configured in [KlipperScreen.conf](https://klipperscreen.readthedocs.io/en/latest/Configuration/#printer-options)
* The raise(+) and lower(-) buttons send `TESTZ Z=distance` where distance is selected in the bottom row.
* Accept will send `ACCEPT`
* Abort will send `ABORT`
## Calibration methods
### Endstop (`Z_ENDSTOP_CALIBRATE`)
Available when an physical endstop is defined for `[stepper_z]`
See Klipper documentation: [Calibrating a Z endstop](https://www.klipper3d.org/Manual_Level.html#calibrating-a-z-endstop)
### Probe (`PROBE_CALIBRATE`)
Available when a probe is defined. (BL-Touch is a probe)
See Klipper documentation: [Calibrating probe Z offset](https://www.klipper3d.org/Probe_Calibrate.html#calibrating-probe-z-offset)
### Bed mesh (`BED_MESH_CALIBRATE`)
Available when a probe is not defined and `[bed_mesh]` is defined
this mode lets you create a mesh leveling bed using the paper test in various points.
!!! warning
DO NOT adjust the bed screws while using this mode.
Adjust the screws using the [bed screws](Screws.md) panel before running this tool.
### Delta Automatic/Manual (`DELTA_CALIBRATE`)
Available when the kinematics are defined as delta.
See Klipper documentation: [Delta calibration](https://www.klipper3d.org/Delta_Calibrate.html)
!!! note
KlipperScreen will automatically Home(`G28`) if needed
-48
View File
@@ -1,48 +0,0 @@
# Quicktips
quick tips, without much explanation
## Hide macros, outputs or fans
You can also hide devices by prefixing the name with an underscore.
Lets hide a temperature_fan:
```ini
[temperature_fan fan1]
[temperature_fan _fan2]
```
fan1 will show in the interface, but _fan2 will be hidden.
## Layer Progress
Accurate layer progress as a message below the status:
PrusaSlicer/SuperSlicer > Printer Settings > Custom Gcode > After layer change Gcode
```ini
M117 Layer {layer_num+1}/[total_layer_count] : {filament_settings_id[0]}
```
![Layer_progress](img/quicktips/PS_SS_Layer_progress.png)
Accurate layer progress in the secondary screen of the printing panel:
The layer number in the secondary screen of the printing panelis calculated according to object height and provided layer height.
It will be innacurate when using variable layer height, but can be fixed by providing klipper with the correct data.
![speed_screenshot](img/panels/job_status_speed.png)
PrusaSlicer/SuperSlicer:
Printer Settings > Custom Gcode > Start Gcode
```ini
SET_PRINT_STATS_INFO TOTAL_LAYER=[total_layer_count]
```
Printer Settings > Custom Gcode > After layer change Gcode
```ini
SET_PRINT_STATS_INFO CURRENT_LAYER={layer_num + 1}
```
+3 -3
View File
@@ -8,7 +8,7 @@ To edit colors and styles, create a css file named `style.css` you can use the c
### Example 1
```sh
```
cd ~/KlipperScreen/styles
mkdir -p mytheme/images
cd mytheme
@@ -24,10 +24,10 @@ At this point `mytheme` should be on the list of themes, and when you select it
Creating a custom background from Mainsail sidebar and this css using Z-bolt icons
```css
```
window { background-image: url("/home/pi/mainsail/img/background.svg");}
button {background-color: rgba(0,0,0,0); border-radius:2em;}
```
![Custom theme example with background](img/theming/theme_example.png)
![Custom theme example with background](img/theme_example.png)
-59
View File
@@ -1,59 +0,0 @@
# Thumbnails
KlipperScreen can display thumbnails in the file browser and as previews in the print status.
![Job Status](img/panels/job_status.png)
Recommended sizes for thumbnails:
* 300 x 300 - For the larger previews.
* 32 x 32 - For the smaller thumbnails used in lists.
!!! note
Other sizes should work, but keep in mind bigger thumbnails are slower to load and can produce bigger gcode files.
## Select your slicer:
* [PrusaSlicer](#prusaslicer)
* [SuperSlicer](#superslicer)
* [Cura](#cura)
* [ideaMaker](#ideamaker)
### PrusaSlicer
In “Expert” mode PrusaSlicer has an option in the “Printer Settings” tab to activate previews.
Under General / Firmware.
![PrusaSlicer](img/quicktips/PrusaSlicer-thumbnails.png)
### SuperSlicer
In “Expert” mode SuperSlicer has some very convenient options in the “Printer Settings” tab to activate and customize the previews.
![SuperSlicer](img/quicktips/SuperSlicer-thumbnails.png)
### Cura
#### Option #1 A post processing script (Cura 4.9+)
1. With Cura open, navigate to Extensions, Post Processing, Modify G-Code
2. Click Add a script, and select Create Thumbnail
3. Set both Width and Height to 300
4. Click Add a script, and select Create Thumbnail
5. Set both Width and Height to 32
6. Click Close
#### Option #2 A plugin (Cura 4.7+)
[Cura2Moonraker](https://github.com/emtrax-ltd/Cura2MoonrakerPlugin)
![Cura](img/quicktips/Cura-thumbnails.png)
### ideaMaker
1. Open the Advanced tab in the printer settings
2. Enable "GCode Thumbnails for Octoprint and Mainsail"
3. Set both Width and Height to 300
![ideaMaker](img/quicktips/IdeaMaker-thumbnails.png)
+13 -26
View File
@@ -1,32 +1,19 @@
# Translations
## Create Translations
## Updating an existing translation:
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.
You can use an editor such as [poedit](https://poedit.net/) to assist in translations.
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.
* Edit `ks_includes/locals/{ISO 639 lang code}/LC_MESSAGES/KlipperScreen.po`
To test your translation:
In poedit go to `File -> Compile to MO`. Save it on the same folder, and restart KlipperScreen
## Adding a new Language:
Example using poedit
#### New Language
* Select `Create a new translation` or `File -> New from POT/PO` and select `ks_includes/locals/KlipperScreen.pot`.
!!! important
Do not edit the POT file as is automatically generated and your changes will be lost.
* Save the file as `ks_includes/locales/{ISO 639 lang code}/LC_MESSAGES/KlipperScreen.po`
* Select `File -> Compile to MO`. Save it on the same folder, and restart KlipperScreen
* 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`
!!! note
[Wikipedia ISO 639 Language Codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
Once you have restarted KlipperScreen, select it from the list in the settings.
If you edited and recompiled, you need to restart KlipperScreen to reload the translation.
## Contributing:
[Attach your translation on a GitHub issue or create a PR](Contact.md)
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.
+28 -90
View File
@@ -1,110 +1,48 @@
# Troubleshooting
This page will have common problems and common solutions to those problems.
## First Steps
The first step to troubleshooting any problem is getting the cause of the error.
The first step to troubleshooting any problem is getting the cause of the error. KlipperScreen log output will occur
in two places. Check for the file `/tmp/KlipperScreen.log` and look at the contents by running
`cat /tmp/KlipperScreen.log` or grabbing the file over WinSCP or another scp program.
* Find KlipperScreen.log:
If that file is non-existent, there is a problem in KlipperScreen starting up. To get the error output in this case,
run `journalctl -xe -u KlipperScreen`.
!!! warning "Important"
This log file should be provided if you ask for support.
Depending on your setup the file could be accessible from the web interface alongside other logs
## Common Errors
Mainsail | Fluidd
:-:|:-:
![mainsail_logs](img/troubleshooting/logs_mainsail.png) | ![fluidd_logs](img/troubleshooting/logs_fluidd.png)
### Problems occurring before the log file appears
if you can't find it in the web interface, use sftp to grab the log (for example Filezilla, WinSCP)
Located at `~/printer_data/logs`or in `/tmp/` if the former doesn't exist.
This section will detail problems that may happen before the log file has been created. Each section will start with a
relevant line from the journalctl output.
## System logs
If [KlipperScreen.log](#first-steps) doesn't exist:
```sh
systemctl status KlipperScreen
#### Cannot open virtual Console
```
or
```sh
journalctl -xe -u KlipperScreen
xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
```
Also the Xorg log where you can find issues with the X server:
```sh
cat /var/log/Xorg.0.log
```
## Screen shows console instead of KlipperScreen
![boot](img/troubleshooting/boot.png)
* Check /etc/X11/Xwrapper.conf
This should have the line `allowed_users=anybody` in it
* Check /etc/group
Run the command `cat /etc/group | grep tty`. If you username is not listed under that line, you need to add it with the
following command (if you username is not 'pi' change 'pi' to your username):
`usermode -a -G tty pi`
### Problems occurring with the log file
!!! abstract "If you see this line in the [system logs](#system-logs):"
```sh
xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
```
[Follow this steps](Troubleshooting/VC_ERROR.md)
#### Screen shows console instead of KlipperScreen
Run the command `ls /dev/fb*`. If you have multiple devices, you may need to fix the X11 configuration.
!!! abstract "If you see this line in the [system logs](#system-logs):"
```sh
xinit[948]: /usr/lib/xorg/Xorg: symbol lookup error: /usr/lib/xorg/modules/drivers/fbturbo_drv.so: undefined symbol: shadowUpdatePackedWeak
```
[Follow this steps](Troubleshooting/FBturbo.md)
Run the command `cat /usr/share/X11/xorg.conf.d/99-fbturbo.conf | grep /dev/fb`. Try modifying the file (
`sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf`) and change `/dev/fb0` to a different file listed in the
previous command (i.e. `/dev/fb1`).
!!! abstract "If you see this line in the [system logs](#system-logs):"
```sh
KlipperScreen-start.sh: (EE) no screens found(EE)
```
This is usually not the main cause of the error. [Start by checking the screen](Troubleshooting/Physical_Install.md)
Once you have saved that file, restart KlipperScreen and it should show up on your display.
Drivers not installed or misconfigured can cause this too, continue looking the logs for more clues.
#### Screen is all white or blank
!!! abstract "If you see this line in the [system logs](#system-logs):"
```sh
modprobe: FATAL: Module g2d_23 not found in directory /lib/modules/6.1.21-v8+
```
This error is common on RaspberryOS when using FBturbo and it's not a related issue.
[Maybe it's the wrong framebuffer](Troubleshooting/Framebuffer.md)
If you can't fix it, [try using a desktop distro as described here.](Troubleshooting/Last_resort.md)
If you want to contribute a solution: [Contact](Contact.md)
## Screen is always ***white*** / ***black*** or ***`No signal`***
If the screen never shows the console even during startup, Then it's typically an improperly installed screen.
[Follow this steps](Troubleshooting/Physical_Install.md)
## The screen shows colors or 'No signal' when idle
In KliperScreen settings find 'Screen DPMS' and turn it off.
![dpms](img/troubleshooting/dpms.gif)
Your screen doesn't seem to support turning off via software.
KlipperScreen will enable an internal screensaver to make it all black, and hopefully avoid burn-in.
If you find a way of turning it off and you want to share it: [Contact](Contact.md)
## Touch issues
[Follow this steps](Troubleshooting/Touch_issues.md)
## Network panel doesn't list WI-FI networks
[Follow this steps](Troubleshooting/Network.md)
## OctoPrint
KlipperScreen was never intended to be used with OctoPrint, and there is no support for it.
## Other issues
If you found an issue not listed here, or can't make it work, please provide all the log files
a description of your hw, and a description of the issue when [asking for support](Contact.md)
Improperly installed screen, follow the manufacturer instructions on how to physically connect the screen and install the proper drivers.
-16
View File
@@ -1,16 +0,0 @@
# FBturbo failing with undefined symbol
in the system [log](../Troubleshooting.md) this appears:
!!! abstract "Log"
```sh
xinit[948]: /usr/lib/xorg/Xorg: symbol lookup error: /usr/lib/xorg/modules/drivers/fbturbo_drv.so: undefined symbol: shadowUpdatePackedWeak
```
Your system doesn't seem compatible with the FBturbo driver that you have installed
Remove the fbturbo driver
```sh
sudo apt purge xserver-xorg-video-fbturbo
```
-60
View File
@@ -1,60 +0,0 @@
# Screen is using the wrong framebuffer
## LCD-show
when using [Waveshare-LCD-show](https://github.com/waveshare/LCD-show) to install screens add `lite` at the end
to properly install the screen on the lite version of the OS. this will typically change the framebuffer
for example:
```
sudo ./LCD35-show lite
```
## Manually change the framebuffer
If you have multiple framebuffers, you may need to fix the X11 configuration,
list the available framebuffers and check the current one:
```sh
ls /dev/fb*
```
!!! example "Output example"
```
pi@raspberrypi ~ $ ls /dev/fb*
/dev/fb0 /dev/fb1
```
!!! failure "Critical"
if you only see one, for example `/dev/fb0` then this is not the issue. Go to [Troubleshooting](../Troubleshooting.md)
the file specifying the framebuffer could be:
- 99-fbturbo.conf
- 99-fbusb.conf
- 99-fbdev.conf
check if one of those or similar exist with:
```sh
ls /usr/share/X11/xorg.conf.d/
```
!!! failure "Critical"
***DO NOT CREATE A FILE***, and only edit if there is more than 1 framebuffer
!!! example
you found 99-fbturbo.conf:
```sh
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf
```
and the file specifies `/dev/fb0`
since `ls /dev/fb*` returned `/dev/fb0 /dev/fb1` change it to `/dev/fb1`
Save the file, restart KlipperScreen.
```sh
sudo service KlipperScreen restart
```
-21
View File
@@ -1,21 +0,0 @@
# Last resort to make the screen work
If the screen never shows the console or bootup text during startup, Then it's typically an improperly installed screen
See [Physical install issues](Physical_Install.md)
![boot](../img/troubleshooting/boot.png)
If the screen shows the bootup text, but ends in a blinking cursor or login prompt,
and no matter what you tried in [Troubleshooting](../Troubleshooting.md) you can't make it work, then do this:
1. Install a distro with a desktop enviromenment
2. Ensure that the screen is working properly (display and touch)
3. Install KlipperScreen
4. Run `sudo systemctl set-default multi-user.target`
5. Reboot
If it still doesn't work, or you did something else to make it work and want to share:
[Contact us](../Contact.md)
Remember to share the logs, as those aid a lot in the troubleshooting.
-55
View File
@@ -1,55 +0,0 @@
# Wi-Fi networks not listed
!!! tip "First start"
The initial scan may take a couple of minutes, first be patient before assuming it's an issue
Check if network-manager is installed:
```bash
dpkg -s network-manager
```
if the response is the following:
```bash
dpkg-query: the package 'network-manager' is not installed
```
go to [wpa_supplicant](wpa_supplicant.md)
if the response is the following:
```sh
Package: network-manager
Status: install ok installed
```
this line may appear in KlipperScreen.log:
!!! abstract "Log"
```sh
[wifi_nm.py:rescan()] [...] NetworkManager.wifi.scan request failed: not authorized
```
in order to fix this polkit needs to be configured or disabled:
here is how to disable polkit for network-manager:
```sh
mkdir -p /etc/NetworkManager/conf.d
sudo nano /etc/NetworkManager/conf.d/any-user.conf
```
in the editor paste this:
```conf
[main]
auth-polkit=false
```
Then restart the service (or reboot):
```sh
systemctl restart NetworkManager.service
systemctl restart KlipperScreen.service
```
-26
View File
@@ -1,26 +0,0 @@
# Physical install issues
If the screen never shows the console even during startup, Then it's typically an improperly installed screen,
!!! important
It is advised follow the manufacturer instructions on how to physically connect the screen and install the proper drivers.
## Cable issues
* Check that the cable is inserted properly:
it shouldn't be loose, and in the case of ribbon cables like DSI make sure the contacts face the right way
* If the touchscreen is connected via USB, try another port if available,
if you are using a HUB try connecting the touch directly without the HUB.
* If the board has more than one HDMI try the other port
## Driver issues
Some screens need drivers installed the most common cases are:
### Waveshare
* [Waveshare Wiki](https://www.waveshare.com/wiki)
* [repo LCD-show](https://github.com/waveshare/LCD-show)
### Goodtft (generic/clones)
* [Goodtft Wiki](http://www.lcdwiki.com)
* [repo LCD-show](https://github.com/goodtft/LCD-show)
-112
View File
@@ -1,112 +0,0 @@
# Touchscreen issues
If the screen is connected over USB, issues with the cable may cause similar symptoms. For that, please see [this guide](Physical_Install.md#cable-issues).
## Touch not working
Some DSI screens have issues where touch doesn't work with Debian Bullseye, or even in Debian Buster after an update. There is currently (September 2023) still no fix in upstream Debian.
The current workaround/temporary fix involves changing the kernel driver module used for these displays.
To apply this fix:
Edit `/boot/config.txt` and change
```sh
dtoverlay=vc4-kms-v3d
```
to
```sh
dtoverlay=vc4-fkms-v3d
```
**Reboot** to apply changes.
If that doesn't fix it, you can try commenting these lines out:
```sh
# dtoverlay=vc4-kms-v3d
# max_framebuffers=2
```
**Reboot** to apply changes.
## Touch rotation and matrix
If the touch works but registers touch input in a different location from the input, then you may need to apply an input transformation matrix.
First you will need your device name. On a terminal, run:
```sh
DISPLAY=:0 xinput
```
Output:
```text
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ ADS7846 Touchscreen id=6 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
```
In this case the device is the ADS7846 Touchscreen, yours may be different
You can test a change by running:
```sh
DISPLAY=:0 xinput set-prop "<device name>" 'Coordinate Transformation Matrix' <matrix>
```
Where the matrix can be one of the following options:
| Rotation | Matrix |
| - | - |
| 0° | `1 0 0 0 1 0 0 0 1` |
| 90° Clockwise | `0 -1 1 1 0 0 0 0 1` |
| 90° Counter-Clockwise | `0 1 0 -1 0 1 0 0 1` |
| 180° (Inverts X and Y) | `-1 0 1 0 -1 1 0 0 1` |
| invert Y | `-1 0 1 1 1 0 0 0 1` |
| invert X | `-1 0 1 0 1 0 0 0 1` |
| expand to twice the size horizontally | `0.5 0 0 0 1 0 0 0 1` |
For more in-depth guidance on using Coordinate Transformation Matrices:
* [Ubuntu wiki InputCoordinateTransformation](https://wiki.ubuntu.com/X/InputCoordinateTransformation)
* [Libinput docs](https://wayland.freedesktop.org/libinput/doc/1.9.0/absolute_axes.html)
It has been reported that the touch expands with screens that don't use HDMI. This is due to the composite output,
which enables automatically as a fallback when no HDMI device is plugged in.
If this is the case, adding `enable_tvout=0` to `/boot/config.txt` and reboot.
!!! example
```sh
DISPLAY=:0 xinput set-prop "ADS7846 Touchscreen" 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
```
To make this permanent, modify the file `/etc/udev/rules.d/51-touchscreen.rules` and add following line:
```sh
ACTION=="add", ATTRS{name}=="<device name>", ENV{LIBINPUT_CALIBRATION_MATRIX}="<matrix>"
```
---
As an alternative **if the above doesn't work**:
edit `/usr/share/X11/xorg.conf.d/40-libinput.conf`
for example:
```sh
Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
EndSection
```
-39
View File
@@ -1,39 +0,0 @@
# Cannot open virtual Console
If you see this line in the [log](../Troubleshooting.md):
!!! abstract "Log"
```sh
xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
```
* Run `cat /etc/X11/Xwrapper.config`
This should have the line `allowed_users=anybody` in it
* Run `cat /etc/group | grep tty`
If your username is not listed under that line, you need to add it with the following command:
```sh
usermod -a -G tty pi
```
(if your username is not 'pi' change 'pi' to your username)
Restart KlipperScreen:
```sh
sudo service KlipperScreen restart
```
If it's still failing:
add `needs_root_rights=yes` to `/etc/X11/Xwrapper.config`:
```sh
sudo bash -c "echo needs_root_rights=yes>>/etc/X11/Xwrapper.config"
```
Restart KlipperScreen:
```sh
sudo service KlipperScreen restart
```
-27
View File
@@ -1,27 +0,0 @@
## wpa_supplicant
The user is not allowed to control the interface
* Edit `/etc/wpa_supplicant/wpa_supplicant.conf` and add this line if it's not there:
```
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
```
* Run `cat /etc/group | grep netdev`
If your username is not listed under that line, you need to add it with the following command:
```sh
usermod -a -G netdev pi
```
(if your username is not 'pi' change 'pi' to your username)
Then reboot the machine:
```sh
systemctl reboot
```
!!! tip
It's possible to just restart KlipperScreen and networking
-65
View File
@@ -1,65 +0,0 @@
# VNC
This article describes how to use KlipperScreen through a remote connection.
!!! warning
The experience may not be equal to run KlipperScreen natively.
Depending on the device or the network you may encounter performance degradation or other issues.
## On the Host device (for example a Raspberry Pi):
1. [First installl KlipperScreen](Installation.md)
2. Install a vnc server package, for example:
```bash
sudo apt install tigervnc-standalone-server
```
3. Create `launch_KlipperScreen.sh`:
```bash
#!/usr/bin/env bash
# Use display 10 to avoid clashing with local X server, if anyy
Xtigervnc -rfbport 5900 -noreset -AlwaysShared -SecurityTypes none :10&
DISPLAY=:10 $KS_XCLIENT&
wait
```
4. Restart KlipperScreen or reboot the system:
```bash
sudo systemctl service KlipperScreen restart
```
5. On KlipperScreen set the following configuration:
DPMS: off
Display timeout: off
![disable_dpms_poweroff](img/disable_dpms_poweroff.png)
## On the remote device:
1. Installa a VNC viewer and configure it to the ip of the host.
???+ example "Example using an iPad"
* Install a VNC viewer for example: `RealVNC Viewer: Remote Desktop`
#### Prevent unwanted rotation of UI:
* Go to `Settings` > `General` > Set `Use side switch to` to `Lock Rotation`
#### Avoid accidentally switching between apps:
* Go to `Restrictions` > Set passcode > Enable restrictions.
* Open
* Triple-click "Home" button
* Guided access pops up
* Press "Start"
* Now iPad is locked to VNC viewer until "Guided access" mode is disabled by triple-clicking "Home" button and entering the restrictions password.
#### On the VNC viewer:
* Press "+" button at the top right
* Enter IP address of your print host.
* Press "Save"
* Select "Interaction", select "Touch panel", go back
* Press "Done"
* Double-click on an icon with IP address you have just added.
* VNC client will complain about unencrypted connection. Disable the warning and say "Connect"
* Use or skip tutorial
* Press the "Pin" icon to hide the panel.
* Enjoy!
+8
View File
@@ -0,0 +1,8 @@
# Changelog
Breaking changes will be listed here.
#### 2021 05 20
* Default configuration is not merged if a user configuration is set for a specific option
For instance, if `menu __main` is user defined, the main menu will not have any defaults.
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 413 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+5 -25
View File
@@ -1,44 +1,24 @@
# KlipperScreen
KlipperScreen is a touchscreen GUI that interfaces with [Klipper](https://github.com/Klipper3d/klipper) via [Moonraker](https://github.com/arksine/moonraker). It can switch between multiple printers to access them from a single location, and it doesn't even need to run on the same host, you can install it on another device and configure the IP address to access the printer.
KlipperScreen is a touchscreen GUI that interfaces with [Klipper](https://github.com/kevinOConnor/klipper) via [Moonraker](https://github.com/arksine/moonraker). It can switch between multiple printers to access them from a single location, and it doesn't even need to run on the same host, you can install it on another device and configure the IP address to access the printer.
### Required Hardware
KlipperScreen should run on any touchscreen that you can connect to a host (Raspberry, PC, Tablet), but not screens that connect directly to the printer MCU board.
A physical touchscreen is not strictly required, for example you may install a remote desktop server like tigervnc-scraping-server and connect from a client device, [check out the hardware page for further information.](Hardware.md)
A physical touchscreen is not strictly required, for example you may install a remote desktop server like tigervnc-scraping-server and connect from a client device, ![check out the hardware page for further information.](Hardware.md)
### Sample Panels
Main Menu
![Main Menu](img/panels/main_panel.png)
![Main Menu](img/main_panel.png)
Job Status
![Job Status](img/job_status.png)
![Job Status](img/panels/job_status.png)
[More](Panels.md)
### 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/klipper3d/klipper) and [Moonraker](https://github.com/arksine/moonraker).
### About the project
KlipperScreen has been created and maintained by Jordan Ruthe from 2020 to 2021
|Donate to Jordan|
|-|
|[Patreon](https://www.patreon.com/klipperscreen)|
|[Ko-fi](https://ko-fi.com/klipperscreen)|
The current maintainer is Alfredo Monclus (alfrix) from 2021 onwards
|Dontate to Alfrix|
|-|
|[Ko-fi](https://ko-fi.com/alfrix)|
thanks to all the people who helped along the way.
[Contributors](https://github.com/KlipperScreen/KlipperScreen/graphs/contributors)
[Changelog](changelog.md)
-59
View File
@@ -1,59 +0,0 @@
# Macros
## Hide Macros
Macros can be completely hidden in the interface by prefixing the name with an underscore.
```ini
[gcode_macro MY_AWESOME_GCODE]
gcode:
_MY_HELPER_CODE
[gcode_macro _MY_HELPER_CODE]
gcode:
M300
```
`MY_AWESOME_GCODE` appears in your interface settings, but `_MY_HELPER_CODE` does not.
## Extrude Panel
### LOAD_FILAMENT / UNLOAD_FILAMENT
This macros are used in the Extrude panel `Load` and `Unload` buttons.
The selected speed in the panel is transferred as a parameter.
The following examples show how this can be used:
```ini
[gcode_macro LOAD_FILAMENT]
gcode:
{% set speed = params.SPEED|default(300) %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity %}
SAVE_GCODE_STATE NAME=load_state
M300 # beep
G91
G92 E0
G1 E350 F{max_velocity} # fast-load
G1 E25 F{speed} # purge
M300
M300
RESTORE_GCODE_STATE NAME=load_state
```
```ini
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set speed = params.SPEED|default(300) %}
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity %}
SAVE_GCODE_STATE NAME=unload_state
G91
M300 # beep
G92 E0
G1 E25 F{speed} # purge
G1 E-420 F{max_velocity} # fast-unload
M300
M300
RESTORE_GCODE_STATE NAME=unload_state
```
+87
View File
@@ -0,0 +1,87 @@
# Panels
### Main Menu
![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://www.klipper3d.org/Config_Reference.html#bed_screws)
* [screws_tilt_adjust](https://www.klipper3d.org/Config_Reference.html#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 theme:material-dark
![Bed Mesh](img/bed_mesh.png)
### Extrude
type: extrude theme:material-dark
![Extrude](img/extrude.png)
### Fan
type: fan
![Fan](img/fan.png)
### Fine Tune
type: fine_tune theme:custom
![Fine Tune Panel](img/fine_tune.png)
### Gcode Macros
type: gcode_macros theme: material-darker
![Gcode Macros Panel](img/gcode_macros.png)
### Menu
type: menu
![Menu Panel](img/menu.png)
### Move
type: move
![Move Panel](img/move.png)
### Network
type: network
![Network Panel](img/network.png)
### Power
type: power
![Power](img/power.png)
### Preheat
type: preheat
![Preheat Panel](img/preheat.png)
### Print
type: print
![Print Panel](img/print.png)
### Settings
type: settings theme:colorized
![Settings](img/settings.png)
### System
type: system
![System Panel](img/system.png)
### Temperature
type: temperature theme:material-light
![Temperature](img/temperature.png)
### Z Calibrate
type: zcalibrate
![Z Calibrate](img/zcalibrate.png)
### Limits
type: limits theme: material-dark
![Limits](img/limits.png)
-2
View File
@@ -1,2 +0,0 @@
mkdocs>=1.3.0
mkdocs-material>=8.2.16
+54 -17
View File
@@ -1,49 +1,86 @@
class KlippyGcodes:
HOME = "G28"
HOME_X = "G28 X"
HOME_Y = "G28 Y"
HOME_Z = "G28 Z"
HOME_XY = "G28 X Y"
Z_TILT = "Z_TILT_ADJUST"
QUAD_GANTRY_LEVEL = "QUAD_GANTRY_LEVEL"
MOVE = "G1"
MOVE_ABSOLUTE = "G90"
MOVE_RELATIVE = "G91"
EXTRUDE_ABS = "M82"
EXTRUDE_REL = "M83"
SET_EXT_TEMP = "M104"
MAX_EXT_TEMP = 450
SET_BED_TEMP = "M140"
MAX_BED_TEMP = 150
SET_EXT_FACTOR = "M221"
SET_FAN_SPEED = "M106"
SET_SPD_FACTOR = "M220"
PROBE_CALIBRATE = "PROBE_CALIBRATE"
Z_ENDSTOP_CALIBRATE = "Z_ENDSTOP_CALIBRATE"
TESTZ = "TESTZ Z="
ABORT = "ABORT"
ACCEPT = "ACCEPT"
SAVE_CONFIG = "SAVE_CONFIG"
RESTART = "RESTART"
FIRMWARE_RESTART = "FIRMWARE_RESTART"
@staticmethod
def set_bed_temp(temp):
return f"M140 S{temp}"
return "%s S%s" % (KlippyGcodes.SET_BED_TEMP, str(temp))
@staticmethod
def set_ext_temp(temp, tool=0):
return f"M104 T{tool} S{temp}"
return "%s T%s S%s" % (KlippyGcodes.SET_EXT_TEMP, str(tool), str(temp))
@staticmethod
def set_heater_temp(heater, temp):
return f'SET_HEATER_TEMPERATURE heater="{heater}" target={temp}'
return 'SET_HEATER_TEMPERATURE heater="%s" target=%s' % (heater, str(temp))
@staticmethod
def set_temp_fan_temp(temp_fan, temp):
return f'SET_TEMPERATURE_FAN_TARGET temperature_fan="{temp_fan}" target={temp}'
return 'SET_TEMPERATURE_FAN_TARGET temperature_fan="%s" target=%s' % (temp_fan, str(temp))
@staticmethod
def set_fan_speed(speed):
speed = str(int(float(int(speed) % 101)/100*255))
return "%s S%s" % (KlippyGcodes.SET_FAN_SPEED, speed)
@staticmethod
def set_extrusion_rate(rate):
return f"M221 S{rate}"
return "%s S%s" % (KlippyGcodes.SET_EXT_FACTOR, rate)
@staticmethod
def set_speed_rate(rate):
return f"M220 S{rate}"
return "%s S%s" % (KlippyGcodes.SET_SPD_FACTOR, rate)
@staticmethod
def testz_move(dist):
return KlippyGcodes.TESTZ + dist
@staticmethod
def extrude(dist, speed=500):
return "%s E%s F%s" % (KlippyGcodes.MOVE, dist, speed)
@staticmethod
def bed_mesh_load(profile):
return f"BED_MESH_PROFILE LOAD='{profile}'"
return "BED_MESH_PROFILE LOAD='%s'" % profile
@staticmethod
def bed_mesh_remove(profile):
return f"BED_MESH_PROFILE REMOVE='{profile}'"
return "BED_MESH_PROFILE REMOVE='%s'" % profile
@staticmethod
def bed_mesh_save(profile):
return f"BED_MESH_PROFILE SAVE='{profile}'"
@staticmethod
def set_led_color(led, color):
return (
f'SET_LED LED="{led}" '
f'RED={color[0]} GREEN={color[1]} BLUE={color[2]} WHITE={color[3]} '
f'SYNC=0 TRANSMIT=1'
)
return "BED_MESH_PROFILE SAVE='%s'" % profile
+235 -191
View File
@@ -1,91 +1,79 @@
# -*- coding: utf-8 -*-
import gi
import logging
import os
import pathlib
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gdk, GdkPixbuf, Gio, Gtk, Pango
def find_widget(widget, wanted_type):
# Returns a widget of wanted_type or None
if isinstance(widget, wanted_type):
return widget
if isinstance(widget, (Gtk.Container, Gtk.Bin, Gtk.Button, Gtk.Alignment, Gtk.Box)):
for _ in widget.get_children():
result = find_widget(_, wanted_type)
if result is not None:
return result
def format_label(widget, lines=2):
label = find_widget(widget, Gtk.Label)
if label is not None:
label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
label.set_line_wrap(True)
label.set_ellipsize(Pango.EllipsizeMode.END)
label.set_lines(lines)
from gi.repository import Gtk, Gdk, GdkPixbuf, Gio, GLib, Pango
klipperscreendir = os.getcwd()
class KlippyGtk:
labels = {}
font_ratio = [43, 29]
keyboard_ratio = .22
width_ratio = 16
height_ratio = 9.375
def __init__(self, screen):
def __init__(self, screen, width, height, theme, cursor, fontsize_type):
self.screen = screen
self.themedir = os.path.join(pathlib.Path(__file__).parent.resolve().parent, "styles", screen.theme, "images")
self.cursor = screen.show_cursor
self.font_size_type = screen._config.get_main_config().get("font_size", "medium")
self.width = screen.width
self.height = screen.height
self.font_ratio = [33, 49] if self.screen.vertical_mode else [43, 29]
self.font_size = min(self.width / self.font_ratio[0], self.height / self.font_ratio[1])
self.img_scale = self.font_size * 2
self.button_image_scale = 1.38
self.bsidescale = .65 # Buttons with image at the side
if self.font_size_type == "max":
self.font_size = self.font_size * 1.2
self.bsidescale = .7
elif self.font_size_type == "extralarge":
self.font_size = self.font_size * 1.14
self.img_scale = self.img_scale * 0.7
self.bsidescale = 1
elif self.font_size_type == "large":
self.font_size = self.font_size * 1.09
self.img_scale = self.img_scale * 0.9
self.bsidescale = .8
elif self.font_size_type == "small":
self.font_size = self.font_size * 0.91
self.bsidescale = .55
self.img_width = self.font_size * 3
self.img_height = self.font_size * 3
self.titlebar_height = self.font_size * 2
logging.info(f"Font size: {self.font_size:.1f} ({self.font_size_type})")
if self.screen.vertical_mode:
self.action_bar_width = int(self.width)
self.action_bar_height = int(self.height * .1)
self.content_width = self.width
self.content_height = self.height - self.titlebar_height - self.action_bar_height
else:
self.action_bar_width = int(self.width * .1)
self.action_bar_height = int(self.height)
self.content_width = self.width - self.action_bar_width
self.content_height = self.height - self.titlebar_height
self.keyboard_height = self.content_height * 0.5
if (self.height / self.width) >= 3: # Ultra-tall
self.keyboard_height = self.keyboard_height * 0.5
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]
))
if fontsize_type == "small":
self.font_size = round(self.font_size * 0.91)
elif (fontsize_type == "large"):
self.font_size = round(self.font_size * 1.09)
self.header_size = int(round((self.width / self.width_ratio) / 1.33))
self.img_width = int(round(self.width / self.width_ratio))
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
self.cursor = cursor
self.color_list = {} # This is set by screen.py init_style()
for key in self.color_list:
if "base" in self.color_list[key]:
rgb = [int(self.color_list[key]['base'][i:i + 2], 16) for i in range(0, 6, 2)]
rgb = [int(self.color_list[key]['base'][i:i+2], 16) for i in range(0, 6, 2)]
self.color_list[key]['rgb'] = rgb
logging.debug("img width: %s height: %s" % (self.img_width, self.img_height))
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_font_size(self):
return self.font_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_keyboard_height(self):
return (self.width - self.get_action_bar_width()) * self.keyboard_ratio
def get_temp_color(self, device):
# logging.debug("Color list %s" % self.color_list)
logging.debug("Color list %s" % self.color_list)
if device not in self.color_list:
return False, False
@@ -94,140 +82,176 @@ class KlippyGtk:
if self.color_list[device]['state'] > 0:
rgb[1] = rgb[1] + self.color_list[device]['hsplit'] * self.color_list[device]['state']
self.color_list[device]['state'] += 1
rgb = [x / 255 for x in rgb]
# logging.debug(f"Assigning color: {device} {rgb}")
color = '{:02X}{:02X}{:02X}'.format(rgb[0], rgb[1], rgb[2])
rgb = [x/255 for x in rgb]
logging.debug("Assigning color: %s %s %s" % (device, rgb, color))
else:
colors = self.color_list[device]['colors']
if self.color_list[device]['state'] >= len(colors):
self.color_list[device]['state'] = 0
color = colors[self.color_list[device]['state'] % len(colors)]
rgb = [int(color[i:i + 2], 16) / 255 for i in range(0, 6, 2)]
rgb = [int(color[i:i+2], 16)/255 for i in range(0, 6, 2)]
self.color_list[device]['state'] += 1
# logging.debug(f"Assigning color: {device} {rgb} {color}")
return rgb
logging.debug("Assigning color: %s %s %s" % (device, rgb, color))
return rgb, color
def reset_temp_color(self):
for key in self.color_list:
self.color_list[key]['state'] = 0
@staticmethod
def Label(label, style=None):
def Label(self, label, style=None):
la = Gtk.Label(label)
if style is not None:
if style is not None and style is not False:
la.get_style_context().add_class(style)
return la
def Image(self, image_name=None, width=None, height=None):
if image_name is None:
return Gtk.Image()
pixbuf = self.PixbufFromIcon(image_name, width, height)
return Gtk.Image.new_from_pixbuf(pixbuf) if pixbuf is not None else Gtk.Image()
def 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)
def PixbufFromIcon(self, filename, width=None, height=None):
width = width if width is not None else self.img_width
height = height if height is not None else self.img_height
filename = os.path.join(self.themedir, filename)
for ext in ["svg", "png"]:
pixbuf = self.PixbufFromFile(f"{filename}.{ext}", int(width), int(height))
if pixbuf is not None:
return pixbuf
return None
image = Gtk.Image.new_from_pixbuf(pixbuf)
@staticmethod
def PixbufFromFile(filename, width=-1, height=-1):
try:
return GdkPixbuf.Pixbuf.new_from_file_at_size(filename, int(width), int(height))
except Exception as e:
logging.exception(e)
logging.error(f"Unable to find image {filename}")
return None
label = Gtk.Label()
label.set_markup(text)
box1.add(image)
box1.add(label)
def PixbufFromHttp(self, resource, width=-1, height=-1):
if style is not False:
ctx = box1.get_style_context()
ctx.add_class(style)
return {"l": label, "b": box1}
def ImageMenuButton(self, image_name, text, size=20, style=False, width_scale=.32, height_scale=.32, popover=False):
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)
mb = Gtk.MenuButton(label="", popover=popover)
label = mb.get_label()
box1.add(image)
box1.add(mb)
if style is not False:
ctx = box1.get_style_context()
ctx.add_class(style)
return {"l": label, "mb": mb, "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 is False:
return None
stream = Gio.MemoryInputStream.new_from_data(response, None)
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale(stream, int(width), int(height), True)
except Exception as e:
logging.exception(e)
return None
stream.close_async(2)
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 Button(self, image_name=None, label=None, style=None, scale=None, position=Gtk.PositionType.TOP, lines=2):
if self.font_size_type == "max" and label is not None and scale is None:
image_name = None
b = Gtk.Button()
if label is not None:
b.set_label(label.replace("\n", " "))
def ProgressBar(self, style=False):
bar = Gtk.ProgressBar()
if style is not 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 is not None:
b.get_style_context().add_class(style)
return b
def ButtonImage(self, image_name, label=None, style=None, width_scale=1.38, height_scale=1.38,
position=Gtk.PositionType.TOP, word_wrap=True):
filename = "%s/styles/%s/images/%s.svg" % (klipperscreendir, self.theme, str(image_name))
if not os.path.exists(filename):
logging.error("Unable to find button image (theme, image): (%s, %s)" % (self.theme, str(image_name)))
filename = "%s/styles/%s/images/%s.svg" % (klipperscreendir, self.theme, "warning")
b = Gtk.Button(label=label)
if os.path.exists(filename):
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.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)
if image_name is not None:
if scale is None:
scale = self.button_image_scale
if label is None:
scale = scale * 1.4
width = height = self.img_scale * scale
b.set_image(self.Image(image_name, width, height))
spinner = Gtk.Spinner.new()
spinner.set_no_show_all(True)
spinner.set_size_request(width, height)
spinner.hide()
box = find_widget(b, Gtk.Box)
if box:
box.add(spinner)
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 Exception:
pass
if label is not None:
format_label(b, lines)
if style is not None:
b.get_style_context().add_class(style)
b.connect("clicked", self.screen.reset_screensaver_timeout)
return b
@staticmethod
def Button_busy(widget, busy):
spinner = find_widget(widget, Gtk.Spinner)
image = find_widget(widget, Gtk.Image)
if busy:
widget.set_sensitive(False)
if image:
widget.set_always_show_image(False)
image.hide()
if spinner:
spinner.start()
spinner.show()
else:
if image:
widget.set_always_show_image(True)
image.show()
if spinner:
spinner.stop()
spinner.hide()
widget.set_sensitive(True)
def Dialog(self, title, buttons, content, callback=None, *args):
dialog = Gtk.Dialog(title=title)
dialog.set_default_size(self.width, self.height)
def Dialog(self, screen, buttons, content, callback=None, *args):
dialog = Gtk.Dialog()
dialog.set_default_size(screen.width, screen.height)
dialog.set_resizable(False)
dialog.set_transient_for(self.screen)
dialog.set_transient_for(screen)
dialog.set_modal(True)
if not self.screen.windowed:
dialog.fullscreen()
for button in buttons:
dialog.add_button(button['name'], button['response'])
button = dialog.get_widget_for_response(button['response'])
button.set_size_request((self.width - 30) / 3, self.height / 5)
format_label(button, 3)
dialog.add_button(button_text=button['name'], response_id=button['response'])
dialog.connect("response", self.screen.reset_screensaver_timeout)
dialog.connect("response", callback, *args)
dialog.get_style_context().add_class("dialog")
box = Gtk.Box()
box.set_size_request(screen.width - 60, 0)
box.set_vexpand(True)
content_area = dialog.get_content_area()
content_area.set_margin_start(15)
content_area.set_margin_end(15)
@@ -238,28 +262,40 @@ class KlippyGtk:
dialog.show_all()
# Change cursor to blank
if self.cursor:
dialog.get_window().set_cursor(
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.ARROW))
dialog.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.ARROW))
else:
dialog.get_window().set_cursor(
Gdk.Cursor.new_for_display(Gdk.Display.get_default(), Gdk.CursorType.BLANK_CURSOR))
dialog.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.BLANK_CURSOR))
self.screen.dialogs.append(dialog)
logging.info(f"Showing dialog {dialog.get_title()} {dialog.get_size()}")
return dialog
def remove_dialog(self, dialog, *args):
if self.screen.updating:
return
dialog.destroy()
if dialog in self.screen.dialogs:
logging.info("Removing Dialog")
self.screen.dialogs.remove(dialog)
return
logging.debug(f"Cannot remove dialog {dialog}")
@staticmethod
def HomogeneousGrid(width=None, height=None):
def ToggleButtonImage(self, image_name, label, style=False, width_scale=1.38, height_scale=1.38):
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.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 is not 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)
@@ -272,17 +308,25 @@ class KlippyGtk:
b.props.relief = Gtk.ReliefStyle.NONE
b.set_hexpand(True)
b.set_vexpand(True)
b.connect("clicked", self.screen.reset_screensaver_timeout)
return b
def ScrolledWindow(self, steppers=True):
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)
scroll.add_events(Gdk.EventMask.BUTTON_PRESS_MASK |
Gdk.EventMask.TOUCH_MASK |
Gdk.EventMask.BUTTON_RELEASE_MASK)
scroll.set_kinetic_scrolling(True)
if self.screen._config.get_main_config().getboolean("show_scroll_steppers", fallback=False) and steppers:
scroll.get_vscrollbar().get_style_context().add_class("with-steppers")
return scroll
def formatFileName(self, name):
name = name.split('/')[-1] if "/" in name else name
name = name.split('.gcod')[0] if ".gcode" in name else name
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"
+24 -60
View File
@@ -1,85 +1,49 @@
import logging
import re
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
self.status = ''
@property
def endpoint(self):
protocol = "http"
if int(self.port) in {443, 7130}:
protocol = "https"
return f"{protocol}://{self.ip}:{self.port}"
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 is False or 'result' not in r:
if r is False:
return False
return r['result']
def get_printer_info(self):
return self.send_request("printer/info")
def get_gcode_help(self):
return self.send_request("printer/gcode/help")
def get_thumbnail_stream(self, thumbnail):
return self.send_request(f"server/files/gcodes/{thumbnail}", json=False)
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 _do_request(self, method, request_method, data=None, json=None, json_response=True, timeout=3):
url = f"{self.endpoint}/{method}"
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 is False else {"x-api-key": self.api_key}
response_data = False
try:
callee = getattr(requests, request_method)
response = callee(url, json=json, data=data, headers=headers, timeout=timeout)
response.raise_for_status()
if json_response:
logging.debug(f"Sending request to {url}")
response_data = response.json()
else:
response_data = response.content
except requests.exceptions.HTTPError as h:
self.status = self.format_status(h)
except requests.exceptions.ConnectionError as c:
self.status = self.format_status(c)
except requests.exceptions.Timeout as t:
self.status = self.format_status(t)
except requests.exceptions.JSONDecodeError as j:
self.status = self.format_status(j)
except requests.exceptions.RequestException as r:
self.status = self.format_status(r)
except Exception as e:
self.status = self.format_status(e)
if response_data:
self.status = ''
else:
logging.error(self.status.replace('\n', '>>'))
return response_data
r = requests.get(url, headers=headers)
except Exception:
return False
if r.status_code != 200:
return False
def post_request(self, method, data=None, json=None, json_response=True):
return self._do_request(method, "post", data, json, json_response)
def send_request(self, method, json=True, timeout=3):
return self._do_request(method, "get", json_response=json, timeout=timeout)
@staticmethod
def format_status(status):
# TODO: Try/except
try:
rep = {"HTTPConnectionPool": "", "/server/info ": "", "Caused by ": "", "(": "", ")": "",
": ": "\n", "'": "", "`": "", "\"": ""}
rep = {re.escape(k): v for k, v in rep.items()}
pattern = re.compile("|".join(rep.keys()))
status = pattern.sub(lambda m: rep[re.escape(m.group(0))], f"{status}").split("\n")
return "\n".join(_ for _ in status if "urllib3" not in _ and _ != "")
except TypeError or KeyError:
return status
data = json.loads(r.content)
except Exception:
logging.exception("Unable to parse response from moonraker:\n %s" % r.content)
return False
return data
Loaded 100 of 327 files, more files were not shown because too many files have changed in this diff. Show more