Added initial code and first idea for GUI setup in .ui file

This commit is contained in:
Olek Bojda 2018-09-25 15:36:28 +02:00
parent 83c159a1e4
commit b7ade7485f
6 changed files with 219 additions and 36 deletions

View File

@ -0,0 +1,6 @@
class ClutchState:
ENGAGED = 4
DISENGAGED = 5
UNKNOWN = 6

View File

@ -0,0 +1,6 @@
class StopState:
STOPPED = 1
RUNNING = 2
UNKNOWN = 3

View File

@ -1,4 +1,22 @@
class MasterPlugin:
def __init__(self):
pass from qt_gui.plugin import Plugin
from master_widget import MasterWidget
class MasterPlugin(Plugin):
def __init__(self,context):
super(MasterPlugin, self).__init__(context)
self.setObjectName('Master Plugin - L1.5 safety system')
self._widget = MasterWidget(context)
# self._qt_wrapper = QtWrapper(self._widget)
# self._ros_wrapper = ROSWrapper()
# self.set_callback_functions()
def set_callback_functions(self):
raise NotImplementedError

View File

@ -0,0 +1,18 @@
#!/usr/bin/env python
import os
import rospkg
from python_qt_binding.QtWidgets import QWidget
from python_qt_binding import loadUi
class MasterWidget(QWidget):
def __init__(self,context):
super(MasterWidget, self).__init__()
ui_file = os.path.join(rospkg.RosPack().get_path('safety_master_plugin'), 'ui', 'master_view.ui')
loadUi(ui_file, self)
self.setObjectName('Master Plugin - L1.5 safety system')
if context.serial_number() > 1:
self.setWindowTitle(self.windowTitle() + (' (%d)' % context.serial_number()))
context.add_widget(self)

View File

@ -13,39 +13,174 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<widget class="QListView" name="listView"> <layout class="QVBoxLayout" name="verticalLayout_5" stretch="2,0,2,0,1">
<property name="geometry"> <item>
<rect> <widget class="QListView" name="robotsList"/>
<x>50</x> </item>
<y>30</y> <item>
<width>601</width> <spacer name="verticalSpacer">
<height>201</height> <property name="orientation">
</rect> <enum>Qt::Vertical</enum>
</property> </property>
</widget> <property name="sizeHint" stdset="0">
<widget class="QTextBrowser" name="textBrowser"> <size>
<property name="geometry"> <width>20</width>
<rect> <height>25</height>
<x>50</x> </size>
<y>451</y> </property>
<width>621</width> </spacer>
<height>91</height> </item>
</rect> <item>
</property> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="3,2">
</widget> <item>
<widget class="QPushButton" name="pushButton"> <layout class="QVBoxLayout" name="verticalLayout_4">
<property name="geometry"> <item>
<rect> <widget class="QLabel" name="label_4">
<x>510</x> <property name="text">
<y>270</y> <string>Ograniczenia robotów</string>
<width>141</width> </property>
<height>141</height> <property name="alignment">
</rect> <set>Qt::AlignCenter</set>
</property> </property>
<property name="text"> </widget>
<string>STOP</string> </item>
</property> <item>
</widget> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Obrazek1</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QSlider" name="verticalSlider">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>0.45</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Obrazek2</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QSlider" name="verticalSlider_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>0.67</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Obrazek3</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QSlider" name="verticalSlider_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>0.45</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="masterstopButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>80</height>
</size>
</property>
<property name="text">
<string>STOP</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QTextBrowser" name="logsBrowser"/>
</item>
</layout>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>