Logo Search packages:      
Sourcecode: scenic version File versions  Download package

def scenic::gui::Gui::on_v4l2_standard_changed (   self,
  widget 
)
When the user changes the V4L2 standard, we actually change this standard using milhouse.
Calls `milhouse --videodevice /dev/videoX --v4l2-standard XXX
Values are either NTSC or PAL.

Definition at line 1464 of file gui.py.

                                              :
        """
        When the user changes the V4L2 standard, we actually change this standard using milhouse.
        Calls `milhouse --videodevice /dev/videoX --v4l2-standard XXX
        Values are either NTSC or PAL.
        """
        if self._widgets_changed_by_user: 
            # change standard for device
            full_name = _get_combobox_value(self.video_source_widget)
            if full_name != VIDEO_TEST_INPUT:
                dev = self.app.parse_v4l2_device_name(full_name)
                current_camera_name = dev["name"]
                def _cb2(unused_result):
                    # callback for the poll_cameras_devices deferred.
                    # check if successfully changed norm
                    # see below
                    cameras = self.app.devices["cameras"]
                    try:
                        cam = cameras[current_camera_name]
                    except KeyError:
                        log.error("Camera %s disappeared once changed standard!" % (current_camera_name))
                    else:
                        actual_standard = cam["standard"]
                        if actual_standard != standard_name:
                            msg = _("Could not change V4L2 standard from %(current_standard)s to %(desired_standard)s for device %(device_name)s.") % {"current_standard": actual_standard, "desired_standard": standard_name, "device_name": current_camera_name}
                            log.error(msg)
                            self.show_error_dialog(msg)
                            
                            self._widgets_changed_by_user = False
                            _set_combobox_value(self.v4l2_standard_widget, actual_standard)
                            self._widgets_changed_by_user = True
                            # Maybe we should show an error dialog in that case, or set the value to what it really is.
                        else:
                            log.info("Successfully changed standard to %s for device %s." % (actual_standard, current_camera_name))
                            log.debug("Now polling cameras.")
                    self.v4l2_standard_widget.set_sensitive(True)
                
                standard_name = _get_combobox_value(widget)
                #cam = self.app.devices["cameras"][current_camera_name]
                self.v4l2_standard_widget.set_sensitive(False)
                d = cameras.set_v4l2_video_standard(device_name=current_camera_name, standard=standard_name)
                def _cb(result):
                    d2 = self.app.poll_camera_devices()
                    d2.addCallback(_cb2)
                    
                d.addCallback(_cb)
        

Generated by  Doxygen 1.6.0   Back to index