427 else: |
427 else: |
428 child_path = child_name |
428 child_path = child_name |
429 if len(child_dimensions) > 0: |
429 if len(child_dimensions) > 0: |
430 child_path += "[%s]" % ",".join([str(dimension[0]) for dimension in child_dimensions]) |
430 child_path += "[%s]" % ",".join([str(dimension[0]) for dimension in child_dimensions]) |
431 child_name += "[]" |
431 child_name += "[]" |
432 item = menu.Append(wx.ID_ANY, help='', kind=wx.ITEM_NORMAL, text=child_name) |
432 |
433 self.ParentWindow.Bind(wx.EVT_MENU, self.GetAddVariableBlockFunction(x, y, scaling, var_class, child_path, child_type), item) |
433 item = self.AppendItem(menu, |
|
434 child_name, |
|
435 self.GetAddVariableBlockFunction(x, y, scaling, var_class, child_path, child_type)) |
434 if len(child_tree) > 0: |
436 if len(child_tree) > 0: |
435 child_menu = wx.Menu(title='') |
437 child_menu = wx.Menu(title='') |
436 self.GenerateTreeMenu(x, y, scaling, child_menu, child_path, var_class, child_tree) |
438 self.GenerateTreeMenu(x, y, scaling, child_menu, child_path, var_class, child_tree) |
437 menu.AppendMenu(wx.ID_ANY, "%s." % child_name, child_menu) |
439 menu.AppendMenu(wx.ID_ANY, "%s." % child_name, child_menu) |
438 |
440 |
1569 |
1571 |
1570 def PopupForceMenu(self): |
1572 def PopupForceMenu(self): |
1571 iec_path = self.GetElementIECPath(self.SelectedElement) |
1573 iec_path = self.GetElementIECPath(self.SelectedElement) |
1572 if iec_path is not None: |
1574 if iec_path is not None: |
1573 menu = wx.Menu(title='') |
1575 menu = wx.Menu(title='') |
1574 item = menu.Append(wx.ID_ANY, help='', kind=wx.ITEM_NORMAL, text=_("Force value")) |
1576 item = self.AppendItem(menu, |
1575 self.Bind(wx.EVT_MENU, self.GetForceVariableMenuFunction(iec_path.upper(), self.SelectedElement), item) |
1577 _("Force value"), |
1576 ritem = menu.Append(wx.ID_ANY, help='', kind=wx.ITEM_NORMAL, text=_("Release value")) |
1578 self.GetForceVariableMenuFunction( |
1577 self.Bind(wx.EVT_MENU, self.GetReleaseVariableMenuFunction(iec_path.upper()), ritem) |
1579 iec_path.upper(), |
|
1580 self.SelectedElement)) |
|
1581 |
|
1582 ritem = self.AppendItem(menu, |
|
1583 _("Release value"), |
|
1584 self.GetReleaseVariableMenuFunction(iec_path.upper())) |
1578 if self.SelectedElement.IsForced(): |
1585 if self.SelectedElement.IsForced(): |
1579 ritem.Enable(True) |
1586 ritem.Enable(True) |
1580 else: |
1587 else: |
1581 ritem.Enable(False) |
1588 ritem.Enable(False) |
1582 if self.Editor.HasCapture(): |
1589 if self.Editor.HasCapture(): |
1900 # Mouse event functions |
1907 # Mouse event functions |
1901 # ------------------------------------------------------------------------------- |
1908 # ------------------------------------------------------------------------------- |
1902 |
1909 |
1903 def OnViewerMouseEvent(self, event): |
1910 def OnViewerMouseEvent(self, event): |
1904 self.ResetBuffer() |
1911 self.ResetBuffer() |
1905 if event.Leaving() and self.ToolTipElement is not None: |
1912 if (event.Leaving() or event.RightDown()) and self.ToolTipElement is not None: |
1906 self.ToolTipElement.DestroyToolTip() |
1913 self.ToolTipElement.DestroyToolTip() |
1907 elif (not event.Entering() and |
1914 elif (not event.Entering() and not event.RightDown() and |
1908 gettime() - self.LastToolTipCheckTime > REFRESH_PERIOD): |
1915 gettime() - self.LastToolTipCheckTime > REFRESH_PERIOD): |
1909 self.LastToolTipCheckTime = gettime() |
1916 self.LastToolTipCheckTime = gettime() |
1910 element = None |
1917 element = None |
1911 if not event.Leaving() and not event.LeftUp() and not event.LeftDClick(): |
1918 if not event.Leaving() and not event.LeftUp() and not event.LeftDClick(): |
1912 dc = self.GetLogicalDC() |
1919 dc = self.GetLogicalDC() |