| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #!/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 <https://www.gnu.org/licenses/>.
- """
- 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
- 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",
- "FOCUS", "ENDURE", "FATAL", "NULL", "DESPAIR", "VAMPIRE",
- "NULL", "VIOLENT", "NEMESIS", "WILL", "SHIELD", "REVENGE",
- "DESTROY", "FIGHT", "DETERMINATION", "ENHANCE", "ACCURACY", "TOLERANCE"
- ]
- if __name__ == '__main__':
- """
- Main function.
- Conects to the database and shows the initial frame.
- """
- #Get CLI app version
- print("EXEC PATH: " + executable_path)
- app_info["app_version"] = subprocess.check_output(
- [
- executable_path,
- 'version'
- ]
- )
- # Open the database
- conn = sqlite3.connect(
- os.path.dirname(os.path.realpath(__file__)) + '/../../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()
|