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 pywin32 types #4978

Merged
merged 4 commits into from
Feb 7, 2023
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
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ test = [
"types-setuptools>=57.0.0",
"types-tabulate>=0.1.0",
"types-tqdm>=4.64.6",
"types_pywin32>=305.0.0.7"
]
docs = [
"autodocsumm>=0.2.9",
Expand Down Expand Up @@ -211,17 +212,13 @@ module = [
"mcl_RF_Switch_Controller64",
"mcl_RF_Switch_Controller_NET45",
"opencensus.ext.azure.*",
"pythoncom",
"pyqtgraph.*",
"pywinusb.*",
"ruamel",
"spyder.utils.site",
"spyder_kernels.customize",
"System.IO",
"uncertainties",
"win32com.*",
"win32con",
"win32gui",
"wrapt",
"zhinst.qcodes",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
import win32com.client
from pythoncom import VT_BYREF, VT_I4, VT_R8
except ImportError as e:
message = ('To use the DynaCool Driver, please install win32com.'
' Installation can be done with pip install pypiwin32com')
message = "To use the DynaCool Driver, please install pywin32."
log.exception(message)
raise ImportError(message)
raise ImportError(message) from e


CmdArgs = namedtuple('CmdArgs', 'cmd args')
Expand Down
10 changes: 6 additions & 4 deletions qcodes/utils/qt_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@ def foreground_qt_window(window: "QMainWindow") -> None:
# use the idea from
# https://stackoverflow.com/questions/12118939/how-to-make-a-pyqt4-window-jump-to-the-front
SetWindowPos(
window.winId(), # pyright: ignore[reportGeneralTypeIssues]
win32con.HWND_TOPMOST, # = always on top. only reliable way to bring it to the front on windows
int(window.winId()),
win32con.HWND_TOPMOST,
# = always on top. only reliable way to bring it to the front on windows
0,
0,
0,
0,
win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_SHOWWINDOW,
)
SetWindowPos(
window.winId(), # pyright: ignore[reportGeneralTypeIssues]
win32con.HWND_NOTOPMOST, # disable the always on top, but leave window at its top position
int(window.winId()),
win32con.HWND_NOTOPMOST,
# disable the always on top, but leave window at its top position
0,
0,
0,
Expand Down