Giter Club home page Giter Club logo

Comments (2)

tassaron avatar tassaron commented on July 18, 2024

Components are designed with the assumption that re-drawing the preview happens after some "tracked value" (usually the content of a widget) changes.

Normally the component's update method does cause the preview to re-render, but it will only do so if the output of the component's savePreset method changes... this is a dictionary of tracked values.

The simplest way to get the preview to re-render, is to put the image URL into a Qwidget (could be an invisible one). Use the trackWidgets method as described in step 3 of component creation.

Something like

    def widget(self, *args):
        super().widget(*args)
        self.page.pushButton_GetNew.clicked.connect(self.getNewImage)
        self.trackWidgets({
            'imagePath': self.page.label_imagePath,
            'tags': self.page.lineEdit_tags,
     })

Then this component would have the properties imagePath and tags.

The getNewImage method can get the value of self.tags and ask Unsplash for an image path, then set the value of the tracked Qwidget (self.page.label_imagePath in my hypothetical) which will automatically set the value of self.imagePath and trigger the preview to re-render. And this should make the component work with the project system and undo system, I think.

Thanks for your interest in the program and don't hesitate to ask more questions! I'll try to respond a bit sooner next time :)

from audio-visualizer-python.

Tanza3D avatar Tanza3D commented on July 18, 2024

ah, that worked! alright, thanks for letting me know how it works, and i'll be sure to reach out if i have any more questions! thanks for the help!

from audio-visualizer-python.

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.