本文整理汇总了Python中kivy.uix.modalview.ModalView方法的典型用法代码示例。如果您正苦于以下问题:Python modalview.ModalView方法的具体用法?Python modalview.ModalView怎么用?Python modalview.ModalView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.modalview
的用法示例。
在下文中一共展示了modalview.ModalView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def open(self, *largs):
'''Show the view window from the :attr:`attach_to` widget. If set, it
will attach to the nearest window. If the widget is not attached to any
window, the view will attach to the global
:class:`~kivy.core.window.Window`.
'''
if self._window is not None:
Logger.warning('ModalView: you can only open once.')
return self
# search window
self._window = self._search_window()
if not self._window:
Logger.warning('ModalView: cannot open view, no window found.')
return self
self._window.add_widget(self)
self._window.bind(on_resize=self._align_center,
on_keyboard=self._handle_keyboard)
self.center = self._window.center
self.bind(size=self._update_center)
a = Animation(_anim_alpha=1., d=self._anim_duration)
a.bind(on_complete=lambda *x: self.dispatch('on_open'))
a.start(self)
return self
示例2: highlight_at
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def highlight_at(self, x, y):
widget = None
# reverse the loop - look at children on top first and
# modalviews before others
win_children = self.win.children
children = chain(
(c for c in reversed(win_children) if isinstance(c, ModalView)),
(c for c in reversed(win_children) if not isinstance(c, ModalView))
)
for child in children:
if child is self:
continue
widget = self.pick(child, x, y)
if widget:
break
self.highlight_widget(widget)
示例3: write_rcp_config
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def write_rcp_config(self, info_msg, callback):
def timeout(dt):
progress_view.dismiss()
Clock.schedule_once(lambda dt: callback(), 0.25)
def write_win(details):
msg.text += ' Success'
self.rc_config.stale = False
Clock.schedule_once(timeout, 1.5)
def write_fail(details):
progress_view.dismiss()
okPopup('Oops!',
'We had a problem updating the device. Check the device connection and try again.\n\nError:\n\n{}'.format(details),
lambda *args: None)
progress_view = ModalView(size_hint=(None, None), size=(dp(600), dp(200)))
msg = FieldLabel(text=info_msg, halign='center')
progress_view.add_widget(msg)
progress_view.open()
self.rc_api.writeRcpCfg(self.rc_config, write_win, write_fail)
示例4: on_preferences
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def on_preferences(self, *args):
"""
Display the dashboard preferences view
"""
settings_view = DashboardPreferences(self._settings, self._dashboard_factory)
def popup_dismissed(*args):
self._notify_preference_listeners()
screens = settings_view.get_selected_screens()
screens = self._filter_dashboard_screens(screens)
self._settings.userPrefs.set_dashboard_screens(screens)
self._update_screens(screens)
popup = ModalView(size_hint=DashboardView._POPUP_SIZE_HINT)
popup.add_widget(settings_view)
popup.bind(on_dismiss=popup_dismissed)
popup.open()
示例5: on_heatmap_options
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def on_heatmap_options(self):
def popup_dismissed(response):
self._update_heatmap_preferences()
settings_view = SettingsWithNoMenu()
base_dir = self._settings.base_dir
settings_view.add_json_panel('Heatmap Settings',
self._settings.userPrefs.config,
os.path.join(base_dir,
'autosportlabs',
'racecapture',
'views',
'dashboard',
'heatmap_settings.json'))
popup = ModalView(size_hint=HeatmapView._POPUP_SIZE_HINT)
popup.add_widget(settings_view)
popup.bind(on_dismiss=popup_dismissed)
popup.open()
示例6: open
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def open(self, *largs):
'''Show the view window from the :attr:`attach_to` widget. If set, it
will attach to the nearest window. If the widget is not attached to any
window, the view will attach to the global
:class:`~kivy.core.window.Window`.
'''
if self._window is not None:
Logger.warning('ModalView: you can only open once.')
return self
# search window
self._window = self._search_window()
if not self._window:
Logger.warning('ModalView: cannot open view, no window found.')
return self
self._window.add_widget(self)
self._window.bind(on_resize=self._align_center,
on_keyboard=self._handle_keyboard)
self.center = self._window.center
self.bind(size=self._align_center)
a = Animation(_anim_alpha=1., d=self._anim_duration)
a.bind(on_complete=lambda *x: self.dispatch('on_open'))
a.start(self)
return self
示例7: dismiss
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def dismiss(self, *largs, **kwargs):
'''Close the view if it is open. If you really want to close the
view, whatever the on_dismiss event returns, you can use the *force*
argument:
::
view = ModalView(...)
view.dismiss(force=True)
When the view is dismissed, it will be faded out before being
removed from the parent. If you don't want animation, use::
view.dismiss(animation=False)
'''
if self._window is None:
return self
if self.dispatch('on_dismiss') is True:
if kwargs.get('force', False) is not True:
return self
if kwargs.get('animation', True):
Animation(_anim_alpha=0., d=self._anim_duration).start(self)
else:
self._anim_alpha = 0
self._real_remove_widget()
return self
示例8: open
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def open(self, *largs):
self._window = self._search_window()
if not self._window:
Logger.warning('ModalView: cannot open view, no window found.')
return
if self.parent:
self.parent.remove_widget(self)
self._window.add_widget(self)
示例9: submit_text
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def submit_text(self, text):
self.submit_func(text)
# Window.softinput_mode = 'pan'
self.dismiss()
# This is the normal ModalView on_touch_down, with
# self.submit_func added to ensure that some text is submitted.
示例10: on_touch_down
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def on_touch_down(self, touch):
if not self.collide_point(*touch.pos):
if self.auto_dismiss:
self.submit_func(self.ids.ti.text)
self.dismiss()
return True
super(ModalView, self).on_touch_down(touch)
return True
# Again, modify the normal _handle_keyboard so that
# self.submit_func is called before self.dismiss
示例11: open
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def open(self, *largs):
self._window = self._search_window()
if not self._window:
Logger.warning('ModalView: cannot open view, no window found.')
return
try:
self._window.remove_widget(self)
self._window.add_widget(self)
except:
pass
示例12: set_language
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def set_language(self, language):
language_map = {
"English": "en_US",
"简体中文": "zh_CN"
}
self.parent.configer.lang = language_map.get(language, "en_US")
self.parent.configer.save_config()
# show popup hint
view = ModalView(size_hint=(None, None), size=(0, 0))
view.add_widget(Label(text=_("This will take effect next time you start"), font_size=30))
view.open()
示例13: __init__
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def __init__(self, **kwargs):
super(ModalView, self).__init__(**kwargs)
示例14: info_popup
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def info_popup(self, msg, callback):
def done():
view.dismiss()
Clock.schedule_once(lambda dt: callback(), 0.25)
view = ModalView(size_hint=(None, None), size=(dp(600), dp(200)))
msg = FieldLabel(halign='center', text=msg)
view.add_widget(msg)
view.open()
Clock.schedule_once(lambda dt: done(), 2.0)
示例15: _start_stopwatch
# 需要导入模块: from kivy.uix import modalview [as 别名]
# 或者: from kivy.uix.modalview import ModalView [as 别名]
def _start_stopwatch(self):
'''
Starts the stopwatch timer
'''
if not self._popup:
self._popup = ModalView(size_hint=self._POPUP_SIZE_HINT, auto_dismiss=False)
self._popup.add_widget(self)
self._set_exit_speed_frame_visible(False)
self._popup.open()
self._current_time = 0.0
self._start_time = time()
self._flash_count = 0
self._currently_racing = False
Clock.schedule_interval(self._tick_stopwatch, self._STOPWATCH_TICK)