-
Notifications
You must be signed in to change notification settings - Fork 4
FireflyUi
When Firefly is started, it hosts a local web server on port 4080 using the omegalib module "Porthole". Firefly then spawns a separate web browser that connects to this server and outputs the contents on a layer on top of the normal firefly pointCloud display. The web browser is embedded into the firefly window utilizing the omegalib module "Omium", and functions similarly to a Chrome interface. Thus, in order to pass information from firefly to the interface, as well as path changes to the interface back to firefly, firefly needs to broadcast information in a similar manner to a web server and a client.
Javascript functions can be called from python using the ps.broadcastjs(string output, '') function. This broadcasts a command to all currently connected clients, which by default includes only the Omium client in the firefly window. The parameter "output" should be a string directly representing javascript code.
From Javascript, it is possible to call python functions using the format {{py <python code>}}. The code specified will be directly interpreted as python code. If needed, you can reference javascript objects an`d variables by surrounding a token name with the '%' character.
Example: {{py saveCurrentView("%presetData.currentName%")}}
loadUi(): Called soon after the server is initialized. Initializes the Omium web browser, sets the background to transparent and initializes a connection attempt with the local web server.
onUiFocusChanged(): Called when the javascript interface is hidden or made the primary focus. Currently used to make the interface slightly transparent when clicking on the Firefly visualization directly.
onClientConnected(): Called after the javascript interface successfully connects to the porthole web server. The Python interface sends dataModes and filterModes to javascript interface.
onEvent(): Called upon a mouse or key event. Includes keyboard shortcuts to hide/show the colormap preview, the help box, the help console, as well as clear the console.