2018-02-26 22:55:01 +01:00
|
|
|
#!/usr/bin/env python3
|
2018-02-27 00:06:15 +01:00
|
|
|
from remi import start
|
2018-02-28 22:17:44 +01:00
|
|
|
import os
|
2018-02-27 00:06:15 +01:00
|
|
|
import api
|
|
|
|
import gui
|
2018-02-26 22:55:01 +01:00
|
|
|
|
|
|
|
# config must be a object with the attributes::
|
|
|
|
# config.host: str
|
|
|
|
# config.port: str
|
|
|
|
# config.start_browser: bool
|
|
|
|
# config.multiple_instance: bool
|
|
|
|
def main(config):
|
2018-03-01 13:56:31 +01:00
|
|
|
assert hasattr(config, "host"), "Config has no attr 'host'!"
|
|
|
|
assert hasattr(config, "port"), "Config has no attr 'port'!"
|
|
|
|
assert hasattr(config, "start_browser"), "Config has no attr 'start_browser'!"
|
|
|
|
assert hasattr(config, "multiple_instance"), "Config has no attr 'multiple_instance'!"
|
2018-02-26 22:55:01 +01:00
|
|
|
|
|
|
|
# start the webserver:
|
2018-02-27 00:06:15 +01:00
|
|
|
api.BASE_URL = config.api_base
|
2018-02-26 22:55:01 +01:00
|
|
|
start(
|
2018-02-27 00:06:15 +01:00
|
|
|
gui.MyApp,
|
2018-02-26 22:55:01 +01:00
|
|
|
title = "Gregorz",
|
|
|
|
address = config.host,
|
|
|
|
port = config.port,
|
|
|
|
start_browser = config.start_browser,
|
|
|
|
multiple_instance = config.multiple_instance,
|
|
|
|
enable_file_cache = True
|
|
|
|
)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if not os.path.exists("config.py"):
|
|
|
|
shutil.copy("default_config.py", "config.py")
|
|
|
|
import config
|
|
|
|
main(config)
|