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

DisplayMode is not callable (or something like this) #4

Closed
galou opened this issue Aug 16, 2024 · 3 comments
Closed

DisplayMode is not callable (or something like this) #4

galou opened this issue Aug 16, 2024 · 3 comments
Labels
invalid This doesn't seem right

Comments

@galou
Copy link
Contributor

galou commented Aug 16, 2024

Not sure about the solution but it seems to solve the error:

diff --git a/freecad/cross/fpo.py b/freecad/cross/fpo.py
index d07f92f..cd384ea 100644
--- a/freecad/cross/fpo.py
+++ b/freecad/cross/fpo.py
@@ -1558,7 +1558,7 @@ def t_view_proxy_get_def_dm(overridden: Any, meta: TypeMeta):
     user = getattr(meta.cls, _DEFAULT_DISPLAY_MODE, None)
     if user:
         def handler(self):
-            return user(self)
+            return user.name
         return handler
 
     if not meta.display_modes:
@mnesarco
Copy link
Owner

mnesarco commented Aug 16, 2024

What is the error?
user.name has no sense as default_display_mode must be a method. The intention of the code is to call the user defined method if it is already defined.

Maybe if you show the code and the error i can understand better the issue.

@mnesarco
Copy link
Owner

I don't know your current code but the expected usage is something like:

@proxy()
class MyComp:

  def default_display_mode(self):
    return ...
    

@galou
Copy link
Contributor Author

galou commented Aug 19, 2024

I see now. The error must have been on my side. I found the error on the terminal but I don't have the corresponding code anymore:

Traceback (most recent call last):
  File "/home/gael/.local/share/FreeCAD/Mod/freecad.cross/freecad/cross/fpo.py", line 1561, in handler
    return user(self)
<class 'TypeError'>: 'DisplayMode' object is not callable

I know, it doesn't bring anything more.

I'll close the issue until I'm able to reproduce.

@galou galou closed this as completed Aug 19, 2024
@mnesarco mnesarco added the invalid This doesn't seem right label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants