MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / PyGauge

Class PyGauge

gui/pyfa_gauge.py:25–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23_t = wx.GetTranslation
24
25class PyGauge(wx.Window):
26 def __init__(self, parent, font, max_range=100, size=(-1, 30), *args,
27 **kargs):
28
29 super().__init__(parent, size=size, *args, **kargs)
30
31 self._size = size
32
33 self._border_colour = wx.BLACK
34 self._bar_colour = None
35 self._bar_gradient = None
36
37 self._border_padding = 0
38 self._max_range = max_range
39 self._value = 0
40
41 self._fraction_digits = 0
42
43 self._timer_id = wx.NewId()
44 self._timer = None
45
46 self._oldValue = 0
47
48 self._anim_duration = 500
49 self._anim_step = 0
50 self._period = 20
51 self._anim_value = 0
52 self._anim_direction = 0
53 self.anim_effect = anim_effects.OUT_QUAD
54
55 # transition colors used based on how full (or overfilled) the gauge is.
56 self.transition_colors = [
57 (wx.Colour(191, 191, 191), wx.Colour(96, 191, 0)), # < 0-100%
58 (wx.Colour(191, 167, 96), wx.Colour(255, 191, 0)), # < 100-101%
59 (wx.Colour(255, 191, 0), wx.Colour(255, 128, 0)), # < 101-103%
60 (wx.Colour(255, 128, 0), wx.Colour(255, 0, 0)) # < 103-105%
61 ]
62
63 self.gradient_effect = -35
64
65 self._percentage = 0
66 self._old_percentage = 0
67 self._show_remaining = False
68
69 self.font = font
70
71 self.SetBackgroundColour(wx.Colour(51, 51, 51))
72
73 self._tooltip = wx.ToolTip("0.00/100.00")
74 self.SetToolTip(self._tooltip)
75
76 self.Bind(wx.EVT_PAINT, self.OnPaint)
77 self.Bind(wx.EVT_TIMER, self.OnTimer)
78 self.Bind(wx.EVT_ENTER_WINDOW, self.OnWindowEnter)
79 self.Bind(wx.EVT_LEAVE_WINDOW, self.OnWindowLeave)
80 self.SetBackgroundStyle(wx.BG_STYLE_PAINT)
81
82 def OnEraseBackground(self, event):

Callers 2

populatePanelMethod · 0.90
populatePanelMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected