--- a/BeremizIDE.py Fri Mar 15 14:11:49 2019 +0100
+++ b/BeremizIDE.py Wed Mar 20 11:34:41 2019 +0100
@@ -1033,6 +1033,15 @@
IDEFrame.ProjectTreeItemSelect(self, select_item)
+ def GetProjectElementWindow(self, element, tagname): + print("BeremizIDE GetProjectElementWindo", element, tagname) + is_a_CTN_tagname = len(tagname.split("::"))==1 + confnode = self.CTR.GetChildByName(tagname) + return confnode.GetView() + return IDEFrame.GetProjectElementWindow(self, element, tagname) def SelectProjectTreeItem(self, tagname):
if self.ProjectTree is not None:
root = self.ProjectTree.GetRootItem()
@@ -1050,6 +1059,7 @@
return self.RecursiveProjectTreeItemSelection(root, [(words[2], ITEM_RESOURCE)])
elif not os.path.exists(words[0]):
IDEFrame.SelectProjectTreeItem(self, tagname)
def GetAddConfNodeFunction(self, name, confnode=None):
--- a/CodeFileTreeNode.py Fri Mar 15 14:11:49 2019 +0100
+++ b/CodeFileTreeNode.py Wed Mar 20 11:34:41 2019 +0100
@@ -212,7 +212,8 @@
def CTNSearch(self, criteria):
- return [((self.CTNFullName()), (0,0),(0,3),"cow")]
+ return [((self.CTNFullName(),"variable",0), (0,2),(0,4),"a_cow"), + ((self.CTNFullName(),"body"), (1,12),(1,15),"Bitch I'm a cow !")] # -------------------------------------------------------------------------------
# Current Buffering Management Functions
--- a/ConfigTreeNode.py Fri Mar 15 14:11:49 2019 +0100
+++ b/ConfigTreeNode.py Wed Mar 20 11:34:41 2019 +0100
@@ -471,20 +471,23 @@
def GetContextualMenuItems(self):
- def _OpenView(self, name=None, onlyopened=False):
- if self.EditorType is not None:
+ if self._View is None and self.EditorType is not None: app_frame = self.GetCTRoot().AppFrame
- if self._View is None and not onlyopened:
+ self._View = self.EditorType(app_frame.TabsOpened, self, app_frame) - self._View = self.EditorType(app_frame.TabsOpened, self, app_frame)
- if self._View is not None:
- name = self.CTNFullName()
- app_frame.EditProjectElement(self._View, name)
+ def _OpenView(self, name=None, onlyopened=False):
+ name = self.CTNFullName() + app_frame = self.GetCTRoot().AppFrame + app_frame.EditProjectElement(view, name) def _CloseView(self, view):
app_frame = self.GetCTRoot().AppFrame
--- a/IDEFrame.py Fri Mar 15 14:11:49 2019 +0100
+++ b/IDEFrame.py Wed Mar 20 11:34:41 2019 +0100
@@ -1587,6 +1587,7 @@
"R": [ITEM_CONFIGURATION, ITEM_RESOURCE]}
def SelectProjectTreeItem(self, tagname):
+ print("SelectProjectTreeItem", tagname) if self.ProjectTree is not None:
root = self.ProjectTree.GetRootItem()
@@ -1597,6 +1598,7 @@
def RecursiveProjectTreeItemSelection(self, root, items):
+ print("RecursiveProjectTreeItemSelection", items) item, root_cookie = self.ProjectTree.GetFirstChild(root)
while item is not None and item.IsOk() and not found:
@@ -1819,7 +1821,50 @@
+ def GetProjectElementWindow(self, element, tagname): + print("GetProjectElementWindo", element, tagname) + if self.Controler.GetEditedElement(tagname) is not None: + if element == ITEM_CONFIGURATION: + new_window = ConfigurationEditor(self.TabsOpened, tagname, self, self.Controler) + new_window.SetIcon(GetBitmap("CONFIGURATION")) + elif element == ITEM_RESOURCE: + new_window = ResourceEditor(self.TabsOpened, tagname, self, self.Controler) + new_window.SetIcon(GetBitmap("RESOURCE")) + elif element in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]: + bodytype = self.Controler.GetEditedElementBodyType(tagname) + new_window = Viewer(self.TabsOpened, tagname, self, self.Controler) + new_window.RefreshScaling(False) + new_window = LD_Viewer(self.TabsOpened, tagname, self, self.Controler) + new_window.RefreshScaling(False) + elif bodytype == "SFC": + new_window = SFC_Viewer(self.TabsOpened, tagname, self, self.Controler) + new_window.RefreshScaling(False) + new_window = TextViewer(self.TabsOpened, tagname, self, self.Controler) + new_window.SetTextSyntax(bodytype) + new_window.SetKeywords(IL_KEYWORDS) + new_window.SetKeywords(ST_KEYWORDS) + if element == ITEM_POU: + pou_type = self.Controler.GetEditedElementType(tagname)[1].upper() + icon = GetBitmap(pou_type, bodytype) + elif element == ITEM_TRANSITION: + icon = GetBitmap("TRANSITION", bodytype) + elif element == ITEM_ACTION: + icon = GetBitmap("ACTION", bodytype) + new_window.SetIcon(icon) + elif element == ITEM_DATATYPE: + new_window = DataTypeEditor(self.TabsOpened, tagname, self, self.Controler) + new_window.SetIcon(GetBitmap("DATATYPE")) def EditProjectElement(self, element, tagname, onlyopened=False):
+ print("EditProjectElement", element, tagname, onlyopened) openedidx = self.IsOpened(tagname)
if openedidx is not None:
old_selected = self.TabsOpened.GetSelection()
@@ -1831,49 +1876,11 @@
if isinstance(element, EditorPanel):
- self.AddPage(element, "")
- elif self.Controler.GetEditedElement(tagname) is not None:
- if element == ITEM_CONFIGURATION:
- new_window = ConfigurationEditor(self.TabsOpened, tagname, self, self.Controler)
- new_window.SetIcon(GetBitmap("CONFIGURATION"))
- self.AddPage(new_window, "")
- elif element == ITEM_RESOURCE:
- new_window = ResourceEditor(self.TabsOpened, tagname, self, self.Controler)
- new_window.SetIcon(GetBitmap("RESOURCE"))
- self.AddPage(new_window, "")
- elif element in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]:
- bodytype = self.Controler.GetEditedElementBodyType(tagname)
- new_window = Viewer(self.TabsOpened, tagname, self, self.Controler)
- new_window.RefreshScaling(False)
- new_window = LD_Viewer(self.TabsOpened, tagname, self, self.Controler)
- new_window.RefreshScaling(False)
- elif bodytype == "SFC":
- new_window = SFC_Viewer(self.TabsOpened, tagname, self, self.Controler)
- new_window.RefreshScaling(False)
- new_window = TextViewer(self.TabsOpened, tagname, self, self.Controler)
- new_window.SetTextSyntax(bodytype)
- new_window.SetKeywords(IL_KEYWORDS)
- new_window.SetKeywords(ST_KEYWORDS)
- if element == ITEM_POU:
- pou_type = self.Controler.GetEditedElementType(tagname)[1].upper()
- icon = GetBitmap(pou_type, bodytype)
- elif element == ITEM_TRANSITION:
- icon = GetBitmap("TRANSITION", bodytype)
- elif element == ITEM_ACTION:
- icon = GetBitmap("ACTION", bodytype)
- new_window.SetIcon(icon)
- self.AddPage(new_window, "")
- elif element == ITEM_DATATYPE:
- new_window = DataTypeEditor(self.TabsOpened, tagname, self, self.Controler)
- new_window.SetIcon(GetBitmap("DATATYPE"))
- self.AddPage(new_window, "")
+ new_window = self.GetProjectElementWindow(element, tagname) if new_window is not None:
+ self.AddPage(new_window, "") openedidx = self.IsOpened(tagname)
old_selected = self.TabsOpened.GetSelection()
if old_selected != openedidx:
@@ -2554,6 +2561,7 @@
# -------------------------------------------------------------------------------
def ShowHighlight(self, infos, start, end, highlight_type):
self.SelectProjectTreeItem(infos[0])
self.Highlights[infos[0]] = highlight_type
--- a/controls/SearchResultPanel.py Fri Mar 15 14:11:49 2019 +0100
+++ b/controls/SearchResultPanel.py Wed Mar 20 11:34:41 2019 +0100
@@ -29,6 +29,7 @@
import wx.lib.agw.customtreectrl as CT
+from pprint import pprint from PLCControler import *
from util.BitmapLibrary import GetBitmap
@@ -130,7 +131,9 @@
("DATATYPE", ITEM_DATATYPE),
("ACTION", "action_block"),
+ ("FILE", ITEM_CONFNODE), self.TreeImageDict[itemtype] = self.TreeImageList.Add(GetBitmap(imgname))
for itemtype in ["function", "functionBlock", "program",
@@ -202,7 +205,12 @@
children = element_infos.setdefault("children", [])
for infos, start, end, text in results:
- if infos[1] == "name" or element_type == ITEM_DATATYPE:
+ if len(words) == 1: # CTN match + child_name = {"body":str(start[0])+":", + "variable":_("Variable:")}[infos[1]] + child_type = {"body":ITEM_CONFNODE, + "variable":"var_inout"}[infos[1]] + elif infos[1] == "name" or element_type == ITEM_DATATYPE: child_name = GenerateName(infos[1:])
child_type = element_type
@@ -232,6 +240,7 @@
children.append(child_infos)
for _element_infos in search_results_tree_children:
if _element_infos["name"] == words[1]:
@@ -240,7 +249,7 @@
if element_type == ITEM_RESOURCE:
search_results_tree_children.append(element_infos)
+ else: # Project node or CTN search_results_tree_children.append(element_infos)
@@ -287,6 +296,8 @@
self.SearchResultsTree.SetItemImage(root, self.TreeImageDict[infos["type"]])
+ print("XXXXXXXXXXXXXX") if infos["text"] is not None:
start, end = infos["data"][1:3]
@@ -302,7 +313,7 @@
text_ctrl_style = wx.BORDER_NONE | wx.TE_READONLY | wx.TE_RICH2
if wx.Platform != '__WXMSW__' or len(text.splitlines()) > 1:
- text_ctrl_style |= wx.TE_MULTILINE
+ text_ctrl_style |= wx.TE_MULTILINE | wx.TE_NO_VSCROLL text_ctrl = wx.TextCtrl(id=-1, parent=self.SearchResultsTree, pos=wx.Point(0, 0),
value=text, style=text_ctrl_style)
width, height = text_ctrl.GetTextExtent(text)
--- a/plcopen/plcopen.py Fri Mar 15 14:11:49 2019 +0100
+++ b/plcopen/plcopen.py Wed Mar 20 11:34:41 2019 +0100
@@ -856,6 +856,7 @@
setattr(cls, "removeVariableByFilter", _removeConfigurationResourceVariableByFilter)
def Search(self, criteria, parent_infos=None):
+ # FIXME : two next lines are incompatible [][-1] raises exception ! parent_infos = [] if parent_infos is None else parent_infos
parent_infos = parent_infos[:-1] + ["R::%s::%s" % (parent_infos[-1].split("::")[1], self.getname())]
search_result = _SearchInConfigurationResource(self, criteria, parent_infos)
--- a/plcopen/types_enums.py Fri Mar 15 14:11:49 2019 +0100
+++ b/plcopen/types_enums.py Wed Mar 20 11:34:41 2019 +0100
@@ -117,6 +117,9 @@
def GetElementType(tagname):
words = tagname.split("::")
+ print("GetElementType",tagname, len(words))