Ejemplo n.º 1
0
 def fromSkelStructure(cls, moduleName: str, boneName: str,
                       skelStructure: dict, **kwargs: Any) -> Any:
     #logger.debug("Recordbone.fromSkelStructure: %r, %r, %r", moduleName, boneName, skelStructure)
     myStruct = skelStructure[boneName]
     readOnly = "readonly" in skelStructure[boneName] and skelStructure[
         boneName]["readonly"]
     required = "required" in skelStructure[boneName] and skelStructure[
         boneName]["required"]
     widgetGen = lambda: cls(moduleName,
                             boneName,
                             readOnly,
                             required,
                             skelStructure[boneName]["multiple"],
                             using=skelStructure[boneName]["using"],
                             format=skelStructure[boneName].get(
                                 "format", "$(name)"))
     if myStruct.get("multiple"):
         viewDeleate = RecordViewBoneDelegate(moduleName, boneName,
                                              skelStructure)
         textFormatFunc = lambda x: viewDeleate.displayText(x, None)
         preMultiWidgetGen = widgetGen
         widgetGen = lambda: TabMultiContainer(preMultiWidgetGen,
                                               textFormatFunc)
     if myStruct.get("languages"):
         preLangWidgetGen = widgetGen
         widgetGen = lambda: LanguageContainer(myStruct["languages"],
                                               preLangWidgetGen)
     return widgetGen()
Ejemplo n.º 2
0
    def fromSkelStructure(cls, moduleName: str, boneName: str,
                          skelStructure: dict, **kwargs: Any) -> Any:
        myStruct = skelStructure[boneName]
        readOnly = "readonly" in myStruct and myStruct["readonly"]
        required = "required" in myStruct and myStruct["required"]
        languages = None
        plaintext = False
        validHtml = None
        if boneName in skelStructure:
            if "plaintext" in myStruct and myStruct["plaintext"]:
                plaintext = True
            if "validHtml" in myStruct:
                validHtml = myStruct["validHtml"]

        widgetGen = lambda: cls(moduleName,
                                boneName,
                                readOnly,
                                required,
                                languages=None,
                                plaintext=plaintext,
                                validHtml=validHtml,
                                **kwargs)
        if myStruct.get("multiple"):
            preMultiWidgetGen = widgetGen
            widgetGen = lambda: ListMultiContainer(preMultiWidgetGen)
        if myStruct.get("languages"):
            preLangWidgetGen = widgetGen
            widgetGen = lambda: LanguageContainer(myStruct["languages"],
                                                  preLangWidgetGen)
        return widgetGen()
Ejemplo n.º 3
0
	def fromSkelStructure(
			cls,
			moduleName: str,
			boneName: str,
			skelStructure: dict,
			**kwargs: Any) -> Any:
		myStruct = skelStructure[boneName]
		readOnly = "readonly" in myStruct and myStruct["readonly"]
		required = "required" in myStruct and myStruct["required"]
		if "module" in myStruct:
			destModul = myStruct["module"]
		else:
			destModul = myStruct["type"].split(".")[1]
		fmt = "value['dest']['name']"
		if "format" in myStruct:
			fmt = myStruct["format"]
		widgetGen = lambda: cls(
			moduleName,
			boneName,
			readOnly,
			required,
			multiple=myStruct.get("multiple"),
			destModule=destModul,
			using=myStruct["using"],
			format=fmt)
		if myStruct.get("multiple"):
			preMultiWidgetGen = widgetGen
			widgetGen = lambda: ListMultiContainer(preMultiWidgetGen)
		if myStruct.get("languages"):
			preLangWidgetGen = widgetGen
			widgetGen = lambda: LanguageContainer(myStruct["languages"], preLangWidgetGen)
		return widgetGen()
Ejemplo n.º 4
0
 def fromSkelStructure(moduleName: str, boneName: str, skelStructure: dict,
                       **kwargs: Any) -> Any:
     myStruct = skelStructure[boneName]
     readOnly = bool(myStruct.get("readonly"))
     required = bool(myStruct.get("required"))
     widgetGen = lambda: ColorEditBone(moduleName, boneName, readOnly,
                                       required, skelStructure, **kwargs)
     if myStruct.get("multiple"):
         preMultiWidgetGen = widgetGen
         widgetGen = lambda: ListMultiContainer(preMultiWidgetGen)
     if myStruct.get("languages"):
         preLangWidgetGen = widgetGen
         widgetGen = lambda: LanguageContainer(myStruct["languages"],
                                               preLangWidgetGen)
     return widgetGen()
Ejemplo n.º 5
0
 def fromSkelStructure(cls, moduleName: str, boneName: str,
                       skelStructure: dict, **kwargs: Any) -> Any:
     myStruct = skelStructure[boneName]
     readOnly = "readonly" in myStruct and myStruct["readonly"]
     required = "required" in myStruct and myStruct["required"]
     widgetGen = lambda: cls(moduleName, boneName, readOnly, required, **
                             kwargs)
     if myStruct.get("multiple"):
         preMultiWidgetGen = widgetGen
         widgetGen = lambda: ListMultiContainer(preMultiWidgetGen)
     if myStruct.get("languages"):
         preLangWidgetGen = widgetGen
         widgetGen = lambda: LanguageContainer(myStruct["languages"],
                                               preLangWidgetGen)
     return widgetGen()
Ejemplo n.º 6
0
 def fromSkelStructure(cls, moduleName: str, boneName: str,
                       skelStructure: dict, **kwargs: Any) -> Any:
     myStruct = skelStructure[boneName]
     readOnly = "readonly" in myStruct and myStruct["readonly"]
     required = "required" in myStruct and myStruct["required"]
     if "sortBy" in myStruct:
         sortBy = myStruct["sortBy"]
     else:
         sortBy = "keys"
     values = list(myStruct["values"])
     widgetGen = lambda: cls(moduleName,
                             boneName,
                             readOnly,
                             required,
                             values=values,
                             sortBy=sortBy,
                             **kwargs)
     if myStruct.get("languages"):
         preLangWidgetGen = widgetGen
         widgetGen = lambda: LanguageContainer(myStruct["languages"],
                                               preLangWidgetGen)
     return widgetGen()
Ejemplo n.º 7
0
 def fromSkelStructure(moduleName: str, boneName: str,
                       skelStructure: Dict[str, Any], **kwargs: Any) -> Any:
     myStruct = skelStructure[boneName]
     readOnly = "readonly" in myStruct and myStruct["readonly"]
     required = "required" in myStruct and myStruct["required"]
     if "sortBy" in myStruct:
         sortBy = myStruct["sortBy"]
     else:
         sortBy = "keys"
     values = list(myStruct["values"])
     if "required" not in myStruct or not myStruct["required"]:
         values.insert(0, ["", ""])
     widgetGen = lambda: SelectOneEditBone(moduleName,
                                           boneName,
                                           readOnly,
                                           required,
                                           values=values,
                                           sortBy=sortBy,
                                           **kwargs)
     if myStruct.get("languages"):
         preLangWidgetGen = widgetGen
         widgetGen = lambda: LanguageContainer(myStruct["languages"],
                                               preLangWidgetGen)
     return widgetGen()