chemicals now ok
This commit is contained in:
parent
d114e6a175
commit
110a1387bc
@ -1,22 +1,22 @@
|
||||
[Water]
|
||||
x = 50
|
||||
y =
|
||||
y = 10
|
||||
z =
|
||||
volume =
|
||||
z/ml = 1
|
||||
volume = 100
|
||||
z/ml = 0.1
|
||||
reakvolume = 100
|
||||
|
||||
[Propanol]
|
||||
x = 100
|
||||
y =
|
||||
y = 10
|
||||
z =
|
||||
volume =
|
||||
z/ml = 1
|
||||
reakvolume = 200
|
||||
reakvolume = 500
|
||||
|
||||
[Aceton]
|
||||
x = 150
|
||||
y =
|
||||
y = 20
|
||||
z =
|
||||
volume =
|
||||
z/ml = 1
|
||||
@ -24,7 +24,7 @@ reakvolume = 500
|
||||
|
||||
[Mausi]
|
||||
x = 200
|
||||
y =
|
||||
y = 30
|
||||
z =
|
||||
volume =
|
||||
z/ml = 1
|
||||
@ -32,8 +32,9 @@ reakvolume = 1000
|
||||
|
||||
[Hasi]
|
||||
x = 200
|
||||
y =
|
||||
z =
|
||||
y = 40
|
||||
z = 12
|
||||
volume =
|
||||
z/ml = 1
|
||||
reakvolume = 1000
|
||||
reakvolume = 1000
|
||||
|
||||
@ -15,10 +15,11 @@ tiphub = 16.5
|
||||
[chemblock]
|
||||
chemx = 200.0
|
||||
chemy = 50.0
|
||||
chemvol = 60.0
|
||||
chemvol = 200.0
|
||||
chemz = 70.0
|
||||
deltaz = 0.5
|
||||
tauch = 0.0
|
||||
reapart = 100.0
|
||||
|
||||
[reacblock]
|
||||
rxoffset = 225.0
|
||||
|
||||
108
gui/testtk.py
108
gui/testtk.py
@ -3,73 +3,79 @@ import tkinter.ttk as ttk
|
||||
import os
|
||||
from configparser import ConfigParser
|
||||
|
||||
## chemicals
|
||||
substances = ['Water','Propanol','Aceton']
|
||||
labels = ['x','y','z','volume','z/ml','reakVolume']
|
||||
entrys = []
|
||||
|
||||
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()
|
||||
|
||||
clabels = ['x','y','z','volume','z/ml','reakVolume']
|
||||
centrys = []
|
||||
chem_config = ConfigParser()
|
||||
|
||||
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():
|
||||
c =0
|
||||
r = 0
|
||||
for p in substances:
|
||||
frame = ttk.LabelFrame(root,text=p)
|
||||
frame = ttk.LabelFrame(chemframe,text=p)
|
||||
frame.grid(column=c,row=r)
|
||||
c +=1
|
||||
if c > 3:
|
||||
c=0
|
||||
r +=1
|
||||
|
||||
for i in range(len(labels)):
|
||||
tk.Label(frame,text=labels[i]).grid(row=i,column=0)
|
||||
for i in range(len(clabels)):
|
||||
tk.Label(frame,text=clabels[i]).grid(row=i,column=0)
|
||||
var = tk.StringVar()
|
||||
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')
|
||||
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()
|
||||
|
||||
def showit():
|
||||
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')
|
||||
tk.Button(chemframe,text='Load',command = load_chem_config).grid(row=100,column=0,sticky='ew')
|
||||
tk.Button(chemframe,text='Save',command = conf_chem_write).grid(row=100,column=1,sticky='ew')
|
||||
|
||||
|
||||
root.mainloop()
|
||||
Loading…
Reference in New Issue
Block a user