def __init__(self): ''' ''' theClass = 'TopLevelWindow' wx.RegisterFirstCallerClassName(self, theClass) Window.__init__(self, None) id = wx.ID_ANY self.tsBeginClassRegistration(theClass, id) self.ts_DefaultItem = None ## self.ts_EnableCloseButton = False self.ts_Icons = [] ## self.thisown = None self.ts_Closed = False self.ts_HelpAsked = False self.ts_Iconized = False self.ts_Maximized = False self.ts_RestoreDown = False self.ts_ReserveTaskBarArea = wx.ThemeToUse['TaskBar']['Enable'] self.ts_Shape = None self.ts_Title = None self.ts_TmpDefaultItem = None self.tsEndClassRegistration(theClass)
def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name=wx.ControlNameStr): ''' Default class constructor. ''' theClass = 'Control' # Capture initial caller parametsrs before they are changed self.caller_parent = parent self.caller_id = id self.caller_pos = pos self.caller_size = size self.caller_style = style self.caller_validator = validator self.caller_name = name wx.RegisterFirstCallerClassName(self, theClass) Window.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.tsBeginClassRegistration(theClass, id) thePosition = self.tsGetClassInstanceFromTuple(pos, wxPoint) theSize = self.tsGetClassInstanceFromTuple(size, wxSize) self.ts_Rect = wxRect( thePosition.x, thePosition.y, theSize.width, theSize.height) 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(' pos: %s' % self.Position) self.logger.debug(' size: %s' % self.Size) self.logger.debug(' style: 0x%X' % style) self.logger.debug(' validator: %s' % validator) self.logger.debug(' name: %s' % name) self.ts_Name = name self.ts_Parent = parent theTopLevelClass = self self.SetTopLevelAncestor(theTopLevelClass) if parent is None: self.ts_GrandParent = None else: self.ts_GrandParent = parent.Parent self.ts_Validator = validator # Facilitate differentiation of this panel from its parent by # transposing the parent's foreground and background colors. self.ts_BackgroundColour = wx.ThemeToUse[ 'ForegroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse[ 'BackgroundColour'].lower() self.ts_Style = style self.tsEndClassRegistration(theClass)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_MENUBAR_STYLE, name=wx.MenuBarNameStr): ''' Construct and show a generic Window. ''' theClass = 'MenuBar' # Capture initial caller parametsrs before they are changed self.caller_parent = parent self.caller_id = id self.caller_pos = pos self.caller_size = size self.caller_style = style self.caller_name = name wx.RegisterFirstCallerClassName(self, theClass) Window.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.tsBeginClassRegistration(theClass, id) myRect = wxRect(parent.Rect.x + wx.pixelWidthPerCharacter, parent.Rect.y + wx.pixelHeightPerCharacter, parent.Rect.width - 2* wx.pixelWidthPerCharacter, wx.ThemeToUse['MenuBar']['WindowHeight']) self.ts_Rect = myRect self.ts_theEntry = [] self.ts_theEntryCount = wx.ID_ANY self.ts_MenuCount = 0 self.ts_Menus = None 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' % self.Position) self.logger.debug(' size: %s' % self.Size) self.logger.debug(' style: 0x%X' % style) self.logger.debug(' name: %s' % name) self.ts_Name = name self.ts_Parent = parent theTopLevelClass = self self.SetTopLevelAncestor(theTopLevelClass) if parent is None: self.ts_GrandParent = None else: self.ts_GrandParent = parent.Parent self.ts_BackgroundColour = wx.ThemeToUse['BackgroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse['ForegroundColour'].lower() self.ts_Style = style self.ts_TheWrapper = None self.ts_UserInputEnable = False self.tsEndClassRegistration(theClass)
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_STATUSBAR_STYLE, name=wx.StatusLineNameStr): ''' Create a Control. Normally you should only call this from a subclass (_init__) as a plain old wx.Control is not very useful. ''' theClass = 'StatusBar' # Capture initial caller parametsrs before they are changed self.caller_parent = parent self.caller_id = id self.caller_pos = pos self.caller_size = size self.caller_style = style self.caller_name = name wx.RegisterFirstCallerClassName(self, theClass) Window.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.tsBeginClassRegistration(theClass, id) self.ts_Name = name self.ts_Parent = parent theTopLevelClass = self self.SetTopLevelAncestor(theTopLevelClass) if parent is None: self.ts_GrandParent = None else: self.ts_GrandParent = parent.Parent # Initialize StatusBar Contents self.ts_minHeight = wx.ThemeToUse['StatusBar']['WindowHeight'] self.ts_nFields = 0 self.ts_FieldRect = [] self.ts_Fields = [] self.ts_StatusStacks = [] self.ts_StatusStyles = [] self.ts_StatusText = [] self.ts_StatusTextStacks = [] self.ts_StatusWidths = [] if callerPositionSizeStyleEnabled: self.ts_Style = style else: self.ts_Style = wx.DEFAULT_STATUSBAR_STYLE self.ts_Rect = self.tsStatusBarLayout(parent, pos, size, style, name) if DEBUG: print('__init__: self.ts_Rect = %s' % self.ts_Rect) 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' % str(pos)) self.logger.debug(' size: %s' % str(size)) self.logger.debug(' style: 0x%X' % style) self.logger.debug(' name: %s' % name) self.logger.debug('rect (see pos/size): %s' % self.ts_Rect) self.ts_BackgroundColour = wx.ThemeToUse['BackgroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse['ForegroundColour'].lower() self.tsEndClassRegistration(theClass)
def __init__(self, parent, id=wx.ID_ANY, label=wx.EmptyString, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_PANEL_STYLE, name=wx.PanelNameStr): ''' Construct and show a generic Window. ''' theClass = 'Panel' # Capture initial caller parametsrs before they are changed self.caller_parent = parent self.caller_id = id self.caller_label = label self.caller_pos = pos self.caller_size = size self.caller_style = style self.caller_name = name wx.RegisterFirstCallerClassName(self, theClass) if parent is None: # Top Level Windows (Frames & Dialogs) have no parent panelPos = pos panelSize = size else: parentClientArea = parent.ClientArea if pos == wx.DefaultPosition: panelPos = wxPoint(parentClientArea.x, parentClientArea.y) else: panelPos = pos if size == wx.DefaultSize: panelSize = wxSize(parentClientArea.width, parentClientArea.height) else: panelSize = size Window.__init__(self, parent, id=id, pos=panelPos, size=panelSize, style=style, name=name) self.tsBeginClassRegistration(theClass, id) if False: self.ts_Rect = wxRect(-1, -1, -1, -1) self.ts_ClientRect = self.ts_Rect else: (myRect, myClientRect) = self.tsPanelLayout( parent, panelPos, panelSize, style, name) self.ts_Rect = myRect self.ts_ClientRect = myClientRect 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' % id) self.logger.debug(' AssignedId: %s' % self.ts_AssignedId) self.logger.debug(' label: %s' % label) 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_Label = label self.ts_Name = name self.ts_Parent = parent theTopLevelClass = self self.SetTopLevelAncestor(theTopLevelClass) if parent is None: self.ts_GrandParent = None else: self.ts_GrandParent = parent.Parent self.ts_BackgroundColour = wx.ThemeToUse['BackgroundColour'].lower() self.ts_ForegroundColour = wx.ThemeToUse['ForegroundColour'].lower() # Facilitate differentiation of this panel from its parent by # transposing the parent's foreground and background colors. if style == wx.BORDER_SUNKEN: self.ts_BackgroundColour = wx.COLOR_BLACK self.ts_ForegroundColour = wx.COLOR_WHITE elif style == wx.BORDER_RAISED: self.ts_BackgroundColour = wx.COLOR_WHITE self.ts_ForegroundColour = wx.COLOR_BLACK else: self.ts_BackgroundColour = self.ts_Parent.ts_BackgroundColour self.ts_ForegroundColour = self.ts_Parent.ts_ForegroundColour self.ts_Style = style # Automatically Bind all mouse events ASAP (now). # Will register event in the SystemEventTable. event = EVT_SET_FOCUS handler = self.SetFocusFromKbd source = self self.Bind(event, handler, source, useSystemEventTable=True) self.tsEndClassRegistration(theClass)