Logo Search packages:      
Sourcecode: pythoncard version File versions  Download package

def PythonCard-0.8.1::model::Background::__init__ (   self,
  aParent,
  aBgRsrc 
)

Initialize this instance.

Definition at line 592 of file model.py.

00592                                         :
        """
        Initialize this instance.
        """
        Scriptable.__init__(self, None)
        event.EventSource.__init__(self)
        self.id = wx.NewId()
        self.resource = aBgRsrc
        self.application = wx.GetApp()
        self.setName(aBgRsrc.name)
        self.setImage(aBgRsrc.image)
        self.setTiled(aBgRsrc.tiled)
        self.components = WidgetDict(self)
        self.menuBar = None
        self.statusBar = None

        # override for application defined position
        position = configuration.getOption('defaultBackgroundPosition')
        if position is None:
            position = aBgRsrc.position

        # KEA 2004-01-18
        # have to explicitly declare the close box in wxPython 2.5
        style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
        if aBgRsrc.style == ['resizeable']:
            style = wx.DEFAULT_FRAME_STYLE
        # First, call the base class' __init__ method to create the frame
        wx.Frame.__init__(self, aParent,
                            self.id, 
                            #self.name,
                            aBgRsrc.title,
                            position,
                            aBgRsrc.size,
                            style | wx.NO_FULL_REPAINT_ON_RESIZE,
                            aBgRsrc.name)

        # KEA 2004-09-24
        # experiment to see if initialize event will
        # fire before all other events
        # also see change to wx.CallAfter in textfield, passwordfield, and textarea
        evt = wx.PyEvent()
        # this is sort of pointless, the target is always self
        # do any samples or tool refer to the target?
        evt.target = self
        wx.CallAfter(self.on_initialize, evt)
        # also changing how other background events are hooked up
        wx.CallAfter(self.OnLatentBackgroundBind, None)

        self._initLayout(aBgRsrc.components)

        # KEA 2001-08-13
        # can't set the colors until after the panel
        # has been created. this initialization should probably work differently
        self._setForegroundColor(aBgRsrc.foregroundColor)
        self._setBackgroundColor(aBgRsrc.backgroundColor)

        self._createMenus(aBgRsrc)
        self._createStatusBar(aBgRsrc)

        # AJT 20.11.2001
        # Add icon creation
        self._setIcon(aBgRsrc)

        # 2001-11-08
        # hack to preserve the statusbar text
        if self.statusBar is not None and self.menuBar is not None:
            wx.EVT_MENU_HIGHLIGHT_ALL(self, self.menuHighlight)

        if aParent is None:
            self.application.SetTopWindow(self)

        # KEA 2002-04-26
        # allow background window to remain hidden 
        if aBgRsrc.visible:
            self.Show(True)

        # RDS 2004-04-14
        # Post the Background initialization event.

##        self.EVT_OPEN_BACKGROUND_TYPE = wx.NewEventType()


Generated by  Doxygen 1.6.0   Back to index