←  [EN] Third-Party Development

Forums

»

Font sizes in plugin

's foto satenkabelgluurder 21 aug 2017

Hi,

 

At the moment im "trying" to write a plugin myself.

 

Now I have a few question:

 

It seems that the same font settings in different plugins behave different.

So for example font="Regular;18 wil have a different size on the screen depending on the plugin.

 

So is the font size somehow related to the resolution of the skin that is used ?

 

And if yes how can i "tell" my plugin to use the HD resolution ?

 

 

 

Citeren

's foto mfaraj57 21 aug 2017

regular font determined by the applied skin of the image will have same size in all plugins,and sizes different between hd and full hd skin

to know if have hd skin or full hd skin is simple

from enigma import  getDesktop

reswidth = getDesktop(0).size().width()
resheight = getDesktop(0).size().height()

if reswidth==1080:
   skin_res='HD'
elif reswidth==1290:
   skin_res="FHD"
else:
   skin_res="skin-"+str(reswidth)
Citeren

's foto littlesat 21 aug 2017

This is not done....
but oe-a images like openatv did start it that way...
smarter is to recalculate it in a centralized way... or add the plugin screen to the common skin
Citeren

's foto mfaraj57 21 aug 2017

sorry the numbers in the code block above are wrong the true

from enigma import  getDesktop

reswidth = getDesktop(0).size().width()
resheight = getDesktop(0).size().height()

if reswidth==720:
   skin_res='HD'
elif reswidth==1080:
   skin_res="FHD"
else:
   skin_res="skin-"+str(reswidth)

Veranderd door mfaraj57, 21 augustus 2017 - 15:15
Citeren

's foto ims 21 aug 2017

try once again ...

Citeren

's foto mfaraj57 21 aug 2017

from enigma import  getDesktop

reswidth = getDesktop(0).size().width()
resheight = getDesktop(0).size().height()

if reswidth==1080:
   skin_res='HD'
elif reswidth==1920:
   skin_res="FHD"
else:
   skin_res="skin-"+str(reswidth)

hope this is final correction,not my day

Citeren

's foto ims 21 aug 2017

I am using this...

desktop = getDesktop(0)
width = desktop.size().width()
fullHD = False
if width > 1280:
	fullHD = True

(btw ... FullHD is 1920x1080)


Veranderd door ims, 21 augustus 2017 - 15:40
Citeren

's foto mfaraj57 21 aug 2017

sure,same idea,wrong again in my code,should be ,never trust my memory but today i tried with severe failure 

from enigma import  getDesktop

reswidth = getDesktop(0).size().width()
resheight = getDesktop(0).size().height()

if reswidth==1280:
   skin_res='HD'
elif reswidth==1920:
   skin_res="FHD"
else:
   skin_res="skin-"+str(reswidth)
Citeren

's foto littlesat 21 aug 2017

Why reading resheight = getDesktop(0).size().height() when you only use reswidth = getDesktop(0).size().width()

Citeren

's foto mfaraj57 21 aug 2017

Not applicable in the code block above but sometimes needed it  to adjust height of widget  position relative to desktop height

just for who ask to know these two functions


Veranderd door mfaraj57, 21 augustus 2017 - 16:21
Citeren

's foto littlesat 21 aug 2017

Not applicable in the code block above but sometimes needed it  to adjust height of widget  position relative to desktop height

->

For this you can use c, e center etc...

 

But I hate having these kind of instructions in the code. It shouldn't be there... better add the screen you want to the standard skin and/or try to use existing screens if possible.


Veranderd door littlesat, 21 augustus 2017 - 16:39
Citeren

's foto mfaraj57 21 aug 2017

we are talking about plugin,mean to use with different images with different skins with different resolution

i do not know e,c can be interpreted by other images than openpli

i found the most flexible way to collect all plugin screens in skin.xml and put it in the root of the plugin directory and to load this skin.xml from the start screen or plugin.py and to call screen names from  different screen classes


Veranderd door mfaraj57, 21 augustus 2017 - 17:24
Citeren

's foto littlesat 21 aug 2017

As far I know openatv has them aswell...
Veranderd door littlesat, 21 augustus 2017 - 18:11
Citeren