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

View File

@ -6,6 +6,7 @@ import signal
from appPublic.jsonConfig import getConfig
from appPublic.folderUtils import ProgramPath
from kivy.factory import Factory
from kivy.config import Config
from kivy.metrics import sp,dp,mm
from kivy.core.window import WindowBase, Window
@ -107,13 +108,19 @@ def appBlocksHack(app):
class BlocksApp(App):
def build(self):
appBlocksHack(self)
root = PageContainer()
x = None
config = getConfig()
x = self.blocks.widgetBuild(config.root)
if x is None:
alert(str(self.config.root)+': cannt build widget')
return root
root.add_widget(x)
blocks = Factory.Blocks()
blocks.bind(on_built=self.addTopWidget)
blocks.bind(on_error=self.showError)
blocks.widgetBuild(config.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.backButton = Button(text='<',size_hint=(None,None),
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)
Window.bind(size=self.on_window_size)
@ -36,6 +36,7 @@ class PageContainer(FloatLayout):
if self.show_back:
return
super(PageContainer,self).add_widget(self.backButton)
self.backButton.text = '<%d' % len(self.pageWidgets)
self.show_back = True
def showLastPage(self):

View File

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

View File

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