Several tool panels missing fields in the UI on MacOS - fixed for next version

Issue #479 new
Hans Boot created an issue

This MIGHT be related to #460

Problem

In the panel tool, there is no possibility to:

  • select the Object type, it is stuck on Gerber files, so implicitly it is not possible to panelize excellon drills.
  • change anything in the section “Panel data” or the constrain settings, resulting in using the preference settings.

Comparable problems exist in the following tools:

  • Solder Paste
  • (Check) Rules (bottom part only)
  • Calculators

Configuration

MacOS 10.15.7

Latest FlatCam version from Git:

commit 90b96f7be4530a6e2cce3c3ad2d3ca42cc5e6f05 (HEAD -> Beta, origin/Beta)

Merge: 8f88fb27 911f2d3b

Author: Andre Spahlinger <andre.spahlinger@gmx.de>

Date:   Tue Dec 29 09:36:03 2020 +0000

    Merged in FixTclCommandNew (pull request #331)

    FixTclCommandNew (Issue #478)

Fresh brew update/upgrade

Fresh pip3 packages re-install/update

Potential cause

The use of QFormLayout instead of QGridLayout, or some issue with form_layout.addRow

The labels are all shown as it should, but the fields are absent if they are in the second column.

Crash on closing

By the way, when I close FlatCam, I almost always end up with an exception. I get this:

[DEBUG][Dummy-10] 0.374408 seconds adding object and plotting.
[DEBUG] App.PreferencesUIManager.save_defaults()
[DEBUG][MainThread] propagate_defaults()
[DEBUG][MainThread] App.save_project_auto_update() --> updated the interval timeout.
WARNING: Traceback (most recent call last):
  File "/Users/(--redacted--)/flatcam/app_Main.py", line 3538, in final_save
    self.on_file_saveprojectas(use_thread=True, quit_action=True)
AttributeError: 'App' object has no attribute 'on_file_saveprojectas'
zsh: abort      python3 FlatCAM.py

flatcam % /usr/local/Cellar/python@3.9/3.9.1_3/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/resource_tracker.py:216: UserWarning: resource_tracker: There appear to be 12 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

or this:

[DEBUG][MainThread] App.save_project_auto_update() --> updated the interval timeout.
[DEBUG] App.PreferencesUIManager.save_defaults()
[DEBUG][MainThread] propagate_defaults()
[DEBUG][MainThread] App.save_project_auto_update() --> updated the interval timeout.
[DEBUG][MainThread] App.quit_application() --> App Defaults saved.
[DEBUG][MainThread] App.quit_application() --> App UI state saved.
[DEBUG][MainThread] App.quit_application() --> 'App' object has no attribute 'new_launch'
[DEBUG][MainThread] App.quit_application() --> 'App' object has no attribute 'listen_th'
zsh: segmentation fault  python3 FlatCAM.py

Error message on opening

[DEBUG][MainThread] Opening project: /Users/(--redacted--)/lidarboardsv2.FlatPrj
[ERROR][MainThread] Failed to parse project file, trying to see if it loads as an LZMA archive: /Users/(--redacted--)/lidarboardsv2.FlatPrj because 'utf-8' codec can't decode byte 0xfd in position 0: invalid start byte
[DEBUG][MainThread] on_file_new()

It does however load the project correctly and this message does not change, even when I save the project again.

Comments (12)

  1. Marius Stanciu

    Hello Hans,

    Unfortunately I do all my programming (and usage) in Windows where everything work as expected regarding the GUI. I do not know why there are issues with the GUI elements in MacOS but I will try to see if I can get a virtual image from somewhere and test.

    The crash on closing if choosing to save is solved.


    The following debug messages are normal for MacOS since those are disabled for MacOS:

    [DEBUG][MainThread] App.quit_application() --> 'App' object has no attribute 'new_launch'
    [DEBUG][MainThread] App.quit_application() --> 'App' object has no attribute 'listen_th'
    

    But this is not:

    zsh: segmentation fault  python3 FlatCAM.py
    

    I guess this is because MacOS may enforce some things and since I am not working in MacOS (no experience here) I really can’t help. Although getting this when you close the application may not matter that much.


    The error message on opening projects is normal and expected. The application tries first to load the old type of projects or projects that are configured to be saved as not compressed. If it fail then it tries to open compressed projects (the default for the later versions of FlatCAM beta). So don’t worry about this, it can be safely ignored. I will mark it as ‘DEBUG’ though instead of ‘ERROR’.

  2. Hans Boot reporter

    Hi, about the “I will try to see if I can get a virtual image from somewhere”, that will be hard. One can run MacOS VM images only on Mac hardware. There are some options though:

    • Amazon AWS has mac instances.
    • the people behind kicad have a load of Mac instances they test and build on. One could try to smooth talk them.
    • find a (2nd hand?) mac or macbook or mac mini
    • I could help you out by setting up a Mac mini instance via a VPN (but no guarantees about uptime, residential installation)
    • I could try to repair.

    Out of the last 2, the last one is probably less work for me, although I never worked with tcl-tk.

    Will take a look. The other panels seem OK, these ones are not. So it should be not that hard.

  3. Hans Boot reporter

    Just to clarify: it is not a problem of the version of tcl-tk. Neither 8.5 nor 8.6 show the missing fields. In 8.6 there is another bug: the menu shows, but cannot be clicked upon.

  4. Hans Boot reporter

    So I tried a couple of options. The addRow call refuses to display the second widget, if called with 2 widgets. No matter the spacing, FormAlignment or LabelAlignment. So either there is some overall setting that messes this up, or we have to bypass it.

    Going from

            form_layout_0 = QtWidgets.QFormLayout()
            self.layout.addLayout(form_layout_0)
            ...
            form_layout_0.addRow(self.type_object_label,self.type_obj_combo)
    

    to

            form_layout_0 = QtWidgets.QFormLayout()
            self.layout.addLayout(form_layout_0)
            ...
            grid0 = QtWidgets.QGridLayout()
            grid0.addWidget(self.type_object_label, 0, 0)
            grid0.addWidget(self.type_obj_combo, 0, 1)
            form_layout_0.addRow(grid0)
    

    solves the issues.

    But in that case, why not directly do it like the other forms do:

            grid0 = QtWidgets.QGridLayout()
            self.layout.addLayout(grid0)
            ...
            grid0.addWidget(self.type_object_label, 0, 0)
            grid0.addWidget(self.type_obj_combo, 0, 1)
    

    After all, QFormLayout is nothing but a facilitator for QGridLayout. And the tool forms that were updated lately all use QGridLayout.

    I would be willing to take this up, but it will mean a lot of updated files, and I do not have access to do pull requests for this repo.

  5. Marius Stanciu

    Hello Hans,

    While you posted the latest replies I actually made the changes in my working copy and replaced all the QFormLayout() usages with QGridLayout(), all over the app.
    Actually this was in my plan already but I just made the changes here and there, progressively, as I worked on different aspects of the UI.

    These changes will be made available on the Beta branch when the 8.995 is ready for release.

    Thank you for your help and pointing it out that the QFormLayout is the problem. It saved me to use the VMWare image for the MacOS (it is possible to run it on the Intel PC’s but it does require some changes; I already done it once, last year I think).

    Happy New Year,
    Marius

  6. Log in to comment