timestamp.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2015 Airbus
00004 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00005 #
00006 # Licensed under the Apache License, Version 2.0 (the "License");
00007 # you may not use this file except in compliance with the License.
00008 # You may obtain a copy of the License at
00009 #
00010 #   http://www.apache.org/licenses/LICENSE-2.0
00011 #
00012 # Unless required by applicable law or agreed to in writing, software
00013 # distributed under the License is distributed on an "AS IS" BASIS,
00014 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 # See the License for the specific language governing permissions and
00016 # limitations under the License.
00017 
00018 import rospy
00019 import os
00020 import time
00021 
00022 from python_qt_binding.QtGui import *
00023 from python_qt_binding.QtCore import *
00024 
00025 from airbus_pyqt_extend import QtAgiCore
00026 
00027 from airbus_cobot_gui.dashboard import Dashboard, DashboardPopup
00028 
00029 from airbus_cobot_gui.res import R
00030 
00031 class CalendarPopup(DashboardPopup):
00032     def __init__(self, parent):
00033         DashboardPopup.__init__(self, parent)
00034         
00035         self.setRelativePosition(DashboardPopup.TopRight,
00036                                  DashboardPopup.BottomRight)
00037         
00038     def onCreate(self, param):
00039         
00040         grid_layout = QGridLayout(self)
00041         grid_layout.setSpacing(0)
00042         grid_layout.setContentsMargins(0, 0, 0, 0)
00043         
00044         calendar = QCalendarWidget()
00045         
00046         grid_layout.addWidget(calendar,0,0,1,1)
00047     
00048     def onDestroy(self):
00049         pass
00050 
00051 class Timestamp(Dashboard):
00052     
00053     def __init__(self, context):
00054         Dashboard.__init__(self, context)
00055         
00056     def onCreate(self, param):
00057         
00058         self._time_label = QLabel()
00059         self._time_label.setStyleSheet(R.values.styles.text)
00060         self._time_label.setObjectName("clock")
00061         self._time_label.setAlignment(Qt.AlignCenter)
00062         
00063         self.getLayout().addWidget(self._time_label)
00064         
00065         clk_time = time.strftime("%H:%M", time.localtime(time.time()))
00066         self._time_label.setText(clk_time)
00067         
00068         self._t_datetime = QTimer(self)
00069         self.connect(self._t_datetime, SIGNAL("timeout()"), self._update_time)
00070         self._t_datetime.start(3600)
00071         
00072     def _update_time(self):
00073         
00074         clk_time = time.strftime("%H:%M", time.localtime(time.time()))
00075         self._time_label.setText(clk_time)
00076         
00077     def resizeEvent(self,event):
00078         pass
00079 #         self.resize(self._time_label.width(), self._time_label.height())
00080         
00081     def onRequestPopup(self):
00082         return CalendarPopup(self)
00083         
00084     def onControlModeChanged(self):
00085         pass
00086     
00087     def onTranslate(self, lng):
00088         pass
00089     
00090     def onEmergencyStop(self, state):
00091         pass
00092     
00093     def onDestroy(self):
00094         self._t_datetime.stop()
00095         


airbus_cobot_gui
Author(s): Martin Matignon
autogenerated on Thu Jun 6 2019 17:59:19