def start_record(self, path=None, options=None): if not options: options = {} if type(options) != dict: options = {} logger.warning("Wrong argument when start_record, receive \ options: %s" % options) if self.recorder: logger.error("Already recording media %s." % self.get_name()) return False if options.get("format", keys.get_key_format_avi()) == keys.get_key_format_png(): self.recorder = self.recorder_image else: self.recorder = self.recorder_video compress = options.get("compress", 0) return self.recorder.start(self.shape, path=path, compress=compress)
def click_record_button(self): if not self.is_recorded: path = self.ui.txt_name_record.text() if not path: path = None if self.ui.rbn_avi.isChecked(): format_rec = keys.get_key_format_avi() else: format_rec = keys.get_key_format_png() options = { "compress": self.ui.sb_compress.value(), "format": format_rec} if not self.controller.start_record(self.ui.cbMedia.currentText(), path, options): # TODO improve error message logger.error("Trying start record...") else: self.is_recorded = True else: if not self.controller.stop_record(self.ui.cbMedia.currentText()): logger.error("Trying stop record...") self.is_recorded = False self.set_info()
def click_record_button(self): if not self.is_recorded: path = self.ui.txt_name_record.text() if not path: path = None if self.ui.rbn_avi.isChecked(): format_rec = keys.get_key_format_avi() else: format_rec = keys.get_key_format_png() options = { "compress": self.ui.sb_compress.value(), "format": format_rec } if not self.controller.start_record(self.ui.cbMedia.currentText(), path, options): # TODO improve error message logger.error("Trying start record...") else: self.is_recorded = True else: if not self.controller.stop_record(self.ui.cbMedia.currentText()): logger.error("Trying stop record...") self.is_recorded = False self.set_info()