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 window_specification module and move WindowSpecification definition to that #1326

Open
wants to merge 6 commits into
base: atspi
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/code/code.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Main User Modules
:maxdepth: 1

pywinauto.base_application.txt
pywinauto.window_specification.txt
pywinauto.windows.application.txt
pywinauto.linux.application.txt
pywinauto.findbestmatch.txt
Expand Down
8 changes: 8 additions & 0 deletions docs/code/pywinauto.window_specification.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pywinauto.window_specification module
---------------------------------

.. automodule:: pywinauto.window_specification
:members:
:undoc-members:
:show-inheritance:

23 changes: 13 additions & 10 deletions pywinauto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ def deprecated(method, deprecated_name=None):

def wrap(*args, **kwargs):
warnings.simplefilter("default", DeprecationWarning)
warnings.warn("Method .{}() is deprecated, use .{}() instead." \
"".format(deprecated_name, method.__name__), DeprecationWarning, stacklevel=2)
warnings.warn(
"Method .{}() is deprecated, use .{}() instead.".format(deprecated_name, method.__name__),
DeprecationWarning,
stacklevel=2,
)
return method(*args, **kwargs)

return wrap
Expand All @@ -56,11 +59,10 @@ def wrap(*args, **kwargs):
# Importing only pythoncom can fail with the errors like:
# ImportError: No system module 'pywintypes' (pywintypes27.dll)
# So try to facilitate pywintypes*.dll loading with implicit import of win32api
import win32api # noqa: E402
import win32api # noqa: F401, E402
import pythoncom # noqa: E402

from .windows import win32defines

from .windows import win32defines # noqa: F401, E402

def _get_com_threading_mode(module_sys):
"""Set up COM threading model
Expand All @@ -84,7 +86,6 @@ def _get_com_threading_mode(module_sys):

return com_init_mode


sys.coinit_flags = _get_com_threading_mode(sys)


Expand All @@ -94,19 +95,21 @@ class WindowNotFoundError(Exception):
"""No window could be found"""
pass

from . import findwindows

from . import findwindows # noqa: E402

WindowAmbiguousError = findwindows.WindowAmbiguousError
ElementNotFoundError = findwindows.ElementNotFoundError
ElementAmbiguousError = findwindows.ElementAmbiguousError


from . import findbestmatch
from . import backend as backends
from . import findbestmatch # noqa: E402
from . import backend as backends # noqa: E402

MatchError = findbestmatch.MatchError

from pywinauto.application import Application, WindowSpecification
from pywinauto.application import Application # noqa: F401, E402
from pywinauto.window_specification import WindowSpecification # noqa: E402


class Desktop(object):
Expand Down
2 changes: 1 addition & 1 deletion pywinauto/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import sys

from .base_application import WindowSpecification # noqa: W0611
from .window_specification import WindowSpecification # noqa: W0611

if sys.platform == 'win32':
from .windows.application import Application # noqa: W0611
Expand Down