dialogs/IDManager.py
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 13 Mar 2019 14:27:24 +0300
changeset 2542 a3ec35ee94e7
parent 2492 7dd551ac2fa0
child 3750 f62625418bff
permissions -rw-r--r--
Fix crash in runtime if PSK secret is missing

./Beremiz_service.py -s $PWD/psk2.txt -n beremiz /tmp/beremiz
Beremiz_service: 1.2-1378c18402c3+

Traceback (most recent call last):
File "./Beremiz_service.py", line 511, in <module>
ensurePSK(servicename, PSKpath)
File "/home/developer/WorkData/PLC/beremiz/beremiz/runtime/Stunnel.py", line 32, in ensurePSK
PSKgen(ID, PSKpath)
File "/home/developer/WorkData/PLC/beremiz/beremiz/runtime/Stunnel.py", line 23, in PSKgen
call(restart_stunnel_cmdline)
File "/home/developer/WorkData/PLC/beremiz/beremiz/runtime/spawn_subprocess.py", line 116, in call
pid = posix_spawn.posix_spawnp(cmd[0], cmd)
File "/home/developer/.local/lib/python2.7/site-packages/posix_spawn/_impl.py", line 120, in posix_spawnp
return _posix_spawn(lib.posix_spawnp, *args, **kwargs)
File "/home/developer/.local/lib/python2.7/site-packages/posix_spawn/_impl.py", line 111, in _posix_spawn
_check_error(res, path)
File "/home/developer/.local/lib/python2.7/site-packages/posix_spawn/_impl.py", line 10, in _check_error
raise OSError(errno, os.strerror(errno), path)
OSError: [Errno 2] No such file or directory: '/etc/init.d/S50stunnel'
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()