Giter Site home page Giter Site logo

Comments (8)

wwmayer avatar wwmayer commented on June 25, 2024

It seems to be a problem for newer PySide versions. With my Qt 6.2.4 and corresponding PySide version it works without problems.

if button == QtGui.QDialogButtonBox.Apply.value:

The value attribute doesn't exist for older PySide versions. To make it working for all PySide versions you should try:

def clicked(self, button):
    if button == int(QtGui.QDialogButtonBox.Apply):

from freecad.

marioalexis84 avatar marioalexis84 commented on June 25, 2024

it does not work:
<class 'TypeError'>: int() argument must be a string, a bytes-like object or a real number, not 'StandardButton'

from freecad.

wwmayer avatar wwmayer commented on June 25, 2024

OK, then the alternative is to modify TaskDialogPython::clicked(int i) where the int should be converted into a QtGui.QDialogButtonBox.StandardButton and passed to the clicked() method of the Python wrapper.

Does this code snippet work for you?

from PySide import QtGui
QtGui.QDialogButtonBox.StandardButton(33554432)

from freecad.

marioalexis84 avatar marioalexis84 commented on June 25, 2024

The code snippet works.

With:

    def clicked(self, button):
        b=QtGui.QDialogButtonBox.StandardButton(button)
        if b == QtGui.QDialogButtonBox.Apply:

the button works normally.

from freecad.

wwmayer avatar wwmayer commented on June 25, 2024

OK, I will prepare a PR to handle this and #14156

Can you also check whether this works for you? #14156 (comment)

from freecad.

marioalexis84 avatar marioalexis84 commented on June 25, 2024

With #14156 (comment) buttons are not even added and there is an error generated when executing Gui.Control.showDialog.

<input>(1)<class 'TypeError'>: int() argument must be a string, a bytes-like object or a real number, not 'StandardButton'

image

from freecad.

wwmayer avatar wwmayer commented on June 25, 2024

Thanks for testing. Yes, according to the docs PyNumber_Long in C is equal to int() in Python and will fail in your case. So, I have to additionally check if the passed object has the attribute value and do the cast on that.

from freecad.

wwmayer avatar wwmayer commented on June 25, 2024

#14648

from freecad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.