2021 |
2021 |
2022 elif instance_category in ITEMS_VARIABLE: |
2022 elif instance_category in ITEMS_VARIABLE: |
2023 if self.Controler.IsOfType(instance_type, "ANY_NUM", True) or\ |
2023 if self.Controler.IsOfType(instance_type, "ANY_NUM", True) or\ |
2024 self.Controler.IsOfType(instance_type, "ANY_BIT", True): |
2024 self.Controler.IsOfType(instance_type, "ANY_BIT", True): |
2025 |
2025 |
2026 return self.OpenGraphicViewer(instance_path) |
2026 new_window = GraphicViewer(self.TabsOpened, self, self.Controler, instance_path) |
|
2027 icon = GetBitmap("GRAPH") |
2027 |
2028 |
2028 else: |
2029 else: |
2029 bodytype = self.Controler.GetEditedElementBodyType(instance_type, True) |
2030 bodytype = self.Controler.GetEditedElementBodyType(instance_type, True) |
2030 new_window = None |
2031 new_window = None |
2031 if bodytype == "FBD": |
2032 if bodytype == "FBD": |
2042 new_window.SetTextSyntax(bodytype) |
2043 new_window.SetTextSyntax(bodytype) |
2043 if bodytype == "IL": |
2044 if bodytype == "IL": |
2044 new_window.SetKeywords(IL_KEYWORDS) |
2045 new_window.SetKeywords(IL_KEYWORDS) |
2045 else: |
2046 else: |
2046 new_window.SetKeywords(ST_KEYWORDS) |
2047 new_window.SetKeywords(ST_KEYWORDS) |
|
2048 |
2047 if new_window is not None: |
2049 if new_window is not None: |
2048 project_infos = self.GetProjectConfiguration() |
|
2049 if project_infos.has_key("editors_state"): |
|
2050 state = project_infos["editors_state"].get(instance_path) |
|
2051 if state is not None: |
|
2052 wx.CallAfter(new_window.SetState, state) |
|
2053 |
|
2054 if instance_category in [ITEM_FUNCTIONBLOCK, ITEM_PROGRAM]: |
2050 if instance_category in [ITEM_FUNCTIONBLOCK, ITEM_PROGRAM]: |
2055 pou_type = self.Controler.GetEditedElementType(instance_type, True)[1].upper() |
2051 pou_type = self.Controler.GetEditedElementType(instance_type, True)[1].upper() |
2056 icon = GetBitmap(pou_type, bodytype) |
2052 icon = GetBitmap(pou_type, bodytype) |
2057 elif instance_category == ITEM_TRANSITION: |
2053 elif instance_category == ITEM_TRANSITION: |
2058 icon = GetBitmap("TRANSITION", bodytype) |
2054 icon = GetBitmap("TRANSITION", bodytype) |
2059 elif instance_category == ITEM_ACTION: |
2055 elif instance_category == ITEM_ACTION: |
2060 icon = GetBitmap("ACTION", bodytype) |
2056 icon = GetBitmap("ACTION", bodytype) |
2061 new_window.SetIcon(icon) |
2057 |
2062 self.AddPage(new_window, "") |
2058 if new_window is not None: |
2063 new_window.RefreshView() |
2059 project_infos = self.GetProjectConfiguration() |
2064 new_window.SetFocus() |
2060 if project_infos.has_key("editors_state"): |
2065 self.RefreshPageTitles() |
2061 state = project_infos["editors_state"].get(instance_path) |
2066 return new_window |
2062 if state is not None: |
2067 |
2063 wx.CallAfter(new_window.SetState, state) |
2068 return None |
2064 |
2069 |
2065 new_window.SetIcon(icon) |
2070 def OpenGraphicViewer(self, var_path): |
2066 self.AddPage(new_window, "") |
2071 new_window = GraphicViewer(self.TabsOpened, self, self.Controler, var_path) |
2067 new_window.RefreshView() |
2072 new_window.SetIcon(GetBitmap("GRAPH")) |
2068 new_window.SetFocus() |
2073 self.AddPage(new_window, "") |
2069 self.RefreshPageTitles() |
2074 new_window.RefreshView() |
|
2075 new_window.SetFocus() |
|
2076 self.RefreshPageTitles() |
|
2077 return new_window |
2070 return new_window |
2078 |
2071 |
2079 def ResetGraphicViewers(self): |
2072 def ResetGraphicViewers(self): |
2080 for i in xrange(self.TabsOpened.GetPageCount()): |
2073 for i in xrange(self.TabsOpened.GetPageCount()): |
2081 editor = self.TabsOpened.GetPage(i) |
2074 editor = self.TabsOpened.GetPage(i) |