Пример #1
0
 def save_project(self):
     if self.project is None:
         Ui.instance().show_status('no project to save.')
     else:
         print 'Weld.save_project()'
         self.project.save()
         Ui.instance().show_status('project saved.')
Пример #2
0
Файл: weld.py Проект: onze/Weld
    def __init__(self, parent=None):
        if Weld.__instance is None:
            Weld.__instance = self
        else:
            raise Exception('can\'t declare new Weld instance. Weld is a singleton.')
        Savable.__init__(self, savepath=os.path.join(user.home, '.weld', 'weld.cache'))
        self.savelist += ['current_project_path']
        # this is used to reload last opened project
        self.current_project_path = None

        Ui(self)

        # setup internal resource handlers
        self.project = None
        
        # list of resources we can ask steel to load
        self.resMan = ResourceManager(os.path.join(Config.instance().weld_data_path, 'resources'))
        self.resMan.attach_to_Ui(Ui.instance().res_browser['library'])

        # entity responsible for behavior trees manipulations
        self.BTMan = BTManager()

        # ready
        Ui.instance().show_status('ready', 1000)
        self.load()
        if Config.instance().on_weld_start_reopen_last_project:
            if self.current_project_path is not None:
                print 'auto reopening project \'%s\'.' % self.current_project_path
                p, f = os.path.split(self.current_project_path)
                self.open_project(self.current_project_path, f)
            else:
                print 'no project to reopen.'
        else:
            print 'skipping project reopening.'
Пример #3
0
Файл: weld.py Проект: onze/Weld
 def save_project(self):
     if self.project is None:
         Ui.instance().show_status('no project to save.')
     else:
         print 'Weld.save_project()'
         self.project.save()
         Ui.instance().show_status('project saved.')
Пример #4
0
def start():

    settings = read_settings()
    initialise = False
    if settings['repo_type'] == 'text':
        clients_repo = TextfileClientsRepo(settings['client_repo'])
        movies_repo = TextfileMoviesRepo(settings['movie_repo'])
        rentals_repo = TextfileRentalsRepo(settings['rental_repo'])
    elif settings['repo_type'] == 'binary':
        clients_repo = BinaryClientsRepo(settings['clients_binary'])
        movies_repo = BinaryMoviesRepo(settings['movies_binary'])
        rentals_repo = BinaryRentalsRepo(settings['rentals_binary'])
    else:
        #iter1 = Iterable()
        #iter2 = Iterable()
        clients_repo = Clients_Repository()
        movies_repo = Movie_Repository()
        rentals_repo = Rental_Repository()
        initialise = True

    clients_validator = client_validator.ValidateClient()
    movies_validator = movie_validator.ValidateMovie()

    undo_controller = UndoController()
    rental_controller = RentalController(rentals_repo, undo_controller, initialise)
    client_controller = ClientController(undo_controller, clients_repo, rentals_repo, initialise)
    movie_controller = MovieController(undo_controller, movies_repo, rentals_repo, initialise)

    ui = Ui(undo_controller, rental_controller, client_controller, movie_controller)
    ui.commandMenu()
Пример #5
0
 def save(self):
     """
     Retrieve some data before saving them.
     """
     self.camera_position = self.qsteelwidget.cameraPosition()
     self.camera_rotation = self.qsteelwidget.cameraRotation()
     Savable.save(self)
     if self.qsteelwidget.saveCurrentLevel():
         s = '%(self)s saved successfuly'
     else:
         s = '%(self)s failed to save'
     Ui.instance().show_status(s)
Пример #6
0
Файл: level.py Проект: onze/Weld
 def save(self):
     """
     Retrieve some data before saving them.
     """
     self.camera_position = self.qsteelwidget.cameraPosition()
     self.camera_rotation = self.qsteelwidget.cameraRotation()
     Savable.save(self)
     if self.qsteelwidget.saveCurrentLevel():
         s='%(self)s saved successfuly'
     else:
         s='%(self)s failed to save'
     Ui.instance().show_status(s)
Пример #7
0
Файл: weld.py Проект: onze/Weld
 def new_level(self, props={}):
     """
     Triggered by the ui when the corresponding menu item is clicked.
     It opens a level configuration form in a tabbed widget, that calls it
     again with the properties ('props') filled by the user.
     """
     if self.project is None:
         Ui.instance().show_status('please create a project first.')
         return
     if props:
         self.project.new_level(props)
         Ui.instance().show_status('new level created')
     else:
         return Ui.instance().open_level_creation_dialog(self.new_level)
Пример #8
0
 def new_level(self, props={}):
     """
     Triggered by the ui when the corresponding menu item is clicked.
     It opens a level configuration form in a tabbed widget, that calls it
     again with the properties ('props') filled by the user.
     """
     if self.project is None:
         Ui.instance().show_status('please create a project first.')
         return
     if props:
         self.project.new_level(props)
         Ui.instance().show_status('new level created')
     else:
         return Ui.instance().open_level_creation_dialog(self.new_level)
Пример #9
0
 def on_steel_ready(self):
     print "Weld.on_steel_ready()"
     qsteelwidget = Ui.instance().qsteelwidget
     #make sure we know when to clean what follows
     qsteelwidget.onSteelClosing.connect(self.on_steel_closing)
     qsteelwidget.onItemDropped.connect(self.on_item_dropped)
     qsteelwidget.onAgentsSelected.connect(self.on_agents_selected)
     #add editing specific resources location
     p = os.path.join(self.current_project_path,
                      Config.instance().weld_data_path, 'resources')
     qsteelwidget.addResourceLocation(p, 'FileSystem',
                                      Config.instance().weld_resource_group)
     if self.project is not None:
         self.project.on_steel_ready(qsteelwidget)
     Ui.instance().on_steel_ready(qsteelwidget)
Пример #10
0
 def on_steel_ready(self, qsteelwidget):
     print "%(self)s.on_steel_ready()" % locals()
     Ui.instance().qsteelwidget.setRootDir(self.rootdir)
     if 0:
         while self.on_steel_ready_actions:
             action = self.on_steel_ready_actions[0]
             self.on_steel_ready_actions.pop(0)
             if 'load_level' in action:
                 assert (self.level is not None)
                 self.level.load()
             else:
                 raise Exception('%(self)s: unrecognized action in '\
                                 'self.on_steel_ready_actions: %(action)s' % \
                                 locals())
     if self.level is not None:
         self.level.on_steel_ready(qsteelwidget)
Пример #11
0
 def on_steel_ready(self, qsteelwidget):
     print "%(self)s.on_steel_ready()" % locals()
     Ui.instance().qsteelwidget.setRootDir(self.rootdir)
     if 0:
         while self.on_steel_ready_actions:
             action = self.on_steel_ready_actions[0]
             self.on_steel_ready_actions.pop(0)
             if 'load_level' in action:
                 assert(self.level is not None)
                 self.level.load()
             else:
                 raise Exception('%(self)s: unrecognized action in '\
                                 'self.on_steel_ready_actions: %(action)s' % \
                                 locals())
     if self.level is not None:
         self.level.on_steel_ready(qsteelwidget)
Пример #12
0
Файл: level.py Проект: onze/Weld
    def attach_to_Ui(self):
        """
        Links the level with its views.
        """
        print '<Level \'%s\'>.attach_to_Ui():' % (self.name)

        self.resMan = ResourceManager(self.path, level=self)
        self.resMan.attach_to_Ui(Ui.instance().res_browser['level'])
        
        self.qsteelwidget = Ui.instance().qsteelwidget
        if self.qsteelwidget.isSteelReady():
            print 'loading now.'
            weld.Weld.instance().on_steel_ready()
        else:
            print 'will wait for steel to be ready before loading.'
            self.qsteelwidget.onSteelReady.connect(weld.Weld.instance().on_steel_ready)
        Ui.instance().level_name = self.name
Пример #13
0
Файл: weld.py Проект: onze/Weld
 def on_steel_ready(self):
     print "Weld.on_steel_ready()"
     qsteelwidget = Ui.instance().qsteelwidget
     #make sure we know when to clean what follows
     qsteelwidget.onSteelClosing.connect(self.on_steel_closing)
     qsteelwidget.onItemDropped.connect(self.on_item_dropped)
     qsteelwidget.onAgentsSelected.connect(self.on_agents_selected)
     #add editing specific resources location
     p = os.path.join(self.current_project_path, 
                      Config.instance().weld_data_path,
                      'resources')
     qsteelwidget.addResourceLocation(p, 
                                      'FileSystem',
                                      Config.instance().weld_resource_group)
     if self.project is not None:
         self.project.on_steel_ready(qsteelwidget)
     Ui.instance().on_steel_ready(qsteelwidget)
Пример #14
0
    def attach_to_Ui(self):
        """
        Links the level with its views.
        """
        print '<Level \'%s\'>.attach_to_Ui():' % (self.name)

        self.resMan = ResourceManager(self.path, level=self)
        self.resMan.attach_to_Ui(Ui.instance().res_browser['level'])

        self.qsteelwidget = Ui.instance().qsteelwidget
        if self.qsteelwidget.isSteelReady():
            print 'loading now.'
            weld.Weld.instance().on_steel_ready()
        else:
            print 'will wait for steel to be ready before loading.'
            self.qsteelwidget.onSteelReady.connect(
                weld.Weld.instance().on_steel_ready)
        Ui.instance().level_name = self.name
Пример #15
0
    def on_item_dropped(self, url):
        """
        triggered when an item is dropped in the qsteelwidget.
        """
        print 'Weld.on_item_dropped:', url
        #make sure all struct are present
        if not (self.project and self.project.level):
            print >> sys.stderr, 'it\'s too early to drop stuff: '\
            'create a project and a level first !'
            return

        #retrieve data if it comes from weld
        if url in self.resMan:
            props = self.resMan.file_props(url)
            if props is None:
                print >> sys.stderr, curr_f(), ': url(\'%s\') in self.resMan '\
                    'but can\'t retrieve props.' % (url)
                return
            props = self.project.level.resMan.add_resource(
                self.resMan.base_path, props)
            url = props['url']
            if props == {} or url not in self.project.level.resMan:
                print >> sys.stderr, curr_f(), 'could not retrieve file and/or '\
                    'dependencies for props:', pp(props)
                return

        #instanciate it
        if url in self.project.level.resMan:
            props = self.project.level.resMan.file_props(url)
            dtp = self.project.level.qsteelwidget.dropTargetPosition(
                Config.instance().drop_target_vec)
            props['position'] = dtp
            props[
                'rotation'] = self.project.level.qsteelwidget.dropTargetRotation(
                )
            if props['resource_type'] == 'meshes':
                props['meshName'] = props['name']
                self.project.level.instanciate(props)
                s = 'dropped agent \'%s\' with id %i' % (props['name'],
                                                         props['agentId'])
                print s
                Ui.instance().show_status(s)
            else:
                Ui.instance().show_status('can only drop meshes so far')
Пример #16
0
Файл: weld.py Проект: onze/Weld
    def new_project(self, rootdir=None):
        """
        Open a new project.
        If rootdir is given, directly open the project file (see 
        Project.file_extension)") located in it.
        Otherwise, open a dialog for the user to choose a path.
        """
        if rootdir is None:
            rootdir = Ui.instance().select_directory(user.home)
        if not os.path.exists(rootdir):
            os.makedirs(rootdir)

        print 'Weld.new_project in ', rootdir
        project = Project(rootdir)

        project.save()
        self.project = project
        self.current_project_path = rootdir
        Ui.instance().set_resources_draggable(True)
        Ui.instance().show_status('new project created')
Пример #17
0
    def new_project(self, rootdir=None):
        """
        Open a new project.
        If rootdir is given, directly open the project file (see 
        Project.file_extension)") located in it.
        Otherwise, open a dialog for the user to choose a path.
        """
        if rootdir is None:
            rootdir = Ui.instance().select_directory(user.home)
        if not os.path.exists(rootdir):
            os.makedirs(rootdir)

        print 'Weld.new_project in ', rootdir
        project = Project(rootdir)

        project.save()
        self.project = project
        self.current_project_path = rootdir
        Ui.instance().set_resources_draggable(True)
        Ui.instance().show_status('new project created')
Пример #18
0
 def load(self):
     Savable.load(self)
     Ui.instance().project_name = self.name
     print debug.curr_f(), ': Config.on_project_opening_reopen_last_level = True'
     if Config.instance().on_project_opening_reopen_last_level:
         print 'trying to reopen level named \'%s\'' % (self.level_name)
         if self.level_name:
             self.open_level(self.level_name)
         else:
             print >> sys.stderr, 'could not reopen such level.'
     else:
         print 'level auto reload skipped.'
Пример #19
0
Файл: weld.py Проект: onze/Weld
    def on_item_dropped(self, url):
        """
        triggered when an item is dropped in the qsteelwidget.
        """
        print 'Weld.on_item_dropped:', url
        #make sure all struct are present
        if not(self.project and self.project.level):
            print >> sys.stderr, 'it\'s too early to drop stuff: '\
            'create a project and a level first !'
            return

        #retrieve data if it comes from weld
        if url in self.resMan:
            props = self.resMan.file_props(url)
            if props is None:
                print >> sys.stderr, curr_f(), ': url(\'%s\') in self.resMan '\
                    'but can\'t retrieve props.' % (url)
                return
            props = self.project.level.resMan.add_resource(self.resMan.base_path,
                                                           props)
            url = props['url']
            if props == {} or url not in self.project.level.resMan:
                print >> sys.stderr, curr_f(), 'could not retrieve file and/or '\
                    'dependencies for props:', pp(props)
                return

        #instanciate it
        if url in self.project.level.resMan:
            props = self.project.level.resMan.file_props(url)
            dtp = self.project.level.qsteelwidget.dropTargetPosition(Config.instance().drop_target_vec)
            props['position'] = dtp
            props['rotation'] = self.project.level.qsteelwidget.dropTargetRotation()
            if props['resource_type'] == 'meshes':
                props['meshName'] = props['name']
                self.project.level.instanciate(props)
                s = 'dropped agent \'%s\' with id %i' % (props['name'], props['agentId'])
                print s
                Ui.instance().show_status(s)
            else:
                Ui.instance().show_status('can only drop meshes so far')
Пример #20
0
 def load(self):
     Savable.load(self)
     Ui.instance().project_name = self.name
     print debug.curr_f(
     ), ': Config.on_project_opening_reopen_last_level = True'
     if Config.instance().on_project_opening_reopen_last_level:
         print 'trying to reopen level named \'%s\'' % (self.level_name)
         if self.level_name:
             self.open_level(self.level_name)
         else:
             print >> sys.stderr, 'could not reopen such level.'
     else:
         print 'level auto reload skipped.'
Пример #21
0
    def __init__(self, parent=None):
        if Weld.__instance is None:
            Weld.__instance = self
        else:
            raise Exception(
                'can\'t declare new Weld instance. Weld is a singleton.')
        Savable.__init__(self,
                         savepath=os.path.join(user.home, '.weld',
                                               'weld.cache'))
        self.savelist += ['current_project_path']
        # this is used to reload last opened project
        self.current_project_path = None

        Ui(self)

        # setup internal resource handlers
        self.project = None

        # list of resources we can ask steel to load
        self.resMan = ResourceManager(
            os.path.join(Config.instance().weld_data_path, 'resources'))
        self.resMan.attach_to_Ui(Ui.instance().res_browser['library'])

        # entity responsible for behavior trees manipulations
        self.BTMan = BTManager()

        # ready
        Ui.instance().show_status('ready', 1000)
        self.load()
        if Config.instance().on_weld_start_reopen_last_project:
            if self.current_project_path is not None:
                print 'auto reopening project \'%s\'.' % self.current_project_path
                p, f = os.path.split(self.current_project_path)
                self.open_project(self.current_project_path, f)
            else:
                print 'no project to reopen.'
        else:
            print 'skipping project reopening.'
Пример #22
0
    def __init__(self, rootdir):
        """
        rootdir: path to the root folder of the project. The project holds the
        directory name.
        """
        if not os.path.exists(rootdir):
            raise Exception('path %s does not exist.')
        self.rootdir = rootdir
        self.name = os.path.split(rootdir)[-1]
        Ui.instance()._project_name = self.name
        Savable.__init__(self, savepath=os.path.join(rootdir, self.name + Project.file_extension))

        self.level = None
        self.level_name = None

        # list of commands (as custom strings to execute at next call to on_steel_ready)
        self.on_steel_ready_actions = []
        #
        self.savelist += ['rootdir', 'name', 'level_name']
Пример #23
0
    def __init__(self, rootdir):
        """
        rootdir: path to the root folder of the project. The project holds the
        directory name.
        """
        if not os.path.exists(rootdir):
            raise Exception('path %s does not exist.')
        self.rootdir = rootdir
        self.name = os.path.split(rootdir)[-1]
        Ui.instance()._project_name = self.name
        Savable.__init__(self,
                         savepath=os.path.join(
                             rootdir, self.name + Project.file_extension))

        self.level = None
        self.level_name = None

        # list of commands (as custom strings to execute at next call to on_steel_ready)
        self.on_steel_ready_actions = []
        #
        self.savelist += ['rootdir', 'name', 'level_name']
Пример #24
0
def main():
    al = All(
        mas=Mas(),
        ui=Ui(),
        cell_types=CellTypes(),
    )
    al.learner = Learner(al, "Alexis", gender=1)
    load(al)
    import_npcs(al)
    al.mesh = Mesh(al)
    al.dex = Dex(al)
    al.lex = Lex(al)
    special_loading(al)  # event-depending change to the data
    # get_links_from_city_word("ดี", al)
    while al.ui.running:
        al.ui.listen_event(al)
        main_interact(al)
        if al.ui.lapsed_tick():
            al.ui.tick()
            al.tick_activity()
        # before_draw = time.time()
        main_draw(al)
Пример #25
0
class CmdAsana(object):
    loop = None
    nav_stack = []
    """Try to get an Asana client using stored tokens

    Raises:
        NotAuthedException: the user has not authorized the app
    """
    def get_client(self):
        try:
            f = open('.oauth', 'r')
            auth_json = f.read()
            f.close()
            token = json.loads(auth_json)
            self.client = asana.Client.oauth(
                client_id=secrets.CLIENT_ID,
                client_secret=secrets.CLIENT_SECRET,
                token=token,
                token_updater=self.save_token,
                auto_refresh_url=AsanaOAuth2Session.token_url,
                auto_refresh_kwargs={
                    'client_id': secrets.CLIENT_ID,
                    'client_secret': secrets.CLIENT_SECRET
                })
        except IOError:
            raise NotAuthedException()

    def authorize(self):
        self.client = asana.Client.oauth(
            client_id=secrets.CLIENT_ID,
            client_secret=secrets.CLIENT_SECRET,
            redirect_uri='urn:ietf:wg:oauth:2.0:oob',
            token_updater=self.save_token,
            auto_refresh_url=AsanaOAuth2Session.token_url,
            auto_refresh_kwargs={
                'client_id': secrets.CLIENT_ID,
                'client_secret': secrets.CLIENT_SECRET
            })
        (url, _) = self.client.session.authorization_url()
        auth = AuthPrompt(url, self.auth_callback)

        try:
            import webbrowser
            webbrowser.open(url)
        except Exception:
            pass

        self.loop = urwid.MainLoop(auth.component(),
                                   unhandled_input=self.exit_handler,
                                   palette=palette)
        self.loop.run()

    def auth_callback(self, code):
        self.save_token(self.client.session.fetch_token(code=code))
        raise urwid.ExitMainLoop()

    def exit_handler(self, key):
        if key in ('q', 'Q', 'esc'):
            raise urwid.ExitMainLoop()
        if key == 'backspace':
            self.ui.go_back()

    def get_asana_service(self):
        self.asana_service = AsanaService(self.client)

    def get_ui(self):
        self.ui = Ui(self.asana_service, self.update)

    def run(self):
        self.placeholder = urwid.WidgetPlaceholder(loading())
        self.loop = urwid.MainLoop(self.placeholder,
                                   unhandled_input=self.exit_handler,
                                   palette=palette)
        self.ui.my_tasks()

    def update(self, widget):
        self.loop.widget.original_widget = widget
        try:
            self.loop.draw_screen()
        except Exception:
            self.loop.run()

    def save_token(self, token):
        f = open('.oauth', 'w')
        f.write(json.dumps(token))
        f.close()
        os.chmod('.oauth', 0o600)
Пример #26
0
Файл: weld.py Проект: onze/Weld
 def close_project(self):
     Ui.instance().set_resources_draggable(False)
     raise NotImplementedError()
Пример #27
0
from ui.ui import Ui

game = Ui()
Пример #28
0
Файл: weld.py Проект: onze/Weld
 def run(self):
     r = Ui.instance().show()
     self.on_quit()
     return r
Пример #29
0
from repository.repository import Repository
from service.service import Service
from ui.ui import Ui
from utils.utils import computeDistance

# berlin52.txt, Berlin (Germany), 52, optimal path=7542
repository = Repository("data/berlin52.txt", "data/out.txt", False)
service = Service(repository)
ui = Ui(service)
ui.run()
Пример #30
0
 def close_project(self):
     Ui.instance().set_resources_draggable(False)
     raise NotImplementedError()
Пример #31
0
 def run(self):
     r = Ui.instance().show()
     self.on_quit()
     return r
Пример #32
0
def main(stdscr):
    curses.start_color()
    curses.use_default_colors()

    ui = Ui(-1, '', HEIGHT, WIDTH)
    ui.run()
Пример #33
0
 def get_ui(self):
     self.ui = Ui(self.asana_service, self.update)
Пример #34
0
    def open_project(self, rootdir=None, filename=None):
        """
        root dir is the path to the project, filename is the project file.
        """
        if None in [rootdir, filename]:
            if rootdir is None:
                rootdir = '~'
            filepath = Ui.instance().select_file(
                startdir=rootdir,
                extensions='Weld project files (*%s)' % Project.file_extension,
                label='Select a weld project')
            if filepath is None:
                Ui.instance().show_status('project opening is aborted')
                return
            rootdir, filename = os.path.split(filepath)
        else:
            if not os.path.exists(rootdir):
                self.current_project_path = None
                s = 'invalid project path:', rootdir
                print >> sys.stderr, s
                Ui.instance().show_status(s)
                return
            if not os.path.exists(
                    os.path.join(rootdir, filename + Project.file_extension)):
                self.current_project_path = None
                s = 'can\'t locate project file \'%s\' inside \'%s\'' % (
                    filename, rootdir)
                print >> sys.stderr, s
                Ui.instance().show_status(s)
                return

        print 'Weld.open_project \'%(filename)s in %(rootdir)s' % locals()
        project = Project(rootdir)
        project.load()

        self.project = project
        self.current_project_path = rootdir
        Ui.instance().set_resources_draggable(True)
        Ui.instance().show_status('project %s opened' % (filename))
Пример #35
0
Файл: weld.py Проект: onze/Weld
    def open_project(self, rootdir=None, filename=None):
        """
        root dir is the path to the project, filename is the project file.
        """
        if None in [rootdir, filename]:
            if rootdir is None:
                rootdir = '~'
            filepath = Ui.instance().select_file(startdir=rootdir,
                                                 extensions='Weld project files (*%s)' % Project.file_extension,
                                                 label='Select a weld project')
            if filepath is None:
                Ui.instance().show_status('project opening is aborted')
                return
            rootdir, filename = os.path.split(filepath)
        else:
            if not os.path.exists(rootdir):
                self.current_project_path = None
                s = 'invalid project path:', rootdir
                print >> sys.stderr, s
                Ui.instance().show_status(s)
                return
            if not os.path.exists(os.path.join(rootdir, filename + Project.file_extension)):
                self.current_project_path = None
                s = 'can\'t locate project file \'%s\' inside \'%s\'' % (filename, rootdir)
                print >> sys.stderr, s
                Ui.instance().show_status(s)
                return

        print 'Weld.open_project \'%(filename)s in %(rootdir)s' % locals()
        project = Project(rootdir)
        project.load()

        self.project = project
        self.current_project_path = rootdir
        Ui.instance().set_resources_draggable(True)
        Ui.instance().show_status('project %s opened' % (filename))
Пример #36
0
                                                   ["idClient", "name"])
            movie_repository = DatabaseRepository(
                database, cursor, 'movies',
                ["id_movie", "title", "description", "genre"])
            rental_repository = DatabaseRepository(
                database, cursor, 'rentals', [
                    "id_client", "id_movie", "rented_date", "due_data",
                    "returned_date"
                ])
        else:
            client_repository = repository_type(settings["clients"])
            movie_repository = repository_type(settings["movies"])
            rental_repository = repository_type(settings["rentals"])

        undo_service = UndoService()
        client_service = ClientService(client_repository, undo_service)
        movie_service = MovieService(movie_repository, undo_service)
        rental_service = RentalService(rental_repository, client_repository,
                                       movie_repository, client_service,
                                       movie_service, undo_service)
        statistics_service = StatisticsService(client_repository,
                                               movie_repository,
                                               rental_repository)

        ui = Ui(client_service, movie_service, rental_service,
                statistics_service, undo_service, settings["init_list"])
        ui.start()

    except Exception as ex:
        print(ex)
Пример #37
0
from repository.filmRepository.filmRepository import FilmRepository
from ui.ui import Ui
from domain.film.filmValidator import FilmValidator
from repository.clientRepository.clientRepository import ClientRepository
from domain.client.clientValidator import ClientValidator
from controller.filmController import FilmController
from controller.clientController import ClientController
from repository.rentRepository.rentRepository import RentRepository
from domain.rent.rentValidator import RentValidator
from controller.rentController import RentController

filmRepo = FilmRepository()
filmVal = FilmValidator()
clientRepo = ClientRepository()
clientVal = ClientValidator()
filmController = FilmController(filmRepo, filmVal)
rentRepo = RentRepository()
rentVal = RentValidator()
rentController = RentController(rentRepo, rentVal, filmRepo, clientRepo)
clientController = ClientController(clientRepo, clientVal)
ui = Ui(filmController, clientController, rentController, clientRepo)

ui.main()