Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flet if no dependencies provided for flet publish command #4507

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 10 additions & 0 deletions packages/flet/lib/src/controls/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class _PageControlState extends State<PageControl> with FletStoreMixin {
bool? _windowTitleBarHidden;
bool? _windowSkipTaskBar;
double? _windowProgressBar;
bool? _windowIgnoreMouseEvents;
final _navigatorKey = GlobalKey<NavigatorState>();
late final RouteState _routeState;
late final SimpleRouterDelegate _routerDelegate;
Expand Down Expand Up @@ -338,6 +339,8 @@ class _PageControlState extends State<PageControl> with FletStoreMixin {
var windowSkipTaskBar = widget.control.attrBool("windowSkipTaskBar");
var windowFrameless = widget.control.attrBool("windowFrameless");
var windowProgressBar = widget.control.attrDouble("windowProgressBar");
var windowIgnoreMouseEvents =
widget.control.attrBool("windowIgnoreMouseEvents");

updateWindow(PageArgsModel? pageArgs) async {
try {
Expand Down Expand Up @@ -580,6 +583,13 @@ class _PageControlState extends State<PageControl> with FletStoreMixin {
if (windowWaitUntilReadyToShow == true) {
await waitUntilReadyToShow();
}

// windowIgnoreMouseEvents
if (windowIgnoreMouseEvents != null &&
windowIgnoreMouseEvents != _windowIgnoreMouseEvents) {
await setIgnoreMouseEvents(windowIgnoreMouseEvents);
_windowIgnoreMouseEvents = windowIgnoreMouseEvents;
}
} catch (e) {
debugPrint("ERROR updating window: $e");
}
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
7 changes: 7 additions & 0 deletions packages/flet/lib/src/utils/desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,13 @@ Future isFocused() async {
}
}

Future setIgnoreMouseEvents(bool ignore) async {
if (isDesktopPlatform()) {
debugPrint("setIgnoreMouseEvents($ignore)");
await windowManager.setIgnoreMouseEvents(ignore);
}
}

Future<WindowMediaData> getWindowMediaData() async {
var m = WindowMediaData();
if (isDesktopPlatform()) {
Expand Down
4 changes: 4 additions & 0 deletions sdk/python/packages/flet-cli/src/flet_cli/commands/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
)

def handle(self, options: argparse.Namespace) -> None:
import flet.version
from flet.utils.pip import ensure_flet_web_package_installed

ensure_flet_web_package_installed()
Expand Down Expand Up @@ -197,6 +198,9 @@ def handle(self, options: argparse.Namespace) -> None:
)
print(f"{reqs_filename} dependencies: {deps}")

if len(deps) == 0:
deps = [f"flet=={flet.version.version}"]

temp_reqs_txt = Path(tempfile.gettempdir()).joinpath(random_string(10))
with open(temp_reqs_txt, "w") as f:
f.writelines(dep + "\n" for dep in deps)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def format_dependency_version(dependency: str, version_value: Any):
suffix = ""
if isinstance(version_value, dict):
version = version_value["version"]
if version_value["markers"]:
suffix = f";{version_value['markers']}"
markers = version_value.get("markers")
if markers is not None:
suffix = f";{markers}"
else:
version = version_value

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
1 change: 0 additions & 1 deletion sdk/python/packages/flet/src/flet/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import subprocess
import sys

import flet.version
from flet.utils.pip import ensure_flet_cli_package_installed


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
48 changes: 0 additions & 48 deletions sdk/python/packages/flet/src/flet/core/circle_avatar.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ def main(page):
def __init__(
self,
content: Optional[Control] = None,
foreground_image_url: Optional[str] = None,
background_image_url: Optional[str] = None,
foreground_image_src: Optional[str] = None,
background_image_src: Optional[str] = None,
color: Optional[ColorValue] = None,
Expand Down Expand Up @@ -152,8 +150,6 @@ def __init__(
data=data,
)

self.foreground_image_url = foreground_image_url
self.background_image_url = background_image_url
self.foreground_image_src = foreground_image_src
self.background_image_src = background_image_src
self.radius = radius
Expand All @@ -173,50 +169,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
Loading