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
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Strange character on input numbers

Post by wmayer »

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

Post by oldsphere »

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 1170 times
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Post by oldsphere »

Hello folks,

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

Re: Strange character on input numbers

Post by mario52 »

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, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Post by oldsphere »

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 1137 times
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Strange character on input numbers

Post by wmayer »

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

Post by oldsphere »

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
Veteran
Posts: 4696
Joined: Wed May 16, 2012 2:13 pm

Re: Strange character on input numbers

Post by mario52 »

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, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
oldsphere
Posts: 11
Joined: Thu Jan 28, 2016 4:09 pm

Re: Strange character on input numbers

Post by oldsphere »

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 1112 times
mario52
Veteran
Posts: 4696
Joined: Wed May 16, 2012 2:13 pm

Re: Strange character on input numbers

Post by mario52 »

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, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
Post Reply