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

Fix waitForWindow() on Mac and Windows. #133

Merged
merged 2 commits into from
May 12, 2019

Conversation

ulodha
Copy link
Contributor

@ulodha ulodha commented Sep 2, 2018

Avoid exception when getWindow() or getWindowTitle() is called while window isn't open yet and waiting for window.
On Mac, return None instead of raising exception when PID window isn't found

Avoid exception when getWindow() or getWindowTitle() is called while window isn't open yet and waiting for window.
On Mac, return None instead of raising exception when PID window isn't found
Copy link
Owner

@glitchassassin glitchassassin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I requested a few changes before merging. Thanks for your contribution!

lackey/App.py Outdated
return PlatformManager.getWindowTitle(PlatformManager.getWindowByPID(self.getPID()))
else:
return ""
return None
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should return an empty string, not None

@@ -328,7 +328,7 @@ def getWindowRect(self, hwnd):
width = w["kCGWindowBounds"]["Width"]
height = w["kCGWindowBounds"]["Height"]
return (x, y, width, height)
raise OSError("Unrecognized window number {}".format(hwnd))
return None
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular method should raise a descriptive error. Returning None when the recipient is expecting a tuple will just raise a different (less clear) error.

@glitchassassin glitchassassin changed the base branch from master to develop May 12, 2019 22:03
@glitchassassin glitchassassin merged commit a53e6e3 into glitchassassin:develop May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants