dialogs/IDManager.py
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sat, 05 Mar 2022 11:14:00 +0100
branchwxPython4
changeset 3437 ce366d67a5b7
parent 2492 7dd551ac2fa0
child 3750 f62625418bff
permissions -rw-r--r--
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.

Some tests were randomly passing, because from time to time waiting for idle was skiped. It was combination of multiple problems :
- buffering on stdout (now use readline + flush for each write to log)
- it is sometime required to wait for activity before waiting for timeout added "WaitForChangeAndIdle" to "stdoutIdleObserver"
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()