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

Improve start behavior #318

Merged
merged 2 commits into from
Jun 4, 2024
Merged
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
32 changes: 16 additions & 16 deletions ahk/_async/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,13 @@
from typing import TypeVar
from typing import Union

from .._hotkey import Hotkey
from .._hotkey import Hotstring
from .._utils import _get_executable_major_version
from .._utils import _resolve_executable_path
from .._utils import MsgBoxButtons
from .._utils import MsgBoxDefaultButton
from .._utils import MsgBoxIcon
from .._utils import MsgBoxModality
from .._utils import MsgBoxOtherOptions
from .._utils import type_escape
from ..directives import Directive
from ..extensions import _extension_registry
from ..extensions import _ExtensionMethodRegistry
from ..extensions import _resolve_extensions
from ..extensions import Extension
from ..keys import Key
from .transport import AsyncDaemonProcessTransport
from .transport import AsyncFutureResult
from .transport import AsyncTransport
from .window import AsyncControl
from .window import AsyncWindow
from ahk._hotkey import Hotkey
from ahk._hotkey import Hotstring
from ahk._types import _BUTTONS
from ahk._types import Coordinates
from ahk._types import CoordModeRelativeTo
Expand All @@ -51,6 +37,20 @@
from ahk._types import Position
from ahk._types import SendMode
from ahk._types import TitleMatchMode
from ahk._utils import _get_executable_major_version
from ahk._utils import _resolve_executable_path
from ahk._utils import MsgBoxButtons
from ahk._utils import MsgBoxDefaultButton
from ahk._utils import MsgBoxIcon
from ahk._utils import MsgBoxModality
from ahk._utils import MsgBoxOtherOptions
from ahk._utils import type_escape
from ahk.directives import Directive
from ahk.extensions import _extension_registry
from ahk.extensions import _ExtensionMethodRegistry
from ahk.extensions import _resolve_extensions
from ahk.extensions import Extension
from ahk.keys import Key

if sys.version_info < (3, 10):
from typing_extensions import TypeAlias
Expand Down
2 changes: 1 addition & 1 deletion ahk/_async/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ async def function_call(
blocking: bool = True,
engine: Optional[AsyncAHK[Any]] = None,
) -> Any:
if not self._started:
if not self._started and blocking:
with warnings.catch_warnings(record=True) as caught_warnings:
await self.init()
if caught_warnings:
Expand Down
32 changes: 16 additions & 16 deletions ahk/_sync/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,13 @@
from typing import TypeVar
from typing import Union

from .._hotkey import Hotkey
from .._hotkey import Hotstring
from .._utils import _get_executable_major_version
from .._utils import _resolve_executable_path
from .._utils import MsgBoxButtons
from .._utils import MsgBoxDefaultButton
from .._utils import MsgBoxIcon
from .._utils import MsgBoxModality
from .._utils import MsgBoxOtherOptions
from .._utils import type_escape
from ..directives import Directive
from ..extensions import _extension_registry
from ..extensions import _ExtensionMethodRegistry
from ..extensions import _resolve_extensions
from ..extensions import Extension
from ..keys import Key
from .transport import DaemonProcessTransport
from .transport import FutureResult
from .transport import Transport
from .window import Control
from .window import Window
from ahk._hotkey import Hotkey
from ahk._hotkey import Hotstring
from ahk._types import _BUTTONS
from ahk._types import Coordinates
from ahk._types import CoordModeRelativeTo
Expand All @@ -51,6 +37,20 @@
from ahk._types import Position
from ahk._types import SendMode
from ahk._types import TitleMatchMode
from ahk._utils import _get_executable_major_version
from ahk._utils import _resolve_executable_path
from ahk._utils import MsgBoxButtons
from ahk._utils import MsgBoxDefaultButton
from ahk._utils import MsgBoxIcon
from ahk._utils import MsgBoxModality
from ahk._utils import MsgBoxOtherOptions
from ahk._utils import type_escape
from ahk.directives import Directive
from ahk.extensions import _extension_registry
from ahk.extensions import _ExtensionMethodRegistry
from ahk.extensions import _resolve_extensions
from ahk.extensions import Extension
from ahk.keys import Key

if sys.version_info < (3, 10):
from typing_extensions import TypeAlias
Expand Down
2 changes: 1 addition & 1 deletion ahk/_sync/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def function_call(
blocking: bool = True,
engine: Optional[AHK[Any]] = None,
) -> Any:
if not self._started:
if not self._started and blocking:
with warnings.catch_warnings(record=True) as caught_warnings:
self.init()
if caught_warnings:
Expand Down
Loading