General -> Product URL property sometimes not saved

A forum to discuss the implementation of a good Materials system in FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

General -> Product URL property sometimes not saved

Post by uwestoehr »

Word size of FreeCAD: 64-bit, Version: 0.18.15780 (Git)
Build type: Release
Branch: master
Hash: f94e76c1116ec3b818961ff65131b3d86fa5b95e
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0

The material property General -> Product URL is not saved if the URL contains the character '=':

- add a material, then "use FreeCAD material editor"
- load a FCMat file
- use e.g. this link for the property General -> Product URL
https://www.testtest.ttt/properties.aspx?ArticleID=720
- Save it under a new FCMat file name
- press OK and again click on "use FreeCAD material editor"
- load the just saved FCMat file

result: the value for General -> Product URL is lost, the field is empty
This only happens if the URL contains an equal sign '='
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: General -> Product URL property sometimes not saved

Post by bernd »

it is even worse ... for Python 3 builds saving material files is broken at all ...

Code: Select all

Traceback (most recent call last):
  File "C:\0_BHA_privat\progr\FreeCAD_0.18.xxxxx_x64_dev_win_Py3Qt5\Mod\Material\MaterialEditor.py", line 451, in savefile
    importFCMat.write(filename, d)
  File "C:\0_BHA_privat\progr\FreeCAD_0.18.xxxxx_x64_dev_win_Py3Qt5\Mod\Material\importFCMat.py", line 122, in write
    for k, i in dictionary.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15713 (Git)
Build type: Release
Branch: master
Hash: 93dd00cc3953416bf46fb0a5b7b3c6397df6e4d0
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: General -> Product URL property sometimes not saved

Post by yorik »

changing dict.iteritems() with dict.items() works for both py2 and py3
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: General -> Product URL property sometimes not saved

Post by bernd »

yorik wrote: Fri Feb 08, 2019 1:45 pm changing dict.iteritems() with dict.items() works for both py2 and py3
changed it allready. There are even more fixes required. Will send a PR on the weekend.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: General -> Product URL property sometimes not saved

Post by bernd »

User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: General -> Product URL property sometimes not saved

Post by uwestoehr »

Many thanks. I cannot test right now, so the question, if it also fixes the issue I originally reported in this thread:

"result: the value for General -> Product URL is lost, the field is empty
This only happens if the URL contains an equal sign '='"

If not, should I open a bug tracker issue that this won't be forgotten?
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: General -> Product URL property sometimes not saved

Post by bernd »

uwestoehr wrote: Mon Feb 11, 2019 9:24 pm
Many thanks. I cannot test right now, so the question, if it also fixes the issue I originally reported in this thread:

"result: the value for General -> Product URL is lost, the field is empty
This only happens if the URL contains an equal sign '='"

If not, should I open a bug tracker issue that this won't be forgotten?
no it does not fix the original one but this https://github.com/FreeCAD/FreeCAD/pull/1966 does :mrgreen: See https://github.com/FreeCAD/FreeCAD/pull ... 84c8023711
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: General -> Product URL property sometimes not saved

Post by uwestoehr »

bernd wrote: Mon Feb 11, 2019 11:11 pm no it does not fix the original one but this https://github.com/FreeCAD/FreeCAD/pull/1966 does :mrgreen: See https://github.com/FreeCAD/FreeCAD/pull ... 84c8023711
Many, many thanks Bernd for your outstanding work! I am very impressed how quick you fix things.
I will test as soon as possible and report back. I had a look at your commits and I think the material editor is now close to be ready for FC 0.18.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: General -> Product URL property sometimes not saved

Post by bernd »

uwestoehr wrote: Mon Feb 11, 2019 11:50 pm I will test as soon as possible and report back.
That would be great. The material editor seams not yet used regularly by a lot user ATM. The unit support has been added recently. Before this the material editor was no fun at all in FEM ...

BTW: using the Py3 build is highly appreciated too!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: General -> Product URL property sometimes not saved

Post by uwestoehr »

bernd wrote: Tue Feb 12, 2019 5:09 pm That would be great.
BTW: using the Py3 build is highly appreciated too!
Here is a first quick feedback (using the conda build) with 4 issues (one mustfix in my opinion):

1. there are issues with the decimal separator. I use Locale: German/Germany (de_DE) on Windows 7. Therefore in all places FC uses the comma as decimal separator. In the material editor however, I see a mixture of dots and comma, see the attached screenshot.
This is the material card for Calculix-steel. So all existing properties use the dot while all new properties I set use the comma.

2. the preview is always empty. In the attached screenshot you see a preview filed but I never managed to see there anything, neither for the predefined materials not by setting up my own materials.

3. in the material property field "Specific Price" I cannot specify a currency unit. So maybe there should be an additional field where one can select a currency.

4. there is a nasty bug with the density:
- load the attached material card "PET.zip" I created today (using FC 0.18.15860)
result: the density is correctly 1380 kg/m³ in the editor
- now press OK
result: in the task panel you see now "1380 kg/mm³" (note the unit)
- now open the material editor
result: you see there now a senselessly high number. And when double-clicking on it you see "13800 kg/m³". So a factor of 10 was added to the original value in the material card.
Attachments
PET.zip
(578 Bytes) Downloaded 228 times
MatEditor-feedback.jpg
MatEditor-feedback.jpg (76.68 KiB) Viewed 22928 times
Post Reply