Skip to content

Commit

Permalink
- Better validation in changing min fs
Browse files Browse the repository at this point in the history
  • Loading branch information
Graveflo committed Aug 5, 2020
1 parent ee0c81e commit a5051c5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
1 change: 0 additions & 1 deletion DlgCompact.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ def decide(self):
del alt_name
del alt_pic
alt_idx = -1
alts
for fs_lvl in [x for x in s_naderr if x not in alt_dict]:
if fs_lvl <= min_fs and not found_mins: # want this to carry over from before. Just one ground up stack
fs_lvl = min_fs
Expand Down
14 changes: 10 additions & 4 deletions FrmMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,10 @@ def __init__(self, frmMain):
frmObj.cmdOk.clicked.connect(self.hide)
def cmdAdd_clicked():
settings = self.frmMain.model.settings
settings[settings.P_NADERR_BAND].append(0)
min_fs = self.frmMain.model.get_min_fs()
settings[settings.P_NADERR_BAND].append(min_fs)
settings.invalidate()
self.add_row(0)
self.add_row(min_fs)

frmObj.cmdAdd.clicked.connect(cmdAdd_clicked)
frmObj.cmdRemove.clicked.connect(self.cmdRemove_clicked)
Expand Down Expand Up @@ -2365,6 +2366,11 @@ def updateMarketTaxUI():
frmObj.chkMerchantsRing.stateChanged.connect(updateMarketTaxUI)
frmObj.spinMerchantsRing.valueChanged.connect(updateMarketTaxUI)
frmObj.spinValuePack.valueChanged.connect(updateMarketTaxUI)
frmObj.spinQuestFSInc.valueChanged.connect(self.dlg_alts.update_fs_min)
frmObj.spinQuestFSInc.valueChanged.connect(self.dlg_naderr.update_fs_min)

def fs_inc_change():
self.dlg_alts.update_fs_min()
self.dlg_naderr.update_fs_min()
self.model.clean_min_fs()

frmObj.spinQuestFSInc.valueChanged.connect(fs_inc_change)
updateMarketTaxUI()
18 changes: 17 additions & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,22 @@ def add_equipment_item(self, this_gear):
self.invalidate_enahce_list()
self.save()

def clean_min_fs(self):
settings = self.settings
alts = settings[settings.P_ALTS]
naderr = settings[settings.P_NADERR_BAND]

min_fs = self.get_min_fs()

for i,n in enumerate(naderr):
if n < min_fs:
naderr[i] = min_fs

for i, pack in enumerate(alts):
pic_path, name, fs = pack
if fs < min_fs:
alts[i][2] = min_fs

def set_cost_bs_a(self, cost_bs_a):
self.settings[[EnhanceSettings.P_ITEM_STORE, ItemStore.P_BLACK_STONE_ARMOR]] = float(cost_bs_a)
self.invalidate_enahce_list()
Expand Down Expand Up @@ -205,7 +221,6 @@ def set_cost_sharp(self, cost_conc_w):
self.invalidate_enahce_list()
self.invalidate_all_gear_cost()


def set_cost_meme(self, cost_meme):
self.settings[[EnhanceSettings.P_ITEM_STORE, ItemStore.P_MEMORY_FRAG]] = float(cost_meme)
self.invalidate_enahce_list()
Expand Down Expand Up @@ -752,3 +767,4 @@ def to_json(self):

def from_json(self, json_str):
self.settings.__setstate__(json.loads(json_str))
self.clean_min_fs()
2 changes: 1 addition & 1 deletion start_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
setIcon = Qt_common.setIcon
MAXIMUM_LOGFILE_SIZE = 500 * 1024

RELEASE_VER = '0.3.0a0'
RELEASE_VER = '0.3.0a1'



Expand Down

0 comments on commit a5051c5

Please sign in to comment.