dialogs/IDManager.py
author usveticic
Wed, 05 Aug 2020 15:20:10 +0200
branchsvghmi
changeset 3016 085a678715d0
parent 2492 7dd551ac2fa0
child 3750 f62625418bff
permissions -rw-r--r--
Beremiz test project with newly created widgets.
2337
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     1
from __future__ import absolute_import
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     2
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     3
import wx
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     4
from controls.IDBrowser import IDBrowser
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     5
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2428
diff changeset
     6
2337
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     7
class IDManager(wx.Dialog):
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     8
    def __init__(self, parent, ctr):
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     9
        self.ctr = ctr
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    10
        wx.Dialog.__init__(self,
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    11
                           name='IDManager', parent=parent,
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    12
                           title=_('URI Editor'),
2428
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    13
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
2492
7dd551ac2fa0 check_sources.sh makes me become even less productive
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2428
diff changeset
    14
                           size=(800, 600))
2337
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    15
        # start IDBrowser in manager mode
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    16
        self.browser = IDBrowser(self, ctr)
2428
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    17
        self.Bind(wx.EVT_CHAR_HOOK, self.OnEscapeKey)
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    18
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    19
    def OnEscapeKey(self, event):
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    20
        keycode = event.GetKeyCode()
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    21
        if keycode == wx.WXK_ESCAPE:
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    22
            self.EndModal(wx.ID_CANCEL)
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    23
        else:
e0f16317668e IDManager : finished Import/Export. Added merging capability to import (asks if particular ID is replaced during import). Added ESC as closing shortcut to IDManager dialog, and adjusted its size.
Edouard Tisserant
parents: 2337
diff changeset
    24
            event.Skip()