bugfix
This commit is contained in:
parent
e476868041
commit
d310b3ad9f
@ -32,7 +32,14 @@ class BoxViewer(BoxLayout):
|
||||
self.parenturl = None
|
||||
self.dataloader = None
|
||||
self.initflag = False
|
||||
BoxLayout.__init__(self, orientation='vertical')
|
||||
remind = ['toolbar',
|
||||
'dataloader',
|
||||
'orientation',
|
||||
'viewer',
|
||||
'boxwidth',
|
||||
'boxheight']
|
||||
kwargs = {k:v for k,v in options if k not in remind }
|
||||
BoxLayout.__init__(self, orientation='vertical', **kwargs)
|
||||
self.selected_data = None
|
||||
self.options = options
|
||||
self.box_width = CSize(options['boxwidth'])
|
||||
|
@ -29,7 +29,7 @@ class NewWidget(Widget):
|
||||
|
||||
def getParentColorLevel(self):
|
||||
if not self.parent:
|
||||
self.fcolor, self.bgcolor = getColors(self.color_level):
|
||||
self.fcolor, self.bgcolor = getColors(self.color_level)
|
||||
|
||||
def on_color_level(self,o,v=None):
|
||||
if bgcolor != [] and fcolor != []:
|
||||
|
@ -4,6 +4,7 @@ from kivy.logger import Logger
|
||||
class SwipeBehavior(object):
|
||||
def __init__(self, **kwargs):
|
||||
object.__init__(self)
|
||||
self.swipeenable = True
|
||||
self.register_event_type('on_context_menu')
|
||||
self.register_event_type('on_swipe_left')
|
||||
self.register_event_type('on_swipe_right')
|
||||
@ -14,11 +15,17 @@ class SwipeBehavior(object):
|
||||
self.sb_start_time = None
|
||||
self.sb_end_time = None
|
||||
self.threshold=20
|
||||
self.threshold_time = 1.5
|
||||
self.threshold_time = 0.6
|
||||
self.bind(on_touch_down=self.on_touchdown)
|
||||
self.bind(on_touch_move=self.on_touchmove)
|
||||
self.bind(on_touch_up=self.on_touchup)
|
||||
|
||||
def disable_swipe(self):
|
||||
self.swipeenable = False
|
||||
|
||||
def enable_swipe(self):
|
||||
self.swipeenable = True
|
||||
|
||||
def on_context_menu(self):
|
||||
Logger.info('SwipeBehavior:on_context_menu fired')
|
||||
|
||||
@ -34,15 +41,21 @@ class SwipeBehavior(object):
|
||||
def on_swipe_down(self):
|
||||
Logger.info('SwipeBehavior:on_swipe_down fired')
|
||||
|
||||
def on_touchdown(self,o,touch):
|
||||
def on_touchdown(self,o, touch):
|
||||
if touch.is_mouse_scrolling:
|
||||
Logger.info('SwipeBehavior:is_mouse_scrolling')
|
||||
return False
|
||||
if not self.collide_point(touch.x, touch.y):
|
||||
return False
|
||||
|
||||
Logger.info('SwipeBehavior:touch_down fired')
|
||||
if self.collide_point(*touch.pos):
|
||||
if self.swipeenable:
|
||||
Logger.info('SwipeBehavior:touch_down fired')
|
||||
self.sb_start_point = touch.pos
|
||||
self.sb_start_time = time.time()
|
||||
|
||||
def on_touchmove(self,o,touch):
|
||||
if self.collide_point(*touch.pos):
|
||||
if self.collide_point(*touch.pos) and self.swipeenable:
|
||||
Logger.info('SwipeBehavior:touch_move fired')
|
||||
if self.sb_start_point is None:
|
||||
self.sb_start_point = touch.pos
|
||||
@ -50,7 +63,7 @@ class SwipeBehavior(object):
|
||||
self.sb_end_point = touch.pos
|
||||
|
||||
def on_touchup(self,o,touch):
|
||||
if self.collide_point(*touch.pos):
|
||||
if self.collide_point(*touch.pos) and self.swipeenable:
|
||||
Logger.info('SwipeBehavior:touch_up fired')
|
||||
self.sb_end_point = touch.pos
|
||||
self.sb_end_time = time.time()
|
||||
@ -66,7 +79,10 @@ class SwipeBehavior(object):
|
||||
return
|
||||
if not self.sb_end_time:
|
||||
return
|
||||
if self.sb_end_time - self.sb_start_time > self.threshold_time:
|
||||
period_time = self.sb_end_time - self.sb_start_time
|
||||
Logger.info('SwipeBehavior:period_time=%f,threshold_time=%f',
|
||||
period_time, self.threshold_time)
|
||||
if period_time >= self.threshold_time:
|
||||
self.dispatch('on_context_menu')
|
||||
|
||||
def check_swipe(self):
|
||||
|
@ -431,7 +431,7 @@ class PopupMenu(BoxLayout):
|
||||
def __init__(self,target,menudesc,**opts):
|
||||
self.target = target
|
||||
self.menudesc = menudesc
|
||||
BoxLayout.__init__(self, size_hint=(0.5,0.5))
|
||||
BoxLayout.__init__(self, size_hint=(0.5,0.5), **opts)
|
||||
self.menu_tree = TextTree(**menudesc)
|
||||
self.add_widget(self.menu_tree)
|
||||
self.menu_tree.bind(on_press=self.onMenuItemTouch)
|
||||
|
@ -1,6 +1,8 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from appPublic.sockPackage import get_free_local_addr
|
||||
from kivy.utils import platform
|
||||
from traceback import print_exc
|
||||
from kivy.core.window import Window
|
||||
@ -22,7 +24,7 @@ from pythonosc import dispatcher, osc_server
|
||||
from ffpyplayer.tools import set_log_callback
|
||||
from .utils import *
|
||||
from .paging import PageLoader
|
||||
from .baseWidget import PressableImage, get_local_addr
|
||||
from .baseWidget import PressableImage
|
||||
from .swipebehavior import SwipeBehavior
|
||||
|
||||
desktopOSs=[
|
||||
@ -235,11 +237,9 @@ class Swipe_VPlayer(BaseVPlayer, SwipeBehavior):
|
||||
|
||||
class OSC_VPlayer(BaseVPlayer):
|
||||
def __init__(self,vfile=None, loop=False, mute=False):
|
||||
self.ip = ip
|
||||
self.port = port
|
||||
self.dispatcher = dispatcher.Dispatcher()
|
||||
addr = get_local_addr
|
||||
self.ip,self.port = get_local_addr()
|
||||
self.ip,self.port = get_free_local_addr()
|
||||
self.server = osc_server.ThreadingOSCUDPServer( (self.ip,self.port),
|
||||
self.dispatcher)
|
||||
BaseVPlayer.__init__(self,vfile=vfile, loop=loop, mute=mute)
|
||||
|
Loading…
Reference in New Issue
Block a user