MCPcopy Create free account
hub / github.com/NyarchLinux/DesktopPuppet / create_gtk_widget

Method create_gtk_widget

puppet_extension.py:187–204  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

185 path = super().translate_path(path)
186 # Replace the default directory with the specified folder path
187 return os.path.join(folder_path, os.path.relpath(path, os.getcwd()))
188 self.httpd = HTTPServer(('127.0.0.1', 0), CustomHTTPRequestHandler)
189 httpd = self.httpd
190 model = self.get_setting("model")
191 background_color = self.get_setting("background-color")
192 scale = int(self.get_setting("scale"))/100
193 q = urlencode({"model": model, "bg": background_color, "scale": scale})
194
195 self.model_webserver_address = "http://localhost:" + str(httpd.server_address[1])
196 threading.Thread(target=self.update_address).start()
197 httpd.serve_forever()
198
199 def update_address(self):
200 try:
201 sleep(3)
202 settings = {"address": self.model_webserver_address, "model": self.get_setting("model"), "scale": self.get_setting("scale"), "extra_w": self.get_setting("extra_w"), "extra_h": self.get_setting("extra_h")}
203 requests.post(f'{self.base_url}/set_settings', json={'settings': settings})
204 except Exception as e:
205 print(e)
206 return
207

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected