Добавил проверку файла настроек. Программа не крашиться, если в настройках нет пункта "валюта"
This commit is contained in:
parent
d1e2f4ab7e
commit
02a04af258
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
10
setts.py
10
setts.py
@ -25,12 +25,19 @@ _ = lang.gettext
|
|||||||
def currency_setts():
|
def currency_setts():
|
||||||
with open('setts.json') as file:
|
with open('setts.json') as file:
|
||||||
old_data = json.load(file)
|
old_data = json.load(file)
|
||||||
|
try:
|
||||||
if old_data['settings']["currency"] == 'руб.':
|
if old_data['settings']["currency"] == 'руб.':
|
||||||
currency = 'руб.'
|
currency = 'руб.'
|
||||||
elif old_data['settings']["currency"] == '$':
|
elif old_data['settings']["currency"] == '$':
|
||||||
currency = '$'
|
currency = '$'
|
||||||
else:
|
else:
|
||||||
currency = '€'
|
currency = '€'
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
if old_data['settings']["locale"] == "рус.":
|
||||||
|
currency = 'руб.'
|
||||||
|
else:
|
||||||
|
currency = '$'
|
||||||
return currency
|
return currency
|
||||||
|
|
||||||
|
|
||||||
@ -45,7 +52,10 @@ def window_setts():
|
|||||||
mk = old_data["settings"]["mk"]
|
mk = old_data["settings"]["mk"]
|
||||||
a = old_data["settings"]["a"]
|
a = old_data["settings"]["a"]
|
||||||
locale = old_data['settings']["locale"]
|
locale = old_data['settings']["locale"]
|
||||||
|
try:
|
||||||
currency = old_data['settings']["currency"]
|
currency = old_data['settings']["currency"]
|
||||||
|
except KeyError:
|
||||||
|
currency = "руб."
|
||||||
try:
|
try:
|
||||||
spi = old_data["settings"]["spi"]
|
spi = old_data["settings"]["spi"]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
Loading…
Reference in New Issue
Block a user