←  [EN] Third-Party Development

Forums

»

Font sizes in plugin

satenkabelgluurder's Photo 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 ?

 

 

 

Quote

mfaraj57's Photo 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)
Quote

littlesat's Photo 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
Quote

mfaraj57's Photo 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)

Edited by mfaraj57, 21 August 2017 - 15:15.
Quote

ims's Photo ims 21 Aug 2017

try once again ...

Quote

mfaraj57's Photo 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

Quote

ims's Photo 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)


Edited by ims, 21 August 2017 - 15:40.
Quote

mfaraj57's Photo 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)
Quote

littlesat's Photo littlesat 21 Aug 2017

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

Quote

mfaraj57's Photo 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


Edited by mfaraj57, 21 August 2017 - 16:21.
Quote

littlesat's Photo 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.


Edited by littlesat, 21 August 2017 - 16:39.
Quote

mfaraj57's Photo 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


Edited by mfaraj57, 21 August 2017 - 17:24.
Quote

littlesat's Photo littlesat 21 Aug 2017

As far I know openatv has them aswell...
Edited by littlesat, 21 August 2017 - 18:11.
Quote