Skip to content

Commit 29c1f6f

Browse files
committed
All appropriate Profile accessors pointing down to ProfileData's
1 parent d3780b3 commit 29c1f6f

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

Models/ProfileData.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class ProfileData(dict):
1818
def __init__(self, config, filename = None, newname = None, profiledata : dict|None = None, editdefault : bool = False) -> None:
1919
profiledata = profiledata or {}
2020

21+
# things as attributes are things we don't save into the JSON / save file.
2122
self.Config = config # wx.Config object
2223
self.Filepath : Path|None = Path(filename) if filename else None
2324
self.LastModTime : int = 0

Profile.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22
from functools import partial
3-
from pathlib import PurePath, Path, PureWindowsPath
3+
from pathlib import PurePath, Path
44
from typing import TYPE_CHECKING
55
import wx
66
import wx.lib.colourselect as csel
@@ -100,21 +100,17 @@ def CreatePage(self, page):
100100

101101
#####
102102
# Convenience / JIT accessors
103-
def ProfileName(self) : return self.Data.Filepath.stem if self.Data.Filepath else ''
103+
def ProfileName(self) : return self.Data.ProfileName()
104104
def Archetype(self) : return self.Data['General']['Archetype']
105105
def Primary(self) : return self.Data['General']['Primary']
106106
def Secondary(self) : return self.Data['General']['Secondary']
107107
def ResetFile(self) : return self.GetBindFile("reset.txt")
108-
def ProfileIDFile(self) : return self.BindsDir() / 'bcprofileid.txt'
108+
def ProfileIDFile(self) : return self.Data.ProfileIDFile()
109109
def Server(self) : return self.Data['General']['Server']
110110
def Filepath(self) : return self.Data.Filepath
111111
def ProfileBindsDir(self) : return self.Data['ProfileBindsDir']
112-
def BindsDir(self) : return Path(wx.ConfigBase.Get().Read('BindPath')) / self.Data['ProfileBindsDir']
113-
def GameBindsDir(self) :
114-
if gbp := wx.ConfigBase.Get().Read('GameBindPath'):
115-
return PureWindowsPath(gbp) / self.Data['ProfileBindsDir']
116-
else:
117-
return self.BindsDir()
112+
def BindsDir(self) : return self.Data.BindsDir()
113+
def GameBindsDir(self) : return self.Data.GameBindsDir()
118114

119115
def HasPowerPool(self, poolname):
120116
for picker in ['Pool1', 'Pool2', 'Pool3', 'Pool4']:

0 commit comments

Comments
 (0)