(width, height, gStart, gEnd, gMid=None, fillRatio=4)
| 35 | |
| 36 | |
| 37 | def DrawGradientBar(width, height, gStart, gEnd, gMid=None, fillRatio=4): |
| 38 | if width == 0 or height == 0: |
| 39 | return None |
| 40 | canvas = wx.Bitmap(round(width), round(height)) |
| 41 | |
| 42 | mdc = wx.MemoryDC() |
| 43 | mdc.SelectObject(canvas) |
| 44 | |
| 45 | r = wx.Rect(0, 0, width, height) |
| 46 | r.SetHeight(round(height / fillRatio)) |
| 47 | |
| 48 | if gMid is None: |
| 49 | gMid = gStart |
| 50 | |
| 51 | mdc.GradientFillLinear(r, gStart, gMid, wx.SOUTH) |
| 52 | r.SetTop(r.GetHeight()) |
| 53 | r.SetHeight(round(height * (fillRatio - 1) / fillRatio + (1 if height % fillRatio != 0 else 0))) |
| 54 | |
| 55 | mdc.GradientFillLinear(r, gMid, gEnd, wx.SOUTH) |
| 56 | |
| 57 | mdc.SelectObject(wx.NullBitmap) |
| 58 | |
| 59 | return canvas |
| 60 | |
| 61 | |
| 62 | def GetPartialText(dc, text , maxWidth, defEllipsis="..."): |
no test coverage detected