Strange character on input numbers [SOLVED]

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
wmayer
Site Admin
Posts: 15279
Joined: Thu Feb 19, 2009 10:32 am

Re: Strange character on input numbers

Postby wmayer » Fri Jan 29, 2016 5:31 pm

Do you get the strange character for any input field or only for the one of the screen shot? And when you execute this snippet below do you get also strange characters or normal input?

Code: Select all

from PySide import QtGui
s=QtGui.QDoubleSpinBox()
s.setValue(1.5)
s.show()
And what happens with?

Code: Select all

ui=FreeCADGui.UiLoader()
q=ui.createWidget("Gui::QuantitySpinBox")
q.setProperty("unit","mm")
q.show()
Then it would also a bit of help to identify the ASCII code of the characters:

Code: Select all

t = "..." # set here the text with copy&paste
for i in t: print (ord(i))
And to get some information about your locales you could try this:

Code: Select all

from PySide import QtCore
loc=QtCore.QLocale.system()
loc.country()
loc.language()
loc.measurementSystem()
loc.negativeSign()
loc.toString(1.5)
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Postby oldsphere » Mon Feb 01, 2016 8:48 am

Hi wmayer,
Answering your questions, yes, the problem is with all the menus, not just the one on the screenshot.
wmayer wrote:Do you get the strange character for any input field or only for the one of the screen shot? And when you execute this snippet below do you get also strange characters or normal input?

Code: Select all

from PySide import QtGui
s=QtGui.QDoubleSpinBox()
s.setValue(1.5)
s.show()
And what happens with?

Code: Select all

ui=FreeCADGui.UiLoader()
q=ui.createWidget("Gui::QuantitySpinBox")
q.setProperty("unit","mm")
q.show()
Both codes result in this incomprehensive characters (attached images)

Code: Select all

t = "١,٥٠"
[ord(nt) for nt in t]
[217, 161, 44, 217, 165, 217, 160]
wmayer wrote: And to get some information about your locales you could try this:

Code: Select all

from PySide import QtCore
loc=QtCore.QLocale.system()
loc.country()
loc.language()
loc.measurementSystem()
loc.negativeSign()
loc.toString(1.5)
The information resultant from this test is:

Code: Select all

country: PySide.QtCore.QLocale.Country.Spain
negativeSign: -
meassurementSystem: PySide.QtCore.QLocale.MeasurementSystem.MetricSystem
toString(1.5): u'\u0661,\u0665'
Hope this can be useful for solve the problem! Thank you for help.
Attachments
FreeCAD-screens.png
FreeCAD-screens.png (10.74 KiB) Viewed 492 times
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Postby oldsphere » Tue Feb 09, 2016 8:15 am

Hello folks,

Is there anything else I can try to solve this issue? Any idea will be welcome.
mario52
Posts: 2807
Joined: Wed May 16, 2012 2:13 pm

Re: Strange character on input numbers

Postby mario52 » Tue Feb 09, 2016 9:54 am

Hi
just to know
is that in a macro display is the same ?
example Macro_FCCircularText (here text and number)
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Postby oldsphere » Tue Feb 09, 2016 10:15 am

Hi mario52,

I've tried your macro and the numbers are displayed well on the geometry. The problem is just with the numbers appearing on the menus.
Attachments
test.png
test.png (189.86 KiB) Viewed 459 times
wmayer
Site Admin
Posts: 15279
Joined: Thu Feb 19, 2009 10:32 am

Re: Strange character on input numbers

Postby wmayer » Tue Feb 09, 2016 10:51 am

Since also Qt stuff itself is affected it's not a bug in FreeCAD. So, either there are very strange system settings to display numbers or for FreeCAD a strange font can be set. What does this give back?

Code: Select all

from PySide import QtGui
s=QtGui.QDoubleSpinBox()
s.setValue(1.5)
s.show()
f=s.font()
f.family()
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Postby oldsphere » Tue Feb 09, 2016 11:06 am

Hi wmayer,
The Qt window shows the same strange charaters.

The font family returns this:

Code: Select all

f=s.font()
f.family()
u'MS Shell Dlg 2'
mario52
Posts: 2807
Joined: Wed May 16, 2012 2:13 pm

Re: Strange character on input numbers

Postby mario52 » Tue Feb 09, 2016 12:16 pm

hi
and the characters in menus of the macro ?
test Macro_FCInfo_Alternate_Linux the character in the macro mm² mm³ and ° are coded iso8859 just to see the result (select object, Box ... and see)
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Postby oldsphere » Tue Feb 09, 2016 12:59 pm

Hi,
Finally some success! The numbers on the menu are correct, excepting for one on the mass section.
What difference has this field respect to the others?
Attachments
test.png
test.png (308.95 KiB) Viewed 434 times
mario52
Posts: 2807
Joined: Wed May 16, 2012 2:13 pm

Re: Strange character on input numbers

Postby mario52 » Tue Feb 09, 2016 2:05 pm

Hi
the mm² are not displayed
the mm ³ are not displayed

the ° are displayed

for the volume is the comma in the spinBox , is the cause

may be your configuration regional or graphic card or encoding .... ?? sorry

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.