(self, event)
| 219 | (self._value, self._max_range if float(self._max_range) > 0.01 else 0)) |
| 220 | |
| 221 | def OnPaint(self, event): |
| 222 | dc = wx.AutoBufferedPaintDC(self) |
| 223 | rect = self.GetClientRect() |
| 224 | |
| 225 | dc.SetBackground(wx.Brush(self.GetBackgroundColour())) |
| 226 | dc.Clear() |
| 227 | |
| 228 | colour = self.GetBackgroundColour() |
| 229 | |
| 230 | dc.SetBrush(wx.Brush(colour)) |
| 231 | dc.SetPen(wx.Pen(colour)) |
| 232 | |
| 233 | dc.DrawRectangle(rect) |
| 234 | |
| 235 | value = self._percentage |
| 236 | |
| 237 | if self._timer: |
| 238 | if self._timer.IsRunning(): |
| 239 | value = self._anim_value |
| 240 | |
| 241 | if self._border_colour: |
| 242 | dc.SetPen(wx.Pen(self.GetBorderColour())) |
| 243 | dc.DrawRectangle(rect) |
| 244 | pad = 1 + self.GetBorderPadding() |
| 245 | rect.Deflate(pad, pad) |
| 246 | |
| 247 | if self.GetBarColour(): |
| 248 | # if we have a bar color set, then we will use this |
| 249 | |
| 250 | colour = self.GetBarColour() |
| 251 | dc.SetBrush(wx.Brush(colour)) |
| 252 | dc.SetPen(wx.Pen(colour)) |
| 253 | |
| 254 | # calculate width of bar and draw it |
| 255 | if value > 100: |
| 256 | w = rect.width |
| 257 | else: |
| 258 | w = rect.width * (float(value) / 100) |
| 259 | r = copy.copy(rect) |
| 260 | r.width = round(w) |
| 261 | dc.DrawRectangle(r) |
| 262 | else: |
| 263 | # if bar color is not set, then we use pre-defined transitions |
| 264 | # for the colors based on the percentage value |
| 265 | |
| 266 | # calculate width of bar |
| 267 | if value > 100: |
| 268 | w = rect.width |
| 269 | else: |
| 270 | w = rect.width * (float(value) / 100) |
| 271 | r = copy.copy(rect) |
| 272 | r.width = round(w) |
| 273 | |
| 274 | # determine transition range number and calculate xv (which is the |
| 275 | # progress between the two transition ranges) |
| 276 | pv = value |
| 277 | if pv <= 100: |
| 278 | xv = pv / 100 |
nothing calls this directly
no test coverage detected