Exemplo n.º 1
0
 def runPeriodically(self, *args):
     '''
     this block should be handled within the appropriate widget
     '''
     while not self.data.message_queue.empty(
     ):  #if there is new data to be read
         message = self.data.message_queue.get()
         if message[0:2] == "pz":
             self.setPosOnScreen(message)
         elif message[0:2] == "pt":
             self.setTargetOnScreen(message)
         elif message[0:8] == "Message:":
             self.data.uploadFlag = 0
             content = NotificationPopup(cancel=self.dismiss_popup,
                                         text=message[9:])
             self._popup = Popup(title="Notification: ",
                                 content=content,
                                 auto_dismiss=False,
                                 size_hint=(0.25, 0.25))
             self._popup.open()
         else:
             try:
                 newText = self.frontpage.consoleText[-3000:] + message
                 self.frontpage.consoleText = newText
                 self.frontpage.textconsole.gotToBottom()
             except:
                 self.frontpage.consoleText = "text not displayed correctly"
Exemplo n.º 2
0
 def runPeriodically(self, *args):
     '''
     this block should be handled within the appropriate widget
     '''
     while not self.data.message_queue.empty(): #if there is new data to be read
         message = self.data.message_queue.get()
         
         if message[0] == "<":
             self.setPosOnScreen(message)
         elif message[0] == "$":
             self.receivedSetting(message)
         elif message[0] == "[":
             if message[1:4] == "PE:":
                 self.setErrorOnScreen(message)
             elif message[1:8] == "Measure":
                 measuredDist = float(message[9:len(message)-3])
                 self.data.measureRequest(measuredDist)
         elif message[0:13] == "Maslow Paused":
             self.data.uploadFlag = 0
             self.writeToTextConsole(message)
         elif message[0:8] == "Message:":
             if self.data.calibrationInProcess:
                 break
             self.previousUploadStatus = self.data.uploadFlag 
             self.data.uploadFlag = 0
             try:
                 self._popup.dismiss()                                           #close any open popup
             except:
                 pass                                                            #there wasn't a popup to close
             content = NotificationPopup(continueOn = self.dismiss_popup_continue, text = message[9:])
             if sys.platform.startswith('darwin'):
                 self._popup = Popup(title="Notification: ", content=content,
                         auto_dismiss=False, size=(360,240), size_hint=(.3, .3))
             else:
                 self._popup = Popup(title="Notification: ", content=content,
                         auto_dismiss=False, size=(360,240), size_hint=(None, None))
             self._popup.open()
             if global_variables._keyboard:
                 global_variables._keyboard.bind(on_key_down=self.keydown_popup)
                 self._popup.bind(on_dismiss=self.ondismiss_popup)
         elif message[0:8] == "Firmware":
             self.data.logger.writeToLog("Ground Control Version " + str(self.data.version) + "\n")
             self.writeToTextConsole("Ground Control " + str(self.data.version) + "\r\n" + message + "\r\n")
             
             #Check that version numbers match
             if float(message[-7:]) < float(self.data.version):
                 self.data.message_queue.put("Message: Warning, your firmware is out of date and may not work correctly with this version of Ground Control\n\n" + "Ground Control Version " + str(self.data.version) + "\r\n" + message)
             if float(message[-7:]) > float(self.data.version):
                 self.data.message_queue.put("Message: Warning, your version of Ground Control is out of date and may not work with this firmware version\n\n" + "Ground Control Version " + str(self.data.version) + "\r\n" + message)
         elif message == "ok\r\n":
             pass #displaying all the 'ok' messages clutters up the display
         else:
             self.writeToTextConsole(message)
Exemplo n.º 3
0
    def runPeriodically(self, *args):
        '''
        this block should be handled within the appropriate widget
        '''
        while not self.data.message_queue.empty(
        ):  #if there is new data to be read
            message = self.data.message_queue.get()

            self.data.logger.writeToLog(message)

            if message[0] == "<":
                self.setPosOnScreen(message)
            elif message[0] == "[":
                if message[1:4] == "PE:":
                    self.setErrorOnScreen(message)
                elif message[1:8] == "Measure":
                    print "measure seen"
                    print message
                    measuredDist = float(message[9:len(message) - 3])
                    self.data.measureRequest(measuredDist)
            elif message[0:8] == "Message:":
                self.previousUploadStatus = self.data.uploadFlag
                self.data.uploadFlag = 0
                try:
                    self._popup.dismiss()  #close any open popup
                except:
                    pass  #there wasn't a popup to close
                content = NotificationPopup(
                    continueOn=self.dismiss_popup_continue,
                    hold=self.dismiss_popup_hold,
                    text=message[9:])
                self._popup = Popup(title="Notification: ",
                                    content=content,
                                    auto_dismiss=False,
                                    size_hint=(0.35, 0.35))
                self._popup.open()
            elif message[0:8] == "Firmware":
                self.writeToTextConsole("Ground Control " +
                                        str(self.data.version) + "\r\n" +
                                        message + "\r\n")
            elif message == "ok\r\n":
                pass  #displaying all the 'ok' messages clutters up the display
            else:
                self.writeToTextConsole(message)
Exemplo n.º 4
0
 def runPeriodically(self, *args):
     '''
     this block should be handled within the appropriate widget
     '''
     while not self.data.message_queue.empty(): #if there is new data to be read
         message = self.data.message_queue.get()
         if message[0:2] == "pz":
             self.setPosOnScreen(message)
         elif message[0:2] == "pt":
             self.setTargetOnScreen(message)
         elif message[0:8] == "Message:":
             self.previousUploadStatus = self.data.uploadFlag 
             self.data.uploadFlag = 0
             content = NotificationPopup(continueOn = self.dismiss_popup_continue, hold=self.dismiss_popup_hold , text = message[9:])
             self._popup = Popup(title="Notification: ", content=content,
                         auto_dismiss=False, size_hint=(0.25, 0.25))
             self._popup.open()
         else:
             self.writeToTextConsole(message)