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

Add wxpython 4.2.x compatibility #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

perchrh
Copy link

@perchrh perchrh commented Feb 4, 2024

Running the app, both from pip and from sources, I get the below error.
The cause is that the wxpython 4.2.1 API, which is what's available and installed on the latest Ubuntu (23.10), doesn't allow font sizes of type 'float'.
The fix is to simply use an integer font size everywhere in the code.


$ GoSync
Traceback (most recent call last):
  File "/usr/local/bin/GoSync", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GoSync/GoSync.py", line 38, in main
    controller = GoSyncController()
                 ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GoSync/GoSyncController.py", line 171, in __init__
    selectionPage = SelectionPage(nb, self.sync_model)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GoSync/GoSyncSelectionPage.py", line 37, in __init__
    headerFont = wx.Font(11.5, wx.SWISS, wx.NORMAL, wx.NORMAL)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Font(): arguments did not match any overloaded call:
  overload 1: too many arguments
  overload 2: argument 1 has unexpected type 'float'
  overload 3: argument 1 has unexpected type 'float'
  overload 4: argument 1 has unexpected type 'float'
  overload 5: argument 1 has unexpected type 'float'
  overload 6: argument 1 has unexpected type 'float'
  overload 7: argument 1 has unexpected type 'float'

@perchrh
Copy link
Author

perchrh commented Feb 4, 2024

Also, there's a new validation assert in the wxpython 4.2 that kicks in on an invalid statement in the code. See below.
The fix I did was to follow the error's instructions and remove the conflicting instructions.


$ GoSync 
Traceback (most recent call last):
  File "/usr/local/bin/GoSync", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GoSync/GoSync.py", line 38, in main
    controller = GoSyncController()
                 ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GoSync/GoSyncController.py", line 166, in __init__
    accountPage = PageAccount(nb, self.sync_model)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GoSync/GoSyncController.py", line 61, in __init__
    self.driveUsageBar = DriveUsageBox(self, long(aboutdrive['storageQuota']['limit']), -1)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/GoSync/DriveUsageBox.py", line 75, in __init__
    mainSizer.Add(self.basePanel, 0, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER, 10)
wx._core.wxAssertionError: C++ assertion "CheckSizerFlags(!((flags) & (wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL | wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL)))" failed at ./src/common/sizer.cpp(2288) in DoInsert(): wxALIGN_RIGHT | wxALIGN_CENTRE_HORIZONTAL | wxALIGN_BOTTOM | wxALIGN_CENTRE_VERTICAL will be ignored in this sizer: wxEXPAND overrides alignment flags in box sizers

DO NOT PANIC !!

If you're an end user running a program not developed by you, please ignore this message, it is harmless, and please try reporting the problem to the program developers.

You may also set WXSUPPRESS_SIZER_FLAGS_CHECK environment variable to suppress all such checks when running this program.

If you're the developer, simply remove this flag from your code to avoid getting this message. You can also call wxSizerFlags::DisableConsistencyChecks() to globally disable all such checks, but this is strongly not recommended.

@perchrh perchrh changed the title Fix illegal font size for wxpython 4.2.x Add wxpython 4.2.x compatibility Feb 4, 2024
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.

1 participant