本文整理汇总了Python中kivy.uix.anchorlayout.AnchorLayout方法的典型用法代码示例。如果您正苦于以下问题:Python anchorlayout.AnchorLayout方法的具体用法?Python anchorlayout.AnchorLayout怎么用?Python anchorlayout.AnchorLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.anchorlayout
的用法示例。
在下文中一共展示了anchorlayout.AnchorLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_view
# 需要导入模块: from kivy.uix import anchorlayout [as 别名]
# 或者: from kivy.uix.anchorlayout import AnchorLayout [as 别名]
def _init_view(self):
databus = self._databus
settings = self._settings
dashboard_state = self._dashboard_state
self._init_global_gauges()
# add the initial set of empty screens
screens = self._screens
screens += self._filter_dashboard_screens(self._settings.userPrefs.get_dashboard_screens())
for i in range (0, len(screens)):
self.ids.carousel.add_widget(AnchorLayout())
# Find all of the global and set the objects they need
gauges = list(kvFindClass(self, DigitalGauge))
for gauge in gauges:
gauge.settings = settings
gauge.data_bus = databus
gauge.dashboard_state = dashboard_state
# Initialize our alert type widgets
self._alert_widgets['pit_stop'] = PitstopTimerView(databus, 'Pit Stop')
self._notify_preference_listeners()
self._show_last_view()
if self._rc_api.connected:
self._race_setup()
self._rc_api.add_connect_listener(self._on_rc_connect)
self._rc_api.addListener('alertmessage', self._on_alertmessage)
self._initialized = True
Clock.schedule_once(lambda dt: HelpInfo.help_popup('dashboard_gauge_help', self, arrow_pos='right_mid'), 2.0)
示例2: _update_screens
# 需要导入模块: from kivy.uix import anchorlayout [as 别名]
# 或者: from kivy.uix.anchorlayout import AnchorLayout [as 别名]
def _update_screens(self, new_screens):
"""
Remove and re-adds screens to match the new configuration
"""
# Prevent events from triggering and interfering with this update process
self._initialized = False
carousel = self.ids.carousel
current_screens = self._screens
loaded_screens = self._loaded_screens
new_screen_count = len(new_screens)
current_screen_count = len(current_screens)
original_screen_count = current_screen_count
# Note, our lazy loading scheme has the actual dashboard
# screens as part of the outer screen containers
# screen containers - placeholders.
# clear all of the dashboard screens from the outer container
for screen in loaded_screens.values():
parent = screen.parent
if parent is not None:
parent.remove_widget(screen)
# add more carousel panes as needed
while True:
if current_screen_count == new_screen_count:
break
if current_screen_count < new_screen_count:
carousel.add_widget(AnchorLayout())
current_screen_count += 1
if current_screen_count > new_screen_count:
carousel.remove_widget(carousel.slides[0])
current_screen_count -= 1
# Now re-add the screens for the new screen keys
for (screen_key, container) in zip(new_screens, carousel.slides):
screen = loaded_screens.get(screen_key)
if screen is not None:
container.add_widget(screen)
self._screens = new_screens
if original_screen_count == 0 and new_screen_count > original_screen_count:
carousel.index = 0
self._check_load_screen(carousel.current_slide)
self._initialized = True