OOS - object oriented skinning

  • skinning ist fuer mich eine arbeit fuer einen, der vater und mutter erschlagen hat... und technologisch etwas rueckstaendig. deswegen habe ich mir folgendes unter dem hochgestochnen namen OOS ueberlegt:

    objektorientierung beinhaltet ja im prinzip: wiederverwendbarkeit durch kapselung und vererbung.

    einen teil davon habe ich mir schon durch xml includes implementiert:

    Code
    <xmlinc name="buttons" />

    dieses statement wird durch ein pre-processor-script dann durch den inhalt von buttons.xmlinc ersetzt.

    d.h. man muss die buttons nur einmal definieren und dann werden sie in allen screens und plugins verwendet.

    das ganze hat so aber noch einen gravierenden nachteil: die positionen der buttons muessen in allen screens gleich sein.

    daher will ich noch einen schritt weitergehen und relative position-offsets ermoeglichen.

    im buttons.xmlinc waeren dann die ganzen positions relativ zu einem virtuellen punkt position="0,0".

    und im xmlinc wuerde dann die absolute position angegeben... etwa so:

    Code
    <xmlinc name="buttons" position="400,200" />

    d.h. das pre-processing-script wuerde dann die position des buttons mit position="0,0" ersetzen durch position="400,200"... einen button mit position="300,0" duch "700,200", etc.

    damit koennte man hierarchische skins bauen, in denen man relativ leicht ganze bloecke wiederverwenden und an verschiedenen positionen instanziieren kann.


    bevor ich mir die arbeit mache und es programmiere, wollte ich nachfragen, ob es sowas vielleicht bereits gibt? danke.


    p.s. ich weiss, dass man bei layouts ein xml file angeben kann, aber das ganze ist nicht so flexibel, wie ich mir das vorstelle.

  • nachdem jetzt das aio beta image public ist, werden einige plugin bauer ihre skins mit wqhd aufloesung anbieten wollen.

    daher habe ich mal als erstes projekt ein kleines script geschrieben, das den wqhd skin automatisch vom fhd oder hd skin generiert/skaliert.

    Code
    python xmlscale -s <scaling factor> -i <input_file.xml> -o <output_file.xml>

    scaling factor fuer fhd > wqhd ist 1.3333333

    man kann aber auch downscalen... z.b. wqhd > fhd mit scaling factor: 0.75


    man kann sogar ganze skins (skin.xml) hoch- oder runter-skalieren.

    dabei muss man aber darauf achten, dass man die entsprechenden skin components installiert hat.


    das ganze ist noch beta... koennte sein, dass noch nicht alle konstrukte richtig behandelt werden, aber das kann man relativ einfach fixen.


    xmlscale.py

    Einmal editiert, zuletzt von alpha ()

  • beim skalieren von skins ist es nicht immer mit dem skalieren der xml(s) getan.

    svgs werden leider nicht immer richtig von e2 gescaled... bei manchen widgets (mit backgroundpixmap und selectionpixmap) muessen die svgs mit der richtigen groesse vorliegen und muessen daher vorab "manuell" skaliert werden.

    ich habe daher ein kleines script geschrieben, das svgs rauf-/runter skaliert:

    svgscale.py (ist im git https://github.com/dream-alpha/SkinForge abgelegt, falls es jemand gebrauchen kann)

    Einmal editiert, zuletzt von alpha ()

  • excellent... i already thought i was the only one refusing to use a calculator to scale the values :grinning_squinting_face:

    im busy with building python script that can build skin from zero any advice can you give me the script is based on skin.py

  • hmmm.... i guess that's a challenge...

    how do you specify the layout of the skin?

    i mean, there must be some kind of input for the skin builder script.

  • I know is a big challenge now the script can build screens based on a txt file that has all screens name with parameters that must be added and buttons if need it and another stuff but still need to build components windowstyle and layouts

  • well, not sure i understand...

    i would start with an empty skin file...

    and then add the skin elements hierarchically... with include files.

    like

    first level:

    Code
    <skin>
        <xmlinclude name="MainMenu"/>
        <xmlinclude name="ConfigScreen"/>
        <xmlinclude name="MovieList"/>
        etc.
    </skin>

    on the next level, i would then refine/define the include files...

    Code
    <screen name="MainMenu"/>
        <xmlincclude name="Buttons"/>
        ...
    </screen>

    on the next level you would specify the Buttons include file... that you could then use in all screen includes...

    the skins already have some elements implemented like layouts... but they are very limited.


    just an idea, how i'm trying to do it :winking_face:

  • is very nice i was know is a crazy idea but why not try honestly i was try to build it as website that you can use to build your enigma2 skin with a lot of patterns and logos but i failed to make it thats why i turn to python

  • well, building a website is not trivial either... and then converting it to a skin is like translating russian to mandarin :grinning_squinting_face:

    to me this doesn't make sense at all.

    e2 skins are rather trivial xml once you get used to it.