Skip to content

Commit

Permalink
Merge branch 'florian'
Browse files Browse the repository at this point in the history
# Conflicts:
#	mock.py
  • Loading branch information
FlorianPix committed Jan 30, 2022
2 parents bed442d + 14a1671 commit 6607403
Show file tree
Hide file tree
Showing 20 changed files with 6,596 additions and 20 deletions.
43 changes: 43 additions & 0 deletions doc/cite_florian.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@Article{Foundation2022,
author = {OPC Foundation},
title = {Unified Architecture},
year = {2022},
url = {https://opcfoundation.org/about/opc-technologies/opc-ua/},
}

@Article{RouletDubonnet2015,
author = {Olivier Roulet-Dubonnet},
title = {Python OPC-UA Documentation},
year = {2015},
url = {https://python-opcua.readthedocs.io/en/latest/},
}

@Article{Limited2021,
author = {Riverbank Computing Limited},
title = {PyQt5 5.15.6},
year = {2021},
url = {https://pypi.org/project/PyQt5/},
}

@Article{StefanLabesius2010,
author = {Stefan Labesius, Institut für Rechtsfragen der Freien und Open Source Software},
title = {Was ist die GPL?},
year = {2010},
url = {https://www.ifross.org/?q=was-gpl},
}

@Article{Virbel2022,
author = {Mathieu Virbel},
title = {kivy},
year = {2022},
url = {https://kivy.org/#home},
}

@Article{Foundation2022a,
author = {Python Software Foundation},
title = {tkinter — Python interface to Tcl/Tk},
year = {2022},
url = {https://docs.python.org/3/library/tkinter.html},
}

@Comment{jabref-meta: databaseType:bibtex;}
36 changes: 36 additions & 0 deletions doc/cite_florian.bib.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@Article{Foundation2022,
author = {OPC Foundation},
title = {Unified Architecture},
year = {2022},
url = {https://opcfoundation.org/about/opc-technologies/opc-ua/},
}

@Article{RouletDubonnet2015,
author = {Olivier Roulet-Dubonnet},
title = {Python OPC-UA Documentation},
year = {2015},
url = {https://python-opcua.readthedocs.io/en/latest/},
}

@Article{Limited2021,
author = {Riverbank Computing Limited},
title = {PyQt5 5.15.6},
year = {2021},
url = {https://pypi.org/project/PyQt5/},
}

@Article{StefanLabesius2010,
author = {Stefan Labesius, Institut für Rechtsfragen der Freien und Open Source Software},
title = {Was ist die GPL?},
year = {2010},
url = {https://www.ifross.org/?q=was-gpl},
}

@Article{Virbel2022,
author = {Mathieu Virbel},
title = {kivy},
year = {2022},
url = {https://kivy.org/#home},
}

@Comment{jabref-meta: databaseType:bibtex;}
Empty file added doc/cite_florian.bib.sav.tmp
Empty file.
1 change: 1 addition & 0 deletions doc/cite_sebastian.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@Comment{jabref-meta: databaseType:bibtex;}
15 changes: 15 additions & 0 deletions doc/cite_sebastian.bib.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@Article{Foundation2022,
author = {OPC Foundation},
title = {Unified Architecture},
year = {2022},
url = {https://opcfoundation.org/about/opc-technologies/opc-ua/},
}

@Article{RouletDubonnet2015,
author = {Olivier Roulet-Dubonnet},
title = {Python OPC-UA Documentation},
year = {2015},
url = {https://python-opcua.readthedocs.io/en/latest/},
}

@Comment{jabref-meta: databaseType:bibtex;}
Empty file added doc/cite_sebastian.bib.sav.tmp
Empty file.
9 changes: 9 additions & 0 deletions frames/frame1/frame1.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def __init__(self, parent):
self.layout.addWidget(self.buttons_widget)
self.labels_widget.setLayout(self.labels_layout)
self.layout.addWidget(self.labels_widget)
self.parent.statusBar().showMessage(u"Umpumpen", 10000)
self.setLayout(self.layout)


Expand Down Expand Up @@ -105,6 +106,14 @@ def set_slider_position(self, slider_nr, p):
self.sliders[slider_nr].setValue(p)
self.labels[slider_nr].setText(str(p) + " mm")

def highlight(self, i, high):
if high:
qss_path = "frames/frame1/slider_highlight.qss"
else:
qss_path = "frames/frame1/slider.qss"
with open(qss_path, "r") as fh:
self.sliders[i].setStyleSheet(fh.read())

def create_slider(self, i):
widget = QSlider(Qt.Vertical)

Expand Down
1 change: 1 addition & 0 deletions frames/frame2/frame2.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def propify(self):
button.setDisabled(True)
qss_path = "frames/frame2/slider_highlight.qss"
with open(qss_path, "r") as fh:
self.parent.statusBar().showMessage(u"Behälter {} ausgewählt".format(self.props[0] + 1), 10000)
self.sliders[self.props[0]].setStyleSheet(fh.read())

self.sliders_widget.setLayout(self.sliders_layout)
Expand Down
3 changes: 3 additions & 0 deletions frames/frame3/frame3.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def propify(self):

for slider in self.chosen_sliders:
qss_path = "frames/frame3/slider.qss"
self.parent.statusBar().showMessage(u"Behälter {} ausgewählt".format(self.props[1] + 1), 10000)
with open(qss_path, "r") as fh:
slider.setStyleSheet(fh.read())
self.sliders_layout.addWidget(slider)
Expand Down Expand Up @@ -200,8 +201,10 @@ def entered(self):
self.parent.change_frame(4, props=self.props)
else:
print("Im Zielbehälter ist nicht genügend Platz für das angegebene Soll.")
self.parent.statusBar().showMessage(u"Im Zielbehälter ist nicht genügend Platz für das angegebene Soll.", 10000)
else:
print("Im Startbehälter ist nicht genügend Flüssigkeit für das angegebene Soll.")
self.parent.statusBar().showMessage(u"Im Startbehälter ist nicht genügend Flüssigkeit für das angegebene Soll.", 10000)
except ValueError as err:
print(err)
correction = re.sub("[^0-9]", "", self.target.text())
Expand Down
2 changes: 2 additions & 0 deletions frames/frame4/frame4.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ def propify(self):
self.layout.addWidget(self.actual_widget)
self.abort_widget.setLayout(self.abort_layout)
self.layout.addWidget(self.abort_widget)
self.parent.statusBar().showMessage(u"Umpumpen gestartet", 10000)
self.setLayout(self.layout)

def value_changed(self, nr, i):
Expand Down Expand Up @@ -153,6 +154,7 @@ def set_slider_position(self, slider_nr, p):
text = self.props[2] + diff
self.actual.setText(str(text))
if abs(diff) <= 0:
self.parent.statusBar().showMessage(u"Umpumpen beendet", 10000)
self.parent.change_frame(0)

def create_slider(self, i):
Expand Down
34 changes: 25 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def __init__(self):
super().__init__()

self.setWindowTitle("IAT control by gesture")
self.directions = [0, 0, 0]
self.volumes = [125, 125, 125]
self.props = []
self.simulation = True
try:
self.client = MyClient()
except BaseException as err:
Expand Down Expand Up @@ -90,23 +92,37 @@ def change_frame(self, widget_index, props=None):
self.widget = self.widgets[widget_index](self)
if widget_index == 0:
self.client.set('Schneider/Start_Umpumpen_FL', False)
self.directions = [0, 0, 0]
elif props:
self.widget.props = props
self.widget.propify()
if len(props) > 3:
self.props = props
self.client.set('Schneider/Behaelter_A_FL', props[0]+1)
self.client.set('Schneider/Behaelter_B_FL', props[1]+1)
self.client.set('Schneider/Start_Umpumpen_FL', True)
if self.simulation:
self.directions[props[0]] = -1
self.directions[props[1]] = 1
else:
self.client.set('Schneider/Behaelter_A_FL', props[0]+1)
self.client.set('Schneider/Behaelter_B_FL', props[1]+1)
self.client.set('Schneider/Start_Umpumpen_FL', True)
self.setCentralWidget(self.widget)

def update_values(self):
if self.client.sub_fuell1_ist.hasChanged():
self.volumes[0] = int(self.client.sub_fuell1_ist.getVar())
if self.client.sub_fuell2_ist.hasChanged():
self.volumes[1] = int(self.client.sub_fuell2_ist.getVar())
if self.client.sub_fuell3_ist.hasChanged():
self.volumes[2] = int(self.client.sub_fuell3_ist.getVar())
if self.simulation:
for i in range(0, 3):
if self.directions[i] > 0:
if self.volumes[i] < 250:
self.volumes[i] += self.directions[i]
else:
if self.volumes[i] > 0:
self.volumes[i] += self.directions[i]
else:
if self.client.sub_fuell1_ist.hasChanged():
self.volumes[0] = int(self.client.sub_fuell1_ist.getVar())
if self.client.sub_fuell2_ist.hasChanged():
self.volumes[1] = int(self.client.sub_fuell2_ist.getVar())
if self.client.sub_fuell3_ist.hasChanged():
self.volumes[2] = int(self.client.sub_fuell3_ist.getVar())

@pyqtSlot(str)
def swipe_detected(side, direction):
Expand Down
5 changes: 2 additions & 3 deletions mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def update(self):


def change_frame(self, widget_index, props=None):
print(props)
self.widget = self.widgets[widget_index](self)
if props:
self.widget.props = props
Expand All @@ -77,7 +76,7 @@ def change_frame(self, widget_index, props=None):
if widget_index == 0:
self.directions = [0, 0, 0]
self.setCentralWidget(self.widget)
self.current_widget_number = widget_index
self.current_widget_number = widget_index

def update_values(self):
for i in range(0, 3):
Expand Down Expand Up @@ -165,7 +164,7 @@ def kinect_thread_runner(fps, request_status):
kinect_thread.setDaemon(False)
kinect_thread.start()


window.resize(1920, 1080)
window.show()

Expand Down
6 changes: 4 additions & 2 deletions myclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

class MyClient:
def __init__(self):
self.server_address = "opc.tcp://141.30.154.211:4850"
self.uri = "http://141.30.154.212:8087/OPC/DA"
self.server_address = "opc.tcp://localhost:4840/freeopcua/server/"
self.uri = "http://tu-dresden.de/iat-opc/"
# self.server_address = "opc.tcp://141.30.154.211:4850"
# self.uri = "http://141.30.154.212:8087/OPC/DA"
self.default_interval = 100
self.connected = False

Expand Down
Loading

0 comments on commit 6607403

Please sign in to comment.