bugfix
This commit is contained in:
parent
d310b3ad9f
commit
8bd812834c
@ -38,7 +38,7 @@ class BoxViewer(BoxLayout):
|
|||||||
'viewer',
|
'viewer',
|
||||||
'boxwidth',
|
'boxwidth',
|
||||||
'boxheight']
|
'boxheight']
|
||||||
kwargs = {k:v for k,v in options if k not in remind }
|
kwargs = {k:v for k,v in options.items() if k not in remind }
|
||||||
BoxLayout.__init__(self, orientation='vertical', **kwargs)
|
BoxLayout.__init__(self, orientation='vertical', **kwargs)
|
||||||
self.selected_data = None
|
self.selected_data = None
|
||||||
self.options = options
|
self.options = options
|
||||||
|
@ -27,36 +27,41 @@ class SwipeBehavior(object):
|
|||||||
self.swipeenable = True
|
self.swipeenable = True
|
||||||
|
|
||||||
def on_context_menu(self):
|
def on_context_menu(self):
|
||||||
Logger.info('SwipeBehavior:on_context_menu fired')
|
pass
|
||||||
|
# Logger.info('SwipeBehavior:on_context_menu fired')
|
||||||
|
|
||||||
def on_swipe_left(self):
|
def on_swipe_left(self):
|
||||||
Logger.info('SwipeBehavior:on_swipe_left fired')
|
pass
|
||||||
|
# Logger.info('SwipeBehavior:on_swipe_left fired')
|
||||||
|
|
||||||
def on_swipe_right(self):
|
def on_swipe_right(self):
|
||||||
Logger.info('SwipeBehavior:on_swipe_right fired')
|
pass
|
||||||
|
# Logger.info('SwipeBehavior:on_swipe_right fired')
|
||||||
|
|
||||||
def on_swipe_up(self):
|
def on_swipe_up(self):
|
||||||
Logger.info('SwipeBehavior:on_swipe_up fired')
|
pass
|
||||||
|
# Logger.info('SwipeBehavior:on_swipe_up fired')
|
||||||
|
|
||||||
def on_swipe_down(self):
|
def on_swipe_down(self):
|
||||||
Logger.info('SwipeBehavior:on_swipe_down fired')
|
pass
|
||||||
|
# Logger.info('SwipeBehavior:on_swipe_down fired')
|
||||||
|
|
||||||
def on_touchdown(self,o, touch):
|
def on_touchdown(self,o, touch):
|
||||||
if touch.is_mouse_scrolling:
|
if touch.is_mouse_scrolling:
|
||||||
Logger.info('SwipeBehavior:is_mouse_scrolling')
|
# Logger.info('SwipeBehavior:is_mouse_scrolling')
|
||||||
return False
|
return False
|
||||||
if not self.collide_point(touch.x, touch.y):
|
if not self.collide_point(touch.x, touch.y):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
Logger.info('SwipeBehavior:touch_down fired')
|
# Logger.info('SwipeBehavior:touch_down fired')
|
||||||
if self.swipeenable:
|
if self.swipeenable:
|
||||||
Logger.info('SwipeBehavior:touch_down fired')
|
# Logger.info('SwipeBehavior:touch_down fired')
|
||||||
self.sb_start_point = touch.pos
|
self.sb_start_point = touch.pos
|
||||||
self.sb_start_time = time.time()
|
self.sb_start_time = time.time()
|
||||||
|
|
||||||
def on_touchmove(self,o,touch):
|
def on_touchmove(self,o,touch):
|
||||||
if self.collide_point(*touch.pos) and self.swipeenable:
|
if self.collide_point(*touch.pos) and self.swipeenable:
|
||||||
Logger.info('SwipeBehavior:touch_move fired')
|
# Logger.info('SwipeBehavior:touch_move fired')
|
||||||
if self.sb_start_point is None:
|
if self.sb_start_point is None:
|
||||||
self.sb_start_point = touch.pos
|
self.sb_start_point = touch.pos
|
||||||
else:
|
else:
|
||||||
@ -64,7 +69,7 @@ class SwipeBehavior(object):
|
|||||||
|
|
||||||
def on_touchup(self,o,touch):
|
def on_touchup(self,o,touch):
|
||||||
if self.collide_point(*touch.pos) and self.swipeenable:
|
if self.collide_point(*touch.pos) and self.swipeenable:
|
||||||
Logger.info('SwipeBehavior:touch_up fired')
|
# Logger.info('SwipeBehavior:touch_up fired')
|
||||||
self.sb_end_point = touch.pos
|
self.sb_end_point = touch.pos
|
||||||
self.sb_end_time = time.time()
|
self.sb_end_time = time.time()
|
||||||
self.check_context_menu()
|
self.check_context_menu()
|
||||||
@ -80,8 +85,8 @@ class SwipeBehavior(object):
|
|||||||
if not self.sb_end_time:
|
if not self.sb_end_time:
|
||||||
return
|
return
|
||||||
period_time = self.sb_end_time - self.sb_start_time
|
period_time = self.sb_end_time - self.sb_start_time
|
||||||
Logger.info('SwipeBehavior:period_time=%f,threshold_time=%f',
|
# Logger.info('SwipeBehavior:period_time=%f,threshold_time=%f',
|
||||||
period_time, self.threshold_time)
|
# period_time, self.threshold_time)
|
||||||
if period_time >= self.threshold_time:
|
if period_time >= self.threshold_time:
|
||||||
self.dispatch('on_context_menu')
|
self.dispatch('on_context_menu')
|
||||||
|
|
||||||
@ -102,7 +107,7 @@ class SwipeBehavior(object):
|
|||||||
self.threshold:
|
self.threshold:
|
||||||
self.dispatch('on_swipe_left')
|
self.dispatch('on_swipe_left')
|
||||||
else:
|
else:
|
||||||
Logger.info('SwipeBehavior:check_swipe x<y')
|
# Logger.info('SwipeBehavior:check_swipe x<y')
|
||||||
if self.sb_end_point[1] - self.sb_start_point[1] >= \
|
if self.sb_end_point[1] - self.sb_start_point[1] >= \
|
||||||
self.threshold:
|
self.threshold:
|
||||||
self.dispatch('on_swipe_up')
|
self.dispatch('on_swipe_up')
|
||||||
|
Loading…
Reference in New Issue
Block a user