Jump to content


Photo

Language assistance requested...


  • Please log in to reply
998 replies to this topic

Re: Language assistance requested... #621 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 2 September 2018 - 13:04

Hi Athoik,
 

No, I mean python doc string. Unfortunately enigma2 completely miss doc strings.

See: https://www.python.o...-is-a-docstring


This is someting I have not been doing. I saw very little evidence of this being used in Enigma2. I have usually just been adding comments.
 

Something like this was doing the "hex" job (the old times...).
 

class HexKeyBoard(VirtualKeyBoard):
        def __init__(self, session, title="", **kwargs):
                VirtualKeyBoard.__init__(self, session, title, **kwargs)
                self.skinName = "VirtualKeyBoard"
                self.keys_list = [[u"EXIT", u"1", u"2", u"3", u"4", u"5", u"6", u"7", u"8", u"9", u"0", u"BACKSPACE"],
                                        [u"OK", u"A", u"B", u"C", u"D", u"E", u"F", u"OK", u"LEFT", u"RIGHT", u"ALL", u"CLEAR"]]
                self.shiftkeys_list = []
                self.keyImages =  { "BACKSPACE": self.key_backspace, "ALL": self.key_all, "EXIT": self.key_esc,
                                        "OK": self.key_ok, "LEFT": self.key_left, "RIGHT": self.key_right, "CLEAR": self.key_clr }
                self.nextLang = None
                self.lang = None
                self["country"] = Label()

def setHexCallback(session, hex):
        print "hex:", hex

def hexmenu(session, service=None, *args, **kwargs):
         session.openWithCallback(boundFunction(setHexCallback, session), HexKeyBoard,
                 title=_("Please enter new hex:"), text="", maxSize=20, visible_width=20)

def Plugins(**kwargs):
        return [PluginDescriptor(name = "Test" , description = "Test", icon="plugin.png",
                where = [PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU],
                fnc = hexmenu, needsRestart = False)]
Now, i really don't know if above still works, or how easy is to get a hex input with keyboard without making custom screens.

On the other hand, an example would be nice.

 

 

The new VirtualKeyBoard could be taught to do this easily. Would you like this to be added?

I will generate some samples for you ASAP.
 

Keep only what they need to remember, more options means more things to remember, so get rid of duplicates.


All the duplicates have already been removed. I changed the code as soon as I read your post. I asked for feedback so I could review and use it!
 

What editor today doesn't properly handle unicode? :)

Uninstall it and use one that makes your like simpler!

 

Done!

I was using WIn32Pad but now also use Notepad++.

Regards,
Ian.

 



Re: Language assistance requested... #622 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 2 September 2018 - 13:34

Hi,

 

Okay, here is the updated NumericalTextInput.  The feedback so far has been integrated.  how does this version look?

 

Regards,

Ian.

Attached Files


Edited by IanSav, 2 September 2018 - 13:35.


Re: Language assistance requested... #623 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 2 September 2018 - 14:16

Regarding unicode, with proper unicode I can do the following:

find lib/ -type f -name "*.py" | xargs fgrep "À"
lib/python/Tools/NumericalTextInput.py:	u"abcáà2ABCÁÀ",
Now if have to do:

find lib/ -type f -name "*.py" | xargs fgrep "\u00C5"
lib/python/Screens/VirtualKeyBoard.py:				[u"FIRST", u"Q", u"W", u"E", u"R", u"T", u"Y", u"U", u"I", u"O", u"P", u"\u00C5", u"{", u"}"],
lib/python/Tools/NumericalTextInput.py:	(u"abc\u00E5\u00E42ABC\u00C5\u00C4", u"ABC\u00C5\u00C42", u"abc\u00E5\u00E42"),
Doesn't seem so nice. But I don't insist, if others have no problem.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Language assistance requested... #624 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 2 September 2018 - 14:39

Hi Athoik,

 

I understand the difficulty but we need to keep the code editable and functional EVERYWHERE.  Given that code is meant to be in US English I doubt that there will be many searches for non English characters.  ;)  (Note that I am not at all talking about the language / po file management.)  And no, I won't be changing the language in "Language_cache.py".  ;)

 

Regards,

Ian.



Re: Language assistance requested... #625 zeros

  • PLi® Contributor
  • 1,635 posts

+61
Good

Posted 2 September 2018 - 15:51

IanSav, I tried #622. It seems that the font in now bigger, but is on the wrong place. I only mean this page where the SMS type keyboard displayed.
I think the characters are smaller there because some of the country are there a lot of them and they may not fit!?
I tried for example the Russian keyboard. It can be seen that there are many characters more than in the English default keyboard.
 

Attached Files


DM920UHD DVB-S2X TRIPLE tuner + Triple M.S tuner DVB-S2X, DVB-T2/T, QboxHD, QboxHD Mini, Icecrypt T2300HD,
Qviart Lunix3 4K, Raspberry Pi 4 Model B 4GB & 8GB

Vertex 4K60 4:4:4 600MHz


Re: Language assistance requested... #626 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 2 September 2018 - 16:01

Hi Zeros,

 

I can't explain the font size changes.  They are controlled by the skin and I am not changing the skin.

 

Did the NumericalTextInput fonts change when you removed some of the characters from the "0" button?

 

Regards,

Ian.



Re: Language assistance requested... #627 zeros

  • PLi® Contributor
  • 1,635 posts

+61
Good

Posted 2 September 2018 - 16:35

Do you mean I'm going to try get less from here:

 

PUNCTUATION0 = u"0,?!&@=*'+\\\"()<>[]{}$~%^`|"


DM920UHD DVB-S2X TRIPLE tuner + Triple M.S tuner DVB-S2X, DVB-T2/T, QboxHD, QboxHD Mini, Icecrypt T2300HD,
Qviart Lunix3 4K, Raspberry Pi 4 Model B 4GB & 8GB

Vertex 4K60 4:4:4 600MHz


Re: Language assistance requested... #628 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 2 September 2018 - 17:09

Hi Athoik,

 

Above should parse all variants of parameters reported. Can you please report if that's ok?

 

The "#" and "0x" colours are working fine.  The colour names are not working.  I started to investigate but I am too tired to do the job properly at the moment.  It looks like we are getting a pointer to a SWIG object rather than a 32 bit colour value.

{19550}< 85035.967> [VirtualKeyBoard] DEBUG: shiftColors [<enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7408b2c0> >, <enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7408b578> >, <enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7408b218> >, <enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7405dae8> >]

Regards,

Ian.



Re: Language assistance requested... #629 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 2 September 2018 - 17:10

Hi Zeros,

 

Do you mean I'm going to try get less from here:

PUNCTUATION0 = u"0,?!&@=*'+\\\"()<>[]{}$~%^`|"

 

 

Yes, if you remove some of those characters does that affect the font size?

 

Regards,

Ian.



Re: Language assistance requested... #630 zeros

  • PLi® Contributor
  • 1,635 posts

+61
Good

Posted 2 September 2018 - 17:43

I'm going to do different tests in tomorrow morning and let you know!


DM920UHD DVB-S2X TRIPLE tuner + Triple M.S tuner DVB-S2X, DVB-T2/T, QboxHD, QboxHD Mini, Icecrypt T2300HD,
Qviart Lunix3 4K, Raspberry Pi 4 Model B 4GB & 8GB

Vertex 4K60 4:4:4 600MHz


Re: Language assistance requested... #631 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 2 September 2018 - 21:00

Hi Athoik,
 

Above should parse all variants of parameters reported. Can you please report if that's ok?

 
The "#" and "0x" colours are working fine.  The colour names are not working.  I started to investigate but I am too tired to do the job properly at the moment.  It looks like we are getting a pointer to a SWIG object rather than a 32 bit colour value.
{19550}< 85035.967> [VirtualKeyBoard] DEBUG: shiftColors [<enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7408b2c0> >, <enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7408b578> >, <enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7408b218> >, <enigma.gRGB; proxy of <Swig Object of type 'gRGB *' at 0x7405dae8> >]

Regards,
Ian.



The colorNames keeps gRGB objects. So we need to use .argb() function in order to get the integer value of the named color.

diff --git a/skin.py b/skin.py
index e8d2f9d..4618ea1 100644
--- a/skin.py
+++ b/skin.py
@@ -225,6 +225,21 @@ def parseColor(s):
                        raise SkinError("color '%s' must be #aarrggbb or valid named color" % s)
        return gRGB(int(s[1:], 0x10))

+def parseParameter(s):
+       """This function is responsible to parse parameters in the skin, in can parse html colors, hex integers, floats, named colors, integers or strings"""
+       if s[0] == '#':
+               return int(s[1:], 16)
+       elif s[:2] == '0x':
+               return int(s, 16)
+       elif '.' in s:
+               return float(s)
+       elif s in colorNames:
+               return colorNames[s].argb()
+       elif s.lstrip('-+').isdigit():
+               return int(s)
+       else
+               return s
+
 def collectAttributes(skinAttributes, node, context, skin_path_prefix=None, ignore=(), filenames=frozenset(("pixmap", "pointer", "seek_pointer", "backgroundPixmap", "selectionPixmap", "sliderPixmap", "scrollbarbackgroundPixmap"))):
        # walk all attributes
        size = None
@@ -586,7 +601,7 @@ def loadSingleSkinData(desktop, skin, path_prefix):
                        try:
                                name = get("name")
                                value = get("value")
-                               parameters[name] = "," in value and map(int, value.split(",")) or int(value)
+                               parameters[name] = "," in value and map(parseParameter, value.split(",")) or parseParameter(value)
                        except Exception, ex:
                                print "[Skin] Bad parameter", ex

Also it should be able to handle strings, as requested.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Language assistance requested... #632 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 3 September 2018 - 03:25

Hi Athoik,

 

This revised code, with a correction, is working well.

 

I suggest the comment can be improved as "This function is responsible for parsing parameters in the skin, it can parse integers, floats, hex colors, hex integers, named colors and strings."

 

Also the "else" should be "else:".  ;)

 

Thank you for your assistance.  This is the sort of collaboration that can make Enigma2 better for everyone.

 

Regards,

Ian.



Re: Language assistance requested... #633 zeros

  • PLi® Contributor
  • 1,635 posts

+61
Good

Posted 3 September 2018 - 04:54

I confirm, that with removing some of those characters does that affect to the font size.

So I'd advice you to leave something out of it:

 

PUNCTUATION0 = u"0,?!&@=*'+\\\"()<>[]{}$~%^`|"

 

Attached Files


DM920UHD DVB-S2X TRIPLE tuner + Triple M.S tuner DVB-S2X, DVB-T2/T, QboxHD, QboxHD Mini, Icecrypt T2300HD,
Qviart Lunix3 4K, Raspberry Pi 4 Model B 4GB & 8GB

Vertex 4K60 4:4:4 600MHz


Re: Language assistance requested... #634 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 3 September 2018 - 05:03

Hi Zeros,

 

Can you please test this version and tell me how it looks.

 

Would it be possible to add some width to the "0" entry in the skins?

 

Regards,

Ian.

 

Attached Files



Re: Language assistance requested... #635 zeros

  • PLi® Contributor
  • 1,635 posts

+61
Good

Posted 3 September 2018 - 05:20

Yes, a little better, but not as good. I have to make my eyes out to read this cricket letters.

Attached Files


Edited by zeros, 3 September 2018 - 05:23.

DM920UHD DVB-S2X TRIPLE tuner + Triple M.S tuner DVB-S2X, DVB-T2/T, QboxHD, QboxHD Mini, Icecrypt T2300HD,
Qviart Lunix3 4K, Raspberry Pi 4 Model B 4GB & 8GB

Vertex 4K60 4:4:4 600MHz


Re: Language assistance requested... #636 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 3 September 2018 - 07:12

Hi Zeros,

 

How about this version?

 

Regards,

Ian.

 

Attached Files



Re: Language assistance requested... #637 athoik

  • PLi® Core member
  • 8,458 posts

+327
Excellent

Posted 3 September 2018 - 07:15

Hi Athoik,
 
This revised code, with a correction, is working well.
 
I suggest the comment can be improved as "This function is responsible for parsing parameters in the skin, it can parse integers, floats, hex colors, hex integers, named colors and strings."
 
Also the "else" should be "else:".  ;)
 
Thank you for your assistance.  This is the sort of collaboration that can make Enigma2 better for everyone.
 
Regards,
Ian.


Pushed: https://github.com/O...64646a53613aca7

(with a typo in subject :P)

Hopefully now there all possible parameters will be parse correctly.
Wavefield T90: 0.8W - 1.9E - 4.8E - 13E - 16E - 19.2E - 23.5E - 26E - 33E - 39E - 42E - 45E on EMP Centauri DiseqC 16/1
Unamed: 13E Quattro - 9E Quattro on IKUSI MS-0916

Re: Language assistance requested... #638 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 3 September 2018 - 07:17

Hi Athoik,

 

I haven't exercised all the possible options around Enigma2 but I have tested all the options within VirtualKeyBoard and it is all working perfectly.  I am not aware of any other code failing due to this change.  Thank you so much for helping solve this problem.

 

Regards,

Ian.



Re: Language assistance requested... #639 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 3 September 2018 - 08:04

Hi Zeros,

 

I can't explain the font size changes.  They are controlled by the skin and I am not changing the skin.

 

Did the NumericalTextInput fonts change when you removed some of the characters from the "0" button?

 

Regards,

Ian.

 

Font size is implemented here: https://github.com/O...24351d53ec89422
It is controlled not by skin but by NumericalTextInputHelpDialog.
 
I'm not checking what you've changed, but I assume that before that, the length was counted only in a particular language, but now it's broken and counted from all languages.


Re: Language assistance requested... #640 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 3 September 2018 - 08:50

Hi Taapat,

 

So I was on the right track in trying to balance the number of symbols between "0" and "1".

 

In my skin I removed the "<" and ">" symbols, as they were not characters that could be entered, and then I widened the display width for "0" to allow for all the extra characters.  Is this something that OpenPLi would consider to keep the font size optimal?

 

Regards,

ian.




17 user(s) are reading this topic

0 members, 17 guests, 0 anonymous users