Porting to python3

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Porting to python3

Post by Kunda1 »

looo wrote: Tue Oct 09, 2018 5:06 pm

Code: Select all

 /home/beast/.FreeCAD/Mod/geodata/InitGui...
please report this to the geodata author. But yes, this should not stop freecad from launching...
Problem reported to @microelly in https://github.com/microelly2/geodata/i ... -453493790
microelly2 wrote:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Porting to python3

Post by Kunda1 »

ztirffritz wrote: Thu Jan 10, 2019 4:05 pm I tried opening this version today and found all the file preview images are missing. It's just a "?" in place of the file preview. I'm obviously a FreeCAD newb, so forgive me if this is already reported or addressed elsewhere.
This is what I see:
Image

using latest Conda Appimage
OS: Manjaro Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15609 (Git) AppImage
Build type: Release
Branch: master
Hash: a14af0f2bd26f980d71be80a799ee48127bc7619
Python version: 3.6.7
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Post by saso »

I also see this with FreeCAD_0.18.15609_Conda_Py3QT5-WinVS2015_x64 and bernd has also report it before https://forum.freecadweb.org/viewtopic. ... 40#p275570 , seems to be an issue with the qt5/py3 builds on windows... Questions is do we know why is it happening? If yes, can we fix it or is it out of our hands (ex related to qt5)?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

regarding the start-worbench problem on windows:
I am not sure if this is a problem with paths or with qt. I remeber having a build on windows with conda-deps where the start-page looked ok. This was a build where I didn't call "cmake install" -> kind of development build with kdevelop.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Post by saso »

If I right click on one of the image and chose "Copy Image Address" I get a correct path, but I don't know if it is possible to somehow check/show what is the exact html code that is generated and displayed for the start page so that one could be able to investigate the problem closer.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Post by looo »

saso wrote: Fri Jan 11, 2019 3:07 pm If I right click on one of the image and chose "Copy Image Address" I get a correct path, but I don't know if it is possible to somehow check/show what is the exact html code that is generated and displayed for the start page so that one could be able to investigate the problem closer.

Code: Select all

import StartPage
StartPage.StartPage.exportTestFile()
But there is the chance different browser handle mixed path-separators different.
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Post by saso »

the export of the start page works with FreeCAD_0.18.15396_x64_dev_win
with FreeCAD_0.18.15609_Conda_Py3QT5-WinVS2015_x64 I get

Code: Select all

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\saso\Desktop\FreeCAD_0.18.15609_Conda_Py3QT5-WinVS2015_x64\Mod\Start\StartPage\StartPage.py", line 491, in exportTestFile
    f.write(handle())
  File "C:\Users\saso\Desktop\FreeCAD_0.18.15609_Conda_Py3QT5-WinVS2015_x64\bin\lib\encodings\cp1250.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 11193-11195: character maps to <undefined>
Update: ok I got the export working :) and I see no difference in the generated html code (I did a diff compare on the two files) :|
User avatar
saso
Veteran
Posts: 1920
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Post by saso »

So, if I edit the generated html page and add "file:///" in front of the image src paths then they show up :roll:
RogerK
Posts: 28
Joined: Thu Oct 04, 2018 6:25 pm
Location: Elsau

Re: Porting to python3

Post by RogerK »

Hi
I have modified the <img src> tags in the StartPage.py and added the uri file encoding (file:/// ...) . This works fine both on py2/qt4 and py3/qt5 Win x64 builds, but only when the absolut path is present. Unfortunately this doesn't work with relativ paths, so some of the images are still missing.
StartPage.py
Modified with URI encoding for <img src> tags
(20.44 KiB) Downloaded 52 times

I belive the issue is related to the embedded Webbrowser used for displaying the start page.

Kind regards
Roger
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Porting to python3

Post by Syres »

@RogerK, thanks for the updated Startpage.py to test, I had to make a mod (using relative path) to enable the Create New.. icon to load correctly and everything on the Start Page > Documents tab works as expected. I've the four icons in Help tab > Documentation still not showing correctly but I'm sure it's a similar change to fix.

I went back and forth with the default program associations between IE11 and Google Chrome in order to get what I want which is probably way different to the regular user. Please see screenshots for the two programs below.

These tests were all carried out using:

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15611 (Git)
Build type: Release
Branch: master
Hash: 64a94ae0f7c60fc981086fe157150a9c0dca29c6
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
Attachments
Defaults_IE11.jpg
Defaults_IE11.jpg (111.89 KiB) Viewed 1660 times
Defaults_Chrome.jpg
Defaults_Chrome.jpg (138.71 KiB) Viewed 1660 times
StartPage.py
(20.48 KiB) Downloaded 58 times
Post Reply