[Formed-commits] r378 - in trunk: . formed/formed formed/formed/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Aug 4 12:53:25 CEST 2010
Author: bh
Date: 2010-08-04 12:53:24 +0200 (Wed, 04 Aug 2010)
New Revision: 378
Modified:
trunk/ChangeLog
trunk/formed/formed/main.py
trunk/formed/formed/model/nodecomponents.py
Log:
* formed/formed/main.py (MainFrame.OnSetDocumentVersion): New. Let
the user set the document version.
(MainFrame._createMenuBar): Add menu item for OnSetDocumentVersion
* formed/formed/model/nodecomponents.py (RootNode.__init__)
(RootNode.getVersion, RootNode.setVersion): Add attribute
"version" and accessor methods.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-08-02 10:37:23 UTC (rev 377)
+++ trunk/ChangeLog 2010-08-04 10:53:24 UTC (rev 378)
@@ -1,3 +1,13 @@
+2010-08-04 Bernhard Herzog <bh at intevation.de>
+
+ * formed/formed/model/nodecomponents.py (RootNode.__init__)
+ (RootNode.getVersion, RootNode.setVersion): Add attribute
+ "version" and accessor methods.
+
+ * formed/formed/main.py (MainFrame.OnSetDocumentVersion): New. Let
+ the user set the document version.
+ (MainFrame._createMenuBar): Add menu item for OnSetDocumentVersion
+
2010-08-02 Bernhard Herzog <bh at intevation.de>
* formed/formed.py, formed/formed/io/document.py,
Modified: trunk/formed/formed/main.py
===================================================================
--- trunk/formed/formed/main.py 2010-08-02 10:37:23 UTC (rev 377)
+++ trunk/formed/formed/main.py 2010-08-04 10:53:24 UTC (rev 378)
@@ -41,6 +41,7 @@
ID_EXIT = wx.NewId()
ID_MODE = wx.NewId()
+ID_VERSION = wx.NewId()
ID_DEL = wx.NewId()
ID_ADD = wx.NewId()
@@ -139,6 +140,9 @@
extramenu.Append(
ID_MODE,
_("&Select mode..."), _("Select a traversal mode"))
+ extramenu.Append(
+ ID_VERSION,
+ _("Set Document &Version..."), _("Set the document version"))
# setup filters
if len(self.config.filters) > 0:
@@ -171,6 +175,7 @@
wx.EVT_MENU(self, ID_EXIT, self.OnExit)
wx.EVT_MENU(self, ID_MODE, self.OnSelectMode)
+ wx.EVT_MENU(self, ID_VERSION, self.OnSetDocumentVersion)
def _createChoice(self, parent):
choiceList = [key for key in sorted(namesToClasses.iterkeys())
@@ -261,6 +266,18 @@
if sel == "all": sel = None
self.selectedMode = sel
+ def OnSetDocumentVersion(self, event):
+ dlg = wx.TextEntryDialog(self, _("FormEd Document Version"),
+ _("Document Version"),
+ self.document.root.getVersion())
+ if dlg.ShowModal() == wx.ID_OK:
+ version = dlg.GetValue()
+ else:
+ version = None
+ dlg.Destroy()
+ if version is not None:
+ self.document.root.setVersion(version)
+
def OnDelClick(self, event):
self.ruleChanges += 1
self.tree.deleteSelected()
Modified: trunk/formed/formed/model/nodecomponents.py
===================================================================
--- trunk/formed/formed/model/nodecomponents.py 2010-08-02 10:37:23 UTC (rev 377)
+++ trunk/formed/formed/model/nodecomponents.py 2010-08-04 10:53:24 UTC (rev 378)
@@ -340,7 +340,14 @@
def __init__(self, document=None):
Node.__init__(self)
self.document = document
+ self.attributes["version"] = ""
+ def getVersion(self):
+ return self.getAttribute("version")
+
+ def setVersion(self, version):
+ self.setAttribute("version", version)
+
class CaseNode(Node):
def __init__(self):
Node.__init__(self)
More information about the Formed-commits
mailing list