#!/usr/bin/env python """ This file is part of RuneOptimizer. RuneOptimizer is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. RuneOptimizer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with RuneOptimizer. If not, see . """ import sqlite3 import json import os import signal import pipes import appdirs import subprocess from types import SimpleNamespace from time import sleep import wx import wx.grid import wx.adv import data.data as data import runeoptimizer.runeoptimizer as runeoptimizer import values.values as values import database.database as database from gui.RuneOptimizerFrame import RuneOptimizerFrame # The path to the RuneOptimizer executable. Different in Windows. executable_path = \ os.path.dirname(os.path.realpath(__file__)) + '/../runeoptimizer' if os.name == 'nt': executable_path = \ os.path.dirname(os.path.realpath(__file__)) + '\\..\\runeoptimizer.exe' if __name__ == '__main__': """ Main function. Conects to the database and shows the initial frame. """ #Get CLI app version # TODO: Change executable name for windows #if os.name == 'nt': values.APP_INFO["app_version"] = subprocess.check_output( ['runeoptimizer', 'version'] ) # TODO: Test for executable to exist # TODO: Test for database to exist # Open the database print(appdirs.user_data_dir("RuneOptimizer", "", roaming=True)) database.CONNECTION = sqlite3.connect( appdirs.user_data_dir("RuneOptimizer", "", roaming=True) + "/data.sqlite" ) database.CONNECTION.isolation_level = None # This makes sure that the executable has connection to the database. runeoptimizer.run(["init"]) data.reload_units() data.reload_teams() # Start the GUI app = wx.App() frm = RuneOptimizerFrame( parent=None, title='Rune Optimizer', pos=(100, 100), size=(1000, 650) ) frm.Show() app.MainLoop()