示例#1
0
文件: frame.py 项目: Ripsnorta/pyui2
    def setCaptionBar(self, captionBar):
        if self._captionBar:
            Base.removeChild(self, self._captionBar)

        self._captionBar = captionBar

        Base.addChild(self, self._captionBar)
        self._captionBar.setWindow(self)

        self._captionBar.moveto(self.theme.getFrameBorderLeft(), self.theme.getFrameBorderTop())
        self._captionBar.resize(self.innerRect[2], self._captionBar.height)
        self.calcInnerRect()
        self.placeInnerObjects()
示例#2
0
文件: window.py 项目: Ripsnorta/pyui2
    def replacePanel(self, panel):
        for c in self.children:
            if c.id == self._panel.id:
                self.children.remove(c)

        self._panel = panel
        Base.addChild(self, self._panel)
        self._panel.setWindow(self)
        self.calcInnerRect()
        self.placeInnerObjects()
        self._panel.moveto(self.innerRect[0], self.innerRect[1])
        self._panel.resize(self.innerRect[2], self.innerRect[3])
        self._panel.calcInnerRect()
        self._panel.placeInnerObjects()
示例#3
0
文件: panel.py 项目: Ripsnorta/pyui2
    def addChild(self, child, option = None):
        if child.getID() == "":
            self.createChildID(child)

        Base.addChild(self, child)
        self.childOptions[child.id] = option

        if child.width > self.width:
            self.width = child.width
        if child.height > self.height:
            self.height = child.height
        # panel cannot be larger than parent
        if self.parent:
            if self.width > self.parent.width:
                self.width = self.parent.width
            if self.height > self.parent.height:
                self.height = self.parent.height
示例#4
0
文件: window.py 项目: Ripsnorta/pyui2
    def __init__(self, x, y, w, h, topmost = 0):
        self._panel = Panel()
        Base.__init__(self)
        self.topMost = topmost
        # the content panel is added as a child through Base::addChild to avoid recursively adding it to itself
        Base.addChild(self, self._panel)
        self._panel.setWindow(self)
        self._panel.setParent(self)
        self.placeInnerObjects()

        self.drawCommands = []
        # these are drawing callbacks to draw _after_ all the widgets are drawn
        self.drawLastCallbacks = []
        self.moveto(x, y)
        self.resize(w, h)
        getDesktop().addWindow(self)

        # Create the graphics context that will be used to display this window
        self.graphicsContext = getPresenter().getDeviceContext().createGraphicsContext((w, h))