本文整理匯總了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