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

Subsequent attempts to open modal dialog provide different results under linux #1180

Open
DarkFenX opened this issue Mar 9, 2019 · 1 comment

Comments

@DarkFenX
Copy link

DarkFenX commented Mar 9, 2019

Debian Testing x86-64
Xorg, GNOME 3 with standard theme, 3840x2160 with 200% UI scaling
Python 3.7.2
wxPython version: 4.0.4 (wxWidgets 3.0.4) from debian repos

(i think this is xorg-specific or UI-scaling specific bug which is not reproducible under wayland with full HD, but will check only later)

from time import sleep

import wx


class MainFrame(wx.Frame):

   def __init__(self):
       wx.Frame.__init__(self, None, wx.ID_ANY, 'test')
       self.Maximize()
       self.Show()
       self.showModal()

   def showModal(self):
       dlg = ModalDialog(self)
       dlg.ShowModal()
       dlg.Destroy()
       sleep(1)
       dlg = ModalDialog(self)
       dlg.ShowModal()
       dlg.Destroy()


class ModalDialog(wx.Dialog):

   def __init__(self, parent):
       wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Dialog", size=(-1, -1), style=wx.DEFAULT_DIALOG_STYLE)
       mainSizer = wx.BoxSizer(wx.VERTICAL)

       radio1 = wx.RadioButton(self, wx.ID_ANY, 'radio1', style=wx.RB_GROUP)
       mainSizer.Add(radio1, 0, wx.EXPAND | wx.ALL, 5)

       cbSizer1 = wx.BoxSizer(wx.VERTICAL)
       checkbox11 = wx.CheckBox(self, -1, 'checkbox11')
       cbSizer1.Add(checkbox11, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
       mainSizer.Add(cbSizer1, 0, wx.EXPAND | wx.LEFT, 20)

       radio2 = wx.RadioButton(self, wx.ID_ANY, 'radio2')
       mainSizer.Add(radio2, 0, wx.EXPAND | wx.ALL, 5)

       cbSizer2 = wx.BoxSizer(wx.VERTICAL)
       checkbox21 = wx.CheckBox(self, -1, 'checkbox21')
       cbSizer2.Add(checkbox21, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
       checkbox22 = wx.CheckBox(self, -1, 'checkbox22')
       cbSizer2.Add(checkbox22, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
       checkbox23 = wx.CheckBox(self, -1, 'checkbox23')
       cbSizer2.Add(checkbox23, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 3)
       mainSizer.Add(cbSizer2, 0, wx.EXPAND | wx.LEFT, 20)

       buttonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
       if buttonSizer:
           mainSizer.Add(buttonSizer, 1, wx.EXPAND | wx.ALL, 5)
       self.SetSizer(mainSizer)
       self.Fit()
       self.Center()

app = wx.App(False)
mf = MainFrame()
app.MainLoop()

First dialog:
image

Spam in console:

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.575: for_size smaller than min-size (2 < 14) while measuring gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.575: Negative content height -3 (allocation 1, extents 2x2) while allocating gadget (node checkbutton, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.575: for_size smaller than min-size (0 < 14) while measuring gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.575: Negative content height -2 (allocation 0, extents 1x1) while allocating gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.575: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.575: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.616: for_size smaller than min-size (2 < 14) while measuring gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.616: Negative content height -3 (allocation 1, extents 2x2) while allocating gadget (node checkbutton, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.616: for_size smaller than min-size (0 < 14) while measuring gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.616: Negative content height -2 (allocation 0, extents 1x1) while allocating gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:28:50.616: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

Second dialog:
image

Console spam:

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.778: for_size smaller than min-size (2 < 14) while measuring gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.778: Negative content height -3 (allocation 1, extents 2x2) while allocating gadget (node checkbutton, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.778: for_size smaller than min-size (0 < 14) while measuring gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.778: Negative content height -2 (allocation 0, extents 1x1) while allocating gadget (node check, owner GtkCheckButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.778: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.778: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.827: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.827: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.861: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.861: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.896: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.896: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.927: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.927: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.960: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.960: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.979: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

(wxtest.py:16896): Gtk-WARNING **: 21:30:28.979: Negative content height -9 (allocation 1, extents 5x5) while allocating gadget (node button, owner GtkButton)

If I change proportion attribute to 1, it looks better but still space below ok/cancel is different:
image image

Expected result:
I am unsure what would be appropriate behavior. But i would expect dialog to fit all the controls by default in their full scale (so like 2nd screenshot but non-shrinked buttons).

@DarkFenX
Copy link
Author

DarkFenX commented Mar 11, 2019

Test results from another PC:

Debian Testing x86-64
GNOME 3 with standard theme, 1920x1080
Python 3.7.2
wxPython version: 4.0.4 (wxWidgets 3.0.4) from debian repos

Wayland 1st:
image

Wayland 2nd:
image

Xorg 1st:
image

Xorg 2nd:
image

So, this seems to be xorg-specific issue.

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

No branches or pull requests

1 participant