Porting to python3

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
wmayer
Site Admin
Posts: 14879
Joined: Thu Feb 19, 2009 10:32 am

Re: Porting to python3

Postby wmayer » Wed Feb 13, 2019 8:56 am

looo wrote:
Wed Feb 13, 2019 7:31 am
I see, thanks. Any ideas how to debug this behavior? (missing auto-completion)
No, but I think there is a bug in PyCXX wrt Py3. IIRC then an option might be to use the class Py::PythonClass instead of Py::PythonExtension
looo
Posts: 2898
Joined: Mon Nov 11, 2013 5:29 pm

Re: Porting to python3

Postby looo » Wed Feb 13, 2019 9:38 am

is our included pycxx updated?

simple changing the base class didn't work for me:

Code: Select all

/home/k/projects/FreeCAD/src/Gui/View3DViewerPy.cpp: In static member function ‘static void Gui::View3DInventorViewerPy::init_type()’:
/home/k/projects/FreeCAD/src/Gui/View3DViewerPy.cpp:50:5: error: ‘add_varargs_method’ was not declared in this scope
please help with my conda-packaging efforts: https://liberapay.com/looooo/
User avatar
curiouscow
Posts: 3
Joined: Mon Jan 07, 2019 1:48 am

Re: Porting to python3

Postby curiouscow » Sat Feb 23, 2019 7:33 pm

Here are the irregularities I have noticed when working with the Py3/QT5 AppImage (up to 15900):

* two of the icons are missing (see attached image). An AppImage packaging problem ?

* when exporting a TechDraw document in .pdf format, the template is not exported (example is attached). This works with py2 version.

* Formatting of the splash screen does not look right. Version number is in the wrong place.

Overall, I like the py3/QT5 version a lot. Feels snappier and looks better.

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15900 (Git) AppImage
Build type: Release
Branch: master
Hash: a73b10203ab1cb31df4a8763b050d64da8e81580
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)
Attachments
Test_TD_pdf_py3.pdf
(185.57 KiB) Downloaded 17 times
Test_TD_pdf_py2.pdf
(374.12 KiB) Downloaded 18 times
Test_TD_pdf.FCStd
(102.31 KiB) Downloaded 18 times
Missing_icons.png
Missing_icons.png (19.57 KiB) Viewed 650 times
User avatar
saso
Posts: 1332
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Postby saso » Sat Mar 02, 2019 11:12 am

saso wrote:
Tue Jan 15, 2019 1:21 pm
saso wrote:
Sat Jan 12, 2019 12:44 pm
But I am also not able to load a translation of the start page, for example if I set the language to Slovenian I get

Code: Select all

("(unicode error) 'utf-8' codec can't decode byte 0xe8 in position 2: invalid continuation byte", ('<string>', 6, 46, None))
About this error I have found this as a possible solution https://stackoverflow.com/questions/124 ... -byte-0x9c

But I don't quite know where in our code I should do this change to test if it works :?
I still see this error, if it is not something to complex to fix it would be nice to fix it before the release

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15998 (Git)
Build type: Release
Branch: master
Hash: 5791c341be797ff2eee99eccac53df71db510fae
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Slovenian/Slovenia (sl_SI)
User avatar
easyw-fc
Posts: 2662
Joined: Thu Jul 09, 2015 9:34 am

Re: Porting to python3

Postby easyw-fc » Sat Mar 02, 2019 11:19 am

wandererfan
Posts: 3062
Joined: Tue Nov 06, 2012 5:42 pm

Re: Porting to python3

Postby wandererfan » Sat Mar 02, 2019 4:21 pm

curiouscow wrote:
Sat Feb 23, 2019 7:33 pm
* when exporting a TechDraw document in .pdf format, the template is not exported (example is attached). This works with py2 version.
So far, this appears to be a Qt4 vs Qt5 issue rather that py2 vs py3.

py2/Qt4 works
py2/qt5 doesn't work (fc daily)
py3/qt5 doesn't work

There are apparently a lot of changes to Qt's print functions in Qt5, but I haven't found one that would cause this yet.
wandererfan
Posts: 3062
Joined: Tue Nov 06, 2012 5:42 pm

Re: Porting to python3

Postby wandererfan » Sun Mar 03, 2019 1:46 pm

curiouscow wrote:
Sat Feb 23, 2019 7:33 pm
* when exporting a TechDraw document in .pdf format, the template is not exported (example is attached). This works with py2 version.
If I change the Page to use a different Template, the PDF export works.
OriginalNISTTemplate.png
Using original template
OriginalNISTTemplate.png (24.13 KiB) Viewed 455 times
ChangedTemplate.png
Using template fromTemplate dir
ChangedTemplate.png (53.64 KiB) Viewed 455 times
OS: Linux Mint 19
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16027 +1 (Git)
Build type: debug
Branch: 3DShot
Hash: eeee8d929fd17ef372fe4fa45d6480cef8e74887
Python version: 3.6.7
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)
triplus
Posts: 8710
Joined: Mon Dec 12, 2011 4:45 pm

Re: Porting to python3

Postby triplus » Sun Mar 03, 2019 4:53 pm

curiouscow wrote:
Sat Feb 23, 2019 7:33 pm
* two of the icons are missing (see attached image). An AppImage packaging problem ?
I have seen such report before but ATM i can't reproduce this on Ubuntu 16.04.
saso wrote:
Sat Mar 02, 2019 11:12 am
I still see this error, if it is not something to complex to fix it would be nice to fix it before the release
Two encoding related issues in Start workbench recently got resolved and i can't reproduce the mentioned one. Highly likely therefore the character is coming form somewhere else, and that was not addressed yet, or some sort of locale issue is at play. If you temporary move user.cfg and system.cfg to some other location and start FreeCAD. Is the problem still reproducible?
wandererfan
Posts: 3062
Joined: Tue Nov 06, 2012 5:42 pm

Re: Porting to python3

Postby wandererfan » Wed Mar 06, 2019 10:08 pm

curiouscow wrote:
Sat Feb 23, 2019 7:33 pm
* when exporting a TechDraw document in .pdf format, the template is not exported (example is attached). This works with py2 version.
The template has a large rectangle with opacity set to zero as the top most item. If I move this rectangle to the bottom of the pile and change its colour/opacity, the export works fine.
nisttestDaily.pdf
(181.44 KiB) Downloaded 16 times
User avatar
saso
Posts: 1332
Joined: Fri May 16, 2014 1:14 pm
Contact:

Re: Porting to python3

Postby saso » Fri Mar 08, 2019 9:29 am

triplus wrote:
Sun Mar 03, 2019 4:53 pm
saso wrote:
Sat Mar 02, 2019 11:12 am
I still see this error, if it is not something to complex to fix it would be nice to fix it before the release
Two encoding related issues in Start workbench recently got resolved and i can't reproduce the mentioned one. Highly likely therefore the character is coming form somewhere else, and that was not addressed yet, or some sort of locale issue is at play. If you temporary move user.cfg and system.cfg to some other location and start FreeCAD. Is the problem still reproducible?
Thanks for looking at it. I still see it with build 0.18.16078. On Win10 I get it also when I set the language to Hrvatski or Čeština (probably some others, did not test them all :) ), on Win7 I see it only with Čeština (from the tested languages). I have now the suspicion that the issue is not in the generated start page but the small tab at the bottom where the name of the view is written and that the issue is when this string contains special characters.

PS: You have to change to a different WB then change back to Start WB to trigger it.