Example #1
0
    def _ogre_init(self, size, render_system):

        cfg_path = os.path.join(get_user_app_dir(), 'ogre.cfg')
        log_path = os.path.join(get_user_app_dir(), 'ogre.log')
        plugins_path = './plugins.cfg'

        root = ogre.Root(plugins_path, cfg_path, log_path)
        self.root = root

        rm = ogre.ResourceGroupManager.getSingleton()
        add = rm.addResourceLocation
        add(app_abs_path('materials'), 'FileSystem', 'General')

        if not os.path.exists(cfg_path):
            _continue = root.showConfigDialog()
        else:
            _continue = root.restoreConfig()
        if not _continue:
            sys.exit('Quit from Config Dialog')

        root.initialise(False)

        params = ogre.NameValuePairList()
        params['externalWindowHandle'] = str(self.GetHandle())

        x, y = size
        r = root.createRenderWindow('pide render', x, y, False, params)
        r.active = True
        self.render_window = r

        rm.initialiseAllResourceGroups()
Example #2
0
def main(options):
    global log, IS_FIRST_RUN

    IS_FIRST_RUN = not os.path.exists(get_user_app_dir(False))

    if not options.log_file:
        options.log_file = os.path.join(get_user_app_dir(), "pide.log")

    # create logger
    log_level = logging.DEBUG if options.debug else logging.INFO
    open(options.log_file, "w").write("")  # truncate log file
    log = create_logger(options.log_file, log_level)

    sys.stdout = StreamLogger(sys.stdout, log)
    sys.stderr = StreamLogger(sys.stderr, log)

    # initialize app
    app = App(options)
    app.MainLoop()
Example #3
0
 def _load_state(self):
     state_fpath = os.path.join(get_user_app_dir(), "state.db")
     self.state = AppState(state_fpath)