bugfix for on_close()

This commit is contained in:
yumoqing 2020-03-17 18:05:56 +08:00
parent 713111677f
commit beb7932daa
12 changed files with 20 additions and 16 deletions

View File

@ -10,6 +10,7 @@ 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
from kivy.clock import Clock from kivy.clock import Clock
from kivy.logger import Logger
import kivy import kivy
from kivy.resources import resource_add_path from kivy.resources import resource_add_path
@ -19,11 +20,7 @@ Config.set('kivy', 'default_font', [
'DroidSansFallback.ttf']) 'DroidSansFallback.ttf'])
from kivy.app import App from kivy.app import App
# from .baseWidget import baseWidgets
# from .widgetExt import Messager
# from .externalwidgetmanager import ExternalWidgetManager
from .threadcall import HttpClient,Workers from .threadcall import HttpClient,Workers
# from .derivedWidget import buildWidget, loadUserDefinedWidget
from .utils import * from .utils import *
from .pagescontainer import PageContainer from .pagescontainer import PageContainer
from .widgetExt.messager import Messager from .widgetExt.messager import Messager
@ -64,12 +61,19 @@ def signal_handler(signal, frame):
signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGINT, signal_handler)
def on_close(o,v=None): def on_close(*args,**kwargs):
""" """
catch the "x" button's event of window catch the "x" button's event of window
""" """
Logger.info('kivyblocks: on_close(), args=%s, kwargs=%s',str(args),str(kwargs))
app = App.get_running_app() app = App.get_running_app()
app.workers.running = False if len(app.root.pageWidgets) <= 1:
app.workers.running = False
Logger.info('kivyblocks: on_close(), return False')
return False
app.root.previous()
Logger.info('kivyblocks: on_close(), return True')
return True
def getAuthHeader(): def getAuthHeader():
app = App.get_running_app() app = App.get_running_app()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -334,29 +334,29 @@ class VPlayer(BaseVPlayer):
def buildMenu(self): def buildMenu(self):
self.menubar = BoxLayout(orientation='horizontal', self.menubar = BoxLayout(orientation='horizontal',
size_hint_y=None,height=CSize(1.4)) size_hint_y=None,height=CSize(1.4))
self.btn_pause = PressableImage(source=blockImage('pause.jpg'), self.btn_pause = PressableImage(source=blockImage('pause.png'),
size_hint=(None,None), size_hint=(None,None),
size=CSize(3,3) size=CSize(3,3)
) )
if self._video.state == 'pause': if self._video.state == 'pause':
self.btn_pause.source = blockImage('play.jpg') self.btn_pause.source = blockImage('play.png')
self.btn_pause.bind(on_press=self.pause) self.btn_pause.bind(on_press=self.pause)
self.menubar.add_widget(self.btn_pause) self.menubar.add_widget(self.btn_pause)
""" """
self.btn_mute = PressableImage(source=blockImage('mute.jpg'), self.btn_mute = PressableImage(source=blockImage('mute.png'),
size_hint=(None,None), size_hint=(None,None),
size=CSize(3,3) size=CSize(3,3)
) )
self.btn_mute.bind(on_press=self.mute) self.btn_mute.bind(on_press=self.mute)
self.menubar.add_widget(self.btn_mute) self.menubar.add_widget(self.btn_mute)
""" """
btn_cut = PressableImage(source=blockImage('next.jpg'), btn_cut = PressableImage(source=blockImage('next.png'),
size_hint=(None,None), size_hint=(None,None),
size=CSize(3,3) size=CSize(3,3)
) )
btn_cut.bind(on_press=self.endplay) btn_cut.bind(on_press=self.endplay)
self.menubar.add_widget(btn_cut) self.menubar.add_widget(btn_cut)
btn_replay = PressableImage(source=blockImage('replay.jpg'), btn_replay = PressableImage(source=blockImage('replay.png'),
size_hint=(None,None), size_hint=(None,None),
size=CSize(3,3) size=CSize(3,3)
) )
@ -364,7 +364,7 @@ class VPlayer(BaseVPlayer):
self.menubar.add_widget(btn_replay) self.menubar.add_widget(btn_replay)
self.btn_audioswitch = PressableImage( \ self.btn_audioswitch = PressableImage( \
source=blockImage('musictrack.jpg'), source=blockImage('musictrack.png'),
size_hint=(None,None), size_hint=(None,None),
size=CSize(3,3) size=CSize(3,3)
) )
@ -393,17 +393,17 @@ class VPlayer(BaseVPlayer):
BaseVPlayer.mute(self,btn) BaseVPlayer.mute(self,btn)
if self.menubar: if self.menubar:
if self._video.volume < 0.001: if self._video.volume < 0.001:
btn.source = blockImage('volume.jpg') btn.source = blockImage('volume.png')
else: else:
btn.source = blockImage('mute.jpg') btn.source = blockImage('mute.png')
def pause(self,t=None): def pause(self,t=None):
BaseVPlayer.pause(self,t) BaseVPlayer.pause(self,t)
if self.menubar: if self.menubar:
if self._video.state == 'pause': if self._video.state == 'pause':
self.btn_pause.source = blockImage('play.jpg') self.btn_pause.source = blockImage('play.png')
else: else:
self.btn_pause.source = blockImage('pause.jpg') self.btn_pause.source = blockImage('pause.png')
def on_state(self,o,v): def on_state(self,o,v):
BaseVPlayer.on_state(self,o,v) BaseVPlayer.on_state(self,o,v)