chemicals now ok
This commit is contained in:
parent
d114e6a175
commit
110a1387bc
@ -1,22 +1,22 @@
|
|||||||
[Water]
|
[Water]
|
||||||
x = 50
|
x = 50
|
||||||
y =
|
y = 10
|
||||||
z =
|
z =
|
||||||
volume =
|
volume = 100
|
||||||
z/ml = 1
|
z/ml = 0.1
|
||||||
reakvolume = 100
|
reakvolume = 100
|
||||||
|
|
||||||
[Propanol]
|
[Propanol]
|
||||||
x = 100
|
x = 100
|
||||||
y =
|
y = 10
|
||||||
z =
|
z =
|
||||||
volume =
|
volume =
|
||||||
z/ml = 1
|
z/ml = 1
|
||||||
reakvolume = 200
|
reakvolume = 500
|
||||||
|
|
||||||
[Aceton]
|
[Aceton]
|
||||||
x = 150
|
x = 150
|
||||||
y =
|
y = 20
|
||||||
z =
|
z =
|
||||||
volume =
|
volume =
|
||||||
z/ml = 1
|
z/ml = 1
|
||||||
@ -24,7 +24,7 @@ reakvolume = 500
|
|||||||
|
|
||||||
[Mausi]
|
[Mausi]
|
||||||
x = 200
|
x = 200
|
||||||
y =
|
y = 30
|
||||||
z =
|
z =
|
||||||
volume =
|
volume =
|
||||||
z/ml = 1
|
z/ml = 1
|
||||||
@ -32,8 +32,9 @@ reakvolume = 1000
|
|||||||
|
|
||||||
[Hasi]
|
[Hasi]
|
||||||
x = 200
|
x = 200
|
||||||
y =
|
y = 40
|
||||||
z =
|
z = 12
|
||||||
volume =
|
volume =
|
||||||
z/ml = 1
|
z/ml = 1
|
||||||
reakvolume = 1000
|
reakvolume = 1000
|
||||||
|
|
||||||
@ -15,10 +15,11 @@ tiphub = 16.5
|
|||||||
[chemblock]
|
[chemblock]
|
||||||
chemx = 200.0
|
chemx = 200.0
|
||||||
chemy = 50.0
|
chemy = 50.0
|
||||||
chemvol = 60.0
|
chemvol = 200.0
|
||||||
chemz = 70.0
|
chemz = 70.0
|
||||||
deltaz = 0.5
|
deltaz = 0.5
|
||||||
tauch = 0.0
|
tauch = 0.0
|
||||||
|
reapart = 100.0
|
||||||
|
|
||||||
[reacblock]
|
[reacblock]
|
||||||
rxoffset = 225.0
|
rxoffset = 225.0
|
||||||
|
|||||||
108
gui/testtk.py
108
gui/testtk.py
@ -3,73 +3,79 @@ import tkinter.ttk as ttk
|
|||||||
import os
|
import os
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
|
## chemicals
|
||||||
substances = ['Water','Propanol','Aceton']
|
substances = ['Water','Propanol','Aceton']
|
||||||
labels = ['x','y','z','volume','z/ml','reakVolume']
|
clabels = ['x','y','z','volume','z/ml','reakVolume']
|
||||||
entrys = []
|
centrys = []
|
||||||
|
chem_config = ConfigParser()
|
||||||
config = ConfigParser()
|
|
||||||
|
|
||||||
def load_config():
|
|
||||||
config.read(os.path.join(os.path.dirname(__file__), "test.ini"),)
|
|
||||||
|
|
||||||
root = tk.Tk()
|
|
||||||
infobar = tk.StringVar()
|
|
||||||
#configue root
|
|
||||||
root.title("Jfs Labrobot")
|
|
||||||
root.geometry('800x500+300+300')
|
|
||||||
|
|
||||||
load_config()
|
|
||||||
substances = config.sections()
|
|
||||||
|
|
||||||
|
|
||||||
|
def load_chem_config():
|
||||||
|
chem_config.read(os.path.join(os.path.dirname(__file__), "chemicals.ini"),)
|
||||||
|
def conf_chem_write():
|
||||||
|
for p in substances:
|
||||||
|
chem_config[p] = {}
|
||||||
|
for x in centrys:
|
||||||
|
if x[0] == p:
|
||||||
|
chem_config[p][x[1]] = x[2].get()
|
||||||
|
with open(os.path.join(os.path.dirname(__file__), "chemicals.ini"),'w') as f:
|
||||||
|
chem_config.write(f)
|
||||||
def init_chem():
|
def init_chem():
|
||||||
c =0
|
c =0
|
||||||
r = 0
|
r = 0
|
||||||
for p in substances:
|
for p in substances:
|
||||||
frame = ttk.LabelFrame(root,text=p)
|
frame = ttk.LabelFrame(chemframe,text=p)
|
||||||
frame.grid(column=c,row=r)
|
frame.grid(column=c,row=r)
|
||||||
c +=1
|
c +=1
|
||||||
if c > 3:
|
if c > 3:
|
||||||
c=0
|
c=0
|
||||||
r +=1
|
r +=1
|
||||||
|
for i in range(len(clabels)):
|
||||||
for i in range(len(labels)):
|
tk.Label(frame,text=clabels[i]).grid(row=i,column=0)
|
||||||
tk.Label(frame,text=labels[i]).grid(row=i,column=0)
|
|
||||||
var = tk.StringVar()
|
var = tk.StringVar()
|
||||||
entry = tk.Entry(frame,width=10,textvariable=var)
|
entry = tk.Entry(frame,width=10,textvariable=var)
|
||||||
var.set(config[p][labels[i]])
|
var.set(chem_config[p][clabels[i]])
|
||||||
entry.grid(row=i,column=1,sticky='w')
|
entry.grid(row=i,column=1,sticky='w')
|
||||||
entrys.append([p,labels[i],entry])
|
centrys.append([p,clabels[i],entry])
|
||||||
|
|
||||||
|
|
||||||
|
root = tk.Tk()
|
||||||
|
|
||||||
|
##init
|
||||||
|
load_chem_config()
|
||||||
|
substances = chem_config.sections()
|
||||||
|
|
||||||
|
#configue root
|
||||||
|
root.title("Jfs Labrobot")
|
||||||
|
root.geometry('800x500+300+300')
|
||||||
|
notebook = ttk.Notebook(root)
|
||||||
|
notebook.grid(sticky='news',padx=5,pady=5)
|
||||||
|
notebook.enable_traversalrightmainframe = ttk.Frame(notebook)
|
||||||
|
## mainframe
|
||||||
|
mainframe = ttk.Frame(notebook)
|
||||||
|
mainframe.columnconfigure(0,weight=1)
|
||||||
|
notebook.add(mainframe,text='main',underline=0)
|
||||||
|
fra1 = ttk.LabelFrame(mainframe,text=' Test')
|
||||||
|
fra1.grid(row=0,column=0,sticky='nw')
|
||||||
|
chemsub = tk.StringVar()
|
||||||
|
chemlab = tk.StringVar()
|
||||||
|
chemit = tk.StringVar()
|
||||||
|
|
||||||
|
def doit(*args):
|
||||||
|
chemit.set(str(chem_config[chemsub.get()][chemlab.get()]))
|
||||||
|
|
||||||
|
chemopt = ttk.OptionMenu(fra1,chemsub,substances[0],*substances,command=doit)
|
||||||
|
chemopt.grid(row=0,column=0,sticky='e')
|
||||||
|
chemopt1 = ttk.OptionMenu(fra1,chemlab,clabels[0],*clabels,command=doit)
|
||||||
|
chemopt1.grid(row=0,column=1,sticky='e')
|
||||||
|
chemerg = ttk.Label(fra1,textvariable=chemit)
|
||||||
|
chemerg.grid(row=0,column=2,sticky='ne')
|
||||||
|
|
||||||
|
##chemicals
|
||||||
|
chemframe = ttk.Frame(notebook)
|
||||||
|
notebook.add(chemframe,text='chemicals',underline=0)
|
||||||
init_chem()
|
init_chem()
|
||||||
|
tk.Button(chemframe,text='Load',command = load_chem_config).grid(row=100,column=0,sticky='ew')
|
||||||
def showit():
|
tk.Button(chemframe,text='Save',command = conf_chem_write).grid(row=100,column=1,sticky='ew')
|
||||||
for x in entrys:
|
|
||||||
for p in substances:
|
|
||||||
for x in entrys:
|
|
||||||
if x[0] == p :
|
|
||||||
print(f'{x[1]} : {x[2].get()} ')
|
|
||||||
#print(x[0],x[1],x[2].get())
|
|
||||||
|
|
||||||
btn =tk.Button(root,text='Ok',command=showit)
|
|
||||||
btn.grid(row=99,column=0,sticky='we')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tk.Button(root,text='Load',command = load_config).grid(row=100,column=0,sticky='ew')
|
|
||||||
|
|
||||||
|
|
||||||
def conf_write():
|
|
||||||
config = ConfigParser()
|
|
||||||
#config.read(os.path.join(os.path.dirname(__file__), "test.ini"),)
|
|
||||||
for p in substances:
|
|
||||||
config[p] = {}
|
|
||||||
for x in entrys:
|
|
||||||
if x[0] == p:
|
|
||||||
config[p][x[1]] = x[2].get()
|
|
||||||
with open(os.path.join(os.path.dirname(__file__), "test.ini"),'w') as f:
|
|
||||||
config.write(f)
|
|
||||||
tk.Button(root,text='Save',command = conf_write).grid(row=100,column=1,sticky='ew')
|
|
||||||
|
|
||||||
|
|
||||||
root.mainloop()
|
root.mainloop()
|
||||||
Loading…
Reference in New Issue
Block a user