ooflet / Mi-Create

Unofficial watchface creator for Xiaomi wearables ~2021 and above
https://ooflet.github.io/docs
GNU General Public License v3.0
48 stars 4 forks source link

internal error: AttributeError: 'int' object has no attribute 'isnumeric' #27

Closed secretmango closed 1 month ago

secretmango commented 2 months ago

Describe the bug Always when I edit the data of a widget for some time, a crash happens, and afterwards no data can be entered anymore, the "data" field has an empty entry and everything below is gone

After restarting the app, the "data" field is there again.

To Reproduce not sure to be honest

I am trying to create a simple watchface for a Mi Band 8, with 2 digit blocks, one hour one minute, with a numeric value, zero hidden

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

Internal error! Please report as a bug.

Traceback (most recent call last):
  File "/var/home/user/programs/Mi-Create-1.0.1/src/./main.py", line 648, in <lambda>
    self.Explorer.itemSelectionChanged.connect(lambda: self.updateProjectSelections("explorer"))
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/user/programs/Mi-Create-1.0.1/src/./main.py", line 1067, in updateProjectSelections
    self.updateProperties(currentExplorerSelected[0],
  File "/var/home/user/programs/Mi-Create-1.0.1/src/./main.py", line 772, in updateProperties
    self.propertiesWidget.loadProperties(self.propertyJson[itemType], currentProject["project"], item,
  File "/var/home/user/programs/Mi-Create-1.0.1/src/widgets/properties.py", line 510, in loadProperties
    self.addProperties(properties["properties"], project, widgetName, resourceList, None, device)
  File "/var/home/user/programs/Mi-Create-1.0.1/src/widgets/properties.py", line 300, in addProperties
    self.addProperties(property, project, widgetName, resourceList, categoryItem, device)  # Recursively add sub-categories
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/home/user/programs/Mi-Create-1.0.1/src/widgets/properties.py", line 447, in addProperties
    if propertyValue.isnumeric():
       ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'isnumeric'
ooflet commented 2 months ago

That should have been fixed on commit 8cf218e, try pulling the latest version.

If you want to do a quick local fix, change line 447 to if isinstance(propertyValue, int) or propertyValue.isnumeric():