-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[gui] Support for setting the initial position of GGUI window #6156
Conversation
This reverts commit b443eb0.
✅ Deploy Preview for docsite-preview ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise lgtm
python/taichi/ui/window.py
Outdated
@@ -26,14 +26,14 @@ class Window: | |||
vsync (bool): whether or not vertical sync should be enabled. | |||
show_window (bool): where or not display the window after initialization. | |||
""" | |||
def __init__(self, name, res, vsync=False, show_window=True): | |||
def __init__(self, name, res, pos=(0, 0), vsync=False, show_window=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pos=(0,0) might be a problem for Windows users who put the task bar on top. Consider (100, 100) or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me try try on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I will fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to add a kwarg, it'd be better to add it at the end to avoid breaking current api. e.g. if user had Window('test', (512, 512), False, True)
it'll be broken by this PR.
Also pos
need a proper docstring explaining which window, and where is the origin ;)
@@ -90,6 +92,12 @@ inline GLFWwindow *create_glfw_window_(const std::string &name, | |||
printf("GLFW reports no Vulkan support\n"); | |||
} | |||
|
|||
// Reset the window hints to default | |||
glfwDefaultWindowHints(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the Window we create should be invisible before we set the position.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
python/taichi/ui/window.py
Outdated
@@ -26,14 +26,14 @@ class Window: | |||
vsync (bool): whether or not vertical sync should be enabled. | |||
show_window (bool): where or not display the window after initialization. | |||
""" | |||
def __init__(self, name, res, vsync=False, show_window=True): | |||
def __init__(self, name, res, pos=(0, 0), vsync=False, show_window=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to add a kwarg, it'd be better to add it at the end to avoid breaking current api. e.g. if user had Window('test', (512, 512), False, True)
it'll be broken by this PR.
Also pos
need a proper docstring explaining which window, and where is the origin ;)
for more information, see https://pre-commit.ci
That's right, I will fix that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Issue: #6107