Jump to content


Photo

VirtualKeyBoard customized screen


  • Please log in to reply
37 replies to this topic

#1 mfaraj57

  • Senior Member
  • 1,467 posts

+243
Excellent

Posted 2 September 2018 - 18:28

I want to modify the screen for my image VirtualKeyboard but i faced with problem whatever i do the the Virtualkeyboard still taking its default screen defined in image skin.xml

my code looks like this

class VirtualKeyBoard(Screen):
            skin = '<screen name="myVirtualKeyBoard" position="center,center" size="20,20" title="" flags="wfNoBorder"></screen>'
    

   
            def __init__(self, session, title = '', text = '', maxSize = False, visible_width = False, type ='', currPos = 0, allMarked = False):

is There  a way to make VirtualKeyBoard class takes my customized screen without adding  my screen to skin.xml?

 



Re: VirtualKeyBoard customized screen #2 Persian Prince

  • Senior Member
  • 1,602 posts

+219
Excellent

Posted 2 September 2018 - 18:38

I think it's better to merge this thread into https://forums.openp...ance-requested/


If you like my post click on green arrow :)

Re: VirtualKeyBoard customized screen #3 mfaraj57

  • Senior Member
  • 1,467 posts

+243
Excellent

Posted 2 September 2018 - 19:37

Thanks friend for the link

The link  is useful for adding language but is unhelpful for modifying virtualkeyboard screen or the widgets

to simplify more i want to add typing history list for the virtual keyboard but skin.py ignores my screen and my list and launches the default virtual keyboard screen

class VirtualKeyBoard(Screen):
            skin = '''<screen name="myVirtualKeyBoard" position="center,center" size="20,20" title="" flags="wfNoBorder">

                <widget
                    name = "historylist"
                    position = "50,50"
                    size = "300,200"
                    selectionDisabled = "1"
                    transparent = "1"/>

            </screen>'''
    

   
            def __init__(self, session, title = '', text = '', maxSize = False, visible_width = False, type ='', currPos = 0, allMarked = False):     


Re: VirtualKeyBoard customized screen #4 IanSav

  • Senior Member
  • 479 posts

+19
Neutral

Posted 3 September 2018 - 05:59

Hi Mfaraj57,

 

Please come to the thread Persian Prince listed and talk to me about what you want / need.  I can try to accomodate your needs.

 

I assume that "historylist" is something that you are adding to the basic VirtualKeyBoard functionality?  Please explain what you are trying to achieve.

 

Regards,

Ian.



Re: VirtualKeyBoard customized screen #5 mfaraj57

  • Senior Member
  • 1,467 posts

+243
Excellent

Posted 3 September 2018 - 08:38

Hi Ian 

It is different subject from the Persian prince mentioned as that for adding language and my problem not with adding language..

Yes as you have said i want to add history list to virtual keyboard contains the typing history instread everytime type the word you can select it from the list..The

problem that in my example code above that the my screen and the history list are not displayed and the defualt image virtual keyboard screen displayed instead.

is There way to make enigma or skin.py to display my local screen instead the image default virtual keyboard screen?


Edited by mfaraj57, 3 September 2018 - 08:38.


Re: VirtualKeyBoard customized screen #6 Persian Prince

  • Senior Member
  • 1,602 posts

+219
Excellent

Posted 3 September 2018 - 08:45

It's better to merge this thread into https://forums.openp...ance-requested/ and rename the original thread from "Language assistance requested..." to "The new Virtual Keyboard and all its discussions"

 

;)


Edited by Persian Prince, 3 September 2018 - 08:45.

If you like my post click on green arrow :)

Re: VirtualKeyBoard customized screen #7 Pr2

  • PLi® Contributor
  • 2,865 posts

+119
Excellent

Posted 3 September 2018 - 11:13

@mfaraj57

 

Don't be blocked by the thread title which is wrong since a very long time now... this is rather now the thread to debug all issues around new VirtualKeyboard.

 

Pr2


NO SUPPORT by PM, it is a forum make your question public so everybody can benefit from the question/answer.

If you think that my answer helps you, you can press the up arrow in bottom right the answer.

 

Octagon SF-4008: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W (+DVB-C)
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C)
Amiko Viper Combo: 1*DVB-S2 + 1*DVB-C

Zgemma H7C: 1*DVB-S2 + 2*DVB-C


Re: VirtualKeyBoard customized screen #8 IanSav

  • Senior Member
  • 479 posts

+19
Neutral

Posted 3 September 2018 - 11:34

Hi Mfaraj57,

 

This forum does not allow posts to be edited (after a few minutes) so I can't do anything about the thread title.  Still changes to VirtualKeyBoard would be better discussed where the others are following the conversation.

 

If you are subclassing the new VirtualKeyBoard why don't you call the VirtualKeyBoard "__init__" from your "__init__" and then change the screen name and then provide your own custom code and screen to deliver the functionality you want.  Just use the new VirtualKeyBoard to do the heavy lifting on the main display and input code.

 

Regards,

Ian.


Edited by IanSav, 3 September 2018 - 11:35.


Re: VirtualKeyBoard customized screen #9 Taapat

  • PLi® Core member
  • 1,468 posts

+70
Good

Posted 3 September 2018 - 12:08

@mfaraj57 to use your screen, you need to call your class in a different, as your screen.
After the description, I think that you want to do the same thing as I am in my plugin youtube.
I use 'prompt' or 'header'  in other images for suggestions that have been updated by function okClicked.
Of course, this text is not selectable.
 
Perhaps this is useful for you as example: https://github.com/T...beSearch.py#L21


Re: VirtualKeyBoard customized screen #10 mfaraj57

  • Senior Member
  • 1,467 posts

+243
Excellent

Posted 3 September 2018 - 13:50

Thanks Ian and Taapat
I think you suggested same idea about importing VirtualKeyBoard class to my customized class.
This way is good if i want to use virtual keyboard in my plugin but i do need this,i want to edit virtual keyboard screen in the system file Screens.VirtualKeyBoard.py and keep the file name as it is also the name of class VirtualKeyBoard.
But your suggestion make me to think to do in opposite way by importing my screen class to virtualkeyboard class.

Re: VirtualKeyBoard customized screen #11 Taapat

  • PLi® Core member
  • 1,468 posts

+70
Good

Posted 3 September 2018 - 16:49

If you edit the screen in your image, I do not see any problems for the changes.
Only you need to change the skin in skin_default.xml or in skin_user.xml, instead of adding another in screen ;).

Edited by Taapat, 3 September 2018 - 16:52.


Re: VirtualKeyBoard customized screen #12 mfaraj57

  • Senior Member
  • 1,467 posts

+243
Excellent

Posted 3 September 2018 - 18:16

For some irrelevant reasons i cannot edit or change skin.xml or skin_default.xml and if i can edit will no problem a all.
I assume that skin.py takes the class name and looks for screen with same name in skin.xml if found one then assign it to class and ignores any local request at module level to change the screen.
So according to this the only way to disrupt this process by changing the name of the class as in our case from VirtualKeyBoard to myVirtualKeyBoard as example.
But this is impossible because changing the class name in screens/VirtualKeyBoard.py will disturb the image and other plugins calling vkboard and at least the image will not restart

Edited by mfaraj57, 3 September 2018 - 18:17.


Re: VirtualKeyBoard customized screen #13 samsamsam

  • Senior Member
  • 1,966 posts

+137
Excellent

Posted 3 September 2018 - 21:33

@mfaraj57

 

1. Chnage name of class VirtualKeyBoard to myVirtualKeyBoard 

2. After myVirtualKeyBoard  class definition add folowing code:

VirtualKeyBoard = myVirtualKeyBoard   

Maybe this is a little bit hacky but it works. Enigma2 use 

.__class__.__name__

as skin name, so after this change it will search for myVirtualKeyBoard and will not find it.


Edited by samsamsam, 3 September 2018 - 21:34.


Re: VirtualKeyBoard customized screen #14 littlesat

  • PLi® Core member
  • 45,502 posts

+465
Excellent

Posted 3 September 2018 - 21:57

The Classic steal classes and functiona trick....’
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W Thanks to Henksat

Re: VirtualKeyBoard customized screen #15 IanSav

  • Senior Member
  • 479 posts

+19
Neutral

Posted 4 September 2018 - 05:31

Hi Mfaraj57,

 

I am not exactly sure about what you are trying to do but I hope I miss-read that you want to change the actual VirtualKeyBoard.py?

 

Regards,

Ian.



Re: VirtualKeyBoard customized screen #16 littlesat

  • PLi® Core member
  • 45,502 posts

+465
Excellent

Posted 4 September 2018 - 06:34

Yes it looks he wants this... at least SSS is suggesting it...
And exactly these kind of structure to steal functions and classes might break things at once...

Edited by littlesat, 4 September 2018 - 06:37.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W Thanks to Henksat

Re: VirtualKeyBoard customized screen #17 mfaraj57

  • Senior Member
  • 1,467 posts

+243
Excellent

Posted 4 September 2018 - 06:43

@samsamsam,thanks

it works.

simple solution for big problem

before applying your code

plugin.py

            from VirtualKeyBoard import VirtualKeyBoard
            self.session.openWithCallback(self.searchCallback,VirtualKeyBoard,text="old")

VirtualKeyBoard.py

class VirtualKeyBoard(Screen):            
            
            def __init__(self, session, title = '', text = '', maxSize = False, visible_width = False, type ='', currPos = 0, allMarked = False):
                    
                    Screen.__init__(self, session)
                    
                    dwidth = getDesktop(0).size().width()
                    if dwidth==1280:
                       self.skin=vkeyboardold_hdskin
                    else:
                       self.skin=vkeyboardold_fhdskin

result  image default virtual keyboard

imagevk.jpg

 

 

after applying code in VirtualKeyBoard.py

class myVirtualKeyBoard(Screen):            
            
            def __init__(self, session, title = '', text = '', maxSize = False, visible_width = False, type ='', currPos = 0, allMarked = False):
                    
                    Screen.__init__(self, session)
                    
                    dwidth = getDesktop(0).size().width()
                    if dwidth==1280:
                       self.skin=vkeyboardold_hdskin
                    else:
                       self.skin=vkeyboardold_fhdskin

                       
VirtualKeyBoard=myVirtualKeyBoard

result my cusromized virtual keyboard

myvkboard.jpg


Edited by mfaraj57, 4 September 2018 - 06:45.


Re: VirtualKeyBoard customized screen #18 mfaraj57

  • Senior Member
  • 1,467 posts

+243
Excellent

Posted 4 September 2018 - 06:55

After put the question i found another way to acheive my target

first to put my virtualkeyboard customized screens in local xml file as example myvkskin.xml 

add the screens like this

<skin>
<screen name="vkeyboardold_hdskin" position="180,150" size="940,495" zPosition="99" title="Virtual KeyBoard" flags="wfNoBorder" backgroundColor="#ffffffff">
<eLabel position="40,25" zPosition="-10" size="844,435" backgroundColor="#21000000"/>
<widget source="global.CurrentTime" render="Label" position="740,30" size="140,60" font="Regular;45" backgroundColor="#21000000" transparent="1">
  <convert type="ClockToText">Default</convert>
</widget>
<wi

load  myvkskin.xml  in VirtualKeyBoard.py

from skin import loadSkin
loadSkin("/usr/share/enigma2/VirtualKeyBoard_Icons/myvkskin.xml")

and use class VirtualKeyboard without changing name of class and add my screens by self.skinName

class VirtualKeyBoard(Screen):            
            
            def __init__(self, session, title = '', text = '', maxSize = False, visible_width = False, type ='', currPos = 0, allMarked = False):
                    
                    Screen.__init__(self, session)
                    
                    dwidth = getDesktop(0).size().width()
                    if dwidth==1280:
                       self.skinName='vkeyboardold_hdskin'
                    else:
                       self.skin='vkeyboardold_fhdskin'

Thanks a lot for all.



Re: VirtualKeyBoard customized screen #19 Taapat

  • PLi® Core member
  • 1,468 posts

+70
Good

Posted 4 September 2018 - 07:03

You miss my point to skin_user.xml.
You can create in folder /etc/enigma2 file skin_user.xml, where you can replace any screen without additional hacks in sources.


Re: VirtualKeyBoard customized screen #20 littlesat

  • PLi® Core member
  • 45,502 posts

+465
Excellent

Posted 4 September 2018 - 07:05

A hack with strealing a class is so brrrr.. I remember this was mandatory in the far past to be able to create plug-ins on DMMs code.
But here someone add a list of Words to the keyboard... the w is here why is this not possible (anymore)... what is required for it to make what we have compatible or what is needed to get the other keyboard compatible... sounds someone search for a solution and took the quick, dirty, hacky part.

Edited by littlesat, 4 September 2018 - 07:18.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W Thanks to Henksat




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users