YCircuit doesn't start if the system decimal separator is not set to a period

Issue #41 resolved
Bart H created an issue

YCircuit crashes at startup if the system decimal separator is not set to a period. This is because it saves floating point numbers to the config file using the system decimal separator, but is only able to read them if they use a period as the separator.

This makes YCircuit unusable for pretty much any European locale!

Error:

Traceback (most recent call last):
  File "top.py", line 54, in <module>
    form = myMainWindow(clipboard=app.clipboard())
  File "D:\source\ycircuit\src\mainwindow.py", line 24, in __init__
    self.ui.drawingArea.applySettingsFromFile('.config')
  File "D:\source\ycircuit\src\drawingarea.py", line 179, in applySettingsFromFile
    self.exportImageWhitespacePadding = settings.value('SaveExport/Export/Whitespace padding', '1.1', type=float)
TypeError: unable to convert a QVariant of type 10 to a QMetaType of type 6

Corresponding line in .config (using a comma as the decimal separator):

Export\Whitespace%20padding="1,1"

Comments (3)

  1. Siddharth Shekar repo owner

    Thanks for bringing this issue to my attention. Qt supports localization so this should hopefully not be too difficult to fix. I'll update this issue once I have something for you to try out.

  2. Bart H reporter

    I had some time to look at the source today. This is solved by changing lines 166-167 in optionswindow.py from

    self.settings.setValue('SaveExport/Export/Whitespace padding', self.ui.doubleSpinBox_exportImageWhitespacePadding.text())
    self.settings.setValue('SaveExport/Export/Image scale factor', self.ui.doubleSpinBox_exportImageScaleFactor.text())
    

    to

    self.settings.setValue('SaveExport/Export/Whitespace padding', self.ui.doubleSpinBox_exportImageWhitespacePadding.value())
    self.settings.setValue('SaveExport/Export/Image scale factor', self.ui.doubleSpinBox_exportImageScaleFactor.value())
    
  3. Log in to comment