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

[gui] Support for setting the initial position of GGUI window #6156

Merged
merged 17 commits into from
Sep 26, 2022

Conversation

Morcki
Copy link
Member

@Morcki Morcki commented Sep 24, 2022

Issue: #6107

@netlify
Copy link

netlify bot commented Sep 24, 2022

Deploy Preview for docsite-preview ready!

Name Link
🔨 Latest commit ba842f1
🔍 Latest deploy log https://app.netlify.com/sites/docsite-preview/deploys/63317f3a85e0ed0008aeb4f5
😎 Deploy Preview https://deploy-preview-6156--docsite-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@PENGUINLIONG PENGUINLIONG left a comment

Choose a reason for hiding this comment

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

otherwise lgtm

@@ -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):
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Contributor

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();
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Member Author

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.

Copy link
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -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):
Copy link
Contributor

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 ;)

@Morcki
Copy link
Member Author

Morcki commented Sep 26, 2022

LGTM!

That's right, I will fix that.

@Morcki Morcki requested a review from ailzhang September 26, 2022 05:26
Copy link
Contributor

@ailzhang ailzhang left a 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 Show resolved Hide resolved
@ailzhang ailzhang merged commit 85e2aea into taichi-dev:master Sep 26, 2022
@Morcki Morcki deleted the taichi_ggui_dev branch September 26, 2022 12:18
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.

3 participants