Exemple #1
0
    def OnPaint(self, event):
        rect = self.GetClientRect()
        dc = wx.AutoBufferedPaintDC(self)
        windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        dc.SetBackground(wx.Brush(windowColor))
        dc.Clear()

        barColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
        shadeColor = colorUtils.GetSuitable(barColor, 0.75)

        barWidth = rect.width / self.bars
        barHeight = rect.height - self.padding * 2

        x = self.padding

        for bar in range(self.bars):
            if bar != self.animCount:
                dc.SetPen(wx.Pen(shadeColor))
                dc.SetBrush(wx.Brush(shadeColor))
                bh = barHeight
                y = self.padding
            else:
                barColor = colorUtils.GetSuitable(barColor, float(self.animCount / 2) / 10)
                dc.SetPen(wx.Pen(barColor))
                dc.SetBrush(wx.Brush(barColor))
                bh = rect.height
                y = 0

            dc.DrawRectangle(x, y, barWidth, bh)
            x += barWidth

        textColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
        dc.SetTextForeground(textColor)
        dc.DrawLabel(self.label, rect, wx.ALIGN_CENTER)
Exemple #2
0
    def OnPaint(self, event):
        dc = wx.AutoBufferedPaintDC(self)

        bkColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        sepColor = colorUtils.GetSuitable(bkColor, 0.2)
        rect = self.GetRect()

        if self.resized:
            self.bkBitmap = drawUtils.RenderGradientBar(bkColor, rect.width, rect.height, 0.1, 0.1, 0.2, 2)
            self.UpdateElementsPos(dc)
            self.resized = False

        dc.DrawBitmap(self.bkBitmap, 0, 0)

        if self.isSearchButtonVisible:
            if self.searchBitmap:
                if self.searchButtonPressed:
                    spad = 1
                else:
                    spad = 0

                dc.DrawBitmap(self.searchBitmapShadow, self.searchButtonX + 1, self.searchButtonY + 1)
                dc.DrawBitmap(self.searchBitmap, self.searchButtonX + spad, self.searchButtonY + spad)

        if self.isCancelButtonVisible:
            if self.cancelBitmap:
                if self.cancelButtonPressed:
                    cpad = 1
                else:
                    cpad = 0
                dc.DrawBitmap(self.cancelBitmapShadow, self.cancelButtonX + 1, self.cancelButtonY + 1)
                dc.DrawBitmap(self.cancelBitmap, self.cancelButtonX + cpad, self.cancelButtonY + cpad)

        dc.SetPen(wx.Pen(sepColor, 1))
        dc.DrawLine(0, rect.height - 1, rect.width, rect.height - 1)
Exemple #3
0
    def DrawItem(self, mdc):
        rect = self.GetRect()

        windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        textColor = colorUtils.GetSuitable(windowColor, 1)
        sepColor = colorUtils.GetSuitable(windowColor, 0.2)

        mdc.SetTextForeground(textColor)

        self.UpdateElementsPos(mdc)
        self.BrowserSearchBox.SetPosition((self.browserBoxX, self.browserBoxY))
        self.BrowserSearchBox.SetSize(wx.Size(self.bEditBoxWidth, -1))

        self.toolbar.SetPosition((self.toolbarx, self.toolbary))
        mdc.SetFont(self.fontSmall)
        mdc.DrawText(self.toolbar.hoverLabel, self.thoverx, self.thovery)
        mdc.SetPen(wx.Pen(sepColor, 1))
        mdc.DrawLine(0, rect.height - 1, rect.width, rect.height - 1)
Exemple #4
0
    def DrawItem(self, mdc):
        rect = self.GetRect()

        windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        textColor = colorUtils.GetSuitable(windowColor, 1)

        mdc.SetTextForeground(textColor)

        self.UpdateElementsPos(mdc)

        self.toolbar.SetPosition((self.toolbarx, self.toolbary))

        if self.GetState() & SFItem.SB_ITEM_HIGHLIGHTED:
            shipEffBk = self.shipEffBkMirrored
        else:
            shipEffBk = self.shipEffBk

        mdc.DrawBitmap(shipEffBk, self.shipEffx, self.shipEffy, 0)

        mdc.DrawBitmap(self.shipBmp, self.shipBmpx, self.shipBmpy, 0)

        mdc.SetFont(self.fontNormal)

        fitDate = self.timestamp.strftime("%m/%d/%Y %H:%M")
        fitLocalDate = fitDate  # "%d/%02d/%02d %02d:%02d" % (fitDate[0], fitDate[1], fitDate[2], fitDate[3], fitDate[4])
        pfdate = drawUtils.GetPartialText(
            mdc, fitLocalDate,
            self.toolbarx - self.textStartx - self.padding * 2 - self.thoverw)

        mdc.DrawText(pfdate, self.textStartx, self.timestampy)

        mdc.SetFont(self.fontSmall)
        mdc.DrawText(self.toolbar.hoverLabel, self.thoverx, self.thovery)

        mdc.SetFont(self.fontBig)

        psname = drawUtils.GetPartialText(
            mdc, self.fitName,
            self.toolbarx - self.textStartx - self.padding * 2 - self.thoverw)

        mdc.DrawText(psname, self.textStartx, self.fitNamey)

        if self.tcFitName.IsShown():
            self.AdjustControlSizePos(
                self.tcFitName, self.textStartx,
                self.toolbarx - self.editWidth - self.padding)

        tdc = wx.MemoryDC()
        self.dragTLFBmp = wx.Bitmap(
            (self.toolbarx if self.toolbarx < 200 else 200), rect.height, 24)
        tdc.SelectObject(self.dragTLFBmp)
        tdc.Blit(0, 0, (self.toolbarx if self.toolbarx < 200 else 200),
                 rect.height, mdc, 0, 0, wx.COPY)
        tdc.SelectObject(wx.NullBitmap)
Exemple #5
0
    def DrawItem(self, mdc):
        # rect = self.GetRect()

        windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        textColor = colorUtils.GetSuitable(windowColor, 1)

        mdc.SetTextForeground(textColor)

        self.UpdateElementsPos(mdc)

        self.toolbar.SetPosition((self.toolbarx, self.toolbary))

        if self.GetState() & SFItem.SB_ITEM_HIGHLIGHTED:
            shipEffBk = self.shipEffBkMirrored
        else:
            shipEffBk = self.shipEffBk

        mdc.DrawBitmap(shipEffBk, self.shipEffx, self.shipEffy, 0)

        mdc.DrawBitmap(self.shipBmp, self.shipBmpx, self.shipBmpy, 0)

        mdc.DrawBitmap(self.raceDropShadowBmp, self.raceBmpx + 1,
                       self.raceBmpy + 1)
        mdc.DrawBitmap(self.raceBmp, self.raceBmpx, self.raceBmpy)

        shipName, shipTrait, fittings = self.shipFittingInfo

        if fittings < 1:
            fformat = "No fits"
        elif fittings == 1:
            fformat = "%d fit"
        else:
            fformat = "%d fits"

        mdc.SetFont(self.fontNormal)
        mdc.DrawText(fformat % fittings if fittings > 0 else fformat,
                     self.textStartx, self.fittingsy)

        mdc.SetFont(self.fontSmall)
        mdc.DrawText(self.toolbar.hoverLabel, self.thoverx, self.thovery)

        mdc.SetFont(self.fontBig)

        psname = drawUtils.GetPartialText(
            mdc, shipName,
            self.toolbarx - self.textStartx - self.padding * 2 - self.thoverw)

        mdc.DrawText(psname, self.textStartx, self.shipNamey)

        if self.tcFitName.IsShown():
            self.AdjustControlSizePos(
                self.tcFitName, self.textStartx,
                self.toolbarx - self.editWidth - self.padding)
Exemple #6
0
    def DrawItem(self, mdc):
        # rect = self.GetRect()
        self.UpdateElementsPos(mdc)

        windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        textColor = colorUtils.GetSuitable(windowColor, 1)

        mdc.SetTextForeground(textColor)
        mdc.DrawBitmap(self.dropShadowBitmap, self.shipBmpx + 1,
                       self.shipBmpy + 1)
        mdc.DrawBitmap(self.shipBmp, self.shipBmpx, self.shipBmpy, 0)

        mdc.SetFont(self.fontBig)

        categoryName, fittings = self.fittingInfo

        mdc.DrawText(categoryName, self.catx, self.caty)
Exemple #7
0
    def DrawText(self, dc):
        height = self.tab_height
        dc.SetFont(self.font)

        if self.tab_bmp:
            text_start = self.left_width + self.padding + self.tab_bmp.GetWidth() / 2
        else:
            text_start = self.left_width

        maxsize = self.tab_width \
            - text_start \
            - self.right_width \
            - self.padding * 4
        color = self.selected_color if self.selected else self.inactive_color

        dc.SetTextForeground(color_utils.GetSuitable(color, 1))

        # draw text (with no ellipses)
        text = draw.GetPartialText(dc, self.text, maxsize, "")
        tx, ty = dc.GetTextExtent(text)
        dc.DrawText(text, text_start + self.padding, height / 2 - ty / 2)
Exemple #8
0
 def InitColors(self):
     """Determines colors used for tab, based on system settings"""
     self.tab_color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)
     self.inactive_color = color_utils.GetSuitable(self.tab_color, 0.25)
     self.selected_color = color_utils.GetSuitable(self.tab_color, 0.10)
Exemple #9
0
    def _Render(self):
        """Renders the tab, complete with the icon, text, and close button"""
        if self.tab_bitmap:
            del self.tab_bitmap

        height = self.tab_height

        canvas = wx.Bitmap(self.tab_width, self.tab_height, 24)

        mdc = wx.MemoryDC()

        mdc.SelectObject(canvas)
        mdc.Clear()

        mdc.DrawBitmap(self.tab_back_bitmap, 0, 0, True)

        # draw the tab icon
        if self.tab_img:
            bmp = wx.Bitmap(self.tab_img.ConvertToGreyscale() if self.
                            disabled else self.tab_img)
            # @todo: is this conditional relevant anymore?
            if self.content_width > 16:
                # Draw tab icon
                mdc.DrawBitmap(
                    bmp, self.left_width + self.padding - bmp.GetWidth() / 2,
                    (height - bmp.GetHeight()) / 2)
            text_start = self.left_width + self.padding + bmp.GetWidth() / 2
        else:
            text_start = self.left_width

        mdc.SetFont(self.font)

        maxsize = self.tab_width \
            - text_start \
            - self.right_width \
            - self.padding * 4
        color = self.selected_color if self.selected else self.inactive_color

        mdc.SetTextForeground(color_utils.GetSuitable(color, 1))

        # draw text (with no ellipses)
        text = draw.GetPartialText(mdc, self.text, maxsize, "")
        tx, ty = mdc.GetTextExtent(text)
        mdc.DrawText(text, text_start + self.padding, height / 2 - ty / 2)

        # draw close button
        if self.closeable:
            if self.close_btn_hovering:
                cbmp = self.ctab_close_bmp
            else:
                cimg = self.ctab_close_bmp.ConvertToImage()
                cimg = cimg.AdjustChannels(0.7, 0.7, 0.7, 0.3)
                cbmp = wx.Bitmap(cimg)

            mdc.DrawBitmap(
                cbmp,
                self.content_width + self.left_width - cbmp.GetWidth() / 2,
                (height - cbmp.GetHeight()) / 2)

        mdc.SelectObject(wx.NullBitmap)

        canvas.SetMaskColour((0x12, 0x23, 0x32))
        img = canvas.ConvertToImage()

        if not img.HasAlpha():
            img.InitAlpha()

        bmp = wx.Bitmap(img)
        self.tab_bitmap = bmp