Skip to content

Commit

Permalink
merge from upstream master
Browse files Browse the repository at this point in the history
  • Loading branch information
moggieuk committed Dec 4, 2024
2 parents ce08c5e + 7431ad8 commit b61d27b
Show file tree
Hide file tree
Showing 118 changed files with 2,499 additions and 602 deletions.
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
This just tracks the most notable changes, if you want all the details checkout the commit history.
Probably all versions contain changes regarding documentation, translation, fixes and other minor refactors

## v0.4.5-*

* menu buttons can have an 'active' status to change their appearance
* basic lockscreen for shows or kids

## v0.4.5 (Oct 28, 2024)

* feat: allow calling KlipperScreen panels from gcode
* feat: mesh will automatically call for z_tilt or quad_level if not applied
* feat: show battery status in the topbar
* feat: keyboard to keypad input switch with auto pre-selection
* allow calling KlipperScreen panels from gcode
* bed_mesh: automatically call for z_tilt or quad_level if not applied
* show battery status in the topbar
* macros: keyboard to keypad input switch with auto pre-selection

## v0.4.4 (Sep 16, 2024)
* support for different moonraker routes
Expand Down
11 changes: 9 additions & 2 deletions config/move_menu.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,48 @@ name: {{ gettext('Home X') }}
icon: home-x
method: printer.gcode.script
params: {"script":"G28 X"}
active: {{ 'x' in printer.homed_axes }}

[menu move homing homey]
name: {{ gettext('Home Y') }}
icon: home-y
method: printer.gcode.script
params: {"script":"G28 Y"}
active: {{ 'y' in printer.homed_axes }}

[menu move homing homez]
name: {{ gettext('Home Z') }}
icon: home-z
method: printer.gcode.script
params: {"script":"G28 Z"}
active: {{ 'z' in printer.homed_axes }}

[menu move homing homeall]
name: {{ gettext('Home All') }}
icon: home
method: printer.gcode.script
params: {"script":"G28"}
active: {{ 'xyz' in printer.homed_axes }}

[menu move homing homexy]
name: {{ gettext('Home XY') }}
icon: home
method: printer.gcode.script
params: {"script":"G28 X Y"}
active: {{ 'xy' in printer.homed_axes }}

[menu move homing quad_gantry_level]
name: {{ gettext('Quad Gantry Level') }}
icon: home-z
method: printer.gcode.script
params: {"script":"QUAD_GANTRY_LEVEL"}
enable: {{ 'quad_gantry_level' in printer.config_sections }}
enable: {{ 'QUAD_GANTRY_LEVEL' in printer.available_commands }}
active: {{ printer.quad_gantry_level.applied }}

[menu move homing Z-Tilt]
name: {{ gettext('Z Tilt') }}
icon: z-tilt
method: printer.gcode.script
params: {"script":"Z_TILT_ADJUST"}
enable: {{ 'z_tilt' in printer.config_sections }}
enable: {{ 'Z_TILT_ADJUST' in printer.available_commands }}
active: {{ printer.z_tilt.applied }}
7 changes: 7 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ The options listed here are not editable from within the user interface.
# 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

# Define the password to use when locking the screen, this is not secure
# it's saved as plain text, it's meant to be a deterrent for kids or people at shows
# it will be redacted from the logs.
# default is no password
# lock_password: example_password
```

!!! tip
Expand Down Expand Up @@ -204,6 +210,7 @@ printer.gcode_macros.count # Number of gcode macros
printer.gcode_macros.list # List of names of the gcode macros
printer.leds.count # Number of leds
printer.config_sections # Array of section headers of Klipper config (printer.cfg)
printer.available_commands # List of all the commands that the printer supports
```


Expand Down
4 changes: 2 additions & 2 deletions happy_hare/install_ks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# MMU KlipperScreen Happy Hare edition supplemental installer
#
# Copyright (C) 2023 moggieuk#6538 (discord)
# moggieuk@hotmail.com
# Copyright (C) 2023-2025 moggieuk#6538 (discord)
# moggieuk@hotmail.com
#
# Screen Capture: scrot -s -D :0.0
#
Expand Down
4 changes: 2 additions & 2 deletions happy_hare/iter_select_gates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ name: {{ gettext('Select Gate #{i}') }}
icon: mmu_select_gate
method: printer.gcode.script
params: { "script":"MMU_SELECT GATE={i}" }
enable: {{ printer.mmu.gate != {i} and printer.mmu.action == "Idle" and printer.mmu.num_gates > {i} }}
enable: {{ printer.mmu.gate != {i} and printer.mmu.num_gates > {i} }}
show_disabled: True
refresh_on: printer.mmu.gate, printer.mmu.action
refresh_on: printer.mmu.gate
38 changes: 19 additions & 19 deletions happy_hare/menus.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Happy Hare KlipperScreen menus. Don't remove this line, installer needs it!
#
# Copyright (C) 2023 moggieuk#6538 (discord)
# moggieuk@hotmail.com
# Copyright (C) 2023-2025 moggieuk#6538 (discord)
# moggieuk@hotmail.com
#
# Menu options:
# name, icon, panel, method, confirm, enable, params, style, NEW: show_disabled, refresh_on
Expand Down Expand Up @@ -50,53 +50,53 @@ show_disabled: True
[menu __main,__print mmu tools]
name: {{ gettext('Load Tool...') }}
icon: extruder
enable: {{ printer.idle_timeout.state != "Printing" }}
enable: {{ printer.mmu.print_state != "printing" }}
show_disabled: True
refresh_on: printer.idle_timeout.state
refresh_on: printer.mmu.print_state

MMU_iter_load_tools

[menu __main,__print mmu preload_gates]
name: {{ gettext('Preload Gate...') }}
icon: mmu_reset
enable: {{ printer.idle_timeout.state != "Printing" }}
enable: {{ printer.mmu.print_state != "printing" }}
show_disabled: True
refresh_on: printer.idle_timeout.state
refresh_on: printer.mmu.print_state

MMU_iter_preload_gates

[menu __main,__print mmu eject_gates]
name: {{ gettext('Eject Gate...') }}
icon: mmu_eject
enable: {{ printer.idle_timeout.state != "Printing" }}
enable: {{ printer.mmu.print_state != "printing" }}
show_disabled: True
refresh_on: printer.idle_timeout.state
refresh_on: printer.mmu.print_state

MMU_iter_eject_gates

[menu __main,__print mmu check_gates]
name: {{ gettext('Check Gate...') }}
icon: mmu_checkgates
enable: {{ printer.idle_timeout.state != "Printing" }}
enable: {{ printer.mmu.print_state != "printing" }}
show_disabled: True
refresh_on: printer.idle_timeout.state
refresh_on: printer.mmu.print_state

MMU_iter_check_gates

[menu __main,__print mmu select_gates]
name: {{ gettext('Select Gate...') }}
icon: mmu_select_gate
enable: {{ printer.idle_timeout.state != "Printing" }}
enable: {{ printer.mmu.print_state != "printing" }}
show_disabled: True
refresh_on: printer.idle_timeout.state
refresh_on: printer.mmu.print_state

# Example: to just select the tool (not load)
#[menu __main,__print mmu select_tools]
#name: {{ gettext('Select Tool...') }}
#icon: extruder
#enable: {{ printer.idle_timeout.state != "Printing" }}
#enable: {{ printer.mmu.print_state != "printing" }}
#show_disabled: True
#refresh_on: printer.idle_timeout.state
#refresh_on: printer.mmu.print_state
#
#MMU_iter_select_tools

Expand All @@ -105,9 +105,9 @@ name: {{ gettext('Select Bypass') }}
icon: mmu_select_bypass
method: printer.gcode.script
params: {"script":"MMU_SELECT_BYPASS"}
enable: {{ printer.mmu.gate != -2 and printer.mmu.action == "Idle" and printer.mmu.has_bypass }}
enable: {{ printer.mmu.gate != -2 and printer.mmu.has_bypass }}
show_disabled: True
refresh_on: printer.mmu.gate, printer.mmu.action, printer.mmu.has_bypass
refresh_on: printer.mmu.gate, printer.mmu.has_bypass

MMU_iter_select_gates

Expand Down Expand Up @@ -162,7 +162,7 @@ name: {{ gettext('Disable LED') }}
icon: mmu_led_disable
method: printer.gcode.script
params: {"script":"MMU_LED ENABLE=0 QUIET=1"}
enable: {{ printer.mmu.enabled == 1 and not printer.mmu.print_state == "standby" }}
enable: {{ printer.mmu.enabled and not printer.mmu.print_state == "standby" }}
show_disabled: True
refresh_on: printer.mmu.enabled, printer.mmu.print_state

Expand All @@ -171,7 +171,7 @@ name: {{ gettext('LED Gate Status') }}
icon: mmu_led_gate_status
method: printer.gcode.script
params: {"script":"MMU_LED ENABLE=1 EXIT_EFFECT=gate_status QUIET=1"}
enable: {{ printer.mmu.enabled == 1 and not printer.mmu.print_state == "standby" }}
enable: {{ printer.mmu.enabled and not printer.mmu.print_state == "standby" }}
show_disabled: True
refresh_on: printer.mmu.enabled, printer.mmu.print_state

Expand All @@ -180,7 +180,7 @@ name: {{ gettext('LED Fil. Color') }}
icon: mmu_led_filament_color
method: printer.gcode.script
params: {"script":"MMU_LED ENABLE=1 EXIT_EFFECT=filament_color QUIET=1"}
enable: {{ printer.mmu.enabled == 1 and not printer.mmu.print_state == "standby" }}
enable: {{ printer.mmu.enabled and not printer.mmu.print_state == "standby" }}
show_disabled: True
refresh_on: printer.mmu.enabled, printer.mmu.print_state

Expand Down
7 changes: 5 additions & 2 deletions ks_includes/KlippyGtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import os
import pathlib

import gi

gi.require_version("Gtk", "3.0")
Expand Down Expand Up @@ -179,7 +180,7 @@ def Button(self, image_name=None, label=None, style=None, scale=None, position=G
format_label(b, lines)
if style is not None:
b.get_style_context().add_class(style)
b.connect("clicked", self.screen.reset_screensaver_timeout)
b.connect("clicked", self.screen.screensaver.reset_timeout)
return b

@staticmethod
Expand Down Expand Up @@ -238,7 +239,7 @@ def Dialog(self, title, buttons, content, callback=None, *args):
dialog.add_events(Gdk.EventMask.BUTTON_RELEASE_MASK)
dialog.connect("button-release-event", self.remove_dialog)

dialog.connect("response", self.screen.reset_screensaver_timeout)
dialog.connect("response", self.screen.screensaver.reset_timeout)
dialog.connect("response", callback, *args)
dialog.get_style_context().add_class("dialog")

Expand All @@ -263,6 +264,8 @@ def remove_dialog(self, dialog, *args):
return
if self.screen.updating:
return
if dialog == self.screen.confirm:
self.screen.confirm = None
dialog.destroy()
if dialog in self.screen.dialogs:
logging.info("Removing Dialog")
Expand Down
1 change: 1 addition & 0 deletions ks_includes/KlippyRest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import re

import requests


Expand Down
2 changes: 1 addition & 1 deletion ks_includes/KlippyWebsocket.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/python

import threading
import json
import logging
import threading

import gi
import websocket
Expand Down
34 changes: 16 additions & 18 deletions ks_includes/config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import configparser
import copy
import gettext
import os
import logging
import json
import re
import copy
import pathlib
import locale

import logging
import os
import pathlib
import re
from io import StringIO

SCREEN_BLANKING_OPTIONS = [
Expand Down Expand Up @@ -188,8 +187,8 @@ def validate_config(self, config, string="", remove=False):
strs = (
'default_printer', 'language', 'print_sort_dir', 'theme', 'screen_blanking_printing', 'font_size',
'print_estimate_method', 'screen_blanking', "screen_on_devices", "screen_off_devices", 'print_view',
'print_estimate_method', 'screen_blanking', "screen_on_devices", "screen_off_devices",
'sticky_panel', # Happy Hare
"lock_password"
)
numbers = (
'job_complete_timeout', 'job_error_timeout', 'move_speed_xy', 'move_speed_z',
Expand All @@ -212,11 +211,7 @@ def validate_config(self, config, string="", remove=False):
strs = ('gcode', '')
numbers = [f'{option}' for option in config[section] if option != 'gcode']
elif section.startswith('menu '):
strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm', 'style', 'show_disabled', 'refresh_on') # Happy Hare: Added show_disabled, refresh_on
elif section == 'bed_screws':
# This section may be deprecated in favor of moving this options under the printer section
numbers = ('rotation', '')
strs = ('screw_positions', '')
strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm', 'style', 'active', 'show_disabled', 'refresh_on') # Happy Hare: Added show_disabled, refresh_on
elif section.startswith('graph')\
or section.startswith('displayed_macros')\
or section.startswith('spoolman'):
Expand Down Expand Up @@ -629,14 +624,16 @@ def set(self, section, name, value):
self.config.set(section, name, value)

def log_config(self, config):
sensitive_keys = [
r'(moonraker_api_key\s*(?:=|:)\s*)\S+',
r'(lock_password\s*(?:=|:)\s*)\S+',
]
config_str = self._build_config_string(config)
for pattern in sensitive_keys:
config_str = re.sub(pattern, r'\1[redacted]', config_str)
lines = [
" "
"===== Config File =====",
re.sub(
r'(moonraker_api_key\s*=\s*\S+)',
'moonraker_api_key = [redacted]',
self._build_config_string(config)
),
config_str,
"======================="
]
logging.info("\n".join(lines))
Expand All @@ -661,6 +658,7 @@ def _build_menu_item(self, menu, name):
"enable": cfg.get("enable", "True"),
"params": cfg.get("params", "{}"),
"style": cfg.get("style", None),
"active": cfg.get("active", None),
"show_disabled": cfg.get("show_disabled", "False"), # Happy Hare
"refresh_on": cfg.get("refresh_on", None) # Happy Hare
}
Expand Down
1 change: 1 addition & 0 deletions ks_includes/files.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os

import gi

gi.require_version("Gtk", "3.0")
Expand Down
7 changes: 2 additions & 5 deletions ks_includes/functions.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import ctypes
import logging
import logging.handlers
import os
import re
import struct
import subprocess
import sys
import threading
import time
import traceback
from queue import SimpleQueue as Queue

import ctypes
import struct

dpms_loaded = False
try:
ctypes.cdll.LoadLibrary('libXext.so.6')
Expand Down
Loading

0 comments on commit b61d27b

Please sign in to comment.