예제 #1
0
    def __init__(self, parent, tabName):
        self.tabName = tabName
        self.first = False
        self.active = False
        self.hovering = False  # is the user hovering the mouse over the control
        self.clicking = False  # is the user clicking the control
        self.font = getDefaultFont()
        # FIXME (EPW) make these colors settable
        self.borderColor = getDefaultControlBorderColor()
        self.tabColor = getDefaultDialogBackgroundColor()
        self.activeColor = getDefaultControlBackgroundColor()
        self.hoverColor = wx.Color(min(self.tabColor.Red() + 20, 255),
                                   min(self.tabColor.Green() + 20, 255),
                                   min(self.tabColor.Blue(), 255))

        wx.Control.__init__(self, parent, wx.ID_ANY, style=wx.NO_BORDER)

        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
        self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter, self)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.onLeave, self)
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClickDown, self)
        self.Bind(wx.EVT_LEFT_UP, self.onLeftClickUp, self)

        # FIXME allow the font to be changed - when that is done, size hints must be recalc'd
        winDC = wx.WindowDC(parent)
        winDC.SetFont(self.font)
        (w, h) = winDC.GetTextExtent(tabName)
        self.SetSizeHints(w + 10, h + 10)
        del winDC
예제 #2
0
    def __init__(self, parent, tabInfo, selected = False):
        self.parent = parent
        self.tabInfo = tabInfo
        self.selected = selected
        self.firstTab = False
        self.wingmanTab = False
        self.hovering = False # is the user hovering the mouse over the control
        self.clicking = False # is the user clicking the control
        self.middleClicking = False # is the user middle-clicking the control
        self.borderColor = TAB_BORDER_INNER_COLOR
        self.selBGColorStart = wx.Color(157, 185, 235)
        self.selBGColorEnd = wx.Color(157, 185, 235)

        wx.Panel.__init__(self, parent, wx.ID_ANY)

        self.preferredWidth = self._calculatePreferredWidth()

        self.SetFont(getDefaultFont())
        self.closeButtonBitmap = getApplicationModel().getResourceRegistry().getBitmap(u"images/widgets/tabcontainer/close.png") #$NON-NLS-1$
        self.closeHoverButtonBitmap = getApplicationModel().getResourceRegistry().getBitmap(u"images/widgets/tabcontainer/close.png") #$NON-NLS-1$

        self.SetSize(wx.Size(self.preferredWidth, -1))

        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
        self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter, self)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.onLeave, self)
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClickDown, self)
        self.Bind(wx.EVT_LEFT_UP, self.onLeftClickUp, self)
        self.Bind(wx.EVT_MIDDLE_DOWN, self.onMiddleClickDown, self)
        self.Bind(wx.EVT_MIDDLE_UP, self.onMiddleClickUp, self)
        self.Bind(wx.EVT_RIGHT_UP, self.onRightClick, self)

        # FIXME (EPW) show the tooltip string only if the title is truncated
        self.SetToolTipString(self.tabInfo.getTitle())
예제 #3
0
 def __init__(self, parent, tabName):
     self.tabName = tabName
     self.first = False
     self.active = False
     self.hovering = False # is the user hovering the mouse over the control
     self.clicking = False # is the user clicking the control
     self.font = getDefaultFont()
     # FIXME (EPW) make these colors settable
     self.borderColor = getDefaultControlBorderColor()
     self.tabColor = getDefaultDialogBackgroundColor()
     self.activeColor = getDefaultControlBackgroundColor()
     self.hoverColor = wx.Color(min(self.tabColor.Red() + 20, 255), min(self.tabColor.Green() + 20, 255), min(self.tabColor.Blue(), 255))
     
     wx.Control.__init__(self, parent, wx.ID_ANY, style = wx.NO_BORDER)
     
     self.Bind(wx.EVT_PAINT, self.onPaint, self)
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
     self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter, self)
     self.Bind(wx.EVT_LEAVE_WINDOW, self.onLeave, self)
     self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClickDown, self)
     self.Bind(wx.EVT_LEFT_UP, self.onLeftClickUp, self)
     
     # FIXME allow the font to be changed - when that is done, size hints must be recalc'd
     winDC = wx.WindowDC(parent)
     winDC.SetFont(self.font)
     (w, h) = winDC.GetTextExtent(tabName)
     self.SetSizeHints(w + 10, h + 10)
     del winDC
예제 #4
0
파일: tabs.py 프로젝트: mpm2050/Raven
    def onPaint(self, event):
        (w, h) = self.GetSizeTuple()
        (fontW,
         fontH) = self.GetTextExtent(self.tabInfo.getTitle())  #@UnusedVariable
        paintDC = wx.BufferedPaintDC(self)
        paintDC.SetBackground(
            wx.Brush(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE),
                     wx.SOLID))
        paintDC.Clear()

        pen = wx.Pen(self.borderColor)
        paintDC.SetPen(pen)

        if self.selected:
            paintDC.DrawLine(0, 6, 0, h)  # left
            _drawTopLeftArc(paintDC, self.borderColor, TAB_BORDER_OUTER_COLOR,
                            0, 0)  # top left
            _drawTopRightArc(paintDC, self.borderColor, TAB_BORDER_OUTER_COLOR,
                             w - 6, 0)  # top right
            paintDC.DrawLine(w - 1, 6, w - 1, h)  # right
            paintDC.DrawLine(6, 0, w - 6, 0)  # top
            self._drawTabBackground(paintDC)
        else:
            if not self.wingmanTab:
                paintDC.DrawLine(w - 1, 0, w - 1, h)  # right line
            paintDC.DrawLine(0, h - 1, w, h - 1)  # bottom line

        paintDC.SetFont(getDefaultFont())

        # Now draw the bitmap and title.
        labelX = 4
        bitmap = self.tabInfo.getBitmap()
        if bitmap is not None:
            paintDC.DrawBitmap(bitmap, 4, (h - bitmap.GetHeight()) / 2)
            labelX += bitmap.GetWidth() + 4
        labelW = w - labelX - 20
        title = sizeStringToFit(self.tabInfo.getTitle(), labelW, self)
        if self.selected:
            paintDC.SetTextForeground(wx.Color(255, 255, 255))
        elif self.hovering:
            paintDC.SetTextForeground(wx.Color(113, 114, 235))
        paintDC.DrawText(title, labelX, (h - fontH) / 2)

        del paintDC

        event.Skip()
예제 #5
0
    def onPaint(self, event):
        (w, h) = self.GetSizeTuple()
        (fontW, fontH) = self.GetTextExtent(self.tabInfo.getTitle()) #@UnusedVariable
        paintDC = wx.BufferedPaintDC(self)
        paintDC.SetBackground(wx.Brush(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE), wx.SOLID))
        paintDC.Clear()

        pen = wx.Pen(self.borderColor)
        paintDC.SetPen(pen)

        if self.selected:
            paintDC.DrawLine(0, 6, 0, h) # left
            _drawTopLeftArc(paintDC, self.borderColor, TAB_BORDER_OUTER_COLOR, 0, 0) # top left
            _drawTopRightArc(paintDC, self.borderColor, TAB_BORDER_OUTER_COLOR, w - 6, 0) # top right
            paintDC.DrawLine(w - 1, 6, w - 1, h) # right
            paintDC.DrawLine(6, 0, w - 6, 0) # top
            self._drawTabBackground(paintDC)
        else:
            if not self.wingmanTab:
                paintDC.DrawLine(w - 1, 0, w - 1, h) # right line
            paintDC.DrawLine(0, h - 1, w, h - 1) # bottom line

        paintDC.SetFont(getDefaultFont())

        # Now draw the bitmap and title.
        labelX = 4
        bitmap = self.tabInfo.getBitmap()
        if bitmap is not None:
            paintDC.DrawBitmap(bitmap, 4, (h - bitmap.GetHeight()) / 2)
            labelX += bitmap.GetWidth() + 4
        labelW = w - labelX - 20
        title = sizeStringToFit(self.tabInfo.getTitle(), labelW, self)
        if self.selected:
            paintDC.SetTextForeground(wx.Color(255, 255, 255))
        elif self.hovering:
            paintDC.SetTextForeground(wx.Color(113, 114, 235))
        paintDC.DrawText(title, labelX, (h - fontH) / 2)

        del paintDC

        event.Skip()
예제 #6
0
파일: toolbar.py 프로젝트: mpm2050/Raven
    def __init__(self, parent, text, description, bitmaps, hoverBitmaps,
                 disabledBitmaps, node):
        self.text = text
        self.description = description
        self.bitmaps = bitmaps
        self.hoverBitmaps = hoverBitmaps
        self.disabledBitmaps = disabledBitmaps
        self.node = node
        self.showTextFlag = True
        self.toolBitmapSize = 16

        wx.PyControl.__init__(self, parent, wx.ID_ANY, style=wx.NO_BORDER)
        ZClickableControlMixin.__init__(self, False)
        ZHoverableControlMixin.__init__(self)

        self.SetFont(getDefaultFont())
        self.SetToolTipString(self.description)
        self._resize()

        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
예제 #7
0
파일: tabs.py 프로젝트: mpm2050/Raven
    def __init__(self, parent, tabInfo, selected=False):
        self.parent = parent
        self.tabInfo = tabInfo
        self.selected = selected
        self.firstTab = False
        self.wingmanTab = False
        self.hovering = False  # is the user hovering the mouse over the control
        self.clicking = False  # is the user clicking the control
        self.middleClicking = False  # is the user middle-clicking the control
        self.borderColor = TAB_BORDER_INNER_COLOR
        self.selBGColorStart = wx.Color(157, 185, 235)
        self.selBGColorEnd = wx.Color(157, 185, 235)

        wx.Panel.__init__(self, parent, wx.ID_ANY)

        self.preferredWidth = self._calculatePreferredWidth()

        self.SetFont(getDefaultFont())
        self.closeButtonBitmap = getApplicationModel().getResourceRegistry(
        ).getBitmap(u"images/widgets/tabcontainer/close.png")  #$NON-NLS-1$
        self.closeHoverButtonBitmap = getApplicationModel(
        ).getResourceRegistry().getBitmap(
            u"images/widgets/tabcontainer/close.png")  #$NON-NLS-1$

        self.SetSize(wx.Size(self.preferredWidth, -1))

        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
        self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter, self)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.onLeave, self)
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClickDown, self)
        self.Bind(wx.EVT_LEFT_UP, self.onLeftClickUp, self)
        self.Bind(wx.EVT_MIDDLE_DOWN, self.onMiddleClickDown, self)
        self.Bind(wx.EVT_MIDDLE_UP, self.onMiddleClickUp, self)
        self.Bind(wx.EVT_RIGHT_UP, self.onRightClick, self)

        # FIXME (EPW) show the tooltip string only if the title is truncated
        self.SetToolTipString(self.tabInfo.getTitle())
예제 #8
0
    def __init__(self, parent, text, description, bitmap, hoverBitmap, selectedBitmap, data):
        self.parent = parent
        self.text = text
        self.description = description
        self.bitmap = bitmap
        self.hoverBitmap = hoverBitmap
        self.selectedBitmap = selectedBitmap
        self.data = data
        
        self.selected = False
        
        self.selectedBackgroundColor = wx.Color(200, 200, 225)
        self.hoverBackgroundColor = wx.Color(225, 225, 250)

        wx.PyControl.__init__(self, parent, wx.ID_ANY, style = wx.NO_BORDER)
        ZClickableControlMixin.__init__(self, False)
        ZHoverableControlMixin.__init__(self)

        self.SetFont(getDefaultFont())

        self._resize()

        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)