This commit is contained in:
yumoqing 2020-06-03 11:23:34 +08:00
parent edac4f5c1d
commit 7e3d2f2a8c
5 changed files with 31 additions and 20 deletions

View File

@ -125,7 +125,10 @@ class FILEDataHandler(EventDispatcher):
for i in range(self.page_rows): for i in range(self.page_rows):
try: try:
r = self.files[page * self.page_rows + i] r = self.files[page * self.page_rows + i]
d['rows'].append({'filename':r}) d['rows'].append({'filename':r,
'id':r,
'url':r
})
except: except:
break break
self.dispatch('on_success',d) self.dispatch('on_success',d)
@ -154,7 +157,7 @@ class HTTPDataHandler(EventDispatcher):
pass pass
def onSuccess(self,o,v): def onSuccess(self,o,v):
print(__file__,'onSuccess():v=',v) # print(__file__,'onSuccess():v=',v)
self.dispatch('on_success',v) self.dispatch('on_success',v)
def onError(self,o,e): def onError(self,o,e):

View File

@ -6,6 +6,7 @@ import signal
from appPublic.jsonConfig import getConfig from appPublic.jsonConfig import getConfig
from appPublic.folderUtils import ProgramPath from appPublic.folderUtils import ProgramPath
from kivy.factory import Factory
from kivy.config import Config from kivy.config import Config
from kivy.metrics import sp,dp,mm from kivy.metrics import sp,dp,mm
from kivy.core.window import WindowBase, Window from kivy.core.window import WindowBase, Window
@ -107,13 +108,19 @@ def appBlocksHack(app):
class BlocksApp(App): class BlocksApp(App):
def build(self): def build(self):
appBlocksHack(self)
root = PageContainer() root = PageContainer()
x = None x = None
config = getConfig() config = getConfig()
x = self.blocks.widgetBuild(config.root) blocks = Factory.Blocks()
if x is None: blocks.bind(on_built=self.addTopWidget)
alert(str(self.config.root)+': cannt build widget') blocks.bind(on_error=self.showError)
return root blocks.widgetBuild(config.root)
root.add_widget(x)
return root return root
def addTopWidget(self,o,w):
self.root.add_widget(w)
def showError(self,o,e):
alert(str(self.config.root)+': cannt build widget')

View File

@ -12,7 +12,7 @@ class PageContainer(FloatLayout):
self.pageWidgets = [] self.pageWidgets = []
self.backButton = Button(text='<',size_hint=(None,None), self.backButton = Button(text='<',size_hint=(None,None),
font_size=CSize(1), font_size=CSize(1),
height=CSize(1.8),width=CSize(1.8)) height=CSize(1.8),width=CSize(4))
self.backButton.bind(on_press=self.previous) self.backButton.bind(on_press=self.previous)
Window.bind(size=self.on_window_size) Window.bind(size=self.on_window_size)
@ -36,6 +36,7 @@ class PageContainer(FloatLayout):
if self.show_back: if self.show_back:
return return
super(PageContainer,self).add_widget(self.backButton) super(PageContainer,self).add_widget(self.backButton)
self.backButton.text = '<%d' % len(self.pageWidgets)
self.show_back = True self.show_back = True
def showLastPage(self): def showLastPage(self):

View File

@ -1,6 +1,7 @@
import time import time
from threading import Thread, Lock, BoundedSemaphore from threading import Thread, Lock, BoundedSemaphore
import requests import requests
from functools import wraps
from kivy.event import EventDispatcher from kivy.event import EventDispatcher
from kivy.clock import Clock from kivy.clock import Clock
@ -101,13 +102,13 @@ class HttpClient:
headers.update({'session':sessionid}) headers.update({'session':sessionid})
elif app.getAuthHeader(): elif app.getAuthHeader():
headers.update(app.getAuthHeader()) headers.update(app.getAuthHeader())
print('headers=',headers) # print('headers=',headers)
if method in ['GET']: if method in ['GET']:
req = requests.Request(method,url, req = requests.Request(method,url,
params=params,headers=headers) params=params,headers=headers,verify=False)
else: else:
req = requests.Request(method,url, req = requests.Request(method,url,
data=params,files=files,headers=headers) data=params,files=files,headers=headers,verify=False)
prepped = self.s.prepare_request(req) prepped = self.s.prepare_request(req)
resp = self.s.send(prepped) resp = self.s.send(prepped)
if resp.status_code == 200: if resp.status_code == 200:

View File

@ -70,14 +70,13 @@ class BaseVPlayer(FloatLayout, SwipeBehavior):
self.setSource(vfile) self.setSource(vfile)
def positionChanged(self,o,v): def positionChanged(self,o,v):
pass if self.muteFlg:
self._video.volume = 0
def playVideo(self,o=None,v=None): def playVideo(self,o=None,v=None):
# print('-------------VPlayer():playVideo()') # print('-------------VPlayer():playVideo()')
self._video.state = 'play' self._video.state = 'play'
self.nextdir = None self.nextdir = None
if self.muteFlg:
self.setVolume(None,0)
def setSource(self,s): def setSource(self,s):
self.stop() self.stop()
@ -123,8 +122,6 @@ class BaseVPlayer(FloatLayout, SwipeBehavior):
def on_state(self,o=None,v=None): def on_state(self,o=None,v=None):
if self._video.state == 'play': if self._video.state == 'play':
Window.allow_screensaver = False Window.allow_screensaver = False
if self.muteFlg:
self.setVolume(None,0)
else: else:
Window.allow_screensaver = True Window.allow_screensaver = True
if self._video.state == 'stop': if self._video.state == 'stop':
@ -203,6 +200,10 @@ class BaseVPlayer(FloatLayout, SwipeBehavior):
def setVolume(self,obj,v): def setVolume(self,obj,v):
self._video.volume = v self._video.volume = v
if v >= 0.01:
self.muteFlg = False
else:
self.muteFlg = True
def setPosition(self,obj,v): def setPosition(self,obj,v):
self._video.seek(v) self._video.seek(v)
@ -251,16 +252,14 @@ class OSCController:
class VPlayer(BaseVPlayer): class VPlayer(BaseVPlayer):
def __init__(self,vfile=None, loop=False,mute=False, opbar=True): def __init__(self,vfile=None, loop=False,mute=False, opbar=True):
super().__init__(vfile=vfile,loop=loop,mute=mute)
self.opbar = opbar self.opbar = opbar
self.menubar = None self.menubar = None
self._popup = None self._popup = None
self.menu_status = False self.menu_status = False
self.manualMode = False self.manualMode = False
self.pb = None self.pb = None
super().__init__(vfile=vfile,loop=loop,mute=mute)
self._video.bind(on_touch_down=self.show_hide_menu) self._video.bind(on_touch_down=self.show_hide_menu)
if self.loop:
self.eos = 'loop'
def totime(self,dur): def totime(self,dur):
h = dur / 3600 h = dur / 3600