#!/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 wx import wx.grid import wx.adv import sqlite3 import math import subprocess from subprocess import Popen, PIPE import json import os import pipes import appdirs from types import SimpleNamespace from time import sleep # Include files classesToInclude = [ '/classes/PanelUnits.py', '/classes/PanelTeams.py', '/classes/PanelOptimizer.py', '/classes/PanelResults.py', '/classes/PanelInfo.py', '/classes/RuneOptimizerFrame.py', '/classes/TabList.py', '/classes/DialogConfirm.py', '/classes/DialogUpdateJson.py', '/classes/DialogNewTeam.py', ] for cls in classesToInclude: exec( compile( source=open(os.path.dirname(os.path.realpath(__file__)) + cls).read(), filename=os.path.dirname(os.path.realpath(__file__)) + cls, mode='exec' ) ) # 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' # App information app_info = { "name": "Rune Optimizer", "app_version": "UNKNOWN", "gui_version": "0.1-RC1", "author": "IƱigo Valentin", "author_mail": "i@inigovalentin.com", "url": { "Home page": "https://inigovalentin.com/projects/RuneOptimizer/", "Source code": "https://github.com/InigoValentin/RuneOptimizer/" } } # Global database connection conn = None # Unit stat names, indexed with Com2Us values. stat_names = [ "NULL", "HP ", "HP% ", "ATK ", "ATK%", "DEF ", "DEF%", "NULL", "SPD ", "CRR ", "CRD ", "RES ", "ACC " ] # Rune set names, indexed with Com2Us values. set_names = [ "NULL", "ENERGY", "GUARD", "SWIFT", "BLADE", "RAGE", # 0- 5 "FOCUS", "ENDURE", "FATAL", "NULL", "DESPAIR", "VAMPIRE", # 6-11 "NULL", "VIOLENT", "NEMESIS", "WILL", "SHIELD", "REVENGE", # 12-17 "DESTROY", "FIGHT", "DETERMIN", "ENHANCE", "ACCURACY", "TOLERANCE" # 18-23 ] 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': app_info["app_version"] = subprocess.check_output( ['RuneOptimizer', 'version'] ) # TODO: Test for executable to exist # TODO: Test for database to exist # Open the database conn = sqlite3.connect( appdirs.user_data_dir("RuneOptimizer") + "/data.sqlite" ) # Start the GUI app = wx.App() frm = RuneOptimizerFrame( parent=None, title='Rune Optimizer', pos=(100, 100), size=(800, 600) ) frm.Show() app.MainLoop()