1import os
2from cudatext import *
3from cudax_lib import get_translation
4
5_   = get_translation(__file__)  # I18N
6
7fn_config = os.path.join(app_path(APP_DIR_SETTINGS), '{module}.ini')
8
9option_int = 100
10option_bool = True
11
12def bool_to_str(v): return '1' if v else '0'
13def str_to_bool(s): return s=='1'
14
15class Command:
16
17    def __init__(self):
18
19        global option_int
20        global option_bool
21        option_int = int(ini_read(fn_config, 'op', 'option_int', str(option_int)))
22        option_bool = str_to_bool(ini_read(fn_config, 'op', 'option_bool', bool_to_str(option_bool)))
23
24    def config(self):
25
26        ini_write(fn_config, 'op', 'option_int', str(option_int))
27        ini_write(fn_config, 'op', 'option_bool', bool_to_str(option_bool))
28        file_open(fn_config)
29
30