import remi import webview import threading from cefpython3 import cefpython as cef import platform import sys class test(remi.App): def __init__(self, *args): super(spatio, self).__init__(*args) def main(self): # defining the looks of the program self.html_head = """ """ cont = remi.gui.HBox(width= "100%", height= "100%", margin="0px auto") l_cont = remi.gui.VBox(width="18%", height="100%", margin="0px") c_cont = remi.gui.VBox(width="64%", height="100%", margin="0px") r_cont = remi.gui.VBox(width="18%", height="100%", margin="0px") self.map = remi.gui.Widget(height="50%", width="100%") # Widgets not active yet! ignore this # self.datalst = remi.gui.TreeView(width="15%", height="100%") # self.layerlst = remi.gui.ListView(width="15%", height="100%") # self.grid = remi.gui.Table(height="50%", width="70%") tag = remi.gui.Tag(_type='script') tag.add_child("javascript", """ var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], target: '%s', controls: [], view: new ol.View({ center: [0, 0], zoom: 2 }) }); """ % (str(self.map.identifier))) c_cont.append(self.map) self.map.add_child("openlayerscript", tag) # l_cont.append(self.datalst) cont.append(l_cont) cont.append(c_cont) cont.append(r_cont) return cont def check_versions(): ver = cef.GetVersion() print("[hello_world.py] CEF Python {ver}".format(ver=ver["version"])) print("[hello_world.py] Chromium {ver}".format(ver=ver["chrome_version"])) print("[hello_world.py] CEF {ver}".format(ver=ver["cef_version"])) print("[hello_world.py] Python {ver} {arch}".format( ver=platform.python_version(), arch=platform.architecture()[0])) assert cef.__version__ >= "57.0", "CEF Python v57.0+ required to run this" def CreateW(): check_versions() sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error cef.Initialize() cef.CreateBrowserSync(url="http://127.0.0.1:8081/", window_title="Spatio") cef.MessageLoop() cef.Shutdown() def startApp(): if __name__ == "__main__": print "starting app" remi.start(test, address='127.0.0.1', port=8081, multiple_instance=False, enable_file_cache=False, start_browser=False) thread1 = threading.Thread(target=CreateW) thread2 = threading.Thread(target=startApp) thread1.setDaemon(True) thread2.start() thread1.start() thread1.join()