res.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 #
00004 # Copyright 2015 Airbus
00005 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00006 #
00007 # Licensed under the Apache License, Version 2.0 (the "License");
00008 # you may not use this file except in compliance with the License.
00009 # You may obtain a copy of the License at
00010 #
00011 #   http://www.apache.org/licenses/LICENSE-2.0
00012 #
00013 # Unless required by applicable law or agreed to in writing, software
00014 # distributed under the License is distributed on an "AS IS" BASIS,
00015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016 # See the License for the specific language governing permissions and
00017 # limitations under the License.
00018 
00019 
00020 ########################################
00021 # Module(s) declaration
00022 ########################################
00023 
00024 import rospy
00025 import os
00026 from roslib.packages import get_pkg_dir
00027 from python_qt_binding.QtGui import *
00028 from python_qt_binding.QtCore import *
00029 from python_qt_binding import loadUi
00030 
00031 ########################################
00032 # Constante(s) and Variable(s) declaration
00033 ########################################
00034 
00035 DIR_SSMPLUGIN_RESOURCES = os.path.join(get_pkg_dir('airbus_ssm_plugin'),'resources')
00036 DIR_SSMPLUGIN_VALUES = DIR_SSMPLUGIN_RESOURCES+'/values'
00037 DIR_SSMPLUGIN_IMAGES = DIR_SSMPLUGIN_RESOURCES+'/images'
00038 DIR_SSMPLUGIN_LAYOUTS = DIR_SSMPLUGIN_RESOURCES+'/layouts'
00039 
00040 ########################################
00041 # Class(ies) declaration
00042 ########################################
00043 
00044 class SsmPluginValues():
00045     def __init__(self):
00046         class SsmPluginStrings():
00047             def __init__(self):
00048                 self.uuid = self.__class__.__name__
00049             def findById(self, id=""):
00050                 try:
00051                     return getattr(self,id)
00052                 except:
00053                     return None
00054             def title(self, lng="en"):
00055                 if lng == "en":
00056                     return "Smart State Machine Plugin interface".decode('utf-8')
00057                 elif lng == "fr":
00058                     return "Interface pour Machine à états intelligente".decode('utf-8')
00059                 else:
00060                     return "Smart State Machine Plugin interface".decode('utf-8')
00061                 
00062             def scxml_header(self, lng="en"):
00063                 if lng == "en":
00064                     return "SCXML".decode('utf-8')
00065                 elif lng == "fr":
00066                     return "SCXML".decode('utf-8')
00067                 else:
00068                     return "SCXML".decode('utf-8')
00069                 
00070         class SsmPluginStyles():
00071             def __init__(self):
00072                 self.uuid = self.__class__.__name__
00073                 self.label = "background-color:#d9d9d9;border-radius: 5px;font-size: 14pt;color: #7c7c7c;"
00074             def findById(self, id=""):
00075                 try:
00076                     return getattr(self,id)
00077                 except:
00078                     return None
00079         self.uuid = self.__class__.__name__
00080         self.dir = DIR_SSMPLUGIN_VALUES
00081         self.strings = SsmPluginStrings()
00082         self.styles = SsmPluginStyles()
00083     def findById(self, id=""):
00084         try:
00085             return getattr(self,id)
00086         except:
00087             return None
00088 
00089 class SsmPluginImages():
00090     def __init__(self):
00091         self.uuid = self.__class__.__name__
00092         self.dir = DIR_SSMPLUGIN_IMAGES
00093         self.ic_ssm_pause = DIR_SSMPLUGIN_IMAGES+'/ic_ssm_pause.png'
00094         self.ic_database = DIR_SSMPLUGIN_IMAGES+'/ic_database.png'
00095         self.ic_launcher = DIR_SSMPLUGIN_IMAGES+'/ic_launcher.png'
00096         self.ic_ssm_error = DIR_SSMPLUGIN_IMAGES+'/ic_ssm_error.png'
00097         self.ic_ssm_ok = DIR_SSMPLUGIN_IMAGES+'/ic_ssm_ok.png'
00098         self.ic_sub_ssm = DIR_SSMPLUGIN_IMAGES+'/ic_sub_ssm.png'
00099         self.ic_unactive_parent_state = DIR_SSMPLUGIN_IMAGES+'/ic_unactive_parent_state.png'
00100         self.ic_ssm_pending = DIR_SSMPLUGIN_IMAGES+'/ic_ssm_pending.png'
00101         self.ic_pause_parent_state = DIR_SSMPLUGIN_IMAGES+'/ic_pause_parent_state.png'
00102         self.ic_ready = DIR_SSMPLUGIN_IMAGES+'/ic_ready.gif'
00103         self.ic_start = DIR_SSMPLUGIN_IMAGES+'/ic_start.png'
00104         self.ic_pause_state = DIR_SSMPLUGIN_IMAGES+'/ic_pause_state.png'
00105         self.ic_state = DIR_SSMPLUGIN_IMAGES+'/ic_state.png'
00106         self.ic_pause = DIR_SSMPLUGIN_IMAGES+'/ic_pause.png'
00107         self.ic_stop = DIR_SSMPLUGIN_IMAGES+'/ic_stop.png'
00108         self.ic_folder = DIR_SSMPLUGIN_IMAGES+'/ic_folder.png'
00109         self.ic_rearm = DIR_SSMPLUGIN_IMAGES+'/ic_rearm.png'
00110         self.ic_active_state = DIR_SSMPLUGIN_IMAGES+'/ic_active_state.png'
00111         self.ic_active_parent_state = DIR_SSMPLUGIN_IMAGES+'/ic_active_parent_state.png'
00112         self.ic_ssm = DIR_SSMPLUGIN_IMAGES+'/ic_ssm.png'
00113         self.ic_unactive_state = DIR_SSMPLUGIN_IMAGES+'/ic_unactive_state.png'
00114         self.ic_preempt = DIR_SSMPLUGIN_IMAGES+'/ic_preempt.png'
00115     def findById(self, id=""):
00116         try:
00117             return getattr(self,id)
00118         except:
00119             return None
00120 
00121 class SsmPluginLayouts():
00122     def __init__(self):
00123         self.uuid = self.__class__.__name__
00124         self.dir = DIR_SSMPLUGIN_LAYOUTS
00125         self.mainwindow = DIR_SSMPLUGIN_LAYOUTS+'/mainwindow.ui'
00126     def findById(self, id=""):
00127         try:
00128             return getattr(self,id)
00129         except:
00130             return None
00131 
00132 class R:
00133     DIR = DIR_SSMPLUGIN_RESOURCES
00134     values = SsmPluginValues()
00135     images = SsmPluginImages()
00136     layouts = SsmPluginLayouts()
00137     @staticmethod
00138     def getPixmapById(id=""):
00139         return QPixmap(R.images.findById(id))
00140     @staticmethod
00141     def getIconById(id=""):
00142         return QIcon(R.images.findById(id))
00143 
00144 
00145 # End of file


airbus_ssm_plugin
Author(s): Ludovic Delval
autogenerated on Thu Jun 6 2019 17:59:30