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

Window not on top #249

Closed
keithterrill opened this Issue Sep 10, 2017 · 7 comments

Comments

Projects
None yet
2 participants
@keithterrill

keithterrill commented Sep 10, 2017

SubWindows and Message Windows are not always on top. If I have the following code:

#!/usr/bin/python3

from appJar import gui

def DoQuit(opt):
    app.stop()

def DoExit(opt):
    if app.yesNoBox("Confirm exit","Exit sub window now?"):
        app.hideSubWindow("SUB1")

def DoSubWindow(opt):
    app.showSubWindow("SUB1")

app = gui("Example","400x200")
app.setLocation(100,100)

app.startSubWindow("SUB1",modal=True)
app.addEntry("E1")
app.addButton("Exit",DoExit)
app.stopSubWindow()

app.addButton("SubWindow",DoSubWindow)
app.addButton("Quit",DoQuit)

app.go()

And the user does the following:

  1. Launch program, Example window appears in upper left corner.
  2. Click on button SubWindow
  3. SUB1 window shows on top of main window
  4. Click on Exit button
  5. Confirm exit window shows on top of main window but under SUB1 window
  6. Click No button
  7. SUB1 window is behind Example window.
  8. Move Example window to see the SUB1 window.
  9. Click Exit button
  10. Confirm exit window shows on top of the Example window
  11. Click Yes button
  12. SUB1 window "closes"
  13. Click Quit button
  14. program ends

Windows do not stay on top as they should. Am I missing something?

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Sep 11, 2017

Owner

Hmm, I'm not seeing quite the same behaviour (on a Mac, python 2.7/3.6)

Windows seem to pop-up in the right order, although if I alt-tab away and come back, the sub-window is on top of the dialog.

What platform are you on?

I suspect there may be an issue here though - I think the dialogs are all "owned" by the topLevel window. So, if one is launched from a subWindow, it may cause some issues in terms of ordering.

I need to look into this some more, but perhaps I can associate dialogs with the right subwindow/toplevel to improve this...

Owner

jarvisteach commented Sep 11, 2017

Hmm, I'm not seeing quite the same behaviour (on a Mac, python 2.7/3.6)

Windows seem to pop-up in the right order, although if I alt-tab away and come back, the sub-window is on top of the dialog.

What platform are you on?

I suspect there may be an issue here though - I think the dialogs are all "owned" by the topLevel window. So, if one is launched from a subWindow, it may cause some issues in terms of ordering.

I need to look into this some more, but perhaps I can associate dialogs with the right subwindow/toplevel to improve this...

@keithterrill

This comment has been minimized.

Show comment
Hide comment
@keithterrill

keithterrill Sep 11, 2017

OS: Linux Mint 17.3 and 18.1
Python 3.4

The example code is launched from terminal. I am only using the mouse to select/click.

keithterrill commented Sep 11, 2017

OS: Linux Mint 17.3 and 18.1
Python 3.4

The example code is launched from terminal. I am only using the mouse to select/click.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Sep 12, 2017

Owner

So, there is an option to set a parent on the dialogs - although I need to play with this on linux to see if I can replicate the issue, as I'm not seeing it on my mac.

But, I think I will put a parent option on the dialogs, so they can be linked to SubWindows if desired.

Owner

jarvisteach commented Sep 12, 2017

So, there is an option to set a parent on the dialogs - although I need to play with this on linux to see if I can replicate the issue, as I'm not seeing it on my mac.

But, I think I will put a parent option on the dialogs, so they can be linked to SubWindows if desired.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Sep 12, 2017

Owner

BTW, a couple of things I'd like to show you.

You can skip two of your functions, by linking the buttons straight to the relative appJar functions (note the used of namedButton).

Also, what do you think of this syntax style, this is something that version 0.08 will support:

from appJar import gui 

def DoExit(opt):
    if app.yesNoBox("Confirm exit","Exit sub window now?"):
        app.hideSubWindow("SUB1")

with gui("Example","400x200") as app:
    app.setLocation(100,100)

    with app.subWindow("SUB1", modal=True):
        app.addEntry("E1")
        app.addButton("Exit",DoExit)

    app.addNamedButton("SubWindow", "SUB1", app.showSubWindow)
    app.addButton("Quit", app.stop)
Owner

jarvisteach commented Sep 12, 2017

BTW, a couple of things I'd like to show you.

You can skip two of your functions, by linking the buttons straight to the relative appJar functions (note the used of namedButton).

Also, what do you think of this syntax style, this is something that version 0.08 will support:

from appJar import gui 

def DoExit(opt):
    if app.yesNoBox("Confirm exit","Exit sub window now?"):
        app.hideSubWindow("SUB1")

with gui("Example","400x200") as app:
    app.setLocation(100,100)

    with app.subWindow("SUB1", modal=True):
        app.addEntry("E1")
        app.addButton("Exit",DoExit)

    app.addNamedButton("SubWindow", "SUB1", app.showSubWindow)
    app.addButton("Quit", app.stop)

jarvisteach added a commit that referenced this issue Sep 14, 2017

Set popUp parent #249
All popUps now have an optional parent parameter

Also, added startWindow & language to GUI contextManager #234

jarvisteach added a commit that referenced this issue Sep 16, 2017

Updated docs #249
Instructions on linking to subWindows
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Sep 16, 2017

Owner

I'm going to close this - there was an issue with dialogs being associated with the top-level window, so if a dialog was launched from a SubWindow, it would bring the topLevel above the SubWindow.

You can now set a parent for dialogs, which will link them to a subWindow if required - and stop the parent from being raised.

Owner

jarvisteach commented Sep 16, 2017

I'm going to close this - there was an issue with dialogs being associated with the top-level window, so if a dialog was launched from a SubWindow, it would bring the topLevel above the SubWindow.

You can now set a parent for dialogs, which will link them to a subWindow if required - and stop the parent from being raised.

jarvisteach added a commit that referenced this issue Sep 16, 2017

@jarvisteach jarvisteach added this to the 0.08 milestone Sep 16, 2017

@keithterrill

This comment has been minimized.

Show comment
Hide comment
@keithterrill

keithterrill Sep 16, 2017

thank-you.

regards the couple of things you are showing me.... I cannot get the code you gave to run. I get an error:

Traceback (most recent call last): File "./example2.py", line 9, in <module> with gui("Example","400x200") as app: AttributeError: __exit__

I like the with statements.

keithterrill commented Sep 16, 2017

thank-you.

regards the couple of things you are showing me.... I cannot get the code you gave to run. I get an error:

Traceback (most recent call last): File "./example2.py", line 9, in <module> with gui("Example","400x200") as app: AttributeError: __exit__

I like the with statements.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Sep 24, 2017

Owner

Yeah, sorry, that was an upcoming feature - so wouldn't work in the version you were running - there's a new version out now which will support it.

Owner

jarvisteach commented Sep 24, 2017

Yeah, sorry, that was an upcoming feature - so wouldn't work in the version you were running - there's a new version out now which will support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment