Add incremented index in Add Map Variable
authorlbessard
Wed, 21 Jun 2006 08:31:34 +0200
changeset 39 3e94ee906bc6
parent 38 9b5bb1dcb4f5
child 40 ddeeb217ed71
Add incremented index in Add Map Variable
Remove jaxe from makefile and configure
configure
objdictgen/Makefile.in
objdictgen/nodemanager.py
objdictgen/objdictedit.py
--- a/configure	Tue Jun 20 22:43:37 2006 +0200
+++ b/configure	Wed Jun 21 08:31:34 2006 +0200
@@ -101,8 +101,6 @@
 	--timers=*)	SUB_TIMERS_DRIVER=$optarg;;
 	--disable-Ox)	DISABLE_OPT=1;
 			echo "On user request: Won't optimize with \"-Ox\"";;
-	--enable-jaxe)	DISABLE_JAXE=0;
-			echo "On user request: Will not install jaxe";;
 	--debug)	DEBUG=1;
 			echo "Debug messages enabled !!";;
 	--debugPDO)	DEBUG=PDO;
@@ -135,7 +133,6 @@
 		echo	" --led=foo	Use 'foo' as DS-305 LED driver (use 'none' to disable or 'stdout')"
 		echo	" --nvram=foo	Use 'foo' as NVRAM driver (use 'none' to disable or 'file')"
 		echo	" --disable-Ox	Disable gcc \"-Ox\" optimizations."
-		echo	" --enable-jaxe	Enable \"jaxe\" installation."
 		echo	" --debug	Enable debug messages."
 		echo	" --debugPDO	Enable debug messages, using PDO."
 		echo	" --enable-lss	Enable Auto Baudrate detect Feature"
@@ -153,18 +150,6 @@
 	shift
 done
 
-if [ "$DISABLE_JAXE" = "1" ]; then
-	SUB_OPT_JAXE=
-else
-	which java >/dev/null 2>&1
-	if (( $? )); then 
-		SUB_OPT_JAXE=
-		echo "Could not find java VM ! Jaxe XML editor disabled !"
-	else
-		SUB_OPT_JAXE=jaxe
-	fi
-fi
-
 ###########################################################################
 #                              GUESS OS/ARCH                              #
 ###########################################################################
@@ -718,7 +703,6 @@
 	s:SUB_OPT_CFLAGS:${SUB_OPT_CFLAGS}:
 	s:SUB_TARGET:${SUB_TARGET}:
 	s:SUB_BINUTILS_PREFIX:${SUB_BINUTILS_PREFIX}:
-	s:SUB_OPT_JAXE:${SUB_OPT_JAXE}:
 	s:SUB_LSS_ENABLE:${SUB_LSS_ENABLE}:
 	s:SUB_LED_ENABLE:${SUB_LED_ENABLE}:
 	s:SUB_NVRAM_ENABLE:${SUB_NVRAM_ENABLE}:
--- a/objdictgen/Makefile.in	Tue Jun 20 22:43:37 2006 +0200
+++ b/objdictgen/Makefile.in	Wed Jun 21 08:31:34 2006 +0200
@@ -22,11 +22,8 @@
 # 
 
 PREFIX = SUB_PREFIX
-INSTALL_JAXE = SUB_OPT_JAXE
 
-all: jaxe gnosis
-
-jaxe: jaxe-unix-2.2.tar.gz
+all: gnosis
 
 gnosis: Gnosis_Utils-1.2.1.tar.gz
 
@@ -36,37 +33,23 @@
 	mv Gnosis_Utils-1.2.1/gnosis .
 	rm -rf Gnosis_Utils-1.2.1
 
-jaxe-unix-2.2.tar.gz:
-ifeq ($(INSTALL_JAXE),jaxe)
-	wget http://dl.sourceforge.net/sourceforge/jaxe/jaxe-unix-2.2.tar.gz
-	tar xfz jaxe-unix-2.2.tar.gz
-endif
-
-install: jaxe
+install: gnosis
 	cp -r ../objdictgen $(PREFIX)/
-ifeq ($(INSTALL_JAXE),jaxe)
-	rm -f $(PREFIX)/objdictgen/jaxe-unix-2.2.tar.gz
-endif
-	rm -f $(PREFIX)/objdictgen/Gnosis_Utils-current.tar.gz
+	rm -f $(PREFIX)/objdictgen/Gnosis_Utils-1.2.1.tar.gz
 	chmod -R a+r $(PREFIX)/objdictgen
-	chmod 755 $(PREFIX)/objdictgen/objdictedit.sh
-	echo -e "#!/bin/sh\n pushd $(PREFIX)/objdictgen/\n ./objdictedit.sh\n popd\n" > $(PREFIX)/bin/objdictedit
-	chmod 755 $(PREFIX)/bin/objdictedit
+	ln -s $(PREFIX)/objdictgen/objdictedit.py $(PREFIX)/bin/objdictedit
+	chmod 755 $(PREFIX)/objdictgen/objdictedit.py
 	ln -s $(PREFIX)/objdictgen/objdictgen.py $(PREFIX)/bin/objdictgen
 	chmod 755 $(PREFIX)/objdictgen/objdictgen.py
 
 uninstall:
 	-rm -rf $(PREFIX)/objdictgen
+	-rm -f $(PREFIX)/bin/objdictedit
 	-rm -f $(PREFIX)/bin/objdictgen
-	-rm -f $(PREFIX)/bin/objdictgen.py
 
 clean:
 
 mrproper: clean
-ifeq ($(INSTALL_JAXE),jaxe)
-	-rm -f jaxe-unix-2.2.tar.gz
-	-rm -rf jaxe
-endif
 	-rm -f Gnosis_Utils-1.2.1.tar.gz
 	-rm -rf gnosis
 
--- a/objdictgen/nodemanager.py	Tue Jun 20 22:43:37 2006 +0200
+++ b/objdictgen/nodemanager.py	Wed Jun 21 08:31:34 2006 +0200
@@ -969,6 +969,16 @@
                 current.append(index)
         return dictionary, current
 
+    def GetCurrentNextMapIndex(self):
+        if self.CurrentNode:
+            index = 0x2000
+            while self.CurrentNode.IsEntry(index) and index < 0x5FFF:
+                index += 1
+            if index < 0x6000:
+                return index
+            else:
+                return None
+
     def CurrentDS302Defined(self):
         if self.CurrentNode:
             return len(self.CurrentNode.GetDS302Profile()) > 0
--- a/objdictgen/objdictedit.py	Tue Jun 20 22:43:37 2006 +0200
+++ b/objdictgen/objdictedit.py	Wed Jun 21 08:31:34 2006 +0200
@@ -1418,18 +1418,25 @@
 #-------------------------------------------------------------------------------
         
     def AddMapVariable(self):
-        dialog = MapVariableDialog(self)
-        if dialog.ShowModal() == wxID_OK:
-            index, name, struct, number = dialog.GetValues()
-            result = self.Manager.AddMapVariableToCurrent(index, name, struct, number)
-            if type(result) != StringType:
-                self.RefreshBufferState()
-                self.RefreshCurrentIndexList()
-            else:
-                message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
-                message.ShowModal()
-                message.Destroy()
-        dialog.Destroy()
+        index = self.Manager.GetCurrentNextMapIndex()
+        if index:
+            dialog = MapVariableDialog(self)
+            dialog.SetIndex(index)
+            if dialog.ShowModal() == wxID_OK:
+                index, name, struct, number = dialog.GetValues()
+                result = self.Manager.AddMapVariableToCurrent(index, name, struct, number)
+                if type(result) != StringType:
+                    self.RefreshBufferState()
+                    self.RefreshCurrentIndexList()
+                else:
+                    message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR)
+                    message.ShowModal()
+                    message.Destroy()
+            dialog.Destroy()
+        else:
+            message = wxMessageDialog(self, result, "No map variable index left!", wxOK|wxICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
         
     def AddUserType(self):
         dialog = UserTypeDialog(self)
@@ -1634,43 +1641,43 @@
               label='Index :', name='staticText1', parent=self.MainPanel,
               pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
 
+        self.Index = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEX, name='Index',
+              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(152,
+              25), style=0, value='0x2000')
+
+        self.staticText3 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT3,
+              label='Name :', name='staticText3', parent=self.MainPanel,
+              pos=wx.Point(24, 80), size=wx.Size(47, 17), style=0)
+
+        self.IndexName = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEXNAME,
+              name='IndexName', parent=self.MainPanel, pos=wx.Point(24, 104),
+              size=wx.Size(152, 24), style=0, value='Undefined')
+
+        self.staticText2 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT2,
+              label='Type :', name='staticText2', parent=self.MainPanel,
+              pos=wx.Point(208, 24), size=wx.Size(38, 17), style=0)
+
         self.radioButton1 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1,
               label='VAR', name='radioButton1', parent=self.MainPanel,
-              pos=wx.Point(208, 48), size=wx.Size(72, 24), style=0)
+              pos=wx.Point(208, 48), size=wx.Size(72, 24), style=wxRB_GROUP)
         self.radioButton1.SetValue(True)
         self.radioButton1.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton1Click,
               id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1)
 
         self.radioButton2 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2,
-              label='REC', name='radioButton2', parent=self.MainPanel,
-              pos=wx.Point(208, 96), size=wx.Size(96, 24), style=0)
+              label='ARRAY', name='radioButton2', parent=self.MainPanel,
+              pos=wx.Point(208, 72), size=wx.Size(80, 24), style=wxRB_SINGLE)
         self.radioButton2.SetValue(False)
         self.radioButton2.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton2Click,
               id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2)
 
         self.radioButton3 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3,
-              label='ARRAY', name='radioButton3', parent=self.MainPanel,
-              pos=wx.Point(208, 72), size=wx.Size(80, 24), style=0)
+              label='REC', name='radioButton3', parent=self.MainPanel,
+              pos=wx.Point(208, 96), size=wx.Size(96, 24), style=wxRB_SINGLE)
         self.radioButton3.SetValue(False)
         self.radioButton3.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton3Click,
               id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3)
 
-        self.staticText2 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT2,
-              label='Type :', name='staticText2', parent=self.MainPanel,
-              pos=wx.Point(208, 24), size=wx.Size(38, 17), style=0)
-
-        self.IndexName = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEXNAME,
-              name='IndexName', parent=self.MainPanel, pos=wx.Point(24, 104),
-              size=wx.Size(152, 24), style=0, value='Undefined')
-
-        self.staticText3 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT3,
-              label='Name :', name='staticText3', parent=self.MainPanel,
-              pos=wx.Point(24, 80), size=wx.Size(47, 17), style=0)
-
-        self.Index = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEX, name='Index',
-              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(152,
-              25), style=0, value='0x2000')
-
         self.staticText4 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT4,
               label='Number :', name='staticText4', parent=self.MainPanel,
               pos=wx.Point(312, 80), size=wx.Size(88, 16), style=0)
@@ -1688,6 +1695,9 @@
         self.staticText4.Enable(False)
         self.Number.Enable(False)
 
+    def SetIndex(self, index):
+        self.Index.SetValue("0x%04X"%index)
+
     def GetValues(self):
         if self.radioButton1.GetValue():
             struct = 1
@@ -1701,20 +1711,20 @@
         return index, name, struct, number
 
     def OnRadioButton1Click(self, event):
-        self.staticText4.Enable(False)
-        self.Number.Enable(False)
+        self.EnableNumberTyping(False)
         event.Skip()
 
     def OnRadioButton2Click(self, event):
-        self.staticText4.Enable(True)
-        self.Number.Enable(True)
+        self.EnableNumberTyping(True)
         event.Skip()
 
     def OnRadioButton3Click(self, event):
-        self.staticText4.Enable(True)
-        self.Number.Enable(True)
-        event.Skip()
-
+        self.EnableNumberTyping(True)
+        event.Skip()
+
+    def EnableNumberTyping(self, enable):
+        self.staticText4.Enable(enable)
+        self.Number.Enable(enable)
 
 
 #-------------------------------------------------------------------------------
@@ -1759,40 +1769,40 @@
               label='Type :', name='staticText1', parent=self.MainPanel,
               pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
 
-        self.staticBox1 = wx.StaticBox(id=wxID_USERTYPEDIALOGSTATICBOX1,
-              label='Values', name='staticBox1', parent=self.MainPanel,
-              pos=wx.Point(200, 24), size=wx.Size(224, 144), style=0)
-
-        self.staticText2 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT2,
-              label='Minimum :', name='staticText2', parent=self.MainPanel,
-              pos=wx.Point(216, 48), size=wx.Size(67, 17), style=0)
-
-        self.Min = wx.TextCtrl(id=wxID_USERTYPEDIALOGMIN, name='Min',
-              parent=self.MainPanel, pos=wx.Point(296, 48), size=wx.Size(112,
-              24), style=wx.TE_RIGHT, value='0')
-
-        self.staticText3 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT3,
-              label='Maximum :', name='staticText3', parent=self.MainPanel,
-              pos=wx.Point(216, 88), size=wx.Size(71, 17), style=0)
-
-        self.Max = wx.TextCtrl(id=wxID_USERTYPEDIALOGMAX, name='Max',
-              parent=self.MainPanel, pos=wx.Point(296, 88), size=wx.Size(112,
-              25), style=wx.TE_RIGHT, value='0')
-
-        self.staticText4 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT4,
-              label='Length :', name='staticText4', parent=self.MainPanel,
-              pos=wx.Point(216, 128), size=wx.Size(52, 17), style=0)
-
-        self.Length = wx.TextCtrl(id=wxID_USERTYPEDIALOGLENGTH, name='Length',
-              parent=self.MainPanel, pos=wx.Point(296, 128), size=wx.Size(112,
-              25), style=wx.TE_RIGHT, value='0')
-
         self.Type = wx.Choice(choices=[], id=wxID_USERTYPEDIALOGTYPE,
               name='Type', parent=self.MainPanel, pos=wx.Point(24, 48),
               size=wx.Size(160, 24), style=0)
         self.Type.Bind(wx.EVT_CHOICE, self.OnTypeChoice,
               id=wxID_USERTYPEDIALOGTYPE)
 
+        self.staticBox1 = wx.StaticBox(id=wxID_USERTYPEDIALOGSTATICBOX1,
+              label='Values', name='staticBox1', parent=self.MainPanel,
+              pos=wx.Point(200, 24), size=wx.Size(224, 144), style=0)
+
+        self.staticText2 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT2,
+              label='Minimum :', name='staticText2', parent=self.MainPanel,
+              pos=wx.Point(216, 48), size=wx.Size(67, 17), style=0)
+
+        self.Min = wx.TextCtrl(id=wxID_USERTYPEDIALOGMIN, name='Min',
+              parent=self.MainPanel, pos=wx.Point(296, 48), size=wx.Size(112,
+              24), style=wx.TE_RIGHT, value='0')
+
+        self.staticText3 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT3,
+              label='Maximum :', name='staticText3', parent=self.MainPanel,
+              pos=wx.Point(216, 88), size=wx.Size(71, 17), style=0)
+
+        self.Max = wx.TextCtrl(id=wxID_USERTYPEDIALOGMAX, name='Max',
+              parent=self.MainPanel, pos=wx.Point(296, 88), size=wx.Size(112,
+              25), style=wx.TE_RIGHT, value='0')
+
+        self.staticText4 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT4,
+              label='Length :', name='staticText4', parent=self.MainPanel,
+              pos=wx.Point(216, 128), size=wx.Size(52, 17), style=0)
+
+        self.Length = wx.TextCtrl(id=wxID_USERTYPEDIALOGLENGTH, name='Length',
+              parent=self.MainPanel, pos=wx.Point(296, 128), size=wx.Size(112,
+              25), style=wx.TE_RIGHT, value='0')
+
         self._init_sizers()
 
     def __init__(self, parent):
@@ -1905,25 +1915,25 @@
               label='Name :', name='staticText1', parent=self.MainPanel,
               pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0)
 
+        self.Name = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNAME, name='Name',
+              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(200,
+              25), style=0, value='')
+
         self.staticText2 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT2,
               label='Node ID :', name='staticText2', parent=self.MainPanel,
               pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0)
 
+        self.NodeID = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNODEID, name='NodeID',
+              parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(200,
+              25), style=wx.TE_RIGHT, value='')
+
         self.staticText3 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT3,
               label='Type :', name='staticText3', parent=self.MainPanel,
               pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0)
 
         self.Type = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGTYPE,
               name='Type', parent=self.MainPanel, pos=wx.Point(24, 160),
-              size=wx.Size(200, 24), style=0)
-
-        self.Name = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNAME, name='Name',
-              parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(200,
-              25), style=0, value='')
-
-        self.NodeID = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNODEID, name='NodeID',
-              parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(200,
-              25), style=wx.TE_RIGHT, value='')
+              size=wx.Size(200, 25), style=0)
 
         self.staticText4 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT4,
               label='Profile :', name='staticText4', parent=self.MainPanel,
@@ -1931,7 +1941,7 @@
 
         self.Profile = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGPROFILE,
               name='Profile', parent=self.MainPanel, pos=wx.Point(24, 216),
-              size=wx.Size(200, 24), style=0)
+              size=wx.Size(200, 25), style=0)
 
         self._init_sizers()