Python kivy.uix.modalview.ModalView() Examples
The following are 18
code examples of kivy.uix.modalview.ModalView().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
kivy.uix.modalview
, or try the search function
.
Example #1
Source File: dialog.py From Blogs-Posts-Tutorials with MIT License | 6 votes |
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
Example #2
Source File: heatmapview.py From RaceCapture_App with GNU General Public License v3.0 | 6 votes |
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()
Example #3
Source File: inspector.py From Tickeys-linux with MIT License | 6 votes |
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)
Example #4
Source File: inspector.py From Tickeys-linux with MIT License | 6 votes |
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)
Example #5
Source File: dashboardview.py From RaceCapture_App with GNU General Public License v3.0 | 6 votes |
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()
Example #6
Source File: dialog.py From KivyMD with MIT License | 6 votes |
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
Example #7
Source File: infoview.py From RaceCapture_App with GNU General Public License v3.0 | 6 votes |
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)
Example #8
Source File: custom_widgets.py From TriFusion with GNU General Public License v3.0 | 5 votes |
def __init__(self, **kwargs): super(ModalView, self).__init__(**kwargs)
Example #9
Source File: dialog.py From Blogs-Posts-Tutorials with MIT License | 5 votes |
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
Example #10
Source File: dialogs.py From CreatorKivyProject with MIT License | 5 votes |
def card(content, title=None, background_color=None, size=(0.7, 0.5)): """Вывод диалоговых окон с кастомным контентом.""" if not background_color: background_color = [1.0, 1.0, 1.0, 1] card = MDCard(size_hint=(1, 1), padding=5) # , background_color=background_color) if title: box = BoxLayout(orientation="vertical", padding=dp(8)) box.add_widget( MDLabel( text=title, theme_text_color="Secondary", font_style="Title", size_hint_y=None, height=dp(36), ) ) box.add_widget(MDSeparator(height=dp(1))) box.add_widget(content) card.add_widget(box) else: card.add_widget(content) dialog = ModalView(size_hint=size, background_color=[0, 0, 0, 0.2]) dialog.add_widget(card) # dialog.open() return dialog
Example #11
Source File: stopwatch.py From RaceCapture_App with GNU General Public License v3.0 | 5 votes |
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)
Example #12
Source File: infoview.py From RaceCapture_App with GNU General Public License v3.0 | 5 votes |
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)
Example #13
Source File: GUI.py From Tickeys-linux with MIT License | 5 votes |
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()
Example #14
Source File: modal_cursor.py From Snu-Photo-Manager with GNU Lesser General Public License v3.0 | 5 votes |
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
Example #15
Source File: interpreter.py From Pyonic-interpreter with GNU General Public License v3.0 | 5 votes |
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
Example #16
Source File: interpreter.py From Pyonic-interpreter with GNU General Public License v3.0 | 5 votes |
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.
Example #17
Source File: modal_cursor.py From kivystudio with MIT License | 5 votes |
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)
Example #18
Source File: dialog.py From KivyMD with MIT License | 5 votes |
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