Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_test(self, app, *args):
Clock.schedule_interval(self.pause, 0.000001)
# Setup
app.main_window.finish_init(None)
# Execute
app.main_window.selected_view_profile()
# Assert
self.assertEqual("Cancel", app.profile_control.children[0].text)
self.assertEqual("Ban", app.profile_control.children[1].text)
self.assertEqual("Kick", app.profile_control.children[2].text)
self.assertEqual("Block", app.profile_control.children[3].text)
self.assertEqual("Profile", app.profile_control.children[4].text)
# Comment out if you are editing the test, it'll leave the
# Window opened.
app.stop()
def run_test(self, app, *args):
Clock.schedule_interval(self.pause, 0.000001)
# Do something
app.my_button.dispatch('on_release')
self.assertEqual('Hello Test', app.my_button.text)
#self.assertEqual('Fail Test', app.my_button.text)
# Comment out if you are editing the test, it'll leave the
# Window opened.
app.stop()
def __init__(self, **kwargs):
super(MultitouchCamera, self).__init__(**kwargs)
self.touches = []
self.touches_center = []
self.touches_dist = 0
Clock.schedule_interval(self.update_cam, 0)
def start(self):
super(CameraAndroid, self).start()
with self._buflock:
self._buffer = None
for k in range(2): # double buffer
buf = '\x00' * self._bufsize
self._android_camera.addCallbackBuffer(buf)
self._android_camera.setPreviewCallbackWithBuffer(self._preview_cb)
self._android_camera.startPreview()
if self._update_ev is not None:
self._update_ev.cancel()
self._update_ev = Clock.schedule_interval(self._update, 1 / self.fps)
def start(self, lbl):
self.pongfloat.remove_widget(lbl)
self.serve_ball()
Clock.schedule_interval(self.update, 1.0 / 30.0)
self.lock(True)
def build(self):
parent = Game()
parent.serve_car()
Clock.schedule_interval(parent.update, 1.0/120.0)
self.painter = MyPaintWidget()
clearbtn = Button(text = 'clear')
savebtn = Button(text = 'save', pos = (parent.width, 0))
loadbtn = Button(text = 'load', pos = (2 * parent.width, 0))
clearbtn.bind(on_release = self.clear_canvas)
savebtn.bind(on_release = self.save)
loadbtn.bind(on_release = self.load)
parent.add_widget(self.painter)
parent.add_widget(clearbtn)
parent.add_widget(savebtn)
parent.add_widget(loadbtn)
return parent
def reactor_start(*args):
'''Start the twisted reactor main loop
'''
Logger.info("Support: Starting twisted reactor")
reactor.interleave(reactor_wake, **kwargs)
Clock.schedule_interval(reactor_work, 0)
def enable(self):
self.facade.enable()
Clock.schedule_interval(self.tell, 1 / 20.)
ani = Animation(
x=0,
y=-1000,
t='in_out_quad',
opacity=0.0,
duration=.7)
ani.start(self.scrollview)
ani.start(self.preview_button)
# schedule a unlock
self.locked = True
Clock.schedule_once(self.unlock, .5)
# schedule an interval to update the preview widget
interval = pkConfig.getfloat('camera', 'preview-interval')
Clock.schedule_interval(self.update_preview, interval)
#=====================================================================
# P R E V I E W => N O R M A L
elif transition == ('preview', 'normal'):
self.scrollview_hidden = False
# cancel all running animations
Animation.cancel_all(self.scrollview)
Animation.cancel_all(self.background)
Animation.cancel_all(self.focus_widget)
Animation.cancel_all(self.preview_exit)
Animation.cancel_all(self.preview_widget)
Animation.cancel_all(self.preview_button)
# hide the preview exit button
ani = Animation(
def start_autoplay(self,*args,**kwargs ):
print 'starting_autoplay'
self.advance_one_move()
if 'message' in kwargs:
message = kwargs['message']
else:
message = True
interval = self.autoplay_dts[self.autoplay_index]
Clock.schedule_interval(self.advance_one_move, interval)
if message:
self.permanent_text = '[b]Autoplay[/b] activated. Tap either side of this box to speed up or slow down autoplay, or any navigation button to stop. Current speed = [b]{}[/b] seconds between stones\n'.format(interval)
else:
self.permanent_text = '[color=dddddd]Autoplaying with [b]{}[/b] seconds between stones[/color]\n'.format(interval)
print 'started autoplay, permanent text is'
print self.permanent_text
self.autoplaying = True
def toggle_autoplay(self,*args,**kwargs):