Skip to content

Commit

Permalink
Fixes #19
Browse files Browse the repository at this point in the history
Also, half of #18
  • Loading branch information
krismaz committed Mar 5, 2017
1 parent ef91a43 commit 0f8a72a
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 20 deletions.
9 changes: 9 additions & 0 deletions Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def evaluate(self, op, index):
print('Time remaining:', datetime.timedelta(seconds=remaining))
self.temp_changed.emit(temps[self.coms.sensor])
if self.to_pause:
pauseStart = time()
self.coms.set_temperature(-100000000.0)
alert(text='PAUSE', title='', button='OK')
self.to_pause = False
self.coms.set_temperature(op.temp)
start += time() - pauseStart
sleep(5)
if op.tag == 'PAUSE':
self.coms.set_temperature(-100000000.0)
Expand Down Expand Up @@ -96,6 +98,13 @@ def shift_temp(self, diff):
except Exception as e:
print(e)

def shift_time(self, diff):
try:
self.current_step.time += diff
self.program_changed.emit(self.program)
except Exception as e:
print(e)

def request_pause(self):
self.to_pause = True

Expand Down
4 changes: 3 additions & 1 deletion SerialCom.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def update_sensors(arg1):
script = sriptFile.readlines()

coms = ArduinoCommunicator(settings['COM'], settings['sensor'])
# coms = DebugCommunicator(settings['COM'], settings['sensor'])
#coms = DebugCommunicator(settings['COM'], settings['sensor'])

app = QtWidgets.QApplication(sys.argv)
app.setStyle(QtWidgets.QStyleFactory.create('Fusion'))
Expand All @@ -59,6 +59,8 @@ def update_sensors(arg1):

ui.upButton.clicked.connect(lambda x: control.shift_temp(0.5))
ui.downButton.clicked.connect(lambda x: control.shift_temp(-0.5))
ui.timeUpButton.clicked.connect(lambda x: control.shift_time(30))
ui.timeDownButton.clicked.connect(lambda x: control.shift_time(-30))
ui.pauseButton.clicked.connect(lambda x: control.request_pause())


Expand Down
2 changes: 1 addition & 1 deletion Steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def __init__(self, temp, time):
self.tag = 'COOK'
self.temp = temp
self.time = time
self.timestring = datetime.timedelta(seconds=time)

def __str__(self):
self.timestring = datetime.timedelta(seconds=self.time)
return 'Cook at {temp}° for {timestring}'.format(**self.__dict__)


Expand Down
8 changes: 4 additions & 4 deletions TestScript
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#Test Script
HEAT 80
COOK 85 0.1
COOK 85 0.5

PAUSE HUMLE1
HEAT 95
COOK 98 0.1
COOK 98 0.5

PAUSE HUMLE2
HEAT 95
COOK 98 0.1
COOK 98 0.5

PAUSE HUMLE3
HEAT 95
COOK 98 0.1
COOK 98 0.5
DONE
20 changes: 14 additions & 6 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,27 @@ def setupUi(self, MainWindow):
self.label.setGeometry(QtCore.QRect(0, 0, 291, 261))
self.label.setObjectName("label")
self.upButton = QtWidgets.QPushButton(self.centralwidget)
self.upButton.setGeometry(QtCore.QRect(700, 450, 80, 22))
self.upButton.setGeometry(QtCore.QRect(729, 450, 51, 22))
self.upButton.setObjectName("upButton")
self.downButton = QtWidgets.QPushButton(self.centralwidget)
self.downButton.setGeometry(QtCore.QRect(700, 470, 80, 22))
self.downButton.setGeometry(QtCore.QRect(729, 470, 51, 22))
self.downButton.setObjectName("downButton")
self.pauseButton = QtWidgets.QPushButton(self.centralwidget)
self.pauseButton.setGeometry(QtCore.QRect(619, 501, 161, 51))
self.pauseButton.setObjectName("pauseButton")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(10, 340, 201, 121))
self.label_2.setText("")
self.label_2.setObjectName("label_2")
self.timeUpButton = QtWidgets.QPushButton(self.centralwidget)
self.timeUpButton.setGeometry(QtCore.QRect(680, 450, 51, 23))
self.timeUpButton.setObjectName("timeUpButton")
self.timeDownButton = QtWidgets.QPushButton(self.centralwidget)
self.timeDownButton.setGeometry(QtCore.QRect(680, 470, 51, 23))
self.timeDownButton.setObjectName("timeDownButton")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 19))
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
Expand All @@ -59,8 +66,9 @@ def retranslateUi(self, MainWindow):
self.progressBar.setFormat(_translate("MainWindow", "%p"))
self.checkBox.setText(_translate("MainWindow", "Pumps"))
self.label.setText(_translate("MainWindow", "TextLabel"))
self.upButton.setText(_translate("MainWindow", "^"))
self.downButton.setText(_translate("MainWindow", "v"))
self.upButton.setText(_translate("MainWindow", "↑🌡"))
self.downButton.setText(_translate("MainWindow", "↓🌡"))
self.pauseButton.setText(_translate("MainWindow", "Pause"))
self.label_2.setText(_translate("MainWindow", " "))
self.timeUpButton.setText(_translate("MainWindow", "↑🕐"))
self.timeDownButton.setText(_translate("MainWindow", "↓🕐"))

42 changes: 34 additions & 8 deletions gui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,27 @@
<widget class="QPushButton" name="upButton">
<property name="geometry">
<rect>
<x>700</x>
<x>729</x>
<y>450</y>
<width>80</width>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>^</string>
<string>↑🌡</string>
</property>
</widget>
<widget class="QPushButton" name="downButton">
<property name="geometry">
<rect>
<x>700</x>
<x>729</x>
<y>470</y>
<width>80</width>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>v</string>
<string>↓🌡</string>
</property>
</widget>
<widget class="QPushButton" name="pauseButton">
Expand All @@ -120,7 +120,33 @@
</rect>
</property>
<property name="text">
<string> </string>
<string/>
</property>
</widget>
<widget class="QPushButton" name="timeUpButton">
<property name="geometry">
<rect>
<x>680</x>
<y>450</y>
<width>51</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>↑🕐</string>
</property>
</widget>
<widget class="QPushButton" name="timeDownButton">
<property name="geometry">
<rect>
<x>680</x>
<y>470</y>
<width>51</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>↓🕐</string>
</property>
</widget>
</widget>
Expand All @@ -130,7 +156,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>19</height>
<height>21</height>
</rect>
</property>
</widget>
Expand Down

0 comments on commit 0f8a72a

Please sign in to comment.