Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_display(self, width, height, name, bpp=24, **kwargs):
self.displays[name] = MpfDisplay(width=width, height=height, bpp=bpp)
Clock.schedule_once(self.display_created)
def _switch_picker(self, *a, **kw):
noanim = "noanim" in kw
if noanim:
noanim = kw["noanim"]
try:
container = self.ids.picker_container
except (AttributeError, NameError):
Clock.schedule_once(lambda *a: self._switch_picker(noanim=noanim))
if self.picker == "hours":
picker = self._h_picker
prevpicker = self._m_picker
elif self.picker == "minutes":
picker = self._m_picker
prevpicker = self._h_picker
if len(self._bound) > 0:
prevpicker.unbind(selected=self.on_selected)
self.unbind(**self._bound)
picker.bind(selected=self.on_selected)
self._bound = {"selector_color": picker.setter("selector_color"),
"color": picker.setter("color"),
"selector_alpha": picker.setter("selector_alpha")}
self.bind(**self._bound)
render.add_done_callback(lambda job:Clock.schedule_once(partial(self.on_render_finished,job),0.01))
def on_touch_up(self, touch):
if touch.grab_current is not self:
return
touch.ungrab(self)
self._num_touches -= 1
if self._pinch_flag:
if self._num_touches == 0:
# user was pinching, and now both fingers are up. Return
# to normal
if self.sv_idx > touch.ud['orig_sv_idx']:
Clock.schedule_once(
self.inertial_incr_sv_idx,
(Clock.get_time() - touch.ud['orig_time']) /
(self.sv_idx - touch.ud['orig_sv_idx']))
if self.sv_idx < touch.ud['orig_sv_idx']:
Clock.schedule_once(
self.inertial_decr_sv_idx,
(Clock.get_time() - touch.ud['orig_time']) /
(self.sv_idx - touch.ud['orig_sv_idx']))
self._pinch_flag = False
return
else:
# user was pinching, and at least one finger remains. We
# don't want to treat the remaining fingers as touches
return
def spawn_enemy_on_portal(self):
if not self.tile_with_portal.actor:
self.tile_with_portal.add_actor()
Clock.schedule_once(self.add_actor_to_portal, 0.7)
def dismiss(self, *largs):
'''Remove the dropdown widget from the window and detach it from
the attached widget.
'''
Clock.schedule_once(self._real_dismiss, self.min_state_time)
def purchase(self, sku):
# Really need to move these debug settings to a global
# settings file. Oh and they say that global settings files are bad.
# Let's get to the bottom of it.
if DEBUG:
self.debug_sku = sku
sku = 'android.test.purchased'
if sku not in self.skus:
self.skus.append(sku)
Logger.warning('IAB is running in DEBUG mode and won\'t buy anything!')
if self.purchase_requested is not None:
self._toast('purchase already in progress')
return False
elif self.syncing:
self.purchase_requested = sku
Clock.schedule_once(self._fail, TIMEOUT)
self._toast('will start purchase shortly')
return True
else:
Logger.info('Purchasing ' + sku)
if not self.setup_complete:
self._toast('will start purchase shortly')
else:
self._toast('purchase started')
self.purchase_requested = sku
Clock.schedule_once(self._fail, TIMEOUT)
self._process_purchase()
return True
def export_finish(self):
app = App.get_running_app()
content = MessagePopup(text='Exporting Collage')
if len(self.images) > 8:
message = 'Exporting Collage, This May Take Several Minutes, Please Wait...'
else:
message = 'Exporting Collage, Please Wait...'
self.popup = NormalPopup(title=message, content=content, size_hint=(None, None), size=(app.popup_x, app.button_scale * 4))
self.popup.open()
#Wait a cycle so the popup can display
Clock.schedule_once(self.export_process)
def plotNextPoint(self, *args):
point = self.listOfPointsToPlot[self.pointIndex]
self.pointIndex = self.pointIndex + 1
xValue = point[0]
yValue = point[1]
pointPlotted, distortedPoint = self.testPointGenerator.plotPoint(xValue, yValue)
self.listOfPointsPlotted.append(pointPlotted)
self.listOfDistortedPoints.append(distortedPoint)
if self.pointIndex < len(self.listOfPointsToPlot):
Clock.schedule_once(self.plotNextPoint)
else:
self.drawLines()