[ Fixed ] [ Bug ] Draft_SetStyle: Apply to selected button results in error

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

[ Fixed ] [ Bug ] Draft_SetStyle: Apply to selected button results in error

Post by Roy_043 »

Test:
  1. Select an object.
  2. Call Draft_SetStyle. Either via the Utilities menu or the Draft Tray.
  3. Press the "Selected" button to apply the settings to the selected object.
  4. Result: Error.
    11:28:28 D:\BKG_Tmp\FreeCAD_0.20_Last_Conda\Mod\Draft\draftguitools\gui_setstyle.py(187)<class 'SystemError'>: PyEval_EvalFrameEx returned a result with an error set
    11:28:28 D:\BKG_Tmp\FreeCAD_0.20_Last_Conda\Mod\Draft\draftguitools\gui_setstyle.py(203)<class 'SystemError'>: PyEval_EvalFrameEx returned a result with an error set

Code: Select all

OS: Windows 8.1 (6.3)
Word size of FreeCAD: 64-bit
Version: 0.20.25065 (Git)
Build type: Release
Branch: master
Hash: 4de2ad46b2b9c78ac2721a0dbea7c19306261095
Python version: 3.8.10
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: Dutch/Netherlands (nl_NL)
Last edited by Roy_043 on Tue Aug 03, 2021 9:08 am, edited 1 time in total.
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: [ Bug ] Draft_SetStyle: Apply to selected button results in error

Post by Syres »

Purely from a consistency point of view, should/could this https://github.com/FreeCAD/FreeCAD/blob ... or.py#L368 be changed to suit in the same PR?
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: [ Bug ] Draft_SetStyle: Apply to selected button results in error

Post by Roy_043 »

Syres wrote: Tue Jun 22, 2021 8:47 am should/could this
Thanks for looking at this.

Internally styles rely on dictionaries in which colors are stored as single integers. That color format is used throughout the implementation. It is only when a color is applied to an object that the color needs to be converted to an RGB list/tupple. At least that is how I understand it.

If you look a little higher in the code you can see how the single integer is converted to RGB numbers:
https://github.com/FreeCAD/FreeCAD/blob ... or.py#L342
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: [ Bug ] Draft_SetStyle: Apply to selected button results in error

Post by Roy_043 »

Merged.
Post Reply