/pmf_doc

Python Modeling Framework (as EMF in python)

Primary LanguageHTML

What is PMFed ?

PMFed is a graphical tree-formular editor application for XML or JSON, written in Python.

It can read, edit and save any model which has been generated by the utility pmfgen given in PMF. This utility generates from a XSD or JSON Schema all necessary python classes defining a model.

Moreover, parts of the generated classes are designed to be easely edited to fine tune the classes behaviour. On new generation, generated classes can be merged with the existing, modified, classes.

The main features of PMFed are:

  • model based: works for every (not **too** complicated) XSD or JSON schema.
  • model classes are generated from the schema.
  • intelligent tree: creation of new children based on the restrictions specified in the schema (choice, minOccurs/maxOccurs).
  • formulars are "real" formulars for user friendly editing (not just strings to edit like in so many others cheaps apps)
  • formulars are automatically derived from the model: a formular contains all the widgets necessary to edit all the attributes of an element, and each widget in a formular is dedicated to the type of the underlying attribute type. (SpinBox for integers types, ComboBox for enums etc.) and follow the possible restrictions on the simple types specified in the schema (pattern, min, max, etc...).
  • formulars can also be defined with Qt ui files.
  • XSD/JSON schema validation on the "fly" during editing (and jump to location on validation error msg click).
  • support for "comments" in XML (see in Appendix).
  • support for "references" in XML models (unidirectional or bi-directional) through special notations in the XSD schema (see in Appendix).
  • support for "references" in JSON models (unidirectional or bi-directional) through special notations in the JSON schema (see in Appendix).
  • fully configurable through customizable generated python classes (see examples later).
  • support for file splitting (see in Appendix).

More specifically, for users, the PMFed (PySide based) application allows to:

  • open/read/save XML/JSON files compliant with the XSD/JSON schema (python module given in argument to the application).
  • edit the tree (add/delete children, cut/copy/paste).
  • edit the items properties through formulars/widgets.
  • full undo-redo.
  • rich set of controls in formular (for every XSD simple type or JSON simple type).

How does it work?

Given a schema (XSD or JSON), a bunch of classes corresponding to the complex types defined in the schema is created in a python "main" module (with the command line tool pmfgen.py furnished with the application).

Moreover, for each class defined in the "main" module, a super class is also created in its own python module, allowing complete control over the generated classes. Finally, a framework is furnished, which is completely user model agnostic. The framework implements a super class where the basic functionalities of the generated classes are implemented. The PMFed application simply relies on this framework (and the generated classes), and thus allows the tree-formular editor to work out of the box for any model. The framework furnishes also a treeview, a formular view and a logger view (with document validation) for the PMFed application.

Because the user will certainly want it, great care has be done so that the user can customize the tree-formular application to fit its own needs:

  • formulars are easily custumizable
  • tree view is easily customizable
  • and of course generated classes are customizable

Note

There are more and more free (and sometimes nice) JSON editors on the internet, but these are limited per nature as the schema is read on the fly and only basic editing is possible.

The concept here is to provide a framework to fully control the model and write a real world, fully customizable application.

Interested?

The full tutorial is given in this repo. Please take contact for pricing if interest is present.