PySide migration

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!
Post Reply
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: PySide migration

Post by wmayer »

ulrich1a wrote:Another question regarding macros: I suspect that a macro based on Pyside does not run with PyQt4. So new macros may not run on old FreeCAD-Versions. Is there a possibility to request by python-code which of both versions is available and use that version in the macro?

Ulrich

Code: Select all

try:
    from PySide import QtGui
except:
   from PyQt4 import QtGui
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: PySide migration

Post by ulrich1a »

wmayer wrote:try:
from PySide import QtGui
except:
from PyQt4 import QtGui
Thanks
Ulrich
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: PySide migration

Post by wmayer »

Start module gives an error when using e.g. German translation.

Code: Select all

import WebGui, StartGui
from StartPage import StartPage
Gives this error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Projects\FreeCAD-git\x64n\Mod\Start\StartPage\StartPage.py", line 56, in <module>
text07 = translate("StartPage","This is the FreeCAD Homepage. Here you will be able to find a lot of information about FreeCAD, including tutorials, examples and user documentation.")
File "C:\Projects\FreeCAD-git\x64n\Mod\Start\StartPage\StartPage.py", line 43, in translate
s.write(i)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 0: ordinal not in range(128)
ulrich1a
Veteran
Posts: 1957
Joined: Sun Jul 07, 2013 12:08 pm

Re: PySide migration

Post by ulrich1a »

The Material-module contains:
./Mod/Material/Material_rc.py:from PyQt4 import QtCore

It was missing in the todo list.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: PySide migration

Post by wmayer »

Fixed!
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: PySide migration

Post by yorik »

Really Werner you are way too fast! I TRIED to fix the startpage before you :)
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: PySide migration

Post by shoogen »

yorik wrote:Really Werner you are way too fast! I TRIED to fix the startpage before you :)
i tried it, too. What is the cStringIO used for?
1. i think += operations on a strings look more straightforward.
2. IMHO the conversion to utf8 should be done as the last step. Otherwise there would be the danger to coerce back to unicode if it would be used with an unicode object in a string operation. This will surly hit us again, when we aim for python3 compatebility.
EDIT: Yorik, you are right. with python 3 a conversion to utf8 right before output to a file would happen automatically.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: PySide migration

Post by yorik »

Yeah I thought about that too, but sooner or later everything will be utf8 anyway... And as far as I tested you can mix both without problems, except that the result is always utf8, a bit like ints and floats...
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: PySide migration

Post by yorik »

I fixed the toolbar problem (just a stupid typo :cry: ) and also updated the Spreadsheet and TemplatePyMod modules. Remaining list is:

- Plot and Ship must be switched (see with sanguinario joe)
- src/WindowsInstaller/LibPack.wxs contains references to PyQt4, don't know what to do there
- PartDesign scripts
- Update the wiki (do that with care)
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: PySide migration

Post by jmaustpc »

Hi Yorik
Its fixed for me to.
Thanks.

OS: Ubuntu 12.04.3 LTS
Platform: 64-bit
Version: 0.14.2993 (Git)
Branch: master
Hash: 270d25658dd98e5fee475d9e534212f0ed373002
Python version: 2.7.3
Qt version: 4.8.1
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.5.0
Post Reply