def __init__(self): ''' Constructor. ''' theClass = 'Object' wx.RegisterFirstCallerClassName(self, theClass) id = wx.ID_ANY # Establish connection with application logger and log the beginning # of class registration. Then establish application access to display # top-level window and to curses screen and windows. if Object.TheLogger is None: Object.PyApp_Object = self Object.PyApp_EventQueue = wxDoubleLinkedList() self.tsBeginClassRegistration(theClass, id) self.tsEndClassRegistration(theClass)
def __init__(self, parent, # Should be None unless modal mode message, # Alias for user prompt output caption=wx.EmptyString, # Alias for title value=wx.EmptyString, # Option for default user input style=wx.TEXT_ENTRY_DIALOG_STYLE, # Options for ClientRect size=wx.DefaultSize, # Extension for application use pos=wx.DefaultPosition # Option for application use ): ''' ''' theClass = 'TextEntry' # Capture initial caller parametsrs before they are changed self.caller_caption = caption self.caller_message = message self.caller_name = name self.caller_parent = parent self.caller_pos = pos self.caller_size = size self.caller_style = style self.caller_title = title self.caller_value = value ## wx.RegisterFirstCallerClassName(self, theClass) ## Dialog.__init__(self, ## parent, # self.GetParentForModalDialog(parent, style), ## id=wx.ID_ANY, ## title=title, ## pos=pos, ## size=size, ## # Apply Default Dialog Style to Top-Level Window ## # (defer TextEntryDialog style for internal layout) ## style=wx.DEFAULT_DIALOG_STYLE, ## name=name) # Capture parameters. self.ts_Caption = self.backup_caption self.ts_Message = self.backup_message self.ts_Parent = self.backup_parent # Should be None unless modal mode self.ts_Pos = self.backup_pos self.ts_Size = self.backup_size self.ts_Style = self.backup_style self.ts_Title = self.backup_title self.ts_Value = self.backup_value ## (self.ts_Rect, ## self.ts_ClientRect) = self.tsTextEntryDialogLayout( ## parent, pos, size, style, caption) thePosition = self.Position theSize = self.Size if DEBUG: self.logger.debug(' self: %s' % self) self.logger.debug(' parent: %s' % parent) self.logger.debug(' id: %s' % self.ts_Id) self.logger.debug(' AssignedId: %s' % self.ts_AssignedId) self.logger.debug(' title: %s' % title) self.logger.debug(' pos: %s' % thePosition) self.logger.debug(' size: %s' % theSize) self.logger.debug(' style: 0x%X' % style) self.logger.debug(' name: %s' % name) self.ts_Name = name self.ts_Parent = parent if True: self.ts_BackgroundColour = wx.ThemeToUse[ 'TextEntryDialog']['BackgroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse[ 'TextEntryDialog']['ForegroundColour'].lower() else: self.ts_BackgroundColour = wx.ThemeToUse[ 'Dialog']['BackgroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse[ 'Dialog']['ForegroundColour'].lower() self.ts_TextPad = None self.ts_IdleTimeQueue = wxDoubleLinkedList(lifoMode=False) self.ts_RealTimeQueue = wxDoubleLinkedList(lifoMode=False) self.ts_DescendantOrderOfShow = [self.ts_AssignedId] # The following redefines the usage of the style wx.CENTRE. # Intended only to govern the alignment of the buttons within # the dialog, we also apply it the centering of the dialog # itself within the desktop because the layout process cannot # wait for the application to initiate centering. if (self.ts_Style & wx.CENTRE) == wx.CENTRE: if DEBUG: msg = 'tsWxTextEntryDialog.__init__: ' + \ 'Proceeding with tsDialogFeatureLayout. ' + \ 'Style contains wx.CENTRE.' self.logger.debug(msg) print('DEBUG: %s\n' % msg) self.Center() self.ts_TextPad = self.tsDialogFeatureLayout() self.Show() else: msg = 'tsWxTextEntryDialog.__init__: ' + \ 'Skipped tsDialogFeatureLayout. ' + \ 'Style did NOT contain wx.CENTRE.' self.logger.error(msg) print('ERROR: %s\n' % msg) self.ts_ButtonUserPressed = wx.ID_CANCEL self.tsEndClassRegistration(theClass)
def __init__(self, parent, # Should be None unless modal mode message, # Alias for user prompt output caption=wx.EmptyString, # Alias for title value=wx.EmptyString, # Option for default user input style=wx.TE_PASSWORD, # Options for ClientRect size=wx.DefaultSize, # Extension for application use pos=wx.DefaultPosition # Option for application use ): ''' Use ShowModal() to show the dialog. Parameters: parent Parent window. message Message to show on the dialog. caption The caption of the dialog. value The default value, which may be the empty string. style A dialog style, specifying the buttons (wxOK, wxCANCEL) and an optional wxCENTRE style. Additionally, wxTextCtrl styles (such as wxTE_PASSWORD or wxTE_MULTILINE) may be specified here. pos Dialog position. ''' theClass = 'PasswordEntryDialog' # Capture initial caller parametsrs before Dialog makes changes self.backup_parent = parent self.backup_message = message self.backup_caption = caption self.backup_value = value self.backup_style = style self.backup_size = size self.backup_pos = pos name = wx.PasswordEntryDialogNameStr title = caption self.backup_name = name self.backup_size = size self.backup_title = title # Capture initial caller parametsrs before they are changed self.caller_caption = caption self.caller_message = message self.caller_name = name self.caller_parent = parent self.caller_pos = pos self.caller_size = size self.caller_style = style self.caller_title = title self.caller_value = value wx.RegisterFirstCallerClassName(self, theClass) TextEntryDialog.__init__( self, parent, # Should be None unless modal mode message, # Alias for user prompt output caption=caption, # Alias for title value=value, # Option for default user input style=style, # Options for ClientRect size=size, # Extension for application use pos=pos # Option for application use ) # Capture parameters. self.ts_Caption = self.backup_caption self.ts_Message = self.backup_message self.ts_Parent = self.backup_parent # Should be None unless modal mode self.ts_Pos = self.backup_pos self.ts_Size = self.backup_size self.ts_Style = self.backup_style self.ts_Title = self.backup_title self.ts_Value = self.backup_value self.ts_Completion = False self.ts_PasswordMode = True self.ts_StripSpaces = True ## (self.ts_Rect, ## self.ts_ClientRect) = self.tsTextEntryDialogLayout( ## parent, pos, size, style, caption) thePosition = self.Position theSize = self.Size if DEBUG: self.logger.debug(' self: %s' % self) self.logger.debug(' parent: %s' % parent) self.logger.debug(' id: %s' % self.ts_Id) self.logger.debug(' AssignedId: %s' % self.ts_AssignedId) self.logger.debug(' title: %s' % title) self.logger.debug(' pos: %s' % thePosition) self.logger.debug(' size: %s' % theSize) self.logger.debug(' style: 0x%X' % style) self.logger.debug(' name: %s' % name) self.ts_Name = name self.ts_Parent = parent if True: self.ts_BackgroundColour = wx.ThemeToUse[ 'PasswordEntryDialog']['BackgroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse[ 'PasswordEntryDialog']['ForegroundColour'].lower() else: self.ts_BackgroundColour = wx.ThemeToUse[ 'Dialog']['BackgroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse[ 'Dialog']['ForegroundColour'].lower() self.ts_TextPad = None self.ts_IdleTimeQueue = wxDoubleLinkedList(lifoMode=False) self.ts_RealTimeQueue = wxDoubleLinkedList(lifoMode=False) self.ts_DescendantOrderOfShow = [self.ts_AssignedId] # The following redefines the usage of the style wx.CENTRE. # Intended only to govern the alignment of the buttons within # the dialog, we also apply it the centering of the dialog # itself within the desktop because the layout process cannot # wait for the application to initiate centering. if (self.ts_Style & wx.CENTRE) == wx.CENTRE: if DEBUG: msg = 'tsWxPasswordEntryDialog.__init__: ' + \ 'Proceeding with tsDialogFeatureLayout. ' + \ 'Style contains wx.CENTRE.' self.logger.debug(msg) print('DEBUG: %s\n' % msg) self.Center() # curses.noecho() self.ts_TextPad = self.tsDialogFeatureLayout() # curses.echo() self.Show() else: msg = 'tsWxPasswordEntryDialog.__init__: ' + \ 'Skipped tsDialogFeatureLayout. ' + \ 'Style did NOT contain wx.CENTRE.' self.logger.error(msg) print('ERROR: %s\n' % msg) self.ts_ButtonUserPressed = wx.ID_CANCEL self.tsEndClassRegistration(theClass)