--- a/GraphicViewer.py Mon Sep 21 12:06:15 2009 +0200
+++ b/GraphicViewer.py Mon Sep 21 12:06:51 2009 +0200
@@ -214,6 +214,9 @@
def SelectAll(self):
pass
+ def ClearErrors(self):
+ pass
+
def NewValue(self, tick, value):
self.Datas.append((float(tick), {True:1., False:0.}.get(value, float(value))))
if self.CurrentValue + self.CurrentRange == len(self.Datas) - 1:
--- a/PLCOpenEditor.py Mon Sep 21 12:06:15 2009 +0200
+++ b/PLCOpenEditor.py Mon Sep 21 12:06:51 2009 +0200
@@ -886,6 +886,14 @@
def RefreshFileMenu(self):
pass
+ def ResetView(self):
+ self.DeleteAllPages()
+ self.VariablePanelIndexer.RemoveAllPanels()
+ self.TypesTree.DeleteAllItems()
+ self.InstancesTree.DeleteAllItems()
+ self.LibraryTree.DeleteAllItems()
+ self.Controler = None
+
def OnCloseTabMenu(self, event):
selected = self.TabsOpened.GetSelection()
if selected >= 0:
@@ -2478,6 +2486,7 @@
# Create a new controller
self.Controler = PLCControler()
self.Controler.OpenXMLFile(fileOpen)
+ self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
# Define PLCOpenEditor icon
self.SetIcon(wx.Icon(os.path.join(CWD,"Images", "poe.ico"),wx.BITMAP_TYPE_ICO))
@@ -2547,6 +2556,7 @@
dialog = ProjectDialog(self)
if dialog.ShowModal() == wx.ID_OK:
properties = dialog.GetValues()
+ self.ResetView()
self.Controler = PLCControler()
self.Controler.CreateNewProject(properties)
self._Refresh(TITLE, FILEMENU, EDITMENU, TYPESTREE, INSTANCESTREE,
@@ -2567,8 +2577,7 @@
if dialog.ShowModal() == wx.ID_OK:
filepath = dialog.GetPath()
if os.path.isfile(filepath):
- self.DeleteAllPages()
- self.VariablePanelIndexer.RemoveAllPanels()
+ self.ResetView()
self.Controler = PLCControler()
self.Controler.OpenXMLFile(filepath)
self._Refresh(TYPESTREE, INSTANCESTREE, LIBRARYTREE)
@@ -2579,12 +2588,7 @@
def OnCloseProjectMenu(self, event):
if not self.CheckSaveBeforeClosing():
return
- self.DeleteAllPages()
- self.VariablePanelIndexer.RemoveAllPanels()
- self.TypesTree.DeleteAllItems()
- self.InstancesTree.DeleteAllItems()
- self.LibraryTree.DeleteAllItems()
- self.Controler = None
+ self.ResetView()
self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU)
event.Skip()
--- a/TextViewer.py Mon Sep 21 12:06:15 2009 +0200
+++ b/TextViewer.py Mon Sep 21 12:06:51 2009 +0200
@@ -157,7 +157,9 @@
self.ParentWindow = window
self.Controler = controler
- self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE)
+ self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|
+ wx.stc.STC_MOD_BEFOREDELETE|
+ wx.stc.STC_PERFORMED_USER)
self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyleNeeded, id=ID_TEXTVIEWER)
if controler:
@@ -190,21 +192,22 @@
def OnModification(self, event):
if not self.DisableEvents:
mod_type = event.GetModificationType()
- if not (mod_type&wx.stc.STC_PERFORMED_UNDO or mod_type&wx.stc.STC_PERFORMED_REDO):
- if mod_type&wx.stc.STC_MOD_BEFOREINSERT:
- if self.CurrentAction == None:
- self.StartBuffering()
- elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1:
- self.Controler.EndBuffering()
- self.StartBuffering()
- self.CurrentAction = ("Add", event.GetPosition())
- elif mod_type&wx.stc.STC_MOD_BEFOREDELETE:
- if self.CurrentAction == None:
- self.StartBuffering()
- elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1:
- self.Controler.EndBuffering()
- self.StartBuffering()
- self.CurrentAction = ("Delete", event.GetPosition())
+ if mod_type&wx.stc.STC_MOD_BEFOREINSERT:
+ if self.CurrentAction == None:
+ self.StartBuffering()
+ elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1:
+ self.Controler.EndBuffering()
+ self.StartBuffering()
+ self.CurrentAction = ("Add", event.GetPosition())
+ wx.CallAfter(self.RefreshModel)
+ elif mod_type&wx.stc.STC_MOD_BEFOREDELETE:
+ if self.CurrentAction == None:
+ self.StartBuffering()
+ elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1:
+ self.Controler.EndBuffering()
+ self.StartBuffering()
+ self.CurrentAction = ("Delete", event.GetPosition())
+ wx.CallAfter(self.RefreshModel)
event.Skip()
def OnDoDrop(self, event):
@@ -506,7 +509,6 @@
self.AutoCompSetIgnoreCase(True)
self.AutoCompShow(len(words[-1]), " ".join(kw))
else:
- wx.CallAfter(self.RefreshModel)
event.Skip()
def OnKillFocus(self, event):