Example #1
0
 def setEditorData(self, editor, index):
     value = variant_to_pyobject(index.data(Qt.EditRole))
     if value != ValueLoading:
         field_attributes = variant_to_pyobject(index.data(Qt.UserRole))
         editor.set_value(create_constant_function(value))
         editor.set_field_attributes(**field_attributes)
     else:
         editor.set_value(ValueLoading)
 def setEditorData(self, editor, index):
     value = variant_to_pyobject(index.data(Qt.EditRole))
     if value != ValueLoading:
         field_attributes = variant_to_pyobject(index.data(Qt.UserRole))
         editor.set_value(create_constant_function(value))
         editor.set_field_attributes(**field_attributes)
     else:
         editor.set_value(ValueLoading)
Example #3
0
    def search_completions(self, text):
        """Search for object that match text, to fill the list of completions

        :return: a list of tuples of (object_representation, object_getter)
        """
        search_decorator = create_entity_search_query_decorator(
            self.admin, text)
        if search_decorator:
            sresult = [
                (unicode(e), create_constant_function(e))
                for e in search_decorator(self.admin.entity.query).limit(20)
            ]
            return text, sresult
        return text, []
Example #4
0
    def search_completions(self, text):
        """Search for object that match text, to fill the list of completions

        :return: a list of tuples of (object_representation, object_getter)
        """
        search_decorator = create_entity_search_query_decorator(
            self.admin, text
        )
        if search_decorator:
            sresult = [
                (unicode(e), create_constant_function(e))
                for e in search_decorator(self.admin.entity.query).limit(20)
            ]
            return text, sresult
        return text, []
Example #5
0
 def setModelData(self, editor, model, index):
     value = editor.time()
     t = datetime.time(hour=value.hour(),
                       minute=value.minute(),
                       second=value.second())
     model.setData(index, create_constant_function(t))
Example #6
0
 def setModelData(self, editor, model, index):
     if isinstance(model, QtGui.QStandardItemModel):
         val = py_to_variant(editor.get_value())
     else:
         val = create_constant_function(editor.get_value())
     model.setData(index, val)
Example #7
0
 def setModelData(self, editor, model, index):
     if isinstance(model, QtGui.QStandardItemModel):
         val = QtCore.QVariant(editor.get_value())
     else:
         val = create_constant_function(editor.get_value())
     model.setData(index, val)
Example #8
0
 def setModelData(self, editor, model, index):
     value = editor.time()
     t = datetime.time(hour=value.hour(),
                       minute=value.minute(),
                       second=value.second())
     model.setData(index, create_constant_function(t))