コード例 #1
0
    def __init__(self, attributeName, qtControl, model, pseudoname="", isMandatory = False, \
                 customValueHandler = None,bindControlOnly = False):
        '''
        :param attributeName: Property name of the database model that is to be mapped.
        :param qtControl: Qt input widget that should be mapped to the model's attribute.
        :param model: STDM model to which the attribute name belongs to.
        :param isMandatory: Flag to indicate whether a value is required from the input control.
        :param customValueHandler: Instance of a custom value handler can be provided if it does not exist amongst 
        those in the registered list.
        :param bindControlOnly: The model will not be updated using the control's value. This is used to only 
        update the control value using the model value when the mapper is in 'Update' mode.
        '''
        self._attrName = attributeName
        self._control = qtControl
        self._model = model
        self._isMandatory = isMandatory
        self._bindControlOnly = bindControlOnly

        if customValueHandler == None:
            self._valueHandler = valueHandler(qtControl)()
        else:
            self._valueHandler = customValueHandler()

        if not self._valueHandler is None:
            self._valueHandler.setControl(qtControl)

        self._pseudoname = attributeName if pseudoname == "" else pseudoname
コード例 #2
0
ファイル: mapping.py プロジェクト: 7o9/stdm-plugin
 def __init__(self, attributeName, qtControl, model,pseudoname="", isMandatory = False, \
              customValueHandler = None,bindControlOnly = False):
     '''
     :param attributeName: Property name of the database model that is to be mapped.
     :param qtControl: Qt input widget that should be mapped to the model's attribute.
     :param model: STDM model to which the attribute name belongs to.
     :param isMandatory: Flag to indicate whether a value is required from the input control.
     :param customValueHandler: Instance of a custom value handler can be provided if it does not exist amongst 
     those in the registered list.
     :param bindControlOnly: The model will not be updated using the control's value. This is used to only 
     update the control value using the model value when the mapper is in 'Update' mode.
     '''
     self._attrName = attributeName
     self._control = qtControl
     self._model = model
     self._isMandatory = isMandatory
     self._bindControlOnly = bindControlOnly
     
     if customValueHandler == None:
         self._valueHandler = valueHandler(qtControl)()
     else:
         self._valueHandler = customValueHandler()
         
     if not self._valueHandler is None:
         self._valueHandler.setControl(qtControl)
         
     self._pseudoname = attributeName if pseudoname == "" else pseudoname
コード例 #3
0
ファイル: spatial_unit_form.py プロジェクト: neogeomat/stdm
    def initWidget(self, widget):
        """
        Initialize the widget
        """
        if not widget is None:
            self.value_handler = valueHandler(widget)

            if not self.value_handler is None:
                self.handler_obj = self.value_handler()

                if widget is not None:
                    self.handler_obj.setControl(widget)

                self.value = getattr(self.handler_obj, 'value')

                self.set_value = getattr(self.handler_obj, 'setValue')
コード例 #4
0
ファイル: mapping.py プロジェクト: aranguren/stdm
    def __init__(self,
                 setting_key,
                 widget,
                 mandatory=False,
                 create_default=True,
                 custom_value_handler=None,
                 get_func=None,
                 set_func=None):
        """
        :param setting_key: Name or path of the configuration key.
        :type setting_key: str
        :param widget: Instance of a Qt Widget.
        :type widget: QWidget
        :param create_default: True to create a default setting if not found;
        False to skip creation - In this case, the mapper will be excluded when
        setting the configuration value.
        :type create_default: bool
        :param custom_value_handler: Instance of a custom value handler can be provided if it does not exist amongst
        those in the registered list.
        :type custom_value_handler: ControlValueHandler
        :param get_func: Function to filter or reformat the return value of the control when 'bindModel' function
        is called.
        :param set_func: Function to filter or reformat a model's values when 'bind_control' function
        is called.
        :param mandatory: Flag to indicate whether a value is required from the input control.
        :type mandatory: bool
        """
        from stdm.ui.helpers import (valueHandler, ControlValueHandler)
        self._key = setting_key
        self._control = widget
        self._create_default = create_default
        self._get_func = get_func
        self._set_func = set_func
        self._mandatory = mandatory

        if not custom_value_handler is None:
            self._value_handler = custom_value_handler()

        else:
            self._value_handler = valueHandler(self._control)()

        if not self._value_handler is None:
            self._value_handler.setControl(self._control)
コード例 #5
0
ファイル: spatial_unit_form.py プロジェクト: gltn/stdm
    def initWidget(self, widget):
        """
        Initialize the widget
        """
        if not widget is None:
            self.value_handler = valueHandler(widget)

            if not self.value_handler is None:
                self.handler_obj = self.value_handler()

                if widget is not None:
                    self.handler_obj.setControl(widget)

                self.value = getattr(
                    self.handler_obj, 'value'
                )

                self.set_value = getattr(
                    self.handler_obj, 'setValue'
                )
コード例 #6
0
ファイル: mapping.py プロジェクト: Guillon88/stdm
    def __init__(self, setting_key, widget, mandatory=False,
                 create_default=True, custom_value_handler=None,
                 get_func=None, set_func=None):
        """
        :param setting_key: Name or path of the configuration key.
        :type setting_key: str
        :param widget: Instance of a Qt Widget.
        :type widget: QWidget
        :param create_default: True to create a default setting if not found;
        False to skip creation - In this case, the mapper will be excluded when
        setting the configuration value.
        :type create_default: bool
        :param custom_value_handler: Instance of a custom value handler can be provided if it does not exist amongst
        those in the registered list.
        :type custom_value_handler: ControlValueHandler
        :param get_func: Function to filter or reformat the return value of the control when 'bindModel' function
        is called.
        :param set_func: Function to filter or reformat a model's values when 'bind_control' function
        is called.
        :param mandatory: Flag to indicate whether a value is required from the input control.
        :type mandatory: bool
        """
        from stdm.ui.helpers import (
            valueHandler,
            ControlValueHandler
        )
        self._key = setting_key
        self._control = widget
        self._create_default = create_default
        self._get_func = get_func
        self._set_func = set_func
        self._mandatory = mandatory

        if not custom_value_handler is None:
            self._value_handler = custom_value_handler()

        else:
            self._value_handler = valueHandler(self._control)()

        if not self._value_handler is None:
            self._value_handler.setControl(self._control)
コード例 #7
0
    def initWidget(self, widget):
        """
        Initialize the widget
        """
        if widget is not None:
            self.value_handler = valueHandler(widget)

            if self.value_handler is not None:
                self.handler_obj = self.value_handler()

                self.handler_obj.setControl(widget)

                self.value = getattr(
                    self.handler_obj, 'value'
                )

                self.set_value = getattr(
                    self.handler_obj, 'setValue'
                )

                self.handler_obj.value_changed.connect(self.emitValueChanged)