ya2 · news · projects · code · about

minor refactoring
[pmachines.git] / main.py
1 from ya2.utils.log import LogMgrBase
2 LogMgrBase.pre_init_logging()
3 from sys import argv
4 from ya2.p3d.gfx import P3dGfxMgr
5 if '--version' in argv: P3dGfxMgr.no_window()
6 from os.path import exists
7 from traceback import print_exc
8 from p3d_appimage import AppImageBuilder
9 from pmachines.app import Pmachines
10
11
12 class Main:
13
14 def __init__(self):
15 self.__pmachines = Pmachines()
16
17 def run(self):
18 if self.__pmachines.is_update_run: AppImageBuilder('pmachines').update()
19 elif not self.__pmachines.is_version_run: self.__run_game()
20
21 def __run_game(self):
22 try: self.__pmachines.run()
23 except Exception: print_exc()
24
25
26 if __name__ == '__main__' or exists('main.pyo'):
27 Main().run()