Compare commits
No commits in common. "e56811c7cf84fb9bec2ca104e0747be5d8602bc0" and "58a143a9ea137f0e15cbd3ef209d6f03c39fcf4a" have entirely different histories.
e56811c7cf
...
58a143a9ea
@ -127,14 +127,6 @@ def ScatterBox(WidgetCSS, WidgetReady, ScatterLayout):
|
|||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
super().__init__(**kw)
|
super().__init__(**kw)
|
||||||
|
|
||||||
class FBox(WidgetCSS, WidgetReady, FloatLayout):
|
|
||||||
def __init__(self, **kw):
|
|
||||||
try:
|
|
||||||
super(FBox, self).__init__(**kw)
|
|
||||||
except Exception as e:
|
|
||||||
print('Box(',kw,') Error')
|
|
||||||
raise e
|
|
||||||
|
|
||||||
class Box(WidgetCSS, WidgetReady, BoxLayout):
|
class Box(WidgetCSS, WidgetReady, BoxLayout):
|
||||||
def __init__(self, **kw):
|
def __init__(self, **kw):
|
||||||
try:
|
try:
|
||||||
@ -301,8 +293,7 @@ class Modal(VBox):
|
|||||||
self.dismiss()
|
self.dismiss()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
super().on_touch_down(touch)
|
return super().on_touch_down(touch)
|
||||||
return True
|
|
||||||
|
|
||||||
def on_target(self, o, target):
|
def on_target(self, o, target):
|
||||||
w = Window
|
w = Window
|
||||||
|
@ -455,7 +455,6 @@ x = ClassX{klass_cnt}()
|
|||||||
return Blocks.findWidget(desc.get('target'),from_widget=widget)
|
return Blocks.findWidget(desc.get('target'),from_widget=widget)
|
||||||
|
|
||||||
def blocksAction(self, widget:Widget, desc, *args):
|
def blocksAction(self, widget:Widget, desc, *args):
|
||||||
print('blocksACtion(),', desc)
|
|
||||||
target = self.get_target(widget, desc)
|
target = self.get_target(widget, desc)
|
||||||
add_mode = desc.get('mode','replace')
|
add_mode = desc.get('mode','replace')
|
||||||
opts = desc.get('options').copy()
|
opts = desc.get('options').copy()
|
||||||
|
@ -74,11 +74,9 @@ class Message(TimedModal):
|
|||||||
i18n=True,
|
i18n=True,
|
||||||
wrap=True,
|
wrap=True,
|
||||||
halign='left',
|
halign='left',
|
||||||
valign='center',
|
|
||||||
size_hint=(1,1),
|
size_hint=(1,1),
|
||||||
font_size=CSize(1)))
|
font_size=CSize(1)))
|
||||||
b.add_widget(b2)
|
b.add_widget(b2)
|
||||||
# b.add_widget(VBox())
|
|
||||||
self.add_widget(b)
|
self.add_widget(b)
|
||||||
|
|
||||||
class Error(Message):
|
class Error(Message):
|
||||||
|
@ -7,7 +7,6 @@ from appPublic.registerfunction import RegisterFunction
|
|||||||
import kivyblocks.clickable
|
import kivyblocks.clickable
|
||||||
import kivyblocks.multi_select
|
import kivyblocks.multi_select
|
||||||
|
|
||||||
from .videoplayer import VideoCtrls
|
|
||||||
from .baseWidget import *
|
from .baseWidget import *
|
||||||
from .container import Container
|
from .container import Container
|
||||||
from .tree import Tree, TextTree, MenuTree, PopupMenu
|
from .tree import Tree, TextTree, MenuTree, PopupMenu
|
||||||
@ -132,12 +131,10 @@ r('Title6',Title6)
|
|||||||
r('Modal',Modal)
|
r('Modal',Modal)
|
||||||
r('TimedModal',TimedModal)
|
r('TimedModal',TimedModal)
|
||||||
r('HBox',HBox)
|
r('HBox',HBox)
|
||||||
r('FBox',FBox)
|
|
||||||
r('VBox',VBox)
|
r('VBox',VBox)
|
||||||
r('SwipeBox',SwipeBox)
|
r('SwipeBox',SwipeBox)
|
||||||
r('ToggleItems',ToggleItems)
|
r('ToggleItems',ToggleItems)
|
||||||
r('Accordion', ExAccordion)
|
r('Accordion', ExAccordion)
|
||||||
r('VideoCtrls',VideoCtrls)
|
|
||||||
r('Slider', Slider)
|
r('Slider', Slider)
|
||||||
if platform == 'android':
|
if platform == 'android':
|
||||||
r('PhoneButton',PhoneButton)
|
r('PhoneButton',PhoneButton)
|
||||||
|
@ -77,7 +77,6 @@ class VideoBehavior(object):
|
|||||||
return img
|
return img
|
||||||
|
|
||||||
def video_blocked(self, *args):
|
def video_blocked(self, *args):
|
||||||
print('videobehavior.py:video_blocked() called')
|
|
||||||
self._play_stop()
|
self._play_stop()
|
||||||
self.on_v_src(None, None)
|
self.on_v_src(None, None)
|
||||||
|
|
||||||
@ -134,20 +133,6 @@ class VideoBehavior(object):
|
|||||||
|
|
||||||
self._player.set_volume(self.volume)
|
self._player.set_volume(self.volume)
|
||||||
|
|
||||||
def stop_timed_job(self):
|
|
||||||
if self._update_task:
|
|
||||||
self._update_task.cancel()
|
|
||||||
self._update_task = None
|
|
||||||
if self.vh_task:
|
|
||||||
self.vh_task.cancel()
|
|
||||||
self.vh_task = None
|
|
||||||
if self.start_task:
|
|
||||||
self.start_task.cancel()
|
|
||||||
self.start_task = None
|
|
||||||
if self.block_task:
|
|
||||||
self.block_task.cancel()
|
|
||||||
self.block_task = None
|
|
||||||
|
|
||||||
def on_status(self, *args):
|
def on_status(self, *args):
|
||||||
print('on_status called, ', self.status)
|
print('on_status called, ', self.status)
|
||||||
if self._player is None:
|
if self._player is None:
|
||||||
@ -159,9 +144,7 @@ class VideoBehavior(object):
|
|||||||
Window.allow_screensaver = False
|
Window.allow_screensaver = False
|
||||||
self._player.set_pause(False)
|
self._player.set_pause(False)
|
||||||
self.video_handle()
|
self.video_handle()
|
||||||
else:
|
elif self.status == 'pause':
|
||||||
self.stop_timed_job()
|
|
||||||
if self.status == 'pause':
|
|
||||||
self._player.set_pause(True)
|
self._player.set_pause(True)
|
||||||
elif self.status == 'stop':
|
elif self.status == 'stop':
|
||||||
self._play_stop()
|
self._play_stop()
|
||||||
@ -228,7 +211,6 @@ class VideoBehavior(object):
|
|||||||
self._player.request_channel('audio', action='cycle')
|
self._player.request_channel('audio', action='cycle')
|
||||||
|
|
||||||
def on_v_src(self, o, src):
|
def on_v_src(self, o, src):
|
||||||
print('videobehavior.py:on_v_src() called ...')
|
|
||||||
self.status = 'stop'
|
self.status = 'stop'
|
||||||
ff_opts = {
|
ff_opts = {
|
||||||
'pause':False
|
'pause':False
|
||||||
@ -286,6 +268,18 @@ class VideoBehavior(object):
|
|||||||
if self._player:
|
if self._player:
|
||||||
self._player.close_player()
|
self._player.close_player()
|
||||||
self._player = None
|
self._player = None
|
||||||
|
if self._update_task:
|
||||||
|
self._update_task.cancel()
|
||||||
|
self._update_task = None
|
||||||
|
if self.vh_task:
|
||||||
|
self.vh_task.cancel()
|
||||||
|
self.vh_task = None
|
||||||
|
if self.start_task:
|
||||||
|
self.start_task.cancel()
|
||||||
|
self.start_task = None
|
||||||
|
if self.block_task:
|
||||||
|
self.block_task.cancel()
|
||||||
|
self.block_task = None
|
||||||
self.next_frame = None
|
self.next_frame = None
|
||||||
self.duration = -1
|
self.duration = -1
|
||||||
self.position = 0
|
self.position = 0
|
||||||
@ -295,7 +289,6 @@ class VideoBehavior(object):
|
|||||||
if self.change_size_task:
|
if self.change_size_task:
|
||||||
self.change_size_task.cancel()
|
self.change_size_task.cancel()
|
||||||
self.change_size_task = Clock.schedule_once(self._set_video_size, 0.1)
|
self.change_size_task = Clock.schedule_once(self._set_video_size, 0.1)
|
||||||
|
|
||||||
def _set_video_size(self, *args):
|
def _set_video_size(self, *args):
|
||||||
if self._player is None:
|
if self._player is None:
|
||||||
return
|
return
|
||||||
@ -418,7 +411,6 @@ class VideoBehavior(object):
|
|||||||
return
|
return
|
||||||
frame, val = self._player.get_frame()
|
frame, val = self._player.get_frame()
|
||||||
if val == 'eof':
|
if val == 'eof':
|
||||||
print('video_handler(),val="eof"')
|
|
||||||
if self.repeat:
|
if self.repeat:
|
||||||
self.seek(0)
|
self.seek(0)
|
||||||
self.play()
|
self.play()
|
||||||
@ -428,7 +420,6 @@ class VideoBehavior(object):
|
|||||||
self.last_val = None
|
self.last_val = None
|
||||||
return
|
return
|
||||||
if val == 'pause':
|
if val == 'pause':
|
||||||
print('video_handle(), val="pause"')
|
|
||||||
self.status = 'pause'
|
self.status = 'pause'
|
||||||
self.last_val = None
|
self.last_val = None
|
||||||
return
|
return
|
||||||
@ -451,16 +442,11 @@ class VideoBehavior(object):
|
|||||||
self._update_task = Clock.schedule_once(self.do_update, 0)
|
self._update_task = Clock.schedule_once(self.do_update, 0)
|
||||||
|
|
||||||
def do_update(self, *args):
|
def do_update(self, *args):
|
||||||
if self.status != 'play':
|
|
||||||
return
|
|
||||||
self.stop_timed_job()
|
|
||||||
"""
|
|
||||||
if self.start_task:
|
if self.start_task:
|
||||||
self.start_task.cancel()
|
self.start_task.cancel()
|
||||||
self.start_task = None
|
self.start_task = None
|
||||||
if self.block_task:
|
if self.block_task:
|
||||||
self.block_task.cancel()
|
self.block_task.cancel()
|
||||||
"""
|
|
||||||
if not self.playing:
|
if not self.playing:
|
||||||
self.playing = True
|
self.playing = True
|
||||||
self._get_video_info()
|
self._get_video_info()
|
||||||
|
@ -1,124 +0,0 @@
|
|||||||
|
|
||||||
from kivy.base import EventDispatcher
|
|
||||||
from kivy.properties import DictProperty, BooleanProperty
|
|
||||||
from kivyblocks.toolbar import Toolbar
|
|
||||||
from kivyblocks.baseWidget import FBox
|
|
||||||
from kivyblocks.ffpyplayer_video import FFVideo
|
|
||||||
|
|
||||||
class VideoCtrls(FBox):
|
|
||||||
toolbar = DictProperty(None)
|
|
||||||
video = DictProperty({})
|
|
||||||
show_toolbar_state = BooleanProperty(False)
|
|
||||||
def __init__(self, **kw):
|
|
||||||
super().__init__(**kw)
|
|
||||||
self.v_w = FFVideo(**self.video)
|
|
||||||
self.tb_w = None
|
|
||||||
self.add_widget(self.v_w)
|
|
||||||
if self.toolbar:
|
|
||||||
self.tb_w = Toolbar(**self.toolbar)
|
|
||||||
self.tb_w.bind(on_press = self.tool_press)
|
|
||||||
self.tb_w.center = self.center
|
|
||||||
self.add_widget(self.tb_w)
|
|
||||||
self.on_show_toolbar_state(w=None, v=None)
|
|
||||||
|
|
||||||
self.actions = {
|
|
||||||
'play':self.play_or_pause,
|
|
||||||
'stop':self.play_stop,
|
|
||||||
'mute':self.mute_or_voice,
|
|
||||||
'forward':self.forward,
|
|
||||||
'back':self.back,
|
|
||||||
'switch_audio':self.switch_audio,
|
|
||||||
'fullscreen':self.fullscreen,
|
|
||||||
'next':self.play_next,
|
|
||||||
'previous':self.play_previous,
|
|
||||||
'voice_inc':self.voice_inc,
|
|
||||||
'voice_dec':self.voice_dec
|
|
||||||
}
|
|
||||||
acts = self.actions.keys()
|
|
||||||
tools = self.toolbar['tools']
|
|
||||||
for t in tools:
|
|
||||||
n = t['name']
|
|
||||||
if n not in acts:
|
|
||||||
event_name = f'on_{n}'
|
|
||||||
setattr(self, event_name, self.default_action)
|
|
||||||
self.register_event_type(event_name)
|
|
||||||
kwargs = {event_name:self.default_action}
|
|
||||||
self.bind(**kwargs)
|
|
||||||
|
|
||||||
self.v_w.bind(on_touch_down=self.on_press)
|
|
||||||
|
|
||||||
def on_show_toolbar_state(self, w, v):
|
|
||||||
print('on_show_toolbar_state() called ...')
|
|
||||||
if self.tb_w is None:
|
|
||||||
return
|
|
||||||
if self.show_toolbar_state:
|
|
||||||
if not self.tb_w in self.children:
|
|
||||||
self.add_widget(self.tb_w)
|
|
||||||
else:
|
|
||||||
if self.tb_w in self.children:
|
|
||||||
self.remove_widget(self.tb_w)
|
|
||||||
|
|
||||||
def play_next(self, w, v):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def play_previous(self, w, v):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def fullscreen(self, w, v):
|
|
||||||
self.fullscreen = not self.fullscreen
|
|
||||||
|
|
||||||
def on_press(self, w, v):
|
|
||||||
print('on_press() called ...')
|
|
||||||
self.show_toolbar_state = not self.show_toolbar_state
|
|
||||||
|
|
||||||
def tool_press(self, w, v):
|
|
||||||
eventname = f'on_{v["name"]}'
|
|
||||||
f = self.actions.get(v['name'], None)
|
|
||||||
if f:
|
|
||||||
return f(w, v)
|
|
||||||
self.dispatch(eventname,v)
|
|
||||||
|
|
||||||
def default_action(self, w, v=None):
|
|
||||||
print('event fire', v)
|
|
||||||
|
|
||||||
def play_or_pause(self, w, v):
|
|
||||||
if self.v_w.status == 'play':
|
|
||||||
self.v_w.pause()
|
|
||||||
else:
|
|
||||||
self.v_w.play()
|
|
||||||
|
|
||||||
def play_stop(self, w, v):
|
|
||||||
print('VideoPlayer():play_stop() called ...')
|
|
||||||
self.v_w.status = 'stop'
|
|
||||||
|
|
||||||
def forward(self, w, v):
|
|
||||||
pts = 0.03 * self.v_w.duration + self.position
|
|
||||||
if tps < self.v_w.duration:
|
|
||||||
self.v_w.seek(pts)
|
|
||||||
|
|
||||||
def back(self, w, v):
|
|
||||||
pts = self.postion - 0.03 * self.v_w.duration
|
|
||||||
if tps >= 0:
|
|
||||||
self.v_w.seek(pts)
|
|
||||||
|
|
||||||
def voice_inc(self, w, v):
|
|
||||||
if self.v_w.volume >= 1:
|
|
||||||
return
|
|
||||||
v = self.volume + 0.03
|
|
||||||
if v < 1:
|
|
||||||
self.v_w.set_volume(v)
|
|
||||||
|
|
||||||
def voice_dec(self, w, v):
|
|
||||||
if self.v_w.volume <= 0:
|
|
||||||
return
|
|
||||||
v - self.volume - 0.03
|
|
||||||
if v > 0:
|
|
||||||
self.v_w.set_volume(v)
|
|
||||||
|
|
||||||
def switch_audio(self, w, v=None):
|
|
||||||
self.v_w.switch_aduio()
|
|
||||||
|
|
||||||
def mute_or_voice(self, w, v):
|
|
||||||
self.v_w.mute()
|
|
||||||
|
|
||||||
|
|
@ -7,6 +7,5 @@
|
|||||||
"huge":5.5,
|
"huge":5.5,
|
||||||
"hugest":6.5
|
"hugest":6.5
|
||||||
},
|
},
|
||||||
"font_name":"normal",
|
"font_name":"normal"
|
||||||
"uihome":"wwwroot"
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user