This commit is contained in:
yumoqing 2022-06-24 16:41:43 +08:00
parent ebd0e3b0e0
commit 2b21e67bfd
5 changed files with 8 additions and 87 deletions

View File

@ -1,10 +1,6 @@
import os
# from kivy.logger import logging
__version_info__ = "0.5.0"
from .defaultimage import DefaultImage
from .version import __version__
path = os.path.dirname(__file__)
fonts_path = os.path.join(path,"ttf/")
images_path = os.path.join(path,'imgs/')
# logging.info("kivyblocks:kivblocks version:{}".format(__version__))

View File

@ -1,75 +0,0 @@
from kivy.logger import Logger
from kivy.graphics import Color, Rectangle
from kivy.properties import ListProperty, NumericProperty
from kivy.factory import Factory
from kivy.uix.widget import Widget
from .color_definitions import getColors
class NewWidget(Widget):
bgcolor = ListProperty([])
fcolor = ListProperty([])
color_level = NumericProperty(-1)
def __init__(self, color_level=-1,bgcolor=[],fcolor=[],**kwargs):
super().__init__(**kwargs)
self.bgcolor = bgcolor
self.fcolor = fcolor
self.color_level = color_level
self.initColors()
self.bind(size=self.onSize_bgcolor_behavior,
pos=self.onSize_bgcolor_behavior)
def initColors(self):
if self.color_level != -1:
fcolor, bgcolor = getColors(self.color_level)
if self.bgcolor == []:
self.bgcolor = bgcolor
if self.fcolor == []:
self.fcolor = fcolor
def getParentColorLevel(self):
if not self.parent:
self.fcolor, self.bgcolor = getColors(self.color_level)
def on_color_level(self,o,v=None):
if bgcolor != [] and fcolor != []:
return
if color_level != -1:
fcolor, bgcolor = getColors(self.color_level)
if self.bgcolor == []:
self.bgcolor = bgcolor
if self.fcolor == []:
self.fcolor = fcolor
def on_fcolor(self,o,v=None):
self.color = self.fcolor
def on_parent(self,o,v=None):
if self.color_level != -1:
self.fcolor, self.bgcolor = getColors(self.color_level)
if self.color_level == -1:
self.setColorsFromAncestor()
def onSize_bgcolor_behavior(self,o,v=None):
if not hasattr(self,'rect'):
self.on_bgcolor()
else:
self.rect.pos = o.pos
self.rect.size = o.size
def on_bgcolor(self,o=None,v=None):
if self.bgcolor == []:
return
if self.canvas:
with self.canvas.before:
Color(*self.bgcolor)
self.rect = Rectangle(pos=self.pos,
size=self.size)
try:
Factory.unregister('Widget')
except:
pass
Factory.register('Widget',cls=NewWidget)

View File

@ -28,6 +28,9 @@ from .message import Conform
from .pagepanel import PagePanel
from .markdown import Markdown
from .custom_camera import CustomCamera, QrReader
from .defaultimage import *
from .price import *
if kivy.platform in ['win','linux', 'macosx']:
from .camerawithmic import ScreenWithMic
from .camerawithmic import CameraWithMic

View File

@ -1,6 +1,8 @@
# __version__ = '0.2.8'
# add a new class DefaultImage, if the source load failed, source set to default_source
__version__ = '0.2.9'
#__version__ = '0.2.9'
# fix bug in ffpyplayer_video.py
__version__ = '0.2.10'
#__version__ = '0.2.10'
# fix bug in __init__.py, can not import kivy here
__version__ = '0.2.11'

View File

@ -134,8 +134,6 @@ class WidgetCSS(object):
self.bgcolor = toArrayColor(c)
def on_fgcolor(self, o, c):
#Logger.info('WidgetCSS:on_fgcolor:%s fgcolor=%s', self.__class__.__name__,
# self.fgcolor)
if not self.fgcolor:
return
if isinstance(self, TextInput):
@ -148,8 +146,6 @@ class WidgetCSS(object):
return
def on_bgcolor(self, o, c):
#Logger.info('WidgetCSS:on_bgcolor:%s bgcolor=%s', self.__class__.__name__,
# self.bgcolor)
if not self.bgcolor:
return
if isinstance(self, TextInput):
@ -169,14 +165,13 @@ class WidgetCSS(object):
def set_background_color(self, *args):
if not self.bgcolor:
#Logger.info('WidgetCSS: set_bg_color(), bgcolor is null, (%s)',
# self.__class__.__name__)
return
if not self.canvas:
#Logger.info('WidgetCSS: set_bg_color(), canvas is null(%s)',
# self.__class__.__name__)
return
# self.canvas.before.clear()
with self.canvas.before:
Color(*self.bgcolor)
if self.radius: