Porting to python3

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
Kunda1
Posts: 5806
Joined: Thu Jan 05, 2017 9:03 pm

Re: Porting to python3

Postby Kunda1 » Fri Jan 11, 2019 11:53 am

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:
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5806
Joined: Thu Jan 05, 2017 9:03 pm

Re: Porting to python3

Postby Kunda1 » Fri Jan 11, 2019 11:59 am

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)
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
saso
Posts: 1333
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Postby saso » Fri Jan 11, 2019 1:25 pm

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)?
looo
Posts: 2917
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Postby looo » Fri Jan 11, 2019 1:45 pm

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.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
User avatar
saso
Posts: 1333
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Postby saso » 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.
looo
Posts: 2917
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Postby looo » Fri Jan 11, 2019 4:12 pm

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.
please help with my conda-packaging efforts: https://liberapay.com/looooo/
User avatar
saso
Posts: 1333
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Postby saso » Fri Jan 11, 2019 8:16 pm

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
Posts: 1333
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Postby saso » Fri Jan 11, 2019 9:47 pm

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: 27
Joined: Thu Oct 04, 2018 6:25 pm
Location: Elsau

Re: Porting to python3

Postby RogerK » Sat Jan 12, 2019 9:37 am

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 13 times

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

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

Re: Porting to python3

Postby Syres » Sat Jan 12, 2019 11:26 am

@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 365 times
Defaults_Chrome.jpg
Defaults_Chrome.jpg (138.71 KiB) Viewed 365 times
StartPage.py
(20.48 KiB) Downloaded 16 times