--- a/objdictgen/networkedit.py Mon Sep 10 15:14:41 2007 +0200
+++ b/objdictgen/networkedit.py Mon Sep 10 18:13:28 2007 +0200
@@ -320,6 +320,10 @@
self.SetClientSize(wx.Size(1000, 700))
self.SetMenuBar(self.menuBar1)
self.Bind(wx.EVT_CLOSE, self.OnCloseFrame, id=ID_NETWORKEDIT)
+ if not self.ModeSolo:
+ self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=ID_NETWORKEDITFILEMENUITEMS1)
+ accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, 83, ID_NETWORKEDITFILEMENUITEMS1)])
+ self.SetAcceleratorTable(accel)
self.NetworkNodes = wx.Notebook(id=ID_NETWORKEDITNETWORKNODES,
name='NetworkNodes', parent=self, pos=wx.Point(0, 0),
@@ -335,7 +339,6 @@
def __init__(self, parent, nodelist = None):
self.ModeSolo = nodelist == None
self._init_ctrls(parent)
- self.Parent = parent
self.HtmlFrameOpened = []
self.BusId = None
@@ -354,6 +357,7 @@
self.NodeList.SetCurrentSelected(0)
self.RefreshNetworkNodes()
self.RefreshProfileMenu()
+ self.NetworkNodes.SetFocus()
self.RefreshBufferState()
self.RefreshTitle()
@@ -375,8 +379,13 @@
return 0
def OnCloseFrame(self, event):
- if not self.ModeSolo:
- self.Parent.CloseEditor(self.BusId)
+ if not self.ModeSolo and getattr(self, "_onclose", None) != None:
+ self._onclose()
+ event.Skip()
+
+ def OnChar(self, event):
+ if event.ControlDown() and event.GetKeyCode() == 83 and getattr(self, "_onsave", None) != None:
+ self._onsave()
event.Skip()
def GetNoteBook(self):
@@ -490,11 +499,14 @@
event.Skip()
def OnSaveProjectMenu(self, event):
- result = self.NodeList.SaveProject()
- if result:
- message = wx.MessageDialog(self, result, "Error", wx.OK|wx.ICON_ERROR)
- message.ShowModal()
- message.Destroy()
+ if not self.ModeSolo and getattr(self, "_onsave", None) != None:
+ self._onsave()
+ else:
+ result = self.NodeList.SaveProject()
+ if result:
+ message = wx.MessageDialog(self, result, "Error", wx.OK|wx.ICON_ERROR)
+ message.ShowModal()
+ message.Destroy()
event.Skip()
def OnCloseProjectMenu(self, event):
--- a/objdictgen/subindextable.py Mon Sep 10 15:14:41 2007 +0200
+++ b/objdictgen/subindextable.py Mon Sep 10 18:13:28 2007 +0200
@@ -392,7 +392,7 @@
def __init__(self, parent, manager, editable = True):
self._init_ctrls(parent.GetNoteBook())
- self.Parent = parent
+ self.ParentWindow = parent
self.Manager = manager
self.ListIndex = []
self.ChoiceIndex = []
@@ -439,7 +439,7 @@
selected = self.IndexChoice.GetStringSelection()
if selected != "":
if selected == "User Type":
- self.Parent.AddUserType()
+ self.ParentWindow.AddUserType()
elif selected == "SDO Server":
self.Manager.AddSDOServerToCurrent()
elif selected == "SDO Client":
@@ -449,13 +449,13 @@
elif selected == "PDO Transmit":
self.Manager.AddPDOTransmitToCurrent()
elif selected == "Map Variable":
- self.Parent.AddMapVariable()
+ self.ParentWindow.AddMapVariable()
elif selected in [menu for menu, indexes in self.Manager.GetCurrentSpecificMenu()]:
self.Manager.AddSpecificEntryToCurrent(selected)
else:
index = self.ChoiceIndex[self.IndexChoice.GetSelection()]
self.Manager.ManageEntriesOfCurrent([index], [])
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
self.RefreshIndexList()
event.Skip()
@@ -471,11 +471,11 @@
def OnSubindexGridSelectCell(self, event):
wx.CallAfter(self.BeginDrag)
- wx.CallAfter(self.Parent.RefreshStatusBar)
+ wx.CallAfter(self.ParentWindow.RefreshStatusBar)
event.Skip()
def BeginDrag(self):
- if not self.Parent.ModeSolo:
+ if not self.ParentWindow.ModeSolo:
row = self.SubindexGrid.GetGridCursorRow()
col = self.SubindexGrid.GetGridCursorCol()
if not self.Editable and col == 0:
@@ -551,7 +551,7 @@
self.CallbackCheck.SetValue(False)
self.CallbackCheck.Disable()
self.Table.ResetView(self.SubindexGrid)
- self.Parent.RefreshStatusBar()
+ self.ParentWindow.RefreshStatusBar()
else:
self.IndexList.SetSelection(selected)
self.RefreshTable()
@@ -570,7 +570,7 @@
self.Table.SetData(data)
self.Table.SetEditors(editors)
self.Table.ResetView(self.SubindexGrid)
- self.Parent.RefreshStatusBar()
+ self.ParentWindow.RefreshStatusBar()
#-------------------------------------------------------------------------------
# Editing Table value function
@@ -585,7 +585,7 @@
value = self.Table.GetValue(subIndex, col)
editor = self.Table.GetEditor(subIndex, col)
self.Manager.SetCurrentEntry(index, subIndex, value, name, editor)
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
wx.CallAfter(self.RefreshTable)
event.Skip()
@@ -593,7 +593,7 @@
if self.Editable:
index = self.Table.GetCurrentIndex()
self.Manager.SetCurrentEntryCallbacks(index, self.CallbackCheck.GetValue())
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
wx.CallAfter(self.RefreshTable)
event.Skip()
@@ -650,7 +650,7 @@
"Rename an index", infos["name"], wx.OK|wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
self.Manager.SetCurrentEntryName(index, dialog.GetValue())
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
self.RefreshIndexList()
dialog.Destroy()
event.Skip()
@@ -671,7 +671,7 @@
if dialog.ShowModal() == wx.ID_OK:
type, min, max, length = dialog.GetValues()
self.Manager.SetCurrentUserType(index, type, min, max, length)
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
self.RefreshIndexList()
event.Skip()
@@ -682,7 +682,7 @@
index = self.ListIndex[selected]
if self.Manager.IsCurrentEntry(index):
self.Manager.ManageEntriesOfCurrent([],[index])
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
self.RefreshIndexList()
event.Skip()
@@ -698,7 +698,7 @@
try:
number = int(dialog.GetValue())
self.Manager.AddSubentriesToCurrent(index, number)
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
self.RefreshIndexList()
except:
message = wx.MessageDialog(self, "An integer is required!", "ERROR", wx.OK|wx.ICON_ERROR)
@@ -719,7 +719,7 @@
try:
number = int(dialog.GetValue())
self.Manager.RemoveSubentriesFromCurrent(index, number)
- self.Parent.RefreshBufferState()
+ self.ParentWindow.RefreshBufferState()
self.RefreshIndexList()
except:
message = wx.MessageDialog(self, "An integer is required!", "ERROR", wx.OK|wx.ICON_ERROR)