Example #1
0
    def __init__(self):
        """Constructor for the PyLNP library."""
        self.bundle = ''
        if hasattr(sys, 'frozen'):
            os.chdir(os.path.dirname(sys.executable))
            if sys.platform == 'win32':
                self.bundle = 'win'
            elif sys.platform.startswith('linux'):
                self.bundle = 'linux'
            elif sys.platform == 'darwin':
                self.bundle = 'osx'
                # OS X bundles start in different directory
                os.chdir('../../..')
        else:
            os.chdir(os.path.dirname(os.path.abspath(__file__)))
        errorlog.start()

        self.lnp_dir = self.identify_folder_name(BASEDIR, 'LNP')
        if not os.path.isdir(self.lnp_dir):
            print('WARNING: LNP folder is missing!', file=sys.stderr)
        self.keybinds_dir = self.identify_folder_name(self.lnp_dir, 'Keybinds')
        self.graphics_dir = self.identify_folder_name(self.lnp_dir, 'Graphics')
        self.utils_dir = self.identify_folder_name(self.lnp_dir, 'Utilities')
        self.colors_dir = self.identify_folder_name(self.lnp_dir, 'Colors')
        self.embarks_dir = self.identify_folder_name(self.lnp_dir, 'Embarks')

        self.folders = []
        self.df_dir = ''
        self.settings = None
        self.init_dir = ''
        self.save_dir = ''
        self.autorun = []
        self.running = {}

        config_file = 'PyLNP.json'
        if os.access(os.path.join(self.lnp_dir, 'PyLNP.json'), os.F_OK):
            config_file = os.path.join(self.lnp_dir, 'PyLNP.json')
        self.config = JSONConfiguration(config_file)
        self.userconfig = JSONConfiguration('PyLNP.user')

        self.load_autorun()
        self.find_df_folder()

        self.new_version = None

        self.ui = TkGui(self)
        self.check_update()
        self.ui.start()
Example #2
0
 def initialize_ui(self):
     """Instantiates the UI object."""
     from tkgui.tkgui import TkGui
     self.ui = TkGui()