-
Notifications
You must be signed in to change notification settings - Fork 95
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
Change Dialog flag to Window to allow minimize/maximize buttons to be shown #1409
Conversation
…shown by more window managers. Some window managers (e.g. Ubuntu 18, 20) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the window does not have minimize and maximize buttons on the window frame. Some window managers (e.g. Fedora) do not do buttons but they do double clicking, and those functionalities can be ignored when the window flag includes Dialog. Some window managers (e.g. OSX, Ubuntu 16) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the minimize button is disabled, but the maximize button can still be used. Some window managers (e.g. Windows, LXDE) would happily combine these flags as union, and allow minimize and maximize buttons to be placed on a Dialog frame.
I think you can infer this from |
Thank you! I realize I might have used the wrong vocabulary here trying to distinguish "top-level" versus "secondary". Sorry about that. Dialog is also a top-level window. I think I should have said is that there is no information as to whether the window is intended to be decorated like a main application window that is more standalone or a dialog intended for small tasks. I guess this is perhaps where window managers apply different interpretations as to what a dialog should look and behave compared to just a window. |
Ah, OK, that's a but different from what I thought you were saying. Other than erring on the side of assuming that things are decorated as a mainwindow, that sort of intention is hard to get out of TraitsUI. I guess if the window is modal, then it is intended to be short-lived and secondary, but there are non-modal windows that can also be intended that way (eg. a non-model search dialog). |
Agreed. Thank you. As an attempt to make sure #1078 has not come back, here is the screenshot for CentOS 8.2 default desktop environment: |
… shown (#1409) * Use Window flag instead to allow minimize and maximize buttons to be shown by more window managers. Some window managers (e.g. Ubuntu 18, 20) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the window does not have minimize and maximize buttons on the window frame. Some window managers (e.g. Fedora) do not do buttons but they do double clicking, and those functionalities can be ignored when the window flag includes Dialog. Some window managers (e.g. OSX, Ubuntu 16) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the minimize button is disabled, but the maximize button can still be used. Some window managers (e.g. Windows, LXDE) would happily combine these flags as union, and allow minimize and maximize buttons to be placed on a Dialog frame. (cherry picked from commit 5a99887)
* Fix Qt IconButton with a clickable area too small (#1383) * Fix IconButton with a clickable area too small. If we set the maximum size using the icon size, the clickable area ends up being too small to click (tested on OSX with FileEditor, RangeEditor, ListEditor). If we don't set the maximum size, the button takes up too much space. This sizeHint logic is similar to how QToolButton.sizeHint is implemented. * Expand docstring for sizeHint * Call ensurePolished as it was called in the original implementation (cherry picked from commit 8912de3) * Enable the scrollable trait of a Group in the Qt backend (#1406) * Enable the scrollable trait of a Group in the Qt backend. * Tests that should exercise each code path for scrollable groups. * Be more specific about getting widgets to avoid cross-platform issues. * Ensure UI gets disposed properly. * Fixes and improvements to tests, code, based on PR review. (cherry picked from commit b73c475) * Change Dialog flag to Window to allow minimize/maximize buttons to be shown (#1409) * Use Window flag instead to allow minimize and maximize buttons to be shown by more window managers. Some window managers (e.g. Ubuntu 18, 20) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the window does not have minimize and maximize buttons on the window frame. Some window managers (e.g. Fedora) do not do buttons but they do double clicking, and those functionalities can be ignored when the window flag includes Dialog. Some window managers (e.g. OSX, Ubuntu 16) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the minimize button is disabled, but the maximize button can still be used. Some window managers (e.g. Windows, LXDE) would happily combine these flags as union, and allow minimize and maximize buttons to be placed on a Dialog frame. (cherry picked from commit 5a99887) * Add GitHub Actions workflows targeting pip-installed dependencies (#1415) * Add GitHub Actions workflow excluding EDM * Shorten names * Shortening name * Add workflow for targeting Traits 6 * EXCLUDE_TESTS is no longer used * Split minimal test to a separate workflow as it may be scheduled differently * Remove job for wxPython + Ubuntu due to lack of allow-to-fail * Update wheel before install * Remove comment about prebuilt wheel being incompatible The wheels for wxPython 4.1.0 did not work well on Python 3.8 and 3.9. But the wheels for wxPython 4.1.1 work. * Use Python 3.6 for per-PR run * Final update to set on-schedule and on-pull-request (cherry picked from commit e14ca3e) * Reduce CI matrix on Appveyor (#1417) * Reduce matrix on Appveyor as part of migration to GitHub Actions * Add Windows to the workflow for null backend (cherry picked from commit 38e5e33) * Update changelog * CLN : Use normal string, not f-string (#1393) In this specific case, there was nothing that needed to be formatted in the string so we can just use a normal string. This was reported as a flake8 failure in the CI job - https://travis-ci.org/github/enthought/traitsui/jobs/738921895 (cherry picked from commit c5438d5) Co-authored-by: Corran Webster <cwebster@enthought.com> Co-authored-by: Poruri Sai Rahul <rporuri@enthought.com>
* Fix Qt IconButton with a clickable area too small (#1383) * Fix IconButton with a clickable area too small. If we set the maximum size using the icon size, the clickable area ends up being too small to click (tested on OSX with FileEditor, RangeEditor, ListEditor). If we don't set the maximum size, the button takes up too much space. This sizeHint logic is similar to how QToolButton.sizeHint is implemented. * Expand docstring for sizeHint * Call ensurePolished as it was called in the original implementation (cherry picked from commit 8912de3) * Enable the scrollable trait of a Group in the Qt backend (#1406) * Enable the scrollable trait of a Group in the Qt backend. * Tests that should exercise each code path for scrollable groups. * Be more specific about getting widgets to avoid cross-platform issues. * Ensure UI gets disposed properly. * Fixes and improvements to tests, code, based on PR review. (cherry picked from commit b73c475) * Change Dialog flag to Window to allow minimize/maximize buttons to be shown (#1409) * Use Window flag instead to allow minimize and maximize buttons to be shown by more window managers. Some window managers (e.g. Ubuntu 18, 20) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the window does not have minimize and maximize buttons on the window frame. Some window managers (e.g. Fedora) do not do buttons but they do double clicking, and those functionalities can be ignored when the window flag includes Dialog. Some window managers (e.g. OSX, Ubuntu 16) interprets the Dialog | WindowMinimizeButtonHint | WindowMaximizeButtonHint such that the minimize button is disabled, but the maximize button can still be used. Some window managers (e.g. Windows, LXDE) would happily combine these flags as union, and allow minimize and maximize buttons to be placed on a Dialog frame. (cherry picked from commit 5a99887) * Add GitHub Actions workflows targeting pip-installed dependencies (#1415) * Add GitHub Actions workflow excluding EDM * Shorten names * Shortening name * Add workflow for targeting Traits 6 * EXCLUDE_TESTS is no longer used * Split minimal test to a separate workflow as it may be scheduled differently * Remove job for wxPython + Ubuntu due to lack of allow-to-fail * Update wheel before install * Remove comment about prebuilt wheel being incompatible The wheels for wxPython 4.1.0 did not work well on Python 3.8 and 3.9. But the wheels for wxPython 4.1.1 work. * Use Python 3.6 for per-PR run * Final update to set on-schedule and on-pull-request (cherry picked from commit e14ca3e) * Reduce CI matrix on Appveyor (#1417) * Reduce matrix on Appveyor as part of migration to GitHub Actions * Add Windows to the workflow for null backend (cherry picked from commit 38e5e33) * Update changelog * CLN : Use normal string, not f-string (#1393) In this specific case, there was nothing that needed to be formatted in the string so we can just use a normal string. This was reported as a flake8 failure in the CI job - https://travis-ci.org/github/enthought/traitsui/jobs/738921895 (cherry picked from commit c5438d5) Co-authored-by: Corran Webster <cwebster@enthought.com> Co-authored-by: Poruri Sai Rahul <rporuri@enthought.com> (cherry picked from commit 7e9a54a)
Fixes enthought/pyface#802
This is an alternative fix to #1078, i.e. it overrides #1083 partially.
This PR:
Dialog
toWindow
. The StickyDialog is the main widget used whenconfigure_traits
oredit_traits
are called with default settings.With this, the only difference compared to TraitsUI 7.0.1 is that when
resizable
is false, the window flag isQt.Window | QtCore.Qt.WindowSystemMenuHint
instead ofQt.Dialog | QtCore.Qt.WindowSystemMenuHint
. Before this change, the dialog may not have minimize/maximize buttons in some window managers.In this part of the code base, there is in fact no information as to whether the window is intended to be top-level or a secondary window. I'd not be surprised if this then brings about other undesirable changes to the visuals on yet another desktop environment, or when one actually wants a secondary dialog-looking window and did so by setting
resizable
to false. In that case, we shall look into allowing additional information to be passed viaedit_traits
to select the appropriate setup based on more specific contextual information.Details:
The issue in #1078 was observed where the first window has a Qt.Dialog flag (because it is not resizable) but the new window has a Qt.Window flag (because it is resizable). This was the original code:
traitsui/traitsui/qt4/ui_base.py
Lines 131 to 134 in c4ee6fd
In retrospect, #1083 fixed #1078 by making both windows to have the same flag (out of
Dialog
orWindow
flag). CentOS window manager may have decided that "Dialog" should always be on top of "Window" (this is a guess).Whether the window is actually resizable is handled by the subsequent call to
setSizeConstraint(QtGui.QLayout.SetFixedSize)
, theWindow
andDialog
flags do not change that. However, a window manager may decorate the window frame differently based on these flags. In Ubuntu default desktop environment, it ignores the subsequentWindowMinimizeButtonHint
andWindowMaximizeButtonHint
flags if theDialog
flag is active. In CentOS, it similarly excludes the capability to maximize the window by double clicking the frame. Yet some X11 desktop environments (e.g. LXDE) respect these resize button hints and provide the buttons despite the Dialog flag.On Windows, none of the above had any noticeable effect: Both
WindowMinimizeButtonHint
andWindowMaximizeButtonHint
are respected such that the window can be maximized or minimized.On OSX, when the
Dialog
flag is used, the minimize button is disabled, but the maximize button can still be used.Screenshots for #1078 on Windows with this branch
(Windows has not been affected on #1078 to start with, and is not affected by #1083 nor changes in this PR)
Screenshots for #1078 on MacOSX with this branch
Screenshots for #1078 on MacOSX with master
(Note that the minimize button is disabled.)
Screenshots for #1078 on Ubuntu 18 with this branch
Screenshots for #1078 on Ubuntu 18 on master
(Note the minimize and maximize buttons are not there.)
Understandably, no self-checking tests can be written for this.