ya2 · news · projects · code · about

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