Ejemplo n.º 1
0
    def init_ui(self):
        """ Initializes all the secions in the layout """

        window_layout = QGridLayout()
        window_layout.setAlignment(QtCore.Qt.AlignTop)

        self.weather_controller = WeatherController()
        self.weather_controller.parse_weather({})

        self.weather_frame = Weather(self.weather_controller)
        window_layout.addWidget(self.weather_frame, 0, 0)

        self.running_clothes_frame = RunningClothes()

        window_layout.addWidget(self.running_clothes_frame, 1, 0)

        ui_palette = self.palette()
        ui_palette.setColor(self.backgroundRole(), QtCore.Qt.black)
        self.setPalette(ui_palette)

        #Set the layout and window
        self.setLayout(window_layout)
        self.move(300, 150)
        self.show()
        #start Fullscreen
        self.showFullScreen()

        # kick off the thread
        self.update_thread = UpdateThread()
        self.update_thread.update_clock.connect(self.callback_update_clock)
        self.update_thread.update_moon.connect(self.callback_update_moon)
        self.update_thread.update_indoor.connect(self.callback_update_indoor)
        self.update_thread.update_weather_and_clothes.connect(self.callback_update_weather_and_clothes)
        self.update_thread.update_person.connect(self.callback_update_person)
        self.update_thread.start()
Ejemplo n.º 2
0
 def requestMasterInfo(self, masteruri, monitoruri):
     '''
 This method starts a thread to get the informations about the ROS master by
 the given RCP uri of the master_discovery node. If all informations are
 retrieved, a C{master_info_signal} of this class will be emitted. If for given
 masteruri a thread is already running, it will be inserted to the requested
 updates. For the same masteruri only one requested update can be stored. 
 On update error the requested update will be ignored.
 This method is thread safe. 
 
 @param masteruri: the URI of the remote ROS master
 @type masteruri: C{str}
 @param monitoruri: the URI of the monitor RPC interface of the master_discovery node
 @type monitoruri: C{str}
 '''
     self._lock.acquire(True)
     if (self.__updateThreads.has_key(masteruri)):
         self.__requestedUpdates[masteruri] = monitoruri
     else:
         upthread = UpdateThread(monitoruri)
         upthread.update_signal.connect(self._on_master_info)
         self.__updateThreads[masteruri] = upthread
         from urlparse import urlparse
         om = urlparse(masteruri)
         upthread.start()
     self._lock.release()
Ejemplo n.º 3
0
 def __create_update_thread(self, monitoruri, masteruri, delayed_exec):
   upthread = UpdateThread(monitoruri, masteruri, delayed_exec)
   self.__updateThreads[masteruri] = upthread
   upthread.update_signal.connect(self._on_master_info)
   upthread.master_errors_signal.connect(self._on_master_errors)
   upthread.error_signal.connect(self._on_error)
   upthread.timediff_signal.connect(self._on_timediff)
   upthread.start()
Ejemplo n.º 4
0
 def _on_master_info(self, minfo):
     self.master_info_signal.emit(minfo)
     self._lock.acquire(True)
     try:
         thread = self.__updateThreads.pop(minfo.masteruri)
         del thread
         monitoruri = self.__requestedUpdates.pop(minfo.masteruri)
     except KeyError:
         pass
     else:
         upthread = UpdateThread(monitoruri)
         upthread.update_signal.connect(self._on_master_info)
         self.__updateThreads[minfo.masteruri] = upthread
         upthread.start()
     self._lock.release()