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">
<string>Form</string>
</property>
<widget class="QListView" name="listView">
<property name="geometry">
<rect>
<x>50</x>
<y>30</y>
<width>601</width>
<height>201</height>
</rect>
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="2,0,2,0,1">
<item>
<widget class="QListView" name="robotsList"/>
</item>
<item>
<spacer name="verticalSpacer">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="3,2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Ograniczenia robotów</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QTextBrowser" name="textBrowser">
<property name="geometry">
<rect>
<x>50</x>
<y>451</y>
<width>621</width>
<height>91</height>
</rect>
</item>
<item>
<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>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>510</x>
<y>270</y>
<width>141</width>
<height>141</height>
</rect>
</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>
<resources/>
<connections/>