Skip to content

Commit 6487eee

Browse files
committed
WIN32: Replaced bare except (thanks to Avasam): clauses with except Exception:, preventing accidental suppression of system-exit signals (KeyboardInterrupt, SystemExit) during error handling.
ALL: Removed unused dependency on `typing_extensions` (thanks to Avasam - https://github.com/Avasam) ALL: Deprecated PyWinBox class in favor of WindowBox (window areas) and ScreenBox (screen areas) ALL: Added general functions: collidepoint, collidebox, contains, clip, union ALL: Added class methods: collidepoint, collidebox, contains, clip, union, move, inflate, clamp, isclamped, unclamp, fit
1 parent ac23174 commit 6487eee

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎src/pywinbox/_main.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ def onSet(box :Box) -> None:
135135
class BaseClass:
136136

137137
def __init__(self,
138-
handle :int | str | NamedTuple | object | None = None,
138+
handle = None,
139139
box :Box | None = None,
140140
onQuery :Callable[[], Box] | None = None, onSet :Callable[[Box], None] | None = None) -> None:
141141

142-
self._handle :int | NamedTuple | object | None = handle
142+
self._handle = handle
143143
self._box :Box = box or Box(0, 0, 0, 0)
144144
self._onQuery: Callable[[], Box] = onQuery or self.onQuery
145145
self._onSet: Callable[[Box], None] = onSet or self.onSet
@@ -633,7 +633,7 @@ def __init__(self,
633633
class WindowBox(BaseClass):
634634

635635
def __init__(self,
636-
handle: int | str | NamedTuple | object,
636+
handle,
637637
onQuery: Callable[[], Box] | None = None, onSet: Callable[[Box], None] | None = None) -> None:
638638
"""
639639
Class to access all window box properties.
@@ -666,12 +666,12 @@ def __init__(self,
666666
It can raise ValueError if not valid window handle is passed
667667
"""
668668
try:
669-
handle: int | str | NamedTuple | object = _getHandle(handle)
669+
newHandle = _getHandle(handle)
670670
except Exception:
671-
handle = None
672-
if handle is None:
671+
newHandle = None
672+
if newHandle is None:
673673
raise ValueError
674-
BaseClass.__init__(self, handle=handle, onQuery=onQuery, onSet=onSet)
674+
BaseClass.__init__(self, handle=newHandle, onQuery=onQuery, onSet=onSet)
675675

676676

677677
class ScreenBox(BaseClass):

0 commit comments

Comments
 (0)