Importing json in listwid with colored text & after clearing the listwid and importing new data an error is prompted



  • Hello,
    Past couple of days i have been trying to color text which are already imported in listwid

    1. i have created a json file in which all the data(dict) is stored
    2. i clear the existing data from the listwid, an error is prompted currently not the concern but still a point which needs to be fixed
    #   File "E:\Proj_Codes\NitinProj\vacuum_cleaner\vacuum_cleaner_delegate.py", line 47, in vacuum_cleaner_textedit_values
    #     self.vacuum_cleaner_listwid.currentItem().text())))
    # AttributeError: 'NoneType' object has no attribute 'text'
    

    and import the updated data in the wid
    3) so here is the issue after importing the new json data(dict) i want to show the wrong values in red and correct in green inside listwid
    i know "listwidgetitem" but after reading json file i have no clue how can i apply color to text
    This tool is for maya with pyside2

    vacuum_cleaner.py
    https://github.com/blossomsg/NitinProj.git

    suggestions would be great and with an example would be cherry on the cake

    Thank You.


  • Lifetime Qt Champion

    Hi,

    Check that the item returned by currentItem() is not None and continue your code only if it's the case.



  • Hello,
    Thank you for your help

    i used ".disconnect" to disconnect the previous json and then import the new json file

    Thank You.


Log in to reply