# Path: pyResMan/BaseDialogs/pyResManCommandDialogBase_Basic.py
# class CommandDialogBase_Basic ( wx.Dialog ):
#     
#     def __init__( self, parent ):
#         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 292,103 ), style = wx.DEFAULT_DIALOG_STYLE )
#         
#         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
#         
#         bSizer45 = wx.BoxSizer( wx.VERTICAL )
#         
#         
#         bSizer45.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         bSizer46 = wx.BoxSizer( wx.HORIZONTAL )
#         
#         self._statictextCommandName = wx.StaticText( self, wx.ID_ANY, u"Command Name", wx.DefaultPosition, wx.DefaultSize, 0 )
#         self._statictextCommandName.Wrap( -1 )
#         bSizer46.Add( self._statictextCommandName, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         self._textctrlCommandValue = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
#         self._textctrlCommandValue.SetExtraStyle( wx.WS_EX_VALIDATE_RECURSIVELY )
#         
#         bSizer46.Add( self._textctrlCommandValue, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         
#         bSizer45.Add( bSizer46, 0, wx.EXPAND, 5 )
#         
#         bSizer47 = wx.BoxSizer( wx.HORIZONTAL )
#         
#         
#         bSizer47.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         self._buttonOK = wx.Button( self, wx.ID_ANY, u"OK", wx.DefaultPosition, wx.DefaultSize, 0 )
#         self._buttonOK.SetDefault() 
#         bSizer47.Add( self._buttonOK, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         self._buttonCancel = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
#         bSizer47.Add( self._buttonCancel, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         
#         bSizer47.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         
#         bSizer45.Add( bSizer47, 0, wx.EXPAND, 5 )
#         
#         
#         bSizer45.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         
#         self.SetSizer( bSizer45 )
#         self.Layout()
#         
#         self.Centre( wx.BOTH )
#         
#         # Connect Events
#         self._buttonOK.Bind( wx.EVT_BUTTON, self._buttonOKOnButtonClick )
#         self._buttonCancel.Bind( wx.EVT_BUTTON, self._buttonCancelOnButtonClick )
#     
#     def __del__( self ):
#         pass
#     
#     
#     # Virtual event handlers, overide them in your derived class
#     def _buttonOKOnButtonClick( self, event ):
#         event.Skip()
#     
#     def _buttonCancelOnButtonClick( self, event ):
#         event.Skip()
# 
# Path: pyResMan/Util.py
# IDOK = 1
# 
# IDCANCEL = 2
# 
# Path: pyResMan/Util.py
# class HexValidator(wx.PyValidator):
#     """Validate Hex strings"""
#     def __init__(self):
#         """Initialize the validator
# 
#         """
#         super(HexValidator, self).__init__()
# 
#         # Event Handlers
#         self.Bind(wx.EVT_CHAR, self.OnChar)
# 
#     def Clone(self):
#         """Clones the current validator
#         @return: clone of this object
# 
#         """
#         return HexValidator()
# 
# #     def Validate(self, win):
# #         """Validate an window value
# #         @param win: window to validate
# # 
# #         """
# #         for char in val:
# #             if char not in Util.HEXCHARS:
# #                 return False
# #         else:
# #             return True
# 
#     def OnChar(self, event):
#         """Process values as they are entered into the control
#         @param event: event that called this handler
# 
#         """
#         key = event.GetKeyCode()
#         if event.CmdDown() or key < wx.WXK_SPACE or key == wx.WXK_DELETE or \
#            key > 255 or chr(key) in Util.HEXCHARS:
#             event.Skip()
#             return
# 
#         if not wx.Validator_IsSilent():
#             wx.Bell()
# 
#         return
#     
#     def TransferFromWindow(self, *args, **kwargs):
#         return True
#     
#     def TransferToWindow(self, *args, **kwargs):
#         return True


from pyResMan.BaseDialogs.pyResManCommandDialogBase_Basic import CommandDialogBase_Basic
from pyResMan.Util import IDOK, IDCANCEL
from pyResMan.Util import HexValidator
# -*- coding: utf-8 -*-

'''
Modified on 2017-03-28

@author: javacardos@gmail.com
@organization: https://www.javacardos.com/
@copyright: JavaCardOS Technologies. All rights reserved.
'''


###########################################################################
## Class CommandDialog_Basic
###########################################################################

MODE_IDLE = 0
MODE_PARSING = 1
MODE_BUILDING = 2

class CommandDialog_Basic ( CommandDialogBase_Basic ):
    def __init__( self, parent, bytesCount = 1 ):

# Path: pyResMan/BaseDialogs/pyResManCommandDialogBase_Basic.py
# class CommandDialogBase_Basic ( wx.Dialog ):
#     
#     def __init__( self, parent ):
#         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.Size( 292,103 ), style = wx.DEFAULT_DIALOG_STYLE )
#         
#         self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
#         
#         bSizer45 = wx.BoxSizer( wx.VERTICAL )
#         
#         
#         bSizer45.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         bSizer46 = wx.BoxSizer( wx.HORIZONTAL )
#         
#         self._statictextCommandName = wx.StaticText( self, wx.ID_ANY, u"Command Name", wx.DefaultPosition, wx.DefaultSize, 0 )
#         self._statictextCommandName.Wrap( -1 )
#         bSizer46.Add( self._statictextCommandName, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         self._textctrlCommandValue = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
#         self._textctrlCommandValue.SetExtraStyle( wx.WS_EX_VALIDATE_RECURSIVELY )
#         
#         bSizer46.Add( self._textctrlCommandValue, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         
#         bSizer45.Add( bSizer46, 0, wx.EXPAND, 5 )
#         
#         bSizer47 = wx.BoxSizer( wx.HORIZONTAL )
#         
#         
#         bSizer47.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         self._buttonOK = wx.Button( self, wx.ID_ANY, u"OK", wx.DefaultPosition, wx.DefaultSize, 0 )
#         self._buttonOK.SetDefault() 
#         bSizer47.Add( self._buttonOK, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         self._buttonCancel = wx.Button( self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
#         bSizer47.Add( self._buttonCancel, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
#         
#         
#         bSizer47.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         
#         bSizer45.Add( bSizer47, 0, wx.EXPAND, 5 )
#         
#         
#         bSizer45.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
#         
#         
#         self.SetSizer( bSizer45 )
#         self.Layout()
#         
#         self.Centre( wx.BOTH )
#         
#         # Connect Events
#         self._buttonOK.Bind( wx.EVT_BUTTON, self._buttonOKOnButtonClick )
#         self._buttonCancel.Bind( wx.EVT_BUTTON, self._buttonCancelOnButtonClick )
#     
#     def __del__( self ):
#         pass
#     
#     
#     # Virtual event handlers, overide them in your derived class
#     def _buttonOKOnButtonClick( self, event ):
#         event.Skip()
#     
#     def _buttonCancelOnButtonClick( self, event ):
#         event.Skip()
# 
# Path: pyResMan/Util.py
# IDOK = 1
# 
# IDCANCEL = 2
# 
# Path: pyResMan/Util.py
# class HexValidator(wx.PyValidator):
#     """Validate Hex strings"""
#     def __init__(self):
#         """Initialize the validator
# 
#         """
#         super(HexValidator, self).__init__()
# 
#         # Event Handlers
#         self.Bind(wx.EVT_CHAR, self.OnChar)
# 
#     def Clone(self):
#         """Clones the current validator
#         @return: clone of this object
# 
#         """
#         return HexValidator()
# 
# #     def Validate(self, win):
# #         """Validate an window value
# #         @param win: window to validate
# # 
# #         """
# #         for char in val:
# #             if char not in Util.HEXCHARS:
# #                 return False
# #         else:
# #             return True
# 
#     def OnChar(self, event):
#         """Process values as they are entered into the control
#         @param event: event that called this handler
# 
#         """
#         key = event.GetKeyCode()
#         if event.CmdDown() or key < wx.WXK_SPACE or key == wx.WXK_DELETE or \
#            key > 255 or chr(key) in Util.HEXCHARS:
#             event.Skip()
#             return
# 
#         if not wx.Validator_IsSilent():
#             wx.Bell()
# 
#         return
#     
#     def TransferFromWindow(self, *args, **kwargs):
#         return True
#     
#     def TransferToWindow(self, *args, **kwargs):
#         return True


# Path: pyResMan/Dialogs/pyResManCommandDialog_Basic.py
from pyResMan.BaseDialogs.pyResManCommandDialogBase_Basic import CommandDialogBase_Basic
from pyResMan.Util import IDOK, IDCANCEL
from pyResMan.Util import HexValidator

# -*- coding: utf-8 -*-

'''
Modified on 2017-03-28

@author: javacardos@gmail.com
@organization: https://www.javacardos.com/
@copyright: JavaCardOS Technologies. All rights reserved.
'''


###########################################################################
## Class CommandDialog_Basic
###########################################################################

MODE_IDLE = 0
MODE_PARSING = 1
MODE_BUILDING = 2

class CommandDialog_Basic ( CommandDialogBase_Basic ):
    def __init__( self, parent, bytesCount = 1 ):

        CommandDialogBase_Basic.__init__ ( self, parent )