From 6abaf82ffd00170a0a66b2f3b56cd252bdc415ae Mon Sep 17 00:00:00 2001 From: Daniel Nunes Date: Tue, 5 Apr 2016 15:21:15 +0000 Subject: [PATCH 1/5] In-tag text should now be properly parsed. --- fomod/config.py | 6 +++--- fomod/factory.py | 20 ++++++++++---------- fomod/info.py | 14 +++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/fomod/config.py b/fomod/config.py index 476f9ef..f4c2e67 100644 --- a/fomod/config.py +++ b/fomod/config.py @@ -33,7 +33,7 @@ def __init__(self, element=None): class ObjectModName(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Name", "moduleName", 0, element, allow_text=True) @@ -215,7 +215,7 @@ def __init__(self, element=None, default_properties=None): class ObjectPluginDescription(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Description", "description", 0, element, allow_text=True) @@ -246,7 +246,7 @@ def __init__(self, element=None): class ObjectFlag(base.ObjectBase): - def __init__(self, element=None, default_properties=None): + def __init__(self, element=None, default_properties=None, text=""): properties = {"name": props.PropertyText("Name", "name", "")} super().__init__("Flag", "flag", 0, element, diff --git a/fomod/factory.py b/fomod/factory.py index fff2dda..b526795 100644 --- a/fomod/factory.py +++ b/fomod/factory.py @@ -21,26 +21,26 @@ def from_element(element): if element.tag == "fomod" and not element.getparent(): return info.ObjectInfo(element) elif element.tag == "Name": - return info.ObjectName(element) + return info.ObjectName(element, element.text) elif element.tag == "Author": - return info.ObjectAuthor(element) + return info.ObjectAuthor(element, element.text) elif element.tag == "Version": - return info.ObjectVersion(element) + return info.ObjectVersion(element, element.text) elif element.tag == "Id": - return info.ObjectID(element) + return info.ObjectID(element, element.text) elif element.tag == "Website": - return info.ObjectWebsite(element) + return info.ObjectWebsite(element, element.text) elif element.tag == "Description": - return info.ObjectDescription(element) + return info.ObjectDescription(element, element.text) elif element.tag == "Groups": return info.ObjectGroup(element) elif element.tag == "element": - return info.ObjectElement(element) + return info.ObjectElement(element, element.text) elif element.tag == "config" and not element.getparent(): return config.ObjectConfig(element) elif element.tag == "moduleName": - return config.ObjectModName(element) + return config.ObjectModName(element, element.text) elif element.tag == "moduleDependencies": return config.ObjectModDepend(element) elif element.tag == "requiredInstallFiles": @@ -84,7 +84,7 @@ def from_element(element): elif element.tag == "plugin": return config.ObjectPlugin(element, dict(element.attrib)) elif element.tag == "description": - return config.ObjectPluginDescription(element) + return config.ObjectPluginDescription(element, element.text) elif element.tag == "image": return config.ObjectImage(element, dict(element.attrib)) elif element.tag == "conditionFlags": @@ -92,7 +92,7 @@ def from_element(element): elif element.tag == "typeDescriptor": return config.ObjectTypeDesc(element) elif element.tag == "flag": - return config.ObjectFlag(element, dict(element.attrib)) + return config.ObjectFlag(element, dict(element.attrib), element.text) elif element.tag == "dependencyType": return config.ObjectDependencyType(element) elif element.tag == "defaultType": diff --git a/fomod/info.py b/fomod/info.py index 4c445ac..b5c980e 100644 --- a/fomod/info.py +++ b/fomod/info.py @@ -27,32 +27,32 @@ def __init__(self, element=None): class ObjectName(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Name", "Name", 1, element, allow_text=True) class ObjectAuthor(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Author", "Author", 1, element, allow_text=True) class ObjectVersion(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Version", "Version", 1, element, allow_text=True) class ObjectID(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("ID", "Id", 1, element, allow_text=True) class ObjectWebsite(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Website", "Website", 1, element, allow_text=True) class ObjectDescription(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Description", "Description", 1, element, allow_text=True) @@ -65,5 +65,5 @@ def __init__(self, element=None): class ObjectElement(base.ObjectBase): - def __init__(self, element=None): + def __init__(self, element=None, text=""): super().__init__("Element", "element", 0, element, allow_text=True) From ad705032611856565f35f2b9a19b579ba310d059 Mon Sep 17 00:00:00 2001 From: Daniel Nunes Date: Tue, 5 Apr 2016 15:26:19 +0000 Subject: [PATCH 2/5] Object classes now properly hold text. --- fomod/config.py | 7 ++++--- fomod/info.py | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fomod/config.py b/fomod/config.py index f4c2e67..d9d2940 100644 --- a/fomod/config.py +++ b/fomod/config.py @@ -34,7 +34,7 @@ def __init__(self, element=None): class ObjectModName(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("Name", "moduleName", 0, element, allow_text=True) + super().__init__("Name", "moduleName", 0, element, allow_text=True, default_text=text) class ObjectModDepend(base.ObjectBase): @@ -217,7 +217,7 @@ def __init__(self, element=None, default_properties=None): class ObjectPluginDescription(base.ObjectBase): def __init__(self, element=None, text=""): super().__init__("Description", "description", 0, element, - allow_text=True) + allow_text=True, default_text=text) class ObjectImage(base.ObjectBase): @@ -250,7 +250,8 @@ def __init__(self, element=None, default_properties=None, text=""): properties = {"name": props.PropertyText("Name", "name", "")} super().__init__("Flag", "flag", 0, element, - properties=properties, allow_text=True, default_properties=default_properties) + properties=properties, allow_text=True, + default_properties=default_properties, default_text=text) class ObjectDependencyType(base.ObjectBase): diff --git a/fomod/info.py b/fomod/info.py index b5c980e..d770b4d 100644 --- a/fomod/info.py +++ b/fomod/info.py @@ -28,32 +28,32 @@ def __init__(self, element=None): class ObjectName(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("Name", "Name", 1, element, allow_text=True) + super().__init__("Name", "Name", 1, element, allow_text=True, default_text=text) class ObjectAuthor(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("Author", "Author", 1, element, allow_text=True) + super().__init__("Author", "Author", 1, element, allow_text=True, default_text=text) class ObjectVersion(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("Version", "Version", 1, element, allow_text=True) + super().__init__("Version", "Version", 1, element, allow_text=True, default_text=text) class ObjectID(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("ID", "Id", 1, element, allow_text=True) + super().__init__("ID", "Id", 1, element, allow_text=True, default_text=text) class ObjectWebsite(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("Website", "Website", 1, element, allow_text=True) + super().__init__("Website", "Website", 1, element, allow_text=True, default_text=text) class ObjectDescription(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("Description", "Description", 1, element, allow_text=True) + super().__init__("Description", "Description", 1, element, allow_text=True, default_text=text) class ObjectGroup(base.ObjectBase): @@ -66,4 +66,4 @@ def __init__(self, element=None): class ObjectElement(base.ObjectBase): def __init__(self, element=None, text=""): - super().__init__("Element", "element", 0, element, allow_text=True) + super().__init__("Element", "element", 0, element, allow_text=True, default_text=text) From fb465916a1b590fff67a6049271092316309a6f6 Mon Sep 17 00:00:00 2001 From: Daniel Nunes Date: Tue, 5 Apr 2016 15:34:39 +0000 Subject: [PATCH 3/5] Text should now be properly serialized. --- fomod/serializer/serializer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fomod/serializer/serializer.py b/fomod/serializer/serializer.py index 4a314f4..ac476b7 100644 --- a/fomod/serializer/serializer.py +++ b/fomod/serializer/serializer.py @@ -35,6 +35,9 @@ def serialize(info_root, config_root, package_path): element = etree.Element(node.tag) node.element = element + if node.allow_text: + element.text = node.text + for key in node.properties: element.set(key, node.properties[key]) @@ -48,6 +51,9 @@ def serialize(info_root, config_root, package_path): element = etree.Element(node.tag) node.element = element + if node.allow_text: + element.text = node.text + for key in node.properties: element.set(node.properties[key].tag, str(node.properties[key].value)) From 620bbf874a627028851acefe164bd6beba0e329e Mon Sep 17 00:00:00 2001 From: Daniel Nunes Date: Tue, 5 Apr 2016 15:35:03 +0000 Subject: [PATCH 4/5] Appveyor artifacts should now be properly uploaded. --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 2bbd133..da4107f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,7 +13,8 @@ deploy: - provider: GitHub auth_token: secure: iMaZrvVT+OI/9jRs8LyOvmzVqIBa0/jpiK96wNzZww/KqKsMcferhIeSK7faNzOo - artifact: dist\* + artifact: '*' + description: '[Changelog.](https://github.com/GandaG/fomod-editor/blob/master/CHANGELOG.md)' force_update: true on: appveyor_repo_tag: true \ No newline at end of file From 2cfd96f0a4f731b924e27d8987ec1720d9764a97 Mon Sep 17 00:00:00 2001 From: Daniel Nunes Date: Tue, 5 Apr 2016 15:36:52 +0000 Subject: [PATCH 5/5] Version bump and updated changelog. --- CHANGELOG.md | 6 ++++++ fomod/__init__.py | 2 +- setup.cfg | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8714738..3e48245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +0.2.1 (2016-04-05) + +* In-tag text is now properly parsed and saved along with everything else. + +---------------------------------- + 0.2.0 (2016-04-05) * Users can now modify the installer's objects. diff --git a/fomod/__init__.py b/fomod/__init__.py index 5047395..589444b 100644 --- a/fomod/__init__.py +++ b/fomod/__init__.py @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.2.0" +__version__ = "0.2.1" diff --git a/setup.cfg b/setup.cfg index 9c7f522..a122c26 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.2.0 +current_version = 0.2.1 [bumpversion:file:fomod/__init__.py]