Program creates .OWNBASE file if not exists and fills it
This commit is contained in:
@@ -252,9 +252,11 @@ def checkbelow(belowthis, dictionary):
|
||||
yesbelow[key] = dictionary[key]
|
||||
return yesbelow
|
||||
|
||||
showown = "All"
|
||||
|
||||
basename = 'default.database'
|
||||
backname = str(os.path.splitext(basename)[0]) + ".databack"
|
||||
showown = "All"
|
||||
ownname = str(os.path.splitext(basename)[0]) + ".ownbase"
|
||||
|
||||
if not os.path.isfile(basename):
|
||||
basewrite = open(basename, 'w+')
|
||||
@@ -296,8 +298,16 @@ shops = set(shops)
|
||||
shops = list(shops)
|
||||
shops = sorted(shops)
|
||||
|
||||
if not os.path.isfile(ownname):
|
||||
ownwrite = open(ownname, 'w+')
|
||||
empty = {}
|
||||
for item in buyitems:
|
||||
empty[item] = False
|
||||
json.dump(empty, ownwrite, indent=3, ensure_ascii=False)
|
||||
ownwrite.close()
|
||||
|
||||
def openbase():
|
||||
global baseread, database, buyitems, typesofitems, shops, bytype, byshop, byprice, backname
|
||||
global baseread, database, buyitems, typesofitems, shops, bytype, byshop, byprice, backname, ownname
|
||||
if not os.path.isfile(basename):
|
||||
basewrite = open(basename, 'w+')
|
||||
empty = {}
|
||||
@@ -338,6 +348,15 @@ def openbase():
|
||||
shops = list(shops)
|
||||
shops = sorted(shops)
|
||||
backname = str(os.path.splitext(basename)[0]) + ".databack"
|
||||
ownname = str(os.path.splitext(basename)[0]) + ".ownbase"
|
||||
|
||||
if not os.path.isfile(ownname):
|
||||
ownwrite = open(ownname, 'w+')
|
||||
empty = {}
|
||||
for item in buyitems:
|
||||
empty[item] = False
|
||||
json.dump(empty, ownwrite, indent=3, ensure_ascii=False)
|
||||
ownwrite.close()
|
||||
|
||||
printlogo()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user