Example #1
0
    def send_configuration(self, content, target=None, valid_error=None):
        msg = IpcMessage("cmd", "configure")

        if target is not None:
            msg.set_param(target, content)
        else:
            for parameter, value in content.items():
                msg.set_param(parameter, value)

        success, reply = self._send_message(msg)
        if not success and None not in [reply, valid_error]:
            if reply["params"]["error"] != valid_error:
                self._raise_reply_error(msg, reply)
            else:
                self.logger.debug("Got valid error for request %s: %s", msg,
                                  reply)
        return success, reply
Example #2
0
 def while_waiting(self):
     if self.parentApp._running == True:
         millis = int(round(time.time() * 1000))
         if millis > (self.parentApp._last_millis + int(1000 / self.parentApp._frame_rate)):
             msg = IpcMessage("notify", "frame_ready")
             msg.set_param("frame", self.parentApp._frames_sent)
             buff_id = self.parentApp._frames_sent % self.parentApp._frames
             msg.set_param("buffer_id", buff_id)
             self.parentApp.send_message(msg)
             self.parentApp._frames_sent = self.parentApp._frames_sent + 1
             self.parentApp._last_millis = millis
             if self.parentApp._frames_sent == self.parentApp._no_of_frames:
                 self.parentApp._running = False
     self.t3.values = ["Running: " + str(self.parentApp._running),
                       "Frames:  " + str(self.parentApp._frames_sent)]
     self.t3.display()
     self.t2.entry_widget.value = None
     self.t2.entry_widget._old_value = None
     self.t2.display()