This commit is contained in:
yumoqing 2022-09-09 12:08:40 +08:00
parent a2148f9585
commit 6b8082fc86
4 changed files with 48 additions and 4 deletions

View File

@ -17,6 +17,7 @@ from kivy.core.window import WindowBase, Window
from kivy.clock import Clock
from kivy.logger import Logger
from kivy.utils import platform
from kivy.metrics import Metrics
from kivy.app import App
import plyer
@ -76,6 +77,8 @@ class BlocksApp(App):
self.public_headers = {
"platform":self.platform
}
# Window.borderless = True
print('Window.dpi=', Window.dpi, 'Metrics.dpi=', Metrics.dpi)
Window.bind(on_request_close=self.on_close)
Window.bind(on_rotate=self.on_rotate)
Window.bind(size=self.device_info)

View File

@ -142,7 +142,7 @@ class FFVideo(WidgetReady, Image):
Line()
Line(points=[0, 0, self.width, 0], width=1)
Color(1,0,0,1)
Line(points=[0,2,p,0], width=2)
Line(points=[0,1,p,1], width=1)
self.position = self._position
def __del__(self):

View File

@ -2,7 +2,9 @@
from kivy.core.window import Window
from kivy.uix.widget import Widget
from kivy.app import App
from kivy.clock import Clock
from kivy.factory import Factory
from kivy.utils import platform
from .baseWidget import VBox, HBox
from .toggleitems import PressableBox
from .utils import *
@ -56,6 +58,7 @@ in control bar, there is a optional left menu icon, page title, right menu icon,
PagePanel description file format
```
{
"bar_autohide": true when page is idle
"bar_size": bar size in CSize unit
"bar_at": "top" or "bottom"
"bar_css":
@ -136,13 +139,19 @@ sub-widget's description file format
csscls='default',
singlepage=False,
fixed_before=None,
bar_autohide=False,
fixed_after=None,
bar_at='top',
enable_on_close=False,
left_menu=None, **kw):
self.bar_size = bar_size
self.bar_autohide = bar_autohide
self.bar_at = bar_at
self.singlepage = singlepage
self.idle_status = False
self.idle_threshold = 10
self.bar_show = True
self.idle_task = None
self.swipe_buffer = []
self.swipe_right = False
self.fixed_before = None
@ -229,15 +238,47 @@ sub-widget's description file format
})
self.bar.add_widget(self.bar_right_menu)
self.bar_right_menu_w.bind(on_press=self.show_right_menu)
self.construct()
if self.bar_autohide:
Window.bind(on_touch_down=self.set_normal_bar)
self.idle_task = Clock.schedule_once(self.set_idle_bar, \
self.idle_threshold)
if bar_at == 'top':
def set_idle_bar(self, *args):
if not self.bar_show:
return
try:
self.bar_pos = self.children.index(self.bar)
print('self.bar_pos=', self.bar_pos, '......................')
super().remove_widget(self.bar)
if platform in ['win', 'macosx','linux']:
Window.borderless = True
except:
pass
self.bar_show = False
def set_normal_bar(self, *args):
if self.idle_task:
self.idle_task.cancel()
self.idle_task = Clock.schedule_once(self.set_idle_bar, \
self.idle_threshold)
if self.bar_show:
return
super().add_widget(self.bar, index=self.bar_pos)
if platform in ['win', 'macosx','linux']:
Window.borderless = False
self.bar_show = True
def construct(self):
self.clear_widgets()
if self.bar_show and self.bar_at == 'top':
super().add_widget(self.bar)
if self.fixed_before:
super().add_widget(self.fixed_before)
super().add_widget(self.content)
if self.fixed_after:
super().add_widget(self.fixed_after)
if bar_at != 'top':
if self.bar_show and self.bar_at != 'top':
super().add_widget(self.bar)
self.left_menu_showed = False
self.right_menu_showed = False

View File

@ -1 +1 @@
__version__ = '0.3.4'
__version__ = '0.3.5'