1416 #------------------------------------------------------------------------------- |
1416 #------------------------------------------------------------------------------- |
1417 # Add User Types and Variables |
1417 # Add User Types and Variables |
1418 #------------------------------------------------------------------------------- |
1418 #------------------------------------------------------------------------------- |
1419 |
1419 |
1420 def AddMapVariable(self): |
1420 def AddMapVariable(self): |
1421 dialog = MapVariableDialog(self) |
1421 index = self.Manager.GetCurrentNextMapIndex() |
1422 if dialog.ShowModal() == wxID_OK: |
1422 if index: |
1423 index, name, struct, number = dialog.GetValues() |
1423 dialog = MapVariableDialog(self) |
1424 result = self.Manager.AddMapVariableToCurrent(index, name, struct, number) |
1424 dialog.SetIndex(index) |
1425 if type(result) != StringType: |
1425 if dialog.ShowModal() == wxID_OK: |
1426 self.RefreshBufferState() |
1426 index, name, struct, number = dialog.GetValues() |
1427 self.RefreshCurrentIndexList() |
1427 result = self.Manager.AddMapVariableToCurrent(index, name, struct, number) |
1428 else: |
1428 if type(result) != StringType: |
1429 message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR) |
1429 self.RefreshBufferState() |
1430 message.ShowModal() |
1430 self.RefreshCurrentIndexList() |
1431 message.Destroy() |
1431 else: |
1432 dialog.Destroy() |
1432 message = wxMessageDialog(self, result, "Error", wxOK|wxICON_ERROR) |
|
1433 message.ShowModal() |
|
1434 message.Destroy() |
|
1435 dialog.Destroy() |
|
1436 else: |
|
1437 message = wxMessageDialog(self, result, "No map variable index left!", wxOK|wxICON_ERROR) |
|
1438 message.ShowModal() |
|
1439 message.Destroy() |
1433 |
1440 |
1434 def AddUserType(self): |
1441 def AddUserType(self): |
1435 dialog = UserTypeDialog(self) |
1442 dialog = UserTypeDialog(self) |
1436 dialog.SetTypeList(self.Manager.GetCustomisableTypes()) |
1443 dialog.SetTypeList(self.Manager.GetCustomisableTypes()) |
1437 if dialog.ShowModal() == wxID_OK: |
1444 if dialog.ShowModal() == wxID_OK: |
1632 |
1639 |
1633 self.staticText1 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT1, |
1640 self.staticText1 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT1, |
1634 label='Index :', name='staticText1', parent=self.MainPanel, |
1641 label='Index :', name='staticText1', parent=self.MainPanel, |
1635 pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0) |
1642 pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0) |
1636 |
1643 |
|
1644 self.Index = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEX, name='Index', |
|
1645 parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(152, |
|
1646 25), style=0, value='0x2000') |
|
1647 |
|
1648 self.staticText3 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT3, |
|
1649 label='Name :', name='staticText3', parent=self.MainPanel, |
|
1650 pos=wx.Point(24, 80), size=wx.Size(47, 17), style=0) |
|
1651 |
|
1652 self.IndexName = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEXNAME, |
|
1653 name='IndexName', parent=self.MainPanel, pos=wx.Point(24, 104), |
|
1654 size=wx.Size(152, 24), style=0, value='Undefined') |
|
1655 |
|
1656 self.staticText2 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT2, |
|
1657 label='Type :', name='staticText2', parent=self.MainPanel, |
|
1658 pos=wx.Point(208, 24), size=wx.Size(38, 17), style=0) |
|
1659 |
1637 self.radioButton1 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1, |
1660 self.radioButton1 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1, |
1638 label='VAR', name='radioButton1', parent=self.MainPanel, |
1661 label='VAR', name='radioButton1', parent=self.MainPanel, |
1639 pos=wx.Point(208, 48), size=wx.Size(72, 24), style=0) |
1662 pos=wx.Point(208, 48), size=wx.Size(72, 24), style=wxRB_GROUP) |
1640 self.radioButton1.SetValue(True) |
1663 self.radioButton1.SetValue(True) |
1641 self.radioButton1.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton1Click, |
1664 self.radioButton1.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton1Click, |
1642 id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1) |
1665 id=wxID_MAPVARIABLEDIALOGRADIOBUTTON1) |
1643 |
1666 |
1644 self.radioButton2 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2, |
1667 self.radioButton2 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2, |
1645 label='REC', name='radioButton2', parent=self.MainPanel, |
1668 label='ARRAY', name='radioButton2', parent=self.MainPanel, |
1646 pos=wx.Point(208, 96), size=wx.Size(96, 24), style=0) |
1669 pos=wx.Point(208, 72), size=wx.Size(80, 24), style=wxRB_SINGLE) |
1647 self.radioButton2.SetValue(False) |
1670 self.radioButton2.SetValue(False) |
1648 self.radioButton2.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton2Click, |
1671 self.radioButton2.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton2Click, |
1649 id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2) |
1672 id=wxID_MAPVARIABLEDIALOGRADIOBUTTON2) |
1650 |
1673 |
1651 self.radioButton3 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3, |
1674 self.radioButton3 = wx.RadioButton(id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3, |
1652 label='ARRAY', name='radioButton3', parent=self.MainPanel, |
1675 label='REC', name='radioButton3', parent=self.MainPanel, |
1653 pos=wx.Point(208, 72), size=wx.Size(80, 24), style=0) |
1676 pos=wx.Point(208, 96), size=wx.Size(96, 24), style=wxRB_SINGLE) |
1654 self.radioButton3.SetValue(False) |
1677 self.radioButton3.SetValue(False) |
1655 self.radioButton3.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton3Click, |
1678 self.radioButton3.Bind(wx.EVT_RADIOBUTTON, self.OnRadioButton3Click, |
1656 id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3) |
1679 id=wxID_MAPVARIABLEDIALOGRADIOBUTTON3) |
1657 |
|
1658 self.staticText2 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT2, |
|
1659 label='Type :', name='staticText2', parent=self.MainPanel, |
|
1660 pos=wx.Point(208, 24), size=wx.Size(38, 17), style=0) |
|
1661 |
|
1662 self.IndexName = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEXNAME, |
|
1663 name='IndexName', parent=self.MainPanel, pos=wx.Point(24, 104), |
|
1664 size=wx.Size(152, 24), style=0, value='Undefined') |
|
1665 |
|
1666 self.staticText3 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT3, |
|
1667 label='Name :', name='staticText3', parent=self.MainPanel, |
|
1668 pos=wx.Point(24, 80), size=wx.Size(47, 17), style=0) |
|
1669 |
|
1670 self.Index = wx.TextCtrl(id=wxID_MAPVARIABLEDIALOGINDEX, name='Index', |
|
1671 parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(152, |
|
1672 25), style=0, value='0x2000') |
|
1673 |
1680 |
1674 self.staticText4 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT4, |
1681 self.staticText4 = wx.StaticText(id=wxID_MAPVARIABLEDIALOGSTATICTEXT4, |
1675 label='Number :', name='staticText4', parent=self.MainPanel, |
1682 label='Number :', name='staticText4', parent=self.MainPanel, |
1676 pos=wx.Point(312, 80), size=wx.Size(88, 16), style=0) |
1683 pos=wx.Point(312, 80), size=wx.Size(88, 16), style=0) |
1677 |
1684 |
1699 index = eval(self.Index.GetValue()) |
1709 index = eval(self.Index.GetValue()) |
1700 number = eval(self.Number.GetValue()) |
1710 number = eval(self.Number.GetValue()) |
1701 return index, name, struct, number |
1711 return index, name, struct, number |
1702 |
1712 |
1703 def OnRadioButton1Click(self, event): |
1713 def OnRadioButton1Click(self, event): |
1704 self.staticText4.Enable(False) |
1714 self.EnableNumberTyping(False) |
1705 self.Number.Enable(False) |
|
1706 event.Skip() |
1715 event.Skip() |
1707 |
1716 |
1708 def OnRadioButton2Click(self, event): |
1717 def OnRadioButton2Click(self, event): |
1709 self.staticText4.Enable(True) |
1718 self.EnableNumberTyping(True) |
1710 self.Number.Enable(True) |
|
1711 event.Skip() |
1719 event.Skip() |
1712 |
1720 |
1713 def OnRadioButton3Click(self, event): |
1721 def OnRadioButton3Click(self, event): |
1714 self.staticText4.Enable(True) |
1722 self.EnableNumberTyping(True) |
1715 self.Number.Enable(True) |
1723 event.Skip() |
1716 event.Skip() |
1724 |
1717 |
1725 def EnableNumberTyping(self, enable): |
|
1726 self.staticText4.Enable(enable) |
|
1727 self.Number.Enable(enable) |
1718 |
1728 |
1719 |
1729 |
1720 #------------------------------------------------------------------------------- |
1730 #------------------------------------------------------------------------------- |
1721 # Create User Type Dialog |
1731 # Create User Type Dialog |
1722 #------------------------------------------------------------------------------- |
1732 #------------------------------------------------------------------------------- |
1757 |
1767 |
1758 self.staticText1 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT1, |
1768 self.staticText1 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT1, |
1759 label='Type :', name='staticText1', parent=self.MainPanel, |
1769 label='Type :', name='staticText1', parent=self.MainPanel, |
1760 pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0) |
1770 pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0) |
1761 |
1771 |
1762 self.staticBox1 = wx.StaticBox(id=wxID_USERTYPEDIALOGSTATICBOX1, |
|
1763 label='Values', name='staticBox1', parent=self.MainPanel, |
|
1764 pos=wx.Point(200, 24), size=wx.Size(224, 144), style=0) |
|
1765 |
|
1766 self.staticText2 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT2, |
|
1767 label='Minimum :', name='staticText2', parent=self.MainPanel, |
|
1768 pos=wx.Point(216, 48), size=wx.Size(67, 17), style=0) |
|
1769 |
|
1770 self.Min = wx.TextCtrl(id=wxID_USERTYPEDIALOGMIN, name='Min', |
|
1771 parent=self.MainPanel, pos=wx.Point(296, 48), size=wx.Size(112, |
|
1772 24), style=wx.TE_RIGHT, value='0') |
|
1773 |
|
1774 self.staticText3 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT3, |
|
1775 label='Maximum :', name='staticText3', parent=self.MainPanel, |
|
1776 pos=wx.Point(216, 88), size=wx.Size(71, 17), style=0) |
|
1777 |
|
1778 self.Max = wx.TextCtrl(id=wxID_USERTYPEDIALOGMAX, name='Max', |
|
1779 parent=self.MainPanel, pos=wx.Point(296, 88), size=wx.Size(112, |
|
1780 25), style=wx.TE_RIGHT, value='0') |
|
1781 |
|
1782 self.staticText4 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT4, |
|
1783 label='Length :', name='staticText4', parent=self.MainPanel, |
|
1784 pos=wx.Point(216, 128), size=wx.Size(52, 17), style=0) |
|
1785 |
|
1786 self.Length = wx.TextCtrl(id=wxID_USERTYPEDIALOGLENGTH, name='Length', |
|
1787 parent=self.MainPanel, pos=wx.Point(296, 128), size=wx.Size(112, |
|
1788 25), style=wx.TE_RIGHT, value='0') |
|
1789 |
|
1790 self.Type = wx.Choice(choices=[], id=wxID_USERTYPEDIALOGTYPE, |
1772 self.Type = wx.Choice(choices=[], id=wxID_USERTYPEDIALOGTYPE, |
1791 name='Type', parent=self.MainPanel, pos=wx.Point(24, 48), |
1773 name='Type', parent=self.MainPanel, pos=wx.Point(24, 48), |
1792 size=wx.Size(160, 24), style=0) |
1774 size=wx.Size(160, 24), style=0) |
1793 self.Type.Bind(wx.EVT_CHOICE, self.OnTypeChoice, |
1775 self.Type.Bind(wx.EVT_CHOICE, self.OnTypeChoice, |
1794 id=wxID_USERTYPEDIALOGTYPE) |
1776 id=wxID_USERTYPEDIALOGTYPE) |
|
1777 |
|
1778 self.staticBox1 = wx.StaticBox(id=wxID_USERTYPEDIALOGSTATICBOX1, |
|
1779 label='Values', name='staticBox1', parent=self.MainPanel, |
|
1780 pos=wx.Point(200, 24), size=wx.Size(224, 144), style=0) |
|
1781 |
|
1782 self.staticText2 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT2, |
|
1783 label='Minimum :', name='staticText2', parent=self.MainPanel, |
|
1784 pos=wx.Point(216, 48), size=wx.Size(67, 17), style=0) |
|
1785 |
|
1786 self.Min = wx.TextCtrl(id=wxID_USERTYPEDIALOGMIN, name='Min', |
|
1787 parent=self.MainPanel, pos=wx.Point(296, 48), size=wx.Size(112, |
|
1788 24), style=wx.TE_RIGHT, value='0') |
|
1789 |
|
1790 self.staticText3 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT3, |
|
1791 label='Maximum :', name='staticText3', parent=self.MainPanel, |
|
1792 pos=wx.Point(216, 88), size=wx.Size(71, 17), style=0) |
|
1793 |
|
1794 self.Max = wx.TextCtrl(id=wxID_USERTYPEDIALOGMAX, name='Max', |
|
1795 parent=self.MainPanel, pos=wx.Point(296, 88), size=wx.Size(112, |
|
1796 25), style=wx.TE_RIGHT, value='0') |
|
1797 |
|
1798 self.staticText4 = wx.StaticText(id=wxID_USERTYPEDIALOGSTATICTEXT4, |
|
1799 label='Length :', name='staticText4', parent=self.MainPanel, |
|
1800 pos=wx.Point(216, 128), size=wx.Size(52, 17), style=0) |
|
1801 |
|
1802 self.Length = wx.TextCtrl(id=wxID_USERTYPEDIALOGLENGTH, name='Length', |
|
1803 parent=self.MainPanel, pos=wx.Point(296, 128), size=wx.Size(112, |
|
1804 25), style=wx.TE_RIGHT, value='0') |
1795 |
1805 |
1796 self._init_sizers() |
1806 self._init_sizers() |
1797 |
1807 |
1798 def __init__(self, parent): |
1808 def __init__(self, parent): |
1799 self._init_ctrls(parent) |
1809 self._init_ctrls(parent) |
1903 |
1913 |
1904 self.staticText1 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT1, |
1914 self.staticText1 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT1, |
1905 label='Name :', name='staticText1', parent=self.MainPanel, |
1915 label='Name :', name='staticText1', parent=self.MainPanel, |
1906 pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0) |
1916 pos=wx.Point(24, 24), size=wx.Size(156, 17), style=0) |
1907 |
1917 |
|
1918 self.Name = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNAME, name='Name', |
|
1919 parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(200, |
|
1920 25), style=0, value='') |
|
1921 |
1908 self.staticText2 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT2, |
1922 self.staticText2 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT2, |
1909 label='Node ID :', name='staticText2', parent=self.MainPanel, |
1923 label='Node ID :', name='staticText2', parent=self.MainPanel, |
1910 pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0) |
1924 pos=wx.Point(24, 80), size=wx.Size(67, 17), style=0) |
1911 |
1925 |
|
1926 self.NodeID = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNODEID, name='NodeID', |
|
1927 parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(200, |
|
1928 25), style=wx.TE_RIGHT, value='') |
|
1929 |
1912 self.staticText3 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT3, |
1930 self.staticText3 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT3, |
1913 label='Type :', name='staticText3', parent=self.MainPanel, |
1931 label='Type :', name='staticText3', parent=self.MainPanel, |
1914 pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0) |
1932 pos=wx.Point(24, 136), size=wx.Size(71, 17), style=0) |
1915 |
1933 |
1916 self.Type = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGTYPE, |
1934 self.Type = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGTYPE, |
1917 name='Type', parent=self.MainPanel, pos=wx.Point(24, 160), |
1935 name='Type', parent=self.MainPanel, pos=wx.Point(24, 160), |
1918 size=wx.Size(200, 24), style=0) |
1936 size=wx.Size(200, 25), style=0) |
1919 |
|
1920 self.Name = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNAME, name='Name', |
|
1921 parent=self.MainPanel, pos=wx.Point(24, 48), size=wx.Size(200, |
|
1922 25), style=0, value='') |
|
1923 |
|
1924 self.NodeID = wx.TextCtrl(id=wxID_NODEINFOSDIALOGNODEID, name='NodeID', |
|
1925 parent=self.MainPanel, pos=wx.Point(24, 104), size=wx.Size(200, |
|
1926 25), style=wx.TE_RIGHT, value='') |
|
1927 |
1937 |
1928 self.staticText4 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT4, |
1938 self.staticText4 = wx.StaticText(id=wxID_NODEINFOSDIALOGSTATICTEXT4, |
1929 label='Profile :', name='staticText4', parent=self.MainPanel, |
1939 label='Profile :', name='staticText4', parent=self.MainPanel, |
1930 pos=wx.Point(24, 192), size=wx.Size(47, 17), style=0) |
1940 pos=wx.Point(24, 192), size=wx.Size(47, 17), style=0) |
1931 |
1941 |
1932 self.Profile = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGPROFILE, |
1942 self.Profile = wx.Choice(choices=[], id=wxID_NODEINFOSDIALOGPROFILE, |
1933 name='Profile', parent=self.MainPanel, pos=wx.Point(24, 216), |
1943 name='Profile', parent=self.MainPanel, pos=wx.Point(24, 216), |
1934 size=wx.Size(200, 24), style=0) |
1944 size=wx.Size(200, 25), style=0) |
1935 |
1945 |
1936 self._init_sizers() |
1946 self._init_sizers() |
1937 |
1947 |
1938 def __init__(self, parent): |
1948 def __init__(self, parent): |
1939 self._init_ctrls(parent) |
1949 self._init_ctrls(parent) |