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

Method MouseClick

gui/builtinShipBrowser/sfBrowserItem.py:140–176  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

138 return doRefresh
139
140 def MouseClick(self, event):
141 bx = self.toolbarX
142 for button in self.buttons:
143 if not button.IsVisible():
144 continue
145
146 state = button.GetState()
147 if state & BTN_PRESSED:
148 button.SetState(state ^ BTN_PRESSED)
149 if self.HitTest((bx, self.toolbarY), event.GetPosition(), button.GetSize()):
150 return button
151 else:
152 return False
153 bwidth, bheight = button.GetSize()
154 bx += bwidth + self.padding
155
156 bx = self.toolbarX
157 for button in self.buttons:
158 if not button.IsVisible():
159 continue
160
161 state = button.GetState()
162
163 if self.HitTest((bx, self.toolbarY), event.GetPosition(), button.GetSize()):
164
165 if event.LeftDown() or event.LeftDClick():
166 button.SetState(state | BTN_PRESSED)
167 return button
168
169 elif event.LeftUp():
170 button.SetState(state | (not BTN_PRESSED))
171 return button
172
173 bwidth, bheight = button.GetSize()
174 bx += bwidth + self.padding
175
176 return None
177
178 def GetWidth(self):
179 bx = 0

Callers 2

OnLeftUpMethod · 0.80
OnLeftDownMethod · 0.80

Calls 6

HitTestMethod · 0.95
IsVisibleMethod · 0.80
SetStateMethod · 0.80
GetStateMethod · 0.45
GetPositionMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected