Added example ok/cancel images. Also small fixes

This commit is contained in:
Olek Bojda 2018-09-20 00:00:28 +02:00
parent c925f4e093
commit 630edc000e
4 changed files with 45 additions and 20 deletions

View File

@ -8,6 +8,8 @@ import math
from enums.clutch_state import ClutchState as CS
from enums.stop_state import StopState as SS
from python_qt_binding.QtGui import QPixmap
class QtWrapper:
@ -16,6 +18,11 @@ class QtWrapper:
self.logger_counter = 0
self.displayed_robots_id_list = []
self.clear_robot_info()
# self.ok_pixmap = QPixmap('../ui/Ok.jpg')
self.ok_pixmap = QPixmap('/home/olek/safetysystemL1.5/src/SafetySystem/safety_user_plugin/ui/Ok.jpg')
self.cancel_pixmap = QPixmap('/home/olek/safetysystemL1.5/src/SafetySystem/safety_user_plugin/ui/Cancel.jpg')
def disconnect_signals(self):
self.widget.clutchButton.clicked.disconnect()
self.widget.stopButton.clicked.disconnect()
@ -51,6 +58,26 @@ class QtWrapper:
else:
return None
def display_clutch_on(self):
self.widget.clutchLabel.setPixmap(self.ok_pixmap.scaled(40,40))
self.widget.clutchButton.setStyleSheet("QPushButton { color: black; background-color: green; font: bold 24px}")
self.widget.clutchButton.setText('Rozlacz sprzeglo')
def display_clutch_off(self):
self.widget.clutchLabel.setPixmap(self.cancel_pixmap.scaled(40,40))
self.widget.clutchButton.setStyleSheet("QPushButton { color: black; background-color: red; font: bold 24px}")
self.widget.clutchButton.setText('Polacz sprzeglo')
def display_state_on(self):
self.widget.stateLabel.setPixmap(self.ok_pixmap.scaled(40,40))
self.widget.stopButton.setStyleSheet("QPushButton { color: black; background-color: green; font: bold 24px}")
self.widget.stopButton.setText('Zatrzymaj robota')
def display_state_off(self):
self.widget.stateLabel.setPixmap(self.cancel_pixmap.scaled(40,40))
self.widget.stopButton.setStyleSheet("QPushButton { color: black; background-color: red; font: bold 24px}")
self.widget.stopButton.setText('Odblokuj robota')
def handle_not_selected_error(self):
self.log_error('Najpierw wybierz PIONIERA z listy robotow')
@ -139,44 +166,36 @@ class QtWrapper:
# self.log_info(str(robot_info.clutch == CS.ENGAGED))
if robot_info.clutch == CS.ENGAGED:
self.widget.clutchLabel.setText('1')
self.display_clutch_on()
else:
self.widget.clutchLabel.setText('0')
self.display_clutch_off()
if robot_info.state == SS.RUNNING:
self.widget.stateLabel.setText('1')
self.display_state_on()
else:
self.widget.stateLabel.setText('0')
self.display_state_off()
def master_stopped(self):
# raise NotImplementedError
self.log_info('Przycisk masterSTOP zostal nacisniety. Zatrzymuje roboty')
def master_started(self):
# raise NotImplementedError
self.log_info('Przycisk masterSTOP odcisniety. Mozesz uruchomic robota')
def user_stopped(self):
# raise NotImplementedError
self.log_info('Robot zatrzymany')
self.widget.stateLabel.setText('0')
self.display_state_off()
def user_started(self):
# raise NotImplementedError
self.log_info('Robot wystartowal')
self.widget.stateLabel.setText('1')
self.display_state_on()
def disengage_clutch(self):
# raise NotImplementedError
self.log_info('Rozprzegam sprzeglo')
self.widget.clutchLabel.setText('0')
# pass
self.display_clutch_off()
def engage_clutch(self):
# raise NotImplementedError
self.log_info('Sprzegam sprzeglo')
# self.signal.('disengage_clutch')
self.widget.clutchLabel.setText('1')
self.display_clutch_on()
def master_is_stopped_notify(self):
self.log_error('Nie mozna wystartowac robota. MasterSTOP wcisniety!')
@ -225,3 +244,9 @@ class QtWrapper:
self.widget.clutchLabel.setText('-')
self.widget.choiceButton.setText('Wybierz')
self.widget.stopButton.setText('-')
self.widget.stopButton.setStyleSheet("")
self.widget.clutchButton.setText('-')
self.widget.clutchButton.setStyleSheet("")

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -75,7 +75,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="4,2,3">
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,1,1,2,2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
@ -124,7 +124,7 @@
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,1,1,1,2,2">
<item>
<widget class="QLabel" name="idLabel">
<property name="text">