screen: allow custom moonraker url/port
This commit is contained in:
parent
bcbbc03151
commit
c3f96418ea
@ -12,6 +12,10 @@ config is included here: [ks_includes/KlipperScreen.conf](../ks_includes/Klipper
|
|||||||
## Main Options
|
## Main Options
|
||||||
```
|
```
|
||||||
[main]
|
[main]
|
||||||
|
# Define the moonraker host/port if different from 127.0.0.1 and 7125
|
||||||
|
moonraker_host: 127.0.0.1
|
||||||
|
moonraker_port: 7125
|
||||||
|
|
||||||
# Invert axis in move panel. Default is False. Change to true to invert
|
# Invert axis in move panel. Default is False. Change to true to invert
|
||||||
invert_x: False
|
invert_x: False
|
||||||
invert_y: False
|
invert_y: False
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#### 2020 12 16
|
#### 2020 12 16
|
||||||
* Config file can now be specified when running from the command line
|
* Config file can now be specified when running from the command line
|
||||||
|
* Moonraker host/port can be specified in the configuration file
|
||||||
|
|
||||||
#### 2020 12 09
|
#### 2020 12 09
|
||||||
* Z value in job status now reflects the gcode Z value. This allows people with ABL to have a better understanding of Z
|
* Z value in job status now reflects the gcode Z value. This allows people with ABL to have a better understanding of Z
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
[main]
|
[main]
|
||||||
|
moonraker_host: 127.0.0.1
|
||||||
|
moonraker_port: 7125
|
||||||
|
|
||||||
[preheat PLA]
|
[preheat PLA]
|
||||||
bed = 40
|
bed = 40
|
||||||
|
@ -38,13 +38,13 @@ class KlippyWebsocket(threading.Thread):
|
|||||||
callback_table = {}
|
callback_table = {}
|
||||||
timeout = None
|
timeout = None
|
||||||
|
|
||||||
def __init__(self, screen, callback):
|
def __init__(self, screen, callback, host, port):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self._screen = screen
|
self._screen = screen
|
||||||
self._callback = callback
|
self._callback = callback
|
||||||
self.klippy = MoonrakerApi(self)
|
self.klippy = MoonrakerApi(self)
|
||||||
|
|
||||||
self._url = "127.0.0.1:7125"
|
self._url = "%s:%s" % (host, port)
|
||||||
|
|
||||||
def connect (self):
|
def connect (self):
|
||||||
#r = requests.get(
|
#r = requests.get(
|
||||||
|
18
screen.py
18
screen.py
@ -93,7 +93,9 @@ class KlipperScreen(Gtk.Window):
|
|||||||
self.lang = gettext.translation('KlipperScreen', localedir='ks_includes/locales')
|
self.lang = gettext.translation('KlipperScreen', localedir='ks_includes/locales')
|
||||||
_ = self.lang.gettext
|
_ = self.lang.gettext
|
||||||
|
|
||||||
self.apiclient = KlippyRest("127.0.0.1",7125)
|
self.apiclient = KlippyRest(self._config.get_main_config_option("moonraker_host"),
|
||||||
|
self._config.get_main_config_option("moonraker_port"))
|
||||||
|
|
||||||
Gtk.Window.__init__(self)
|
Gtk.Window.__init__(self)
|
||||||
self.width = self._config.get_main_config().getint("width", Gdk.Screen.get_width(Gdk.Screen.get_default()))
|
self.width = self._config.get_main_config().getint("width", Gdk.Screen.get_width(Gdk.Screen.get_default()))
|
||||||
self.height = self._config.get_main_config().getint("height", Gdk.Screen.get_height(Gdk.Screen.get_default()))
|
self.height = self._config.get_main_config().getint("height", Gdk.Screen.get_height(Gdk.Screen.get_default()))
|
||||||
@ -108,11 +110,15 @@ class KlipperScreen(Gtk.Window):
|
|||||||
|
|
||||||
self.printer_initializing(_("Initializing"))
|
self.printer_initializing(_("Initializing"))
|
||||||
|
|
||||||
self._ws = KlippyWebsocket(self, {
|
self._ws = KlippyWebsocket(self,
|
||||||
"on_connect": self.init_printer,
|
{
|
||||||
"on_message": self._websocket_callback,
|
"on_connect": self.init_printer,
|
||||||
"on_close": self.printer_initializing
|
"on_message": self._websocket_callback,
|
||||||
})
|
"on_close": self.printer_initializing
|
||||||
|
},
|
||||||
|
self._config.get_main_config_option("moonraker_host"),
|
||||||
|
self._config.get_main_config_option("moonraker_port")
|
||||||
|
)
|
||||||
self._ws.connect()
|
self._ws.connect()
|
||||||
|
|
||||||
# Disable DPMS
|
# Disable DPMS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user