From 250fa6ee23192f6965a4a68eafac5c5a5c12c029 Mon Sep 17 00:00:00 2001 From: jens Date: Tue, 1 Feb 2022 18:22:42 +0100 Subject: [PATCH] Weiter auf der Strecke --- gui/LabRobot22.py | 100 ++++++++++++++++++++++++++++++++-------------- gui/chemicals.ini | 16 ++++---- gui/labrobot.py | 4 +- 3 files changed, 79 insertions(+), 41 deletions(-) diff --git a/gui/LabRobot22.py b/gui/LabRobot22.py index 18b9ec3..9ce7686 100644 --- a/gui/LabRobot22.py +++ b/gui/LabRobot22.py @@ -1,9 +1,13 @@ +from lib2to3 import refactor +from shutil import register_unpack_format import tkinter as tk import tkinter.ttk as ttk import os from configparser import ConfigParser import serial.tools.list_ports from idlelib.tooltip import * +from labrobot import LabReactBlock +from labrobot import ChemLoc import labrobot as lrb # serial ports ports = serial.tools.list_ports.comports() @@ -25,7 +29,7 @@ orders =['Home','HomeX','HomeY'] ## chemicals substances = ['Water','Propanol','Aceton'] -clabels = ['x','y','z','volume','z/ml','reakVolume'] +clabels = ['x','y','z','volume','z/ml','reakvolume'] centrys = [] chem_config = ConfigParser() @@ -128,6 +132,8 @@ root = tk.Tk() akttip = tk.IntVar() lbp = lrb.LabPipBlock pip = lrb.LabPip +startVessel = tk.IntVar() +lastVessel = tk.IntVar() ##init load_chem_config() substances = chem_config.sections() @@ -223,32 +229,39 @@ b17 = ttk.Button(downrightframe,text='Load All') b17.grid(row=4,column=2,sticky='e') b18 = ttk.Button(downrightframe,text='Clear Tip') b18.grid(row=3,column=2,sticky='e') -## Info Panel -downrightframe1 =ttk.LabelFrame(rightframe,text='Info') -downrightframe1.grid(column=0,row=2,sticky='new',pady=5) -i1l = ttk.Label(downrightframe1,text='Tip Nr') -i1l.grid(row=0,column=0) -i2l =ttk.Label(downrightframe1,textvariable=akttip) -i2l.grid(row=0,column=1) - - -## Test Zugriff -downrightframe2 =ttk.LabelFrame(rightframe,text='Tests') -downrightframe2.grid(column=0,row=3,sticky='new',pady=5) +## Robot +downrightframe2 =ttk.LabelFrame(rightframe,text='Robot') +downrightframe2.grid(column=0,row=3,sticky='new',pady=5) +## Chemicals fra1 = ttk.LabelFrame(downrightframe2,text=' Chemicals') 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=1,column=0,sticky='e') -chemopt1 = ttk.OptionMenu(fra1,chemlab,clabels[0],*clabels,command=doit) -chemopt1.grid(row=1,column=1,sticky='e') -chemerg = ttk.Label(fra1,textvariable=chemit) -chemerg.grid(row=1,column=2,sticky='ne') +chemvol = tk.StringVar() #Volumen +reacvol = tk.StringVar() #Reaktionsvolumen +ttk.Label(fra1,text='Vol[ml]').grid(row=0,column=1) +ttk.Label(fra1,textvariable=chemvol).grid(row=0,column=2) +ttk.Label(fra1,text='Reac[ul]').grid(row=0,column=3) +ttk.Label(fra1,textvariable=reacvol).grid(row=0,column=4) + +def do_chemicals(*args): + global chem + chem = ChemLoc(chem_config[chemsub.get()]['x'], + chem_config[chemsub.get()]['y'], + chem_config[chemsub.get()]['z'], + chem_config[chemsub.get()]['volume'], + chem_config[chemsub.get()]['z/ml'], + chem_config[chemsub.get()]['reakvolume'], + ) + + chemvol.set(chem_config[chemsub.get()]['volume']) + reacvol.set(chem_config[chemsub.get()]['reakvolume']) + +chemopt = ttk.OptionMenu(fra1,chemsub,substances[0],*substances,command=do_chemicals) +chemopt.grid(row=0,column=0,sticky='e') + +do_chemicals() + ## Pipettes fra2 = ttk.LabelFrame(downrightframe2,text=' Pipettes') fra2.grid(row=1,column=0,sticky='nw') @@ -267,7 +280,6 @@ def do_pipettes(*args): pipet_config[pips.get()]['tiphub'], pipet_config[pips.get()]['tipspeed'], pipet_config[pips.get()]['tipup']) - print(pip) pipopt = ttk.OptionMenu(fra2,pips,pipettes[0],*pipettes,command=do_pipettes) pipopt.grid(row=0,column=0,sticky='ew') @@ -275,8 +287,28 @@ do_pipettes() aktvol = tk.StringVar() aktvol.set('----') ttk.Label(fra2,textvariable=aktvol).grid(row=0,column=1,sticky='ew') +ttk.Label(fra2,text='Tip Nr').grid(row=0,column=2) +ttk.Label(fra2,textvariable=akttip).grid(row=0,column=4) + +## Vessels fra3 = ttk.LabelFrame(downrightframe2,text=' Vessels') fra3.grid(row=2,column=0,sticky='nw') +vess = tk.StringVar() +def do_vessels(*args): + global reakt + reakt = LabReactBlock(vess_config[vess.get()]['rxoffset'], + vess_config[vess.get()]['ryoffset'], + vess_config[vess.get()]['rzlevel'], + vess_config[vess.get()]['rrows'], + vess_config[vess.get()]['rcols'], + vess_config[vess.get()]['rxspace'], + vess_config[vess.get()]['ryspace'], + + ) +vessopt = ttk.OptionMenu(fra3,vess,vessels[0],*vessels,command= do_vessels) +vessopt.grid(row=0,column=0) + +do_vessels() ## main serial command def homeAll(): @@ -343,7 +375,7 @@ def load(): b13.config(command=load) def dispense(): - v = reaPart.get() + v = reacvol.get() if pip.dispenseVol(v): command.append(pip.sendE().encode('utf-8')) else : @@ -369,13 +401,13 @@ def takeChem(): command.append(pip.down().encode('utf-8')) load() command.append(pip.up().encode('utf-8')) - chemVol.set(chem.vol) + #chemVol.set(chem.vol) b14.config(command=takeChem) def nextVessel(): upTip() - command.append(pip.get_tip(react.next()).encode('utf-8')) - rakt.set(react.akt) + command.append(pip.get_tip(reakt.next()).encode('utf-8')) + reakt.set(reakt.akt) downTip() b15.config(command=nextVessel) @@ -393,10 +425,10 @@ def loadSerie(): q = lastVessel.get() + 1 for i in range(p,q): print(i) - react.akt = i - rakt.set(react.akt) + reakt.akt = i + reakt.set(reakt.akt) upTip() - command.append(pip.get_tip(react.same()).encode('utf-8')) + command.append(pip.get_tip(reakt.same()).encode('utf-8')) downTip() dispense() upTip() @@ -427,6 +459,12 @@ pipetframe = ttk.Frame(notebook) notebook.add(pipetframe,text='pipettes',underline=0) init_pipet() +### Init Vars +startVessel.set(1) +e2.config(textvariable=startVessel) +lastVessel.set(6) +e3.config(textvariable=lastVessel) + ## looping and working weiter = True def checkSerialPort(): diff --git a/gui/chemicals.ini b/gui/chemicals.ini index c561307..c069772 100644 --- a/gui/chemicals.ini +++ b/gui/chemicals.ini @@ -1,7 +1,7 @@ [Water] x = 50 y = 10 -z = +z = 10 volume = 100 z/ml = 0.1 reakvolume = 100 @@ -9,24 +9,24 @@ reakvolume = 100 [Propanol] x = 100 y = 10 -z = -volume = +z = 10 +volume = 100 z/ml = 1 reakvolume = 500 [Aceton] x = 150 y = 20 -z = -volume = +z = 10 +volume = 100 z/ml = 1 reakvolume = 500 [Mausi] x = 200 y = 30 -z = -volume = +z = 10 +volume = 100 z/ml = 1 reakvolume = 1000 @@ -34,7 +34,7 @@ reakvolume = 1000 x = 200 y = 40 z = 12 -volume = +volume = 100 z/ml = 1 reakvolume = 1000 diff --git a/gui/labrobot.py b/gui/labrobot.py index 34f8f72..1473814 100644 --- a/gui/labrobot.py +++ b/gui/labrobot.py @@ -164,13 +164,13 @@ class ChemLoc(): vol of chemical change of surface per ml """ - def __init__(self,xloc,yloc,zloc,vol,deltaz,tauch,chemvol): + def __init__(self,xloc,yloc,zloc,vol,deltaz,chemvol): self.xloc = xloc self.yloc = yloc self.zloc = zloc self.vol = vol self.deltaz = deltaz - self.tauch = tauch + #self.tauch = tauch self.chemvol = chemvol def getXY(self):