dialogs/IDManager.py
author Edouard Tisserant
Thu, 22 Nov 2018 23:39:54 +0100
changeset 2428 e0f16317668e
parent 2337 8689ce77076f
child 2492 7dd551ac2fa0
permissions -rw-r--r--
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.
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 connectors import ConnectorSchemes, EditorClassFromScheme
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     5
from controls.DiscoveryPanel import DiscoveryPanel
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     6
from controls.IDBrowser import IDBrowser
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     7
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     8
class IDManager(wx.Dialog):
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
     9
    def __init__(self, parent, ctr):
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    10
        self.ctr = ctr
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    11
        wx.Dialog.__init__(self,
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    12
                           name='IDManager', parent=parent,
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    13
                           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
    14
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
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
    15
                           size=(800,600))
2337
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    16
        # start IDBrowser in manager mode
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    17
        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
    18
        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
    19
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
    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
    21
        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
    22
        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
    23
            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
    24
        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
    25
            event.Skip()
2337
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    26
8689ce77076f Added toolbar button to launch ID Manager dialog.
Edouard Tisserant
parents:
diff changeset
    27