echofilter.win package
Contents
echofilter.win package#
Window management and Echoview integration.
Submodules#
echofilter.win.ev module#
Echoview interface management.
- echofilter.win.ev.maybe_open_echoview(app=None, do_open=True, minimize=False, hide='new')[source]#
If the current pointer to the Echoview is invalid, open an Echoview window.
- Parameters
app (COM object or None, optional) – Existing COM object to interface with Echoview.
do_open (bool, optional) – If
False
(dry-run mode), we don’t actually need Echoview open and so don’t try to open it. In this case,None
is yielded. Present so a context manager can be used even if the application isn’t opened. Default isTrue
, do open Echoview.minimize (bool, optional) – If
True
, the Echoview window being used will be minimized while the code runs. Default isFalse
.hide ({"never", "new", "always"}, optional) – Whether to hide the Echoview window entirely. If
hide="new"
, the application is only hidden if it was created by this context, and not if it was already running. Ifhide="always"
, the application is hidden even if it was already running. In the latter case, the window will be revealed again when leaving this context. Default is"new"
.
- echofilter.win.ev.open_ev_file(filename, app=None)[source]#
Open an EV file within a context.
- Parameters
filename (str) – Path to file to open.
app (COM object or None, optional) – Existing COM object to interface with Echoview. If
None
, a new COM interface is created. If that requires opening a new instance of Echoview, it is hidden while the file is in use.
echofilter.win.manager module#
Window management for Windows.
- class echofilter.win.manager.WindowManager(title=None, class_name=None, title_pattern=None)[source]#
Bases:
object
Encapsulates calls to window management using the Windows api.
Notes
Based on: https://stackoverflow.com/a/2091530 and https://stackoverflow.com/a/4440622
- echofilter.win.manager.opencom(com_name, can_make_anew=False, title=None, title_pattern=None, minimize=False, hide='never')[source]#
Open a connection to an application with a COM object.
The application may or may not be open before this context begins. If it was not already open, the application is closed when leaving the context.
- Parameters
com_name (str) – Name of COM object to dispatch.
can_make_anew (bool, optional) – Whether arbitrarily many sessions of the COM object can be created, and if so whether they should be. Default is
False
, in which case the context manager will check to see if the application is already running before connecting to it. If it was already running, it will not be closed when this context closes.title (str, optional) – Exact title of window. If the title can not be determined exactly, use
title_pattern
instead.title_pattern (str, optional) – Regular expression for the window title.
minimize (bool, optional) – If
True
, the application will be minimized while the code runs. Default isFalse
.hide ({"never", "new", "always"}, optional) – Whether to hide the application window entirely. Default is
"never"
. If this is enabled, at least one oftitle
andtitle_pattern
must be specified. Ifhide="new"
, the application is only hidden if it was created by this context, and not if it was already running. Ifhide="always"
, the application is hidden even if it was already running. In the latter case, the window will be revealed again when leaving this context.
- Yields
win32com.gen_py – Interface to COM object.