From ab0747250567f25c78b3e0a726500cc208d429b4 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Thu, 8 Sep 2022 14:39:41 -0700 Subject: [PATCH 1/3] Icon, Column -> constrained control --- package/lib/src/controls/icon.dart | 2 +- sdk/python/flet/column.py | 19 +++++++++++++++++++ sdk/python/flet/icon.py | 26 +++++++++++++++++++++++--- sdk/python/flet/list_tile.py | 1 - 4 files changed, 43 insertions(+), 5 deletions(-) diff --git a/package/lib/src/controls/icon.dart b/package/lib/src/controls/icon.dart index ebd0b8e31..e06679877 100644 --- a/package/lib/src/controls/icon.dart +++ b/package/lib/src/controls/icon.dart @@ -21,7 +21,7 @@ class IconControl extends StatelessWidget { var color = HexColor.fromString( Theme.of(context), control.attrString("color", "")!); - return baseControl( + return constrainedControl( Icon( getMaterialIcon(name), size: size, diff --git a/sdk/python/flet/column.py b/sdk/python/flet/column.py index 8d3e1c87a..1e8e3c867 100644 --- a/sdk/python/flet/column.py +++ b/sdk/python/flet/column.py @@ -11,6 +11,7 @@ ScrollMode, ) from flet.ref import Ref +from flet.types import AnimationValue, OffsetValue, RotateValue, ScaleValue class Column(ConstrainedControl): @@ -26,6 +27,15 @@ def __init__( bottom: OptionalNumber = None, expand: Union[None, bool, int] = None, opacity: OptionalNumber = None, + rotate: RotateValue = None, + scale: ScaleValue = None, + offset: OffsetValue = None, + animate_opacity: AnimationValue = None, + animate_size: AnimationValue = None, + animate_position: AnimationValue = None, + animate_rotation: AnimationValue = None, + animate_scale: AnimationValue = None, + animate_offset: AnimationValue = None, visible: Optional[bool] = None, disabled: Optional[bool] = None, data: Any = None, @@ -52,6 +62,15 @@ def __init__( bottom=bottom, expand=expand, opacity=opacity, + rotate=rotate, + scale=scale, + offset=offset, + animate_opacity=animate_opacity, + animate_size=animate_size, + animate_position=animate_position, + animate_rotation=animate_rotation, + animate_scale=animate_scale, + animate_offset=animate_offset, visible=visible, disabled=disabled, data=data, diff --git a/sdk/python/flet/icon.py b/sdk/python/flet/icon.py index b973450cb..b2ea60228 100644 --- a/sdk/python/flet/icon.py +++ b/sdk/python/flet/icon.py @@ -2,17 +2,28 @@ from beartype import beartype -from flet.control import Control, OptionalNumber +from flet.constrained_control import ConstrainedControl +from flet.control import OptionalNumber from flet.ref import Ref +from flet.types import AnimationValue, OffsetValue, RotateValue, ScaleValue -class Icon(Control): +class Icon(ConstrainedControl): def __init__( self, name: Optional[str] = None, ref: Optional[Ref] = None, expand: Union[None, bool, int] = None, opacity: OptionalNumber = None, + rotate: RotateValue = None, + scale: ScaleValue = None, + offset: OffsetValue = None, + animate_opacity: AnimationValue = None, + animate_size: AnimationValue = None, + animate_position: AnimationValue = None, + animate_rotation: AnimationValue = None, + animate_scale: AnimationValue = None, + animate_offset: AnimationValue = None, tooltip: Optional[str] = None, visible: Optional[bool] = None, disabled: Optional[bool] = None, @@ -24,11 +35,20 @@ def __init__( size: OptionalNumber = None, ): - Control.__init__( + ConstrainedControl.__init__( self, ref=ref, expand=expand, opacity=opacity, + rotate=rotate, + scale=scale, + offset=offset, + animate_opacity=animate_opacity, + animate_size=animate_size, + animate_position=animate_position, + animate_rotation=animate_rotation, + animate_scale=animate_scale, + animate_offset=animate_offset, tooltip=tooltip, visible=visible, disabled=disabled, diff --git a/sdk/python/flet/list_tile.py b/sdk/python/flet/list_tile.py index c2a03b539..a3833e06f 100644 --- a/sdk/python/flet/list_tile.py +++ b/sdk/python/flet/list_tile.py @@ -18,7 +18,6 @@ class ListTile(ConstrainedControl): def __init__( self, - text: Optional[str] = None, ref: Optional[Ref] = None, width: OptionalNumber = None, height: OptionalNumber = None, From dfd6bb292357479a4ce9e9d5f00e13d609c5d3df Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Tue, 13 Sep 2022 11:18:51 -0700 Subject: [PATCH 2/3] Do not use input() to block the script on Windows Fix #314 --- sdk/python/flet/flet.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sdk/python/flet/flet.py b/sdk/python/flet/flet.py index 3845a7ab3..905954a56 100644 --- a/sdk/python/flet/flet.py +++ b/sdk/python/flet/flet.py @@ -140,11 +140,10 @@ def exit_gracefully(signum, frame): if view == WEB_BROWSER and url_prefix == None: open_in_browser(conn.page_url) try: - if is_windows(): - input() - else: - terminate.wait() - except (Exception) as e: + while True: + if terminate.wait(1): + break + except KeyboardInterrupt: pass conn.close() From fb79a4cffcab428b2918ec972cabda60189a9129 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Wed, 14 Sep 2022 10:28:25 -0700 Subject: [PATCH 3/3] Disable websocket logging completely Fix #321 --- sdk/python/flet/reconnecting_websocket.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/python/flet/reconnecting_websocket.py b/sdk/python/flet/reconnecting_websocket.py index cc732e3d9..5c0fc469e 100644 --- a/sdk/python/flet/reconnecting_websocket.py +++ b/sdk/python/flet/reconnecting_websocket.py @@ -24,6 +24,10 @@ def __init__(self, url) -> None: if is_localhost_url(url) else _REMOTE_CONNECT_TIMEOUT_SEC ) + # disable websocket logging completely + # https://github.com/websocket-client/websocket-client/blob/master/websocket/_logging.py#L22-L51 + ws_logger = logging.getLogger("websocket") + ws_logger.setLevel(logging.FATAL) @property def on_connect(self, handler):