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

Can't Get Combo View #220

Closed
mampir opened this issue May 21, 2024 · 7 comments
Closed

Can't Get Combo View #220

mampir opened this issue May 21, 2024 · 7 comments

Comments

@mampir
Copy link

mampir commented May 21, 2024

Hello,

When I try to Export 3D Model or another action, I get the following error log:

11:47:29  PoM not present
11:47:29  using 'Part' container and 'Links'
11:47:29  FC Version 021-2
11:47:29  kicad StepUp version 12.0.3
11:47:29  tolerance on vertex applied
11:47:29  applying Materials to Shapes
11:47:29  your home path is /home/mmp
11:47:29  export to STEP False
11:47:29  Running the Python command 'ksuToolsExportModel' failed:
Traceback (most recent call last):
  File "/home/mmp/.local/share/FreeCAD/Mod/kicadStepUpMod/./kicadStepUpCMD.py", line 1289, in Activated
    from kicadStepUptools import routineScaleVRML
  File "/home/mmp/.local/share/FreeCAD/Mod/kicadStepUpMod/./kicadStepUptools.py", line 21737, in 
    cv.setFeatures( QtGui.QDockWidget.DockWidgetMovable | QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetClosable )
    ^^^^^^^^^^^^^^

'NoneType' object has no attribute 'setFeatures'

I'm using FreeCAD 0.21.2 and KiCadStepUp revision 56df083.

@mampir
Copy link
Author

mampir commented May 21, 2024

I managed to make the export button work with this ugly thing:

diff --git a/kicadStepUptools.py b/kicadStepUptools.py
index 7ae55fe..2d86899 100644
--- a/kicadStepUptools.py
+++ b/kicadStepUptools.py
@@ -21732,6 +21732,12 @@ if singleInstance():
         cv = t.findChild(QtGui.QDockWidget, "Model")
         if cv is None:
             cv = t.findChild(QtGui.QDockWidget, "Tree view")
+            if cv is None:
+                cv = [o for o in t.children () if o.objectName () == "Combo View"]
+                if cv:
+                    cv = cv[0]
+                else:
+                    cv = None
     #say( "Combo View" + str(cv))
     ## print( "KSUWidget" + str(wf))        
     cv.setFeatures( QtGui.QDockWidget.DockWidgetMovable | QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetClosable )

Should I make a pull request for this?

@easyw
Copy link
Owner

easyw commented May 23, 2024

Should I make a pull request for this?

yes please

@ https://github.com/easyw/kicadStepUpMod/blob/56df083ae33473b5eb7698307ed181cb5c771032/kicadStepUptools.py#L1371
I also did this:

    cv = t.findChild(QtGui.QDockWidget, "Combo View")
    if cv is None:
        cv = t.findChild(QtGui.QDockWidget, "ComboView")
        if cv is None:
            cv = t.findChild(QtGui.QDockWidget, "Model")
            if cv is None:
                cv = t.findChild(QtGui.QDockWidget, "Tree view")

does it work for you?

@mampir
Copy link
Author

mampir commented May 23, 2024

does it work for you?

It does not and it can be fixed the same way, but then the next lines start to fail, starting @ https://github.com/easyw/kicadStepUpMod/blob/56df083ae33473b5eb7698307ed181cb5c771032/kicadStepUptools.py#L1384

    if KSUWidget and cv:
        dw=t.findChildren(QtGui.QDockWidget)
        try:
            t.tabifyDockWidget(cv,KSUWidget)                
        except:
            pass
        k_tab = t.findChild(QtGui.QDockWidget, "kicadStepUp") #"kicad StepUp 3D tools")  # L1384 -> returns None  
        k_tab.activateWindow()  # Error

I tried to fix this in a similar way, by checking the children names in a loop, but none of the children have the name "kicadStepUp". I even checked recursively for "kicadStepUp". Without fixing the code you mentioned, the window can't be docked, but at least appears.

@easyw
Copy link
Owner

easyw commented May 31, 2024

hi @mampir
I cannot reproduce your issue...
could you please attach a zipped version of your FreeCAD 'user.cfg' file?

@mampir
Copy link
Author

mampir commented May 31, 2024

user.cfg.zip
Here you go. You may also note, that I'm using I'm using this packaging of FreeCAD: https://www.parabola.nu/packages/libre/x86_64/freecad/

@easyw
Copy link
Owner

easyw commented Jun 19, 2024

@mampir
I cannot reproduce your issue...
it could be related to your distribution/packaging...
I'm closing it for the moment

@easyw easyw closed this as completed Jun 19, 2024
@mampir
Copy link
Author

mampir commented Jun 19, 2024

That's very disappointing and annoying. Of course it is because of different distribution and packaging - people use more than one distribution and packaging in this world. You could have just implemented the simple fix I already submitted.

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

2 participants