This commit is contained in:
yumoqing 2022-12-16 18:14:59 +08:00
parent 8e9719ac57
commit 263636779b
9 changed files with 38 additions and 23 deletions

BIN
kivyblocks/imgs/.DS_Store vendored Normal file

Binary file not shown.

BIN
kivyblocks/imgs/photo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -4,15 +4,16 @@ from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.app import App
from .utils import CSize
from .bgcolorbehavior import BGColorBehavior
from .utils import CSize, SUPER
from .widget_css import WidgetCSS
from .ready import WidgetReady
class PageContainer(WidgetReady, BGColorBehavior, FloatLayout):
class PageContainer(WidgetReady, WidgetCSS, FloatLayout):
def __init__(self,**kw):
FloatLayout.__init__(self, **kw)
BGColorBehavior.__init__(self)
WidgetReady.__init__(self)
SUPER(PageContainer, self, kw)
# FloatLayout.__init__(self, **kw)
# BGColorBehavior.__init__(self)
# WidgetReady.__init__(self)
self.show_back = True
self.pageWidgets = []
self.backButton = Button(text='<',size_hint=(None,None),

View File

@ -24,18 +24,15 @@ from appPublic.uniqueID import getID
from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem
from kivy.clock import Clock
from kivy.factory import Factory
from .utils import SUPER
from .widget_css import WidgetCSS
from .bgcolorbehavior import BGColorBehavior
class TabsPanel(BGColorBehavior, TabbedPanel):
def __init__(self,color_level=-1,
radius=[],
tabs=[],
**options):
class TabsPanel(WidgetCSS, TabbedPanel):
def __init__(self, tabs=[], **options):
self.tabs_list = tabs
TabbedPanel.__init__(self,**options)
BGColorBehavior.__init__(self,color_level=color_level,
radius=radius)
SUPER(TabsPanel, self, options)
# TabbedPanel.__init__(self,**options)
# BGColorBehavior.__init__(self)
Clock.schedule_once(self.add_tabs,0)
def newname(self):

View File

@ -1,10 +1,13 @@
import io
from traceback import print_exc
import time
import numpy as np
from ffpyplayer.player import MediaPlayer
from ffpyplayer.tools import set_log_callback
from PIL import Image as PILImage
from ffpyplayer.pic import Image as FFImage
from kivy.factory import Factory
from kivy.app import App
from kivy.core.window import Window
@ -12,11 +15,12 @@ from kivy.uix.image import Image
from kivy.uix.widget import Widget
from kivy.clock import Clock
from kivy.properties import StringProperty, BooleanProperty, \
OptionProperty, NumericProperty
OptionProperty, NumericProperty, ListProperty
from kivy.graphics.texture import Texture
from kivy.graphics import Color, Line, Rectangle
from kivyblocks.ready import WidgetReady
from kivyblocks.baseWidget import Running
from appPublic.registerfunction import getRegisterFunctionByName
class VideoBehavior(object):
v_src = StringProperty(None)
@ -31,6 +35,7 @@ class VideoBehavior(object):
volume = NumericProperty(-1)
timeout = NumericProperty(5)
auto_play=BooleanProperty(True)
prehandlers = ListProperty([])
repeat=BooleanProperty(False)
in_center_focus = BooleanProperty(False)
renderto = OptionProperty('foreground', options=['background', 'foreground', 'cover'])
@ -62,6 +67,15 @@ class VideoBehavior(object):
for k, v in kwargs.items():
setattr(self, k, v)
def prehandle(self, img):
if len(self.prehandlers) == 0:
return img
for her in self.prehandlers:
f = getRegisterFunctionByName(her)
if f:
img = f(img)
return img
def video_blocked(self, *args):
self._play_stop()
self.on_v_src(None, None)
@ -298,6 +312,7 @@ class VideoBehavior(object):
self.is_black = True
def show_yuv420(self, img):
img = self.prehandle(img)
w, h = img.get_size()
w2 = int(w / 2)
h2 = int(h / 2)
@ -328,6 +343,7 @@ class VideoBehavior(object):
# self.texture = texture
def show_others(self, img):
img = self.prehandle(img)
w, h = img.get_size()
texture = Texture.create(size=(w, h), colorfmt='rgb')
texture.blit_buffer(

View File

@ -52,7 +52,7 @@ class WidgetCSS(object):
bg_func = Rectangle
def on_canvas(self, o, s):
#Logger.info('WidgetCSS:on_canvas():%s',self.__class__.__name__)
Logger.info('WidgetCSS:on_canvas():%s',self.__class__.__name__)
self.set_background_color()
def on_size(self, o, s):
@ -164,8 +164,8 @@ class WidgetCSS(object):
self.set_background_color()
def set_background_color(self, *args):
if self.width == 100 and self.height == 100:
return
# if self.width == 100 and self.height == 100:
# return
if not self.bgcolor:
return
if not self.canvas:

View File

@ -4,7 +4,7 @@
"size_hint":[0.5, 0.5],
"ModalBehavior":{
"auto_open":true,
"position":"tr",
"anchor":"br",
"auto_dismiss":true
}
},

View File

@ -2,8 +2,9 @@
"widgettype":"BoxLayout",
"options":{
"VideoBehavior":{
"v_src":"/home/ymq/c/songs/alone-braver.mkv",
"v_src":"/Volumes/data/share/songs/alone-braver.mkv",
"renderto":"background",
"repeat":true,
"auto_play":true
}
},

View File

@ -2,7 +2,7 @@
"widgettype":"BoxLayout",
"options":{
"VideoBehavior":{
"v_src":"/home/ymq/c/songs/undr-sky.mkv",
"v_src":"/home/ymq/d/share/songs/undr-sky.mkv",
"renderto":"background",
"auto_play":true
}