Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
MEYER authored and MEYER committed Oct 11, 2022
1 parent 8cf3f94 commit 1cdc713
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 30 deletions.
Binary file modified __pycache__/generators.cpython-310.pyc
Binary file not shown.
Binary file modified __pycache__/mlibs.cpython-310.pyc
Binary file not shown.
29 changes: 6 additions & 23 deletions generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def get_dir():
if not dir_exists:
os.mkdir(path)

pth = os.path.join(path,file)
path = os.path.join(path,file)

if not os.path.exists(pth):
if not os.path.exists(path):
with open(path, 'x') as a:
a.write(
'{\n'
Expand All @@ -40,7 +40,7 @@ def get_dir():
+'\n}')
print(a.read)
a.close()
f= open(pth, 'r')
f= open(path, 'r')
rip = json.loads(f.read())
generators = rip["generators"][0]
f.close()
Expand All @@ -49,6 +49,7 @@ def get_dir():
def getGeneratorInterval(genid):
ri = generators["{}".format(genid)]["interval"]
rit = generators["{}".format(genid)]["intervalType"]
print(rit + " " + ri)
if "tf" in str(rit): # mi
return ri * 60
elif "hj" in str(rit): # se
Expand All @@ -63,32 +64,14 @@ def getGeneratorName(genid):
def getGeneratorBalper(genid):
return generators["{}".format(genid)]["balper"]

def getGenerators():
i=1
for x in generators:

print(i)
genname=generator.getGeneratorName(i)
time=generator.getGeneratorInterval(i)
baltoadd= generator.getGeneratorBalper(i)
if baltoadd:
generator.registerGenerators(genname,time,baltoadd)
print("generator error due to incorrect type formatting")
i+=1


def registerGenerators(genname,time,baltoadd):
import mlibs

mlibs.start_gen_jobs(genname,time,baltoadd)
def close():

pth = os.path.join(path,file)
a = open(pth, "w")
a = open(path, "w")
sda = str(generators).replace("'","\"")
a.write(
'{\n'
+' "generators": [%'.format()
+' "generators": [{}'.format(sda)
+']\n}')
a.close()
pass
Expand Down
24 changes: 17 additions & 7 deletions mlibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def close():
+' "prestige": {}'.format(prestige)
+'\n}')
a.close()
#generators.generator.close()
generators.generator.close()
win.destroy()

def restart():
Expand Down Expand Up @@ -230,15 +230,25 @@ def restart():


win.protocol('WM_DELETE_WINDOW', close)

def getGenerators():
i=1
for x in generators.generators:

print(i)
genname=generators.generator.getGeneratorName(i)
time=generators.generator.getGeneratorInterval(i)
baltoadd1= generators.generator.getGeneratorBalper(i)
if baltoadd1:
scheduler = BackgroundScheduler()
scheduler.add_job(id=genname, trigger=lambda: genAddBal(baltoadd1), next_run_time='interval', seconds=time)
scheduler.start()
print("generator error due to incorrect type formatting")
i+=1


def genAddBal(baltoadd):
global bal
bal += baltoadd
return

def start_gen_jobs(genname,time,baltoadd):
scheduler = BackgroundScheduler()
scheduler.add_job(id=genname, trigger=lambda: genAddBal(baltoadd), next_run_time='interval', seconds=time)
scheduler.start()
generators.generator.getGenerators()
win.mainloop()

0 comments on commit 1cdc713

Please sign in to comment.