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

Method __start_webserver

puppet_extension.py:152–169  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

150 self._puppet_process = subprocess.Popen(get_spawn_command() + ["python3", os.path.join(self.puppet_path,"src", "main.py")])
151
152 def __start_webserver(self):
153 folder_path = self.webview_path
154 class CustomHTTPRequestHandler(SimpleHTTPRequestHandler):
155 def translate_path(self, path):
156 # Get the default translate path
157 path = super().translate_path(path)
158 # Replace the default directory with the specified folder path
159 return os.path.join(folder_path, os.path.relpath(path, os.getcwd()))
160 self.httpd = HTTPServer(('127.0.0.1', 0), CustomHTTPRequestHandler)
161 httpd = self.httpd
162 model = self.get_setting("model")
163 background_color = self.get_setting("background-color")
164 scale = int(self.get_setting("scale"))/100
165 q = urlencode({"model": model, "bg": background_color, "scale": scale})
166
167 self.model_webserver_address = "http://localhost:" + str(httpd.server_address[1])
168 threading.Thread(target=self.update_address).start()
169 httpd.serve_forever()
170
171 def update_address(self):
172 try:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected