dialogs/IDManager.py
author Edouard Tisserant
Mon, 08 Nov 2021 14:06:29 +0100
changeset 3385 18621ce81f5f
parent 2492 7dd551ac2fa0
child 3750 f62625418bff
permissions -rw-r--r--
SVGHMI: Changes /CURRENT_PAGE_* behaviour to prevent problem whith multiclient : all clients were switching page when one was jumping.
- now PLC have to prefix page name with "!" to order page switch.
- HMI do not prefix with "!" when jumping, this avoiding looping incidently
- In case of multiple client:
CURRENT_PAGE reflects current page of last client hwo did jump
Setting CURRENT_PAGE with "!" affects all clients simultaneously
from __future__ import absolute_import

import wx
from controls.IDBrowser import IDBrowser


class IDManager(wx.Dialog):
    def __init__(self, parent, ctr):
        self.ctr = ctr
        wx.Dialog.__init__(self,
                           name='IDManager', parent=parent,
                           title=_('URI Editor'),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
                           size=(800, 600))
        # start IDBrowser in manager mode
        self.browser = IDBrowser(self, ctr)
        self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey)

    def OnEscapeKey(self, event):
        keycode = event.GetKeyCode()
        if keycode == wx.WXK_ESCAPE:
            self.EndModal(wx.ID_CANCEL)
        else:
            event.Skip()