Added option to select default printer at startup. (#542)
This commit is contained in:
parent
aa6ae014d8
commit
1af42e6f0f
@ -36,6 +36,9 @@ show_cursor: False
|
|||||||
|
|
||||||
# Allows to define custom systemctl command for restart like xrdp
|
# Allows to define custom systemctl command for restart like xrdp
|
||||||
service: KlipperScreen
|
service: KlipperScreen
|
||||||
|
|
||||||
|
# If multiple printers are defined, this can be set the name of the one to show at startup.
|
||||||
|
default_printer: Ender 3 Pro
|
||||||
```
|
```
|
||||||
|
|
||||||
## Printer Options
|
## Printer Options
|
||||||
|
@ -143,9 +143,12 @@ class KlipperScreen(Gtk.Window):
|
|||||||
self.change_cursor()
|
self.change_cursor()
|
||||||
|
|
||||||
printers = self._config.get_printers()
|
printers = self._config.get_printers()
|
||||||
logging.debug("Printers: %s" % printers)
|
default_printer = self._config.get_main_config().get('default_printer')
|
||||||
if len(printers) == 1:
|
logging.debug("Printers: %s, Default: %s" % (printers, default_printer))
|
||||||
pname = list(self._config.get_printers()[0])[0]
|
if [True for p in printers if default_printer in p]:
|
||||||
|
self.connect_printer(default_printer)
|
||||||
|
elif len(printers) == 1:
|
||||||
|
pname = list(printers[0])[0]
|
||||||
self.connect_printer(pname)
|
self.connect_printer(pname)
|
||||||
else:
|
else:
|
||||||
self.show_panel("printer_select", "printer_select", "Printer Select", 2)
|
self.show_panel("printer_select", "printer_select", "Printer Select", 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user