Skip to content

Commit

Permalink
Update colors before on_start
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Dynamos committed Apr 14, 2024
1 parent 51c099c commit e71dc87
Show file tree
Hide file tree
Showing 64 changed files with 7 additions and 110 deletions.
1 change: 0 additions & 1 deletion examples/bottomappbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ async def generate_card():
}
)

super().on_start()
self.on_tap_card()
fake = Faker()
Clock.schedule_once(lambda x: asynckivy.start(generate_card()))
Expand Down
1 change: 0 additions & 1 deletion examples/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def disabled_widgets(self):
button.disabled = not button.disabled

def on_start(self):
super().on_start()
styles = ["standard", "filled", "outlined", "tonal"]
color_disabled = [
0.4627450980392157,
Expand Down
1 change: 0 additions & 1 deletion examples/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def build(self):
return Builder.load_string(KV)

def on_start(self):
super().on_start()
color_disabled = [
0.4627450980392157,
0.47058823529411764,
Expand Down
1 change: 0 additions & 1 deletion examples/checkbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def build(self):
return Builder.load_string(KV)

def on_start(self):
super().on_start()
self.root.ids.widget_box.add_widget(MDCheckbox())
self.root.ids.custom_widget_box.add_widget(
MDCheckbox(
Expand Down
1 change: 0 additions & 1 deletion examples/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def build(self):
return Builder.load_string(KV)

def on_start(self):
super().on_start()
for chip_type in ["assist", "input", "suggestion", "filter"]:
self.root.ids.widget_box.add_widget(
MDChip(
Expand Down
1 change: 0 additions & 1 deletion examples/dynamic_color_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def generate_cards(self, *args):
)

def on_start(self):
super().on_start()
Clock.schedule_once(self.generate_cards)


Expand Down
1 change: 0 additions & 1 deletion examples/dynamic_color_schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def build(self):
return Builder.load_string(KV)

def on_start(self):
super().on_start()
parent_widget = self.root.ids.widget_box.parent.parent
parent_widget.clear_widgets()
self.container = Container()
Expand Down
1 change: 0 additions & 1 deletion examples/expansionpanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ async def set_panel_list():
await asynckivy.sleep(0)
self.root.ids.container.add_widget(ExpansionPanelItem())

super().on_start()
asynckivy.start(set_panel_list())

def build(self):
Expand Down
1 change: 0 additions & 1 deletion examples/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def create_widgets(self):
)

def on_start(self):
super().on_start()
self.create_widgets()


Expand Down
1 change: 0 additions & 1 deletion examples/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def on_tap_list_item(self, list_item: MDListItem):
print("on_tap_list_item")

def on_start(self):
super().on_start()
self.root.ids.widget_box.orientation = "vertical"
self.root.ids.widget_box.add_widget(
MDListItem(
Expand Down
1 change: 0 additions & 1 deletion examples/material_scroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def build(self):
return Builder.load_string(MAIN_KV)

def on_start(self):
super().on_start()
info = {
"Name": [
os.name,
Expand Down
1 change: 0 additions & 1 deletion examples/navigation_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def on_switch_tabs(
...

def on_start(self):
super().on_start()
self.root.ids.widget_box.height = dp(80)
self.root.ids.widget_box.add_widget(
MDNavigationBar(
Expand Down
1 change: 0 additions & 1 deletion examples/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def build(self):
return Builder.load_string(KV)

def on_start(self):
super().on_start()
self.root.ids.widget_box.add_widget(
MDSlider(
MDSliderHandle(),
Expand Down
1 change: 0 additions & 1 deletion examples/snackbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def disabled_widgets(self):
...

def on_start(self):
super().on_start()
data = {
"Single-line snackbar": self.show_snack_single_line,
"Single-line snackbar with action": self.show_snack_single_line_with_action,
Expand Down
1 change: 0 additions & 1 deletion examples/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def build(self):
return Builder.load_string(KV)

def on_start(self):
super().on_start()
self.root.ids.widget_box.add_widget(
MDSwitch(
icon_active="check",
Expand Down
1 change: 0 additions & 1 deletion examples/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

class Example(MDApp, CommonApp):
def on_start(self):
super().on_start()
for type_tabs in ["primary", "secondary"]:
if type_tabs == "primary":
tabs = self.root.ids.primary_tabs
Expand Down
1 change: 0 additions & 1 deletion examples/textfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def build(self):
return Builder.load_string(KV)

def on_start(self):
super().on_start()
for mode in ["outlined", "filled", "required"]:
self.root.ids.widget_box.add_widget(
MDTextField(
Expand Down
30 changes: 7 additions & 23 deletions kivymd/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def build(self):
return Builder.load_string(KV)
def on_start(self):
super().on_start()
self.fps_monitor_start()
Expand All @@ -50,7 +49,6 @@ def build(self):
[...]
def on_start(self):
super().on_start()
[...]
"""

Expand Down Expand Up @@ -135,27 +133,13 @@ def __init__(self, **kwargs):
super().__init__(**kwargs)
self.theme_cls = ThemeManager()

def on_start(self):
"""
Event handler for the `on_start` event which is fired after
initialization (after build() has been called) but before the
application has started running.
.. versionadded:: 2.0.0
"""

def on_start(*args):
self.theme_cls.bind(
theme_style=lambda *x: Clock.schedule_once(
self.theme_cls.update_theme_colors, 0.1
),
primary_palette=lambda *x: Clock.schedule_once(
self.theme_cls.set_colors, 0.1
),
)
self.theme_cls.set_colors()

Clock.schedule_once(on_start)
def _run_prepare(self):
self.theme_cls.bind(
theme_style=self.theme_cls.update_theme_colors,
primary_palette=self.theme_cls.set_colors
)
self.theme_cls.set_colors()
super()._run_prepare()

def load_all_kv_files(self, path_to_directory: str) -> None:
"""
Expand Down
2 changes: 0 additions & 2 deletions kivymd/dynamic_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ def generate_cards(self, *args):
)
def on_start(self):
super().on_start()
Clock.schedule_once(self.generate_cards)
Expand Down Expand Up @@ -267,7 +266,6 @@ def generate_cards(self, *args):
)
def on_start(self):
super().on_start()
Clock.schedule_once(self.generate_cards)
Expand Down
2 changes: 0 additions & 2 deletions kivymd/icon_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def build(self):
return self.screen
def on_start(self):
super().on_start()
self.screen.set_list_md_icons()
Expand Down Expand Up @@ -7669,7 +7668,6 @@ def build(self):
return self.screen

def on_start(self):
super().on_start()
self.screen.set_list_md_icons()

MainApp().run()
1 change: 0 additions & 1 deletion kivymd/tests/button/test_bg_color_after_changed_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def change_palette(self, *args):
Clock.schedule_once(self.check_button_colors, 1.2)

def on_start(self):
super().on_start()
Clock.schedule_once(self.change_palette, 1.2)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/button/test_fab_size_m3_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def check_size_button(self, *args):
self.stop()

def on_start(self):
super().on_start()
styles = ["standard", "small", "large"]
for style in styles:
self.root.ids.box.add_widget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def check_button_md_bg_color_disabled(self, button):
].rgba == [1.0, 0.0, 0.0, 1.0]

def on_start(self):
super().on_start()
self.generate_buttons()


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/button/test_md_icon_button_icon_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def check_icon_size(self, *args):
self.stop()

def on_start(self):
super().on_start()
Clock.schedule_once(self.check_icon_size, 1.2)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/button/test_on_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def press_button(self, *args):
Clock.schedule_once(self.check_release_flag, 2)

def on_start(self):
super().on_start()
Clock.schedule_once(self.press_button, 1)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/button/test_outline_button_custom_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def check_button_colors(self, *args):
self.stop()

def on_start(self):
super().on_start()
Clock.schedule_once(self.check_button_colors, 1.2)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def check_button_colors_control(dt):
Clock.schedule_once(check_button_colors_control, 1.2)

def on_start(self):
super().on_start()
Clock.schedule_once(self.check_button_colors, 1.2)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/button/test_size_hint.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def check_button_size(self, button):
self.stop()

def on_start(self):
super().on_start()
self.generate_buttons()


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/hero/test_with_first_screen_without_hero.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def set_screen_with_hero_from(self, *args):
Clock.schedule_once(self.move_hero_to_another_screen, 1)

def on_start(self):
super().on_start()
Clock.schedule_once(self.set_screen_with_hero_from, 1)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_allow_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def on_start(*args):
touch = MouseMotionEvent("mouse", "button", self.root.ids.label.pos)
self.root.ids.label.on_double_tap(touch, ())

super().on_start()
Clock.schedule_once(on_start, 1)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_color_deselection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def check_selection(self, *args):
self.stop()

def on_start(self):
super().on_start()
self.touch = MouseMotionEvent(
"mouse", "button", self.root.ids.label.pos
)
Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_color_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def check_selection(self, *args):
self.stop()

def on_start(self):
super().on_start()
touch = MouseMotionEvent("mouse", "button", self.root.ids.label.pos)
self.root.ids.label.on_double_tap(touch, ())
Clock.schedule_once(self.check_selection)
Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_default_theme_text_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ async def generate_labels(self):
self.stop()

def on_start(self):
super().on_start()
asynckivy.start(self.generate_labels())


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_disabled_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def check_disabled_color(self, *args):
self.stop()

def on_start(self):
super().on_start()
Clock.schedule_once(self.check_disabled_color, 1)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_font_size_in_python_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def build(self):
)

def on_start(self):
super().on_start()
Clock.schedule_once(self.check_font_size, 1.2)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_font_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def on_start(*args):
)
self.stop()

super().on_start()
Clock.schedule_once(on_start, 2)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_md_icon_badge_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def check_badge_colors(self, *args):
self.stop()

def on_start(self):
super().on_start()
Clock.schedule_once(self.check_badge_colors, 2)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def check_badge_colors(self, *args):
self.stop()

def on_start(self):
super().on_start()
Clock.schedule_once(self.icon_undisabled, 1)
Clock.schedule_once(self.check_badge_colors, 2)

Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_switch_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def switch_screen_two(self, *args):
self.root.current = "screen two"

def on_start(self):
super().on_start()
Clock.schedule_once(self.switch_screen_two, 1)

def build(self):
Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/label/test_theme_text_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def on_start(*args):
assert self.root.ids.label.text_color == [1.0, 0.0, 0.0, 1.0]
self.stop()

super().on_start()
Clock.schedule_once(on_start, 2)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/list/test_disable.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def _disable(*args):
self.root.ids.item4.disabled = True
Clock.schedule_once(_enabled, 1)

super().on_start()
Clock.schedule_once(_disable, 1)


Expand Down
1 change: 0 additions & 1 deletion kivymd/tests/test_md_bg_color_layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ async def generate_layouts(self):
self.stop()

def on_start(self):
super().on_start()
asynckivy.start(self.generate_layouts())

def check_md_bg_color(self, widget):
Expand Down
Loading

0 comments on commit e71dc87

Please sign in to comment.