Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
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