Пример #1
0
    def __init__(self, config_file=None):
        self._config_manager = ConfigManager(config_file)

        self._server = Server(self._config_manager.server_config,
                              self._config_manager.content_db,
                              self._config_manager.identity)

        self._discoverer = Discoverer(self._config_manager.discoverer_config, server_config=self._config_manager.server_config)

        self._synchronizer = Synchronizer(self._discoverer,
                                          self._config_manager.synchronizer_config,
                                          self._config_manager.content_db)
Пример #2
0
class DandelionApp:

    def __init__(self, config_file=None):
        self._config_manager = ConfigManager(config_file)

        self._server = Server(self._config_manager.server_config,
                              self._config_manager.content_db,
                              self._config_manager.identity)

        self._discoverer = Discoverer(self._config_manager.discoverer_config, server_config=self._config_manager.server_config)

        self._synchronizer = Synchronizer(self._discoverer,
                                          self._config_manager.synchronizer_config,
                                          self._config_manager.content_db)

    def run_ui(self):

        self._ui = UI(self._config_manager.ui_config,
                      self._config_manager.content_db,
                      self._config_manager.identity,
                      self._server,
                      self._discoverer,
                      self._synchronizer)

        self._ui.run()

    def run_gui(self):
        from dandelion.gui.gui import GUI
        self._gui = GUI(self._config_manager.ui_config,
                        self._config_manager.content_db,
                        self._config_manager.identity,
                        self._server,
                        self._synchronizer)

    def exit(self):
        self._synchronizer.stop()
        self._discoverer.stop()
        self._server.stop()
        self._config_manager.write_file()