Skip to content

Commit

Permalink
Remove v0.26.0 deprecations (#4479)
Browse files Browse the repository at this point in the history
* delete deprecations on py end

* delete deprecations on dart end
  • Loading branch information
ndonkoHenri authored Dec 3, 2024
1 parent d5fe9c5 commit 07bb136
Show file tree
Hide file tree
Showing 38 changed files with 3 additions and 1,823 deletions.
7 changes: 2 additions & 5 deletions packages/flet/lib/src/controls/circle_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ class CircleAvatarControl extends StatelessWidget with FletStoreMixin {
bool disabled = control.isDisabled || parentDisabled;

return withPageArgs((context, pageArgs) {
// DEPRECATED: foregroundImageUrl and backgroundImageUrl
var foregroundImageSrc = control.attrString("foregroundImageSrc") ??
control.attrString("foregroundImageUrl");
var backgroundImageSrc = control.attrString("backgroundImageSrc") ??
control.attrString("backgroundImageUrl");
var foregroundImageSrc = control.attrString("foregroundImageSrc");
var backgroundImageSrc = control.attrString("backgroundImageSrc");
var contentCtrls =
children.where((c) => c.name == "content" && c.isVisible);

Expand Down
1 change: 0 additions & 1 deletion packages/flet/lib/src/controls/popup_menu_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class PopupMenuButtonControl extends StatelessWidget with FletStoreMixin {
},
onCanceled: () {
backend.triggerControlEvent(control.id, "cancel");
backend.triggerControlEvent(control.id, "cancelled"); // DEPRECATED
},
onOpened: () {
backend.triggerControlEvent(control.id, "open");
Expand Down
5 changes: 1 addition & 4 deletions sdk/python/packages/flet/src/flet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
DismissibleUpdateEvent,
)
from flet.core.divider import Divider
from flet.core.drag_target import DragTarget, DragTargetAcceptEvent
from flet.core.drag_target import DragTarget, DragTargetEvent
from flet.core.draggable import Draggable
from flet.core.dropdown import Dropdown
from flet.core.elevated_button import ElevatedButton
Expand Down Expand Up @@ -239,7 +239,6 @@
NavigationBar,
NavigationBarDestination,
NavigationBarLabelBehavior,
NavigationDestination,
)
from flet.core.navigation_drawer import (
NavigationDrawer,
Expand Down Expand Up @@ -405,7 +404,6 @@
Locale,
LocaleConfiguration,
MainAxisAlignment,
MaterialState,
MouseCursor,
NotchShape,
Number,
Expand All @@ -427,7 +425,6 @@
VisualDensity,
WebRenderer,
)
from flet.core.user_control import UserControl
from flet.core.vertical_divider import VerticalDivider
from flet.core.video import (
PlaylistMode,
Expand Down
40 changes: 0 additions & 40 deletions sdk/python/packages/flet/src/flet/core/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,58 +127,18 @@ def _get_control_name(self):
def play(self):
self.invoke_method("play")

@deprecated(
reason="Use play() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def play_async(self):
self.play()

def pause(self):
self.invoke_method("pause")

@deprecated(
reason="Use pause() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def pause_async(self):
self.pause()

def resume(self):
self.invoke_method("resume")

@deprecated(
reason="Use resume() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def resume_async(self):
self.resume()

def release(self):
self.invoke_method("release")

@deprecated(
reason="Use release() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def release_async(self):
self.release()

def seek(self, position_milliseconds: int):
self.invoke_method("seek", {"position": str(position_milliseconds)})

@deprecated(
reason="Use seek() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def seek_async(self, position_milliseconds: int):
self.seek(position_milliseconds)

def get_duration(self, wait_timeout: Optional[float] = 5) -> Optional[int]:
sr = self.invoke_method(
"get_duration",
Expand Down
24 changes: 0 additions & 24 deletions sdk/python/packages/flet/src/flet/core/audio_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,6 @@ def start_recording(
)
return started == "true"

@deprecated(
reason="Use start_recording() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def start_recording_async(self, output_path: str) -> bool:
return self.start_recording(output_path)

def is_recording(self, wait_timeout: Optional[float] = 5) -> bool:
recording = self.invoke_method(
"is_recording",
Expand Down Expand Up @@ -145,25 +137,9 @@ def cancel_recording(self, wait_timeout: Optional[float] = 5) -> None:
def resume_recording(self):
self.invoke_method("resume_recording")

@deprecated(
reason="Use resume_recording() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def resume_recording_async(self):
self.resume_recording()

def pause_recording(self):
self.invoke_method("pause_recording")

@deprecated(
reason="Use pause_recording() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def pause_recording_async(self):
self.pause_recording()

def is_paused(self, wait_timeout: Optional[float] = 5) -> bool:
paused = self.invoke_method(
"is_paused",
Expand Down
6 changes: 0 additions & 6 deletions sdk/python/packages/flet/src/flet/core/canvas/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ def clean(self):
super().clean()
self.__shapes.clear()

@deprecated(
reason="Use clean() method instead.", version="0.21.0", delete_version="0.26.0"
)
async def clean_async(self):
self.clean()

# shapes
@property
def shapes(self) -> List[Shape]:
Expand Down
44 changes: 0 additions & 44 deletions sdk/python/packages/flet/src/flet/core/circle_avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,50 +173,6 @@ def _get_children(self):
return [self.__content]
return []

# foreground_image_url
@property
def foreground_image_url(self) -> Optional[str]:
warnings.warn(
f"foreground_image_url is deprecated since version 0.22.0 "
f"and will be removed in version 0.26.0. Use foreground_image_src instead.",
category=DeprecationWarning,
stacklevel=2,
)
return self._get_attr("foregroundImageUrl")

@foreground_image_url.setter
def foreground_image_url(self, value: Optional[str]):
self._set_attr("foregroundImageUrl", value)
if value is not None:
warnings.warn(
f"foreground_image_url is deprecated since version 0.22.0 "
f"and will be removed in version 0.26.0. Use foreground_image_src instead.",
category=DeprecationWarning,
stacklevel=2,
)

# background_image_url
@property
def background_image_url(self) -> Optional[str]:
warnings.warn(
f"background_image_url is deprecated since version 0.22.0 "
f"and will be removed in version 0.26.0. Use background_image_src instead.",
category=DeprecationWarning,
stacklevel=2,
)
return self._get_attr("backgroundImageUrl")

@background_image_url.setter
def background_image_url(self, value: Optional[str]):
self._set_attr("backgroundImageUrl", value)
if value is not None:
warnings.warn(
f"background_image_url is deprecated since version 0.22.0 "
f"and will be removed in version 0.26.0. Use background_image_src instead.",
category=DeprecationWarning,
stacklevel=2,
)

# foreground_image_src
@property
def foreground_image_src(self) -> Optional[str]:
Expand Down
8 changes: 0 additions & 8 deletions sdk/python/packages/flet/src/flet/core/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,6 @@ def clean(self):
super().clean()
self.__controls.clear()

@deprecated(
reason="Use clean() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def clean_async(self):
self.clean()

# tight
@property
def tight(self) -> bool:
Expand Down
6 changes: 0 additions & 6 deletions sdk/python/packages/flet/src/flet/core/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,6 @@ def clean(self) -> None:
), f"{self.__class__.__qualname__} Control must be added to the page"
self.__page._clean(self)

@deprecated(
reason="Use clean() method instead.", version="0.21.0", delete_version="0.26.0"
)
async def clean_async(self):
self.clean()

def invoke_method(
self,
method_name: str,
Expand Down
17 changes: 0 additions & 17 deletions sdk/python/packages/flet/src/flet/core/date_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,6 @@ def __init__(
def _get_control_name(self):
return "datepicker"

@deprecated(
reason="Use Page.open() method instead.",
version="0.23.0",
delete_version="0.26.0",
)
def pick_date(self):
self.open = True
self.update()

@deprecated(
reason="Use Page.open() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def pick_date_async(self):
self.pick_date()

# open
@property
def open(self) -> bool:
Expand Down
8 changes: 0 additions & 8 deletions sdk/python/packages/flet/src/flet/core/dismissible.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,6 @@ def before_update(self):
def confirm_dismiss(self, dismiss: bool):
self.invoke_method("confirm_dismiss", {"dismiss": str(dismiss).lower()})

@deprecated(
reason="Use confirm_dismiss() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def confirm_dismiss_async(self, dismiss: bool):
self.confirm_dismiss(dismiss)

# content
@property
def content(self) -> Control:
Expand Down
15 changes: 0 additions & 15 deletions sdk/python/packages/flet/src/flet/core/drag_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,6 @@ def on_move(self, handler: OptionalEventCallable["DragTargetEvent"]):
self.__on_move.handler = handler


class DragTargetAcceptEvent(ControlEvent):
def __init__(self, e: ControlEvent):
super().__init__(e.target, e.name, e.data, e.control, e.page)
d = json.loads(e.data)
warn(
f"{self.__class__.__name__} is deprecated since version 0.22.0 "
f"and will be removed in version 0.26.0. Use DragTargetEvent instead.",
category=DeprecationWarning,
stacklevel=2,
)
self.src_id: float = d.get("src_id")
self.x: float = d.get("x")
self.y: float = d.get("y")


class DragTargetEvent(ControlEvent):
def __init__(self, e: ControlEvent):
super().__init__(e.target, e.name, e.data, e.control, e.page)
Expand Down
8 changes: 0 additions & 8 deletions sdk/python/packages/flet/src/flet/core/dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,6 @@ def focus(self):
self._set_attr_json("focus", str(time.time()))
self.update()

@deprecated(
reason="Use focus() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def focus_async(self):
self.focus()

# options
@property
def options(self):
Expand Down
8 changes: 0 additions & 8 deletions sdk/python/packages/flet/src/flet/core/elevated_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,6 @@ def focus(self):
self._set_attr_json("focus", str(time.time()))
self.update()

@deprecated(
reason="Use focus() method instead.",
version="0.21.0",
delete_version="0.26.0",
)
async def focus_async(self):
self.focus()

# text
@property
def text(self) -> Optional[str]:
Expand Down
Loading

0 comments on commit 07bb136

Please sign in to comment.