flet 0.70.0.dev5771__py3-none-any.whl → 0.70.0.dev5776__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flet might be problematic. Click here for more details.

Files changed (65) hide show
  1. flet/controls/control.py +12 -6
  2. flet/controls/core/animated_switcher.py +3 -2
  3. flet/controls/core/autofill_group.py +6 -2
  4. flet/controls/core/dismissible.py +12 -10
  5. flet/controls/core/drag_target.py +3 -2
  6. flet/controls/core/draggable.py +9 -9
  7. flet/controls/core/icon.py +16 -12
  8. flet/controls/core/interactive_viewer.py +24 -23
  9. flet/controls/core/pagelet.py +3 -2
  10. flet/controls/core/reorderable_draggable.py +3 -2
  11. flet/controls/core/safe_area.py +3 -2
  12. flet/controls/core/text_span.py +5 -3
  13. flet/controls/core/window_drag_area.py +3 -2
  14. flet/controls/cupertino/cupertino_action_sheet.py +10 -5
  15. flet/controls/cupertino/cupertino_action_sheet_action.py +3 -4
  16. flet/controls/cupertino/cupertino_activity_indicator.py +4 -3
  17. flet/controls/cupertino/cupertino_alert_dialog.py +6 -3
  18. flet/controls/cupertino/cupertino_button.py +6 -5
  19. flet/controls/cupertino/cupertino_context_menu.py +8 -4
  20. flet/controls/cupertino/cupertino_context_menu_action.py +3 -4
  21. flet/controls/cupertino/cupertino_date_picker.py +44 -28
  22. flet/controls/cupertino/cupertino_dialog_action.py +3 -4
  23. flet/controls/cupertino/cupertino_list_tile.py +3 -4
  24. flet/controls/cupertino/cupertino_navigation_bar.py +6 -5
  25. flet/controls/cupertino/cupertino_picker.py +14 -10
  26. flet/controls/cupertino/cupertino_segmented_button.py +6 -5
  27. flet/controls/cupertino/cupertino_slider.py +16 -12
  28. flet/controls/cupertino/cupertino_sliding_segmented_button.py +6 -5
  29. flet/controls/cupertino/cupertino_timer_picker.py +38 -31
  30. flet/controls/material/alert_dialog.py +6 -5
  31. flet/controls/material/app_bar.py +17 -14
  32. flet/controls/material/banner.py +13 -11
  33. flet/controls/material/bottom_app_bar.py +5 -4
  34. flet/controls/material/bottom_sheet.py +5 -4
  35. flet/controls/material/button.py +12 -4
  36. flet/controls/material/chip.py +13 -12
  37. flet/controls/material/circle_avatar.py +17 -13
  38. flet/controls/material/datatable.py +48 -41
  39. flet/controls/material/divider.py +24 -14
  40. flet/controls/material/dropdown.py +5 -3
  41. flet/controls/material/expansion_tile.py +11 -22
  42. flet/controls/material/floating_action_button.py +32 -23
  43. flet/controls/material/icon_button.py +7 -3
  44. flet/controls/material/navigation_rail.py +14 -11
  45. flet/controls/material/outlined_button.py +7 -3
  46. flet/controls/material/progress_bar.py +18 -10
  47. flet/controls/material/radio_group.py +5 -1
  48. flet/controls/material/range_slider.py +13 -13
  49. flet/controls/material/segmented_button.py +21 -17
  50. flet/controls/material/selection_area.py +3 -2
  51. flet/controls/material/slider.py +16 -12
  52. flet/controls/material/snack_bar.py +18 -10
  53. flet/controls/material/switch.py +6 -5
  54. flet/controls/material/tabs.py +18 -14
  55. flet/controls/material/textfield.py +22 -14
  56. flet/controls/material/vertical_divider.py +14 -12
  57. flet/controls/page.py +2 -1
  58. flet/testing/finder.py +2 -0
  59. flet/testing/flet_test_app.py +2 -0
  60. flet/version.py +1 -1
  61. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/METADATA +5 -5
  62. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/RECORD +65 -65
  63. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/WHEEL +0 -0
  64. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/entry_points.txt +0 -0
  65. {flet-0.70.0.dev5771.dist-info → flet-0.70.0.dev5776.dist-info}/top_level.txt +0 -0
@@ -23,7 +23,7 @@ class Segment(Control):
23
23
  A segment for a [`SegmentedButton`][flet.].
24
24
 
25
25
  Raises:
26
- AssertionError: If neither [`icon`][(c).] nor [`label`][(c).] is set.
26
+ ValueError: If neither [`icon`][(c).] nor [`label`][(c).] is set.
27
27
  """
28
28
 
29
29
  value: str
@@ -45,12 +45,13 @@ class Segment(Control):
45
45
 
46
46
  def before_update(self):
47
47
  super().before_update()
48
- assert (
48
+ if not (
49
49
  (isinstance(self.icon, IconData))
50
50
  or (isinstance(self.icon, Control) and self.icon.visible)
51
51
  or (isinstance(self.label, str))
52
52
  or (isinstance(self.label, Control) and self.label.visible)
53
- ), "one of icon or label must be set and visible"
53
+ ):
54
+ raise ValueError("one of icon or label must be set and visible")
54
55
 
55
56
 
56
57
  @control("SegmentedButton")
@@ -59,11 +60,13 @@ class SegmentedButton(LayoutControl):
59
60
  A segmented button control.
60
61
 
61
62
  Raises:
62
- AssertionError: If [`segments`][(c).] is empty or does not have at
63
+ ValueError: If [`segments`][(c).] is empty or does not have at
63
64
  least one visible `Segment`.
64
- AssertionError: If [`selected`][(c).] is empty and [`allow_empty_selection`][(c).] is `False`.
65
- AssertionError: If [`selected`][(c).] has more than one item and [`allow_multiple_selection`][(c).] is `False`.
66
- """ # noqa: E501
65
+ ValueError: If [`selected`][(c).] is empty and
66
+ [`allow_empty_selection`][(c).] is `False`.
67
+ ValueError: If [`selected`][(c).] has more than one item and
68
+ [`allow_multiple_selection`][(c).] is `False`.
69
+ """
67
70
 
68
71
  segments: list[Segment]
69
72
  """
@@ -153,13 +156,14 @@ class SegmentedButton(LayoutControl):
153
156
 
154
157
  def before_update(self):
155
158
  super().before_update()
156
- assert any(segment.visible for segment in self.segments), (
157
- "segments must have at minimum one visible Segment"
158
- )
159
- assert len(self.selected) > 0 or self.allow_empty_selection, (
160
- "allow_empty_selection must be True for selected to be empty"
161
- )
162
- assert len(self.selected) < 2 or self.allow_multiple_selection, (
163
- "allow_multiple_selection must be True for selected "
164
- "to have more than one item"
165
- )
159
+ if not any(segment.visible for segment in self.segments):
160
+ raise ValueError("segments must have at minimum one visible Segment")
161
+ if len(self.selected) == 0 and not self.allow_empty_selection:
162
+ raise ValueError(
163
+ "allow_empty_selection must be True for selected to be empty"
164
+ )
165
+ if len(self.selected) >= 2 and not self.allow_multiple_selection:
166
+ raise ValueError(
167
+ "allow_multiple_selection must be True for selected to "
168
+ "have more than one item"
169
+ )
@@ -14,7 +14,7 @@ class SelectionArea(Control):
14
14
  selection for its child control.
15
15
 
16
16
  Raises:
17
- AssertionError: If [`content`][(c).] is not visible
17
+ ValueError: If [`content`][(c).] is not visible
18
18
  """
19
19
 
20
20
  content: Control
@@ -33,4 +33,5 @@ class SelectionArea(Control):
33
33
 
34
34
  def before_update(self):
35
35
  super().before_update()
36
- assert self.content.visible, "content must be visible"
36
+ if not self.content.visible:
37
+ raise ValueError("content must be visible")
@@ -34,9 +34,9 @@ class Slider(LayoutControl, AdaptiveControl):
34
34
  of setting changes.
35
35
 
36
36
  Raises:
37
- AssertionError: If [`min`][(c).] is greater than or equal to [`max`][(c).].
38
- AssertionError: If [`min`][(c).] is greater than or equal to [`value`][(c).].
39
- AssertionError: If [`max`][(c).] is less than or equal to [`value`][(c).].
37
+ ValueError: If [`min`][(c).] is greater than [`max`][(c).].
38
+ ValueError: If [`value`][(c).] is less than [`min`][(c).].
39
+ ValueError: If [`value`][(c).] is greater than [`max`][(c).].
40
40
  """
41
41
 
42
42
  value: Optional[Number] = None
@@ -216,12 +216,16 @@ class Slider(LayoutControl, AdaptiveControl):
216
216
 
217
217
  def before_update(self):
218
218
  super().before_update()
219
- assert self.max is None or self.min <= self.max, (
220
- f"min ({self.min}) must be less than or equal to max ({self.max})"
221
- )
222
- assert self.value is None or self.value >= self.min, (
223
- f"value ({self.value}) must be greater than or equal to min ({self.min})"
224
- )
225
- assert self.value is None or self.value <= self.max, (
226
- f"value ({self.value}) must be less than or equal to max ({self.max})"
227
- )
219
+ if self.max is not None and self.min > self.max:
220
+ raise ValueError(
221
+ f"min ({self.min}) must be less than or equal to max ({self.max})"
222
+ )
223
+ if self.value is not None and self.value < self.min:
224
+ raise ValueError(
225
+ f"value ({self.value}) must be greater than or "
226
+ f"equal to min ({self.min})"
227
+ )
228
+ if self.value is not None and self.value > self.max:
229
+ raise ValueError(
230
+ f"value ({self.value}) must be less than or equal to max ({self.max})"
231
+ )
@@ -93,6 +93,11 @@ class SnackBar(DialogControl):
93
93
  """
94
94
  A lightweight message with an optional action which briefly displays at the
95
95
  bottom of the screen.
96
+
97
+ Raises:
98
+ ValueError: If [`content`][(c).] is not a string or visible control.
99
+ ValueError: If [`action_overflow_threshold`][(c).] is not between 0 and 1.
100
+ ValueError: If [`elevation`][(c).] is negative.
96
101
  """
97
102
 
98
103
  content: StrOrControl
@@ -229,13 +234,16 @@ class SnackBar(DialogControl):
229
234
 
230
235
  def before_update(self):
231
236
  super().before_update()
232
- assert isinstance(self.content, str) or (
233
- isinstance(self.content, Control) and self.content.visible
234
- ), "content must be a string or a visible control"
235
- assert (
236
- self.action_overflow_threshold is None
237
- or 0 <= self.action_overflow_threshold <= 1
238
- ), "action_overflow_threshold must be between 0 and 1 inclusive"
239
- assert self.elevation is None or self.elevation >= 0, (
240
- "elevation cannot be negative"
241
- )
237
+ if not (
238
+ isinstance(self.content, str)
239
+ or (isinstance(self.content, Control) and self.content.visible)
240
+ ):
241
+ raise ValueError("content must be a string or a visible control")
242
+ if self.action_overflow_threshold is not None and not (
243
+ 0 <= self.action_overflow_threshold <= 1
244
+ ):
245
+ raise ValueError(
246
+ "action_overflow_threshold must be between 0 and 1 inclusive"
247
+ )
248
+ if self.elevation is not None and self.elevation < 0:
249
+ raise ValueError("elevation cannot be negative")
@@ -28,7 +28,7 @@ class Switch(LayoutControl, AdaptiveControl):
28
28
  For example, "On/Off", "Show/Hide".
29
29
 
30
30
  Raises:
31
- AssertionError: If [`splash_radius`][(c).] is negative.
31
+ ValueError: If [`splash_radius`][(c).] is negative.
32
32
  """
33
33
 
34
34
  label: Optional[StrOrControl] = None
@@ -225,7 +225,8 @@ class Switch(LayoutControl, AdaptiveControl):
225
225
 
226
226
  def before_update(self):
227
227
  super().before_update()
228
- assert self.splash_radius is None or self.splash_radius >= 0, (
229
- "splash_radius must be greater than or equal to 0, "
230
- f"got {self.splash_radius}"
231
- )
228
+ if self.splash_radius is not None and self.splash_radius < 0:
229
+ raise ValueError(
230
+ "splash_radius must be greater than or equal to 0, "
231
+ f"got {self.splash_radius}"
232
+ )
@@ -316,9 +316,9 @@ class TabBar(LayoutControl, AdaptiveControl):
316
316
  on text headers to articulate the different sections of content.
317
317
 
318
318
  Raises:
319
- AssertionError: If [`indicator`][(c).] is None and
319
+ ValueError: If [`indicator`][(c).] is None and
320
320
  [`indicator_thickness`][(c).] is not strictly greater than 0.
321
- AssertionError: If [`tab_alignment`][(c).] is not valid for
321
+ ValueError: If [`tab_alignment`][(c).] is not valid for
322
322
  the given [`scrollable`][(c).] state.
323
323
  """
324
324
 
@@ -538,20 +538,25 @@ class TabBar(LayoutControl, AdaptiveControl):
538
538
 
539
539
  def before_update(self):
540
540
  super().before_update()
541
- assert self.indicator is not None or self.indicator_thickness > 0.0, (
542
- f"indicator_thickness must be strictly greater than zero if indicator is "
543
- f"None, got {self.indicator_thickness}"
544
- )
541
+ if self.indicator is None and self.indicator_thickness <= 0.0:
542
+ raise ValueError(
543
+ f"indicator_thickness must be strictly greater than zero if indicator "
544
+ f"is None, got {self.indicator_thickness}"
545
+ )
545
546
  valid_alignments = (
546
547
  [TabAlignment.CENTER, TabAlignment.FILL]
547
548
  if not self.scrollable
548
549
  else [TabAlignment.START, TabAlignment.START_OFFSET, TabAlignment.CENTER]
549
550
  )
550
551
 
551
- assert self.tab_alignment is None or self.tab_alignment in valid_alignments, (
552
- f"If scrollable is {self.scrollable}, tab_alignment must be one of: "
553
- f"{', '.join(f'TabAlignment.{a.name}' for a in valid_alignments)}."
554
- )
552
+ if (
553
+ self.tab_alignment is not None
554
+ and self.tab_alignment not in valid_alignments
555
+ ):
556
+ raise ValueError(
557
+ f"If scrollable is {self.scrollable}, tab_alignment must be one of: "
558
+ f"{', '.join(f'TabAlignment.{a.name}' for a in valid_alignments)}."
559
+ )
555
560
 
556
561
 
557
562
  @control("Tab")
@@ -560,7 +565,7 @@ class Tab(AdaptiveControl):
560
565
  A Material Design [`TabBar`][flet.] tab.
561
566
 
562
567
  Raises:
563
- AssertionError: If both [`label`][(c).] and [`icon`][(c).] are not set.
568
+ ValueError: If both [`label`][(c).] and [`icon`][(c).] are not set.
564
569
  """
565
570
 
566
571
  label: Optional[StrOrControl] = None
@@ -599,6 +604,5 @@ class Tab(AdaptiveControl):
599
604
 
600
605
  def before_update(self):
601
606
  super().before_update()
602
- assert (self.label is not None) or (self.icon is not None), (
603
- "Tab must have at least label or icon property set"
604
- )
607
+ if not ((self.label is not None) or (self.icon is not None)):
608
+ raise ValueError("Tab must have at least label or icon property set")
@@ -133,6 +133,12 @@ class TextField(FormFieldControl, AdaptiveControl):
133
133
  """
134
134
  A text field lets the user enter text, either with hardware keyboard or with an
135
135
  onscreen keyboard.
136
+
137
+ Raises:
138
+ ValueError: If [`min_lines`][(c).] is not positive.
139
+ ValueError: If [`max_lines`][(c).] is not positive.
140
+ ValueError: If [`min_lines`][(c).] is greater than [`max_lines`][(c).].
141
+ ValueError: If [`max_length`][(c).] is not -1 or positive.
136
142
  """
137
143
 
138
144
  value: str = ""
@@ -420,20 +426,22 @@ class TextField(FormFieldControl, AdaptiveControl):
420
426
 
421
427
  def before_update(self):
422
428
  super().before_update()
423
- assert self.min_lines is None or self.min_lines > 0, (
424
- "min_lines must be greater than 0"
425
- )
426
- assert self.max_lines is None or self.max_lines > 0, (
427
- "min_lines must be greater than 0"
428
- )
429
- assert (
430
- self.max_lines is None
431
- or self.min_lines is None
432
- or self.min_lines <= self.max_lines
433
- ), "min_lines can't be greater than max_lines"
434
- assert (
435
- self.max_length is None or self.max_length == -1 or self.max_length > 0
436
- ), "max_length must be either equal to -1 or greater than 0"
429
+ if self.min_lines is not None and self.min_lines <= 0:
430
+ raise ValueError("min_lines must be greater than 0")
431
+ if self.max_lines is not None and self.max_lines <= 0:
432
+ raise ValueError("max_lines must be greater than 0")
433
+ if (
434
+ self.max_lines is not None
435
+ and self.min_lines is not None
436
+ and self.min_lines > self.max_lines
437
+ ):
438
+ raise ValueError("min_lines can't be greater than max_lines")
439
+ if (
440
+ self.max_length is not None
441
+ and self.max_length != -1
442
+ and self.max_length <= 0
443
+ ):
444
+ raise ValueError("max_length must be either equal to -1 or greater than 0")
437
445
  if (
438
446
  self.bgcolor is not None
439
447
  or self.fill_color is not None
@@ -13,6 +13,12 @@ class VerticalDivider(Control):
13
13
  A thin vertical line, with padding on either side.
14
14
 
15
15
  In the material design language, this represents a divider.
16
+
17
+ Raises:
18
+ ValueError: If [`width`][(c).] is negative.
19
+ ValueError: If [`thickness`][(c).] is negative.
20
+ ValueError: If [`leading_indent`][(c).] is negative.
21
+ ValueError: If [`trailing_indent`][(c).] is negative.
16
22
  """
17
23
 
18
24
  width: Optional[Number] = None
@@ -63,15 +69,11 @@ class VerticalDivider(Control):
63
69
 
64
70
  def before_update(self):
65
71
  super().before_update()
66
- assert self.width is None or self.width >= 0, (
67
- "width must be greater than or equal to 0"
68
- )
69
- assert self.thickness is None or self.thickness >= 0, (
70
- "thickness must be greater than or equal to 0"
71
- )
72
- assert self.leading_indent is None or self.leading_indent >= 0, (
73
- "leading_indent must be greater than or equal to 0"
74
- )
75
- assert self.trailing_indent is None or self.trailing_indent >= 0, (
76
- "trailing_indent must be greater than or equal to 0"
77
- )
72
+ if self.width is not None and self.width < 0:
73
+ raise ValueError("width must be greater than or equal to 0")
74
+ if self.thickness is not None and self.thickness < 0:
75
+ raise ValueError("thickness must be greater than or equal to 0")
76
+ if self.leading_indent is not None and self.leading_indent < 0:
77
+ raise ValueError("leading_indent must be greater than or equal to 0")
78
+ if self.trailing_indent is not None and self.trailing_indent < 0:
79
+ raise ValueError("trailing_indent must be greater than or equal to 0")
flet/controls/page.py CHANGED
@@ -487,7 +487,8 @@ class Page(BasePage):
487
487
  current page.
488
488
  """
489
489
  _context_page.set(self)
490
- assert asyncio.iscoroutinefunction(handler)
490
+ if not asyncio.iscoroutinefunction(handler):
491
+ raise TypeError("handler must be a coroutine function")
491
492
 
492
493
  future = asyncio.run_coroutine_threadsafe(
493
494
  handler(*args, **kwargs), self.get_session().connection.loop
flet/testing/finder.py CHANGED
@@ -1,5 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
 
3
+ __all__ = ["Finder"]
4
+
3
5
 
4
6
  @dataclass
5
7
  class Finder:
@@ -17,6 +17,8 @@ from flet.testing.tester import Tester
17
17
  from flet.utils.network import get_free_tcp_port
18
18
  from flet.utils.platform_utils import get_bool_env_var
19
19
 
20
+ __all__ = ["FletTestApp"]
21
+
20
22
 
21
23
  class FletTestApp:
22
24
  """
flet/version.py CHANGED
@@ -10,7 +10,7 @@ from flet.utils import is_mobile, is_windows, which
10
10
  DEFAULT_VERSION = "0.1.0"
11
11
 
12
12
  # will be replaced by CI
13
- version = "0.70.0.dev5771"
13
+ version = "0.70.0.dev5776"
14
14
 
15
15
 
16
16
  def update_version():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flet
3
- Version: 0.70.0.dev5771
3
+ Version: 0.70.0.dev5776
4
4
  Summary: Flet for Python - easily build interactive multi-platform apps in Python
5
5
  Author-email: "Appveyor Systems Inc." <hello@flet.dev>
6
6
  License-Expression: Apache-2.0
@@ -9,10 +9,10 @@ Project-URL: Repository, https://github.com/flet-dev/flet
9
9
  Project-URL: Documentation, https://docs.flet.dev/
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
- Requires-Dist: flet-cli==0.70.0.dev5771; extra == "cli"
13
- Requires-Dist: flet-desktop==0.70.0.dev5771; extra == "desktop" and (platform_system == "Darwin" or platform_system == "Windows")
14
- Requires-Dist: flet-desktop-light==0.70.0.dev5771; platform_system == "Linux" and (extra == "all" or extra == "desktop")
15
- Requires-Dist: flet-web==0.70.0.dev5771; extra == "web"
12
+ Requires-Dist: flet-cli==0.70.0.dev5776; extra == "cli"
13
+ Requires-Dist: flet-desktop==0.70.0.dev5776; extra == "desktop" and (platform_system == "Darwin" or platform_system == "Windows")
14
+ Requires-Dist: flet-desktop-light==0.70.0.dev5776; platform_system == "Linux" and (extra == "all" or extra == "desktop")
15
+ Requires-Dist: flet-web==0.70.0.dev5776; extra == "web"
16
16
  Requires-Dist: oauthlib>=3.2.2; platform_system != "Pyodide"
17
17
  Requires-Dist: httpx>=0.28.1; platform_system != "Pyodide"
18
18
  Requires-Dist: repath>=0.9.0