added verification logic to save as input, added printing to yaml for users
This commit is contained in:
parent
fca57523eb
commit
a2b618f566
|
|
@ -1,8 +1,6 @@
|
|||
import time
|
||||
|
||||
import re
|
||||
import dearpygui.dearpygui as dpg
|
||||
from xiv_csolver.modules import loader, log, solver, printer
|
||||
import rich
|
||||
|
||||
|
||||
class User:
|
||||
|
|
@ -114,10 +112,16 @@ class User:
|
|||
def save_users() -> True:
|
||||
if dpg.get_value(save_user_as) == '':
|
||||
loggers.add_log('Cannot save user without a name.')
|
||||
elif re.search(r'^\s+$', dpg.get_value(save_user_as)):
|
||||
loggers.add_log('Name cannot be only whitespaces.')
|
||||
elif re.search(r'^\s.+', dpg.get_value(save_user_as)):
|
||||
loggers.add_log('Name cannot start with a whitespace.')
|
||||
elif re.search(r'\s$', dpg.get_value(save_user_as)):
|
||||
loggers.add_log('Name cannot end with a whitespace.')
|
||||
else:
|
||||
saver.save_users(dpg.get_value(save_user_as), dpg.get_value(user_stats))
|
||||
|
||||
dpg.configure_item('user_combo', items=full_config.get_users_names())
|
||||
loggers.add_log('User saved!')
|
||||
dpg.configure_item('user_combo', items=full_config.get_users_names())
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
# Name: [Craftsmanship, control, cp]
|
||||
# You are encouraged to use this either for multiple characters if you have them, or different jobs having
|
||||
# different gear or melds.
|
||||
# The top line will always be selected by default
|
||||
# The top line will always be selected by default
|
||||
|
||||
|
||||
Vicky Crosia: [4021, 3933, 587]
|
||||
Dandaedre Zadiel: [0, 0, 0]
|
||||
Dandaedre Zadiel: [0, 0, 2]
|
||||
Sekundes Dullahan: [2566, 2443, 522]
|
||||
ewww: [213, 3124, 0]
|
||||
bernard: [0, 0, 0]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import rich
|
||||
|
||||
from xiv_csolver.modules import loader
|
||||
|
||||
|
||||
|
|
@ -39,18 +37,21 @@ class Printer:
|
|||
|
||||
if user_name.title() == '':
|
||||
for user, stats in self.full_config.get_users_dict().items():
|
||||
output += f'{user}: [{stats[0]}, {stats[1]}, {stats[2]}]\n'
|
||||
if user != ' ':
|
||||
output += f'{user}: [{stats[0]}, {stats[1]}, {stats[2]}]\n'
|
||||
|
||||
else:
|
||||
self.full_config.get_users_dict()[user_name] = user_stats
|
||||
for user, stats in self.full_config.get_users_dict().items():
|
||||
output += f'{user}: [{stats[0]}, {stats[1]}, {stats[2]}]\n'
|
||||
if user != ' ':
|
||||
output += f'{user}: [{stats[0]}, {stats[1]}, {stats[2]}]\n'
|
||||
|
||||
self.print_users(output)
|
||||
return self.full_config.get_users_dict()
|
||||
|
||||
def print_users(self, output: str):
|
||||
pass
|
||||
with open(self.full_config.relative_import(self.full_config.config.yaml_user), 'w') as file:
|
||||
file.write(output)
|
||||
|
||||
def save_recipe(self):
|
||||
pass
|
||||
|
|
|
|||
Reference in New Issue