Skip to content

Commit

Permalink
Merge pull request #318 from spyoungtech/improve-start-behavior
Browse files Browse the repository at this point in the history
Improve start behavior
  • Loading branch information
spyoungtech committed Jun 4, 2024
2 parents ed959b3 + 969bbec commit 592f1eb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
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

0 comments on commit 592f1eb

Please sign in to comment.