viper / app.py
hoduyquocbao's picture
update fix name component
05c8778
import logging
from channels.channel import Channel
from entities.entity import Entity
from interactors.interactor import Interactor
from presenters.presenter import Presenter
from routers.router import Router
from views.view import View
setup_logging = __import__('logging_config').setup_logging
setup_logging()
logger = logging.getLogger('app')
def initialize_app():
# Tạo các thành phần
channel = Channel()
entity = Entity()
interactor = Interactor(channel, entity)
presenter = Presenter(channel)
router = Router(channel)
view = View(channel)
# Xử lý các sự kiện từ người dùng
presenter.handle('render')
presenter.handle('create', 'sampleKey', 'sampleValue')
presenter.handle('read', 'sampleKey')
presenter.handle('update', 'sampleKey', 'updatedValue')
presenter.handle('delete', 'sampleKey')
# Điều hướng
router.navigate('Home')
if __name__ == "__main__":
logger.info("Application started")
initialize_app()
logger.info("Application finished")