[Skin] Processing Of Skin Tags That Have Boolean Values (1 Viewer)

CyberSimian

Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    Started on: 2016-12-29
    last update: 2016-12-29

    Summary:
    The current processing of XML tags that accept boolean values does not allow a long expression to be split over multiple lines. This makes files more difficult to maintain.

    Area:
    The skin engine.

    Description:
    This morning I wanted to code the following in a skin file that I have been modifying:

    Code:
    <visible>window.isvisible(6)
            |window.isvisible(600)
            |window.isvisible(601)
            |window.isvisible(603)
            |window.isvisible(762)
            |window.isvisible(763)</visible>


    Well, I did code it. The problem is that it does not work. To get it to work, I had to code it like this:

    Code:
    <visible>window.isvisible(6)|window.isvisible(600)|window.isvisible(601)|window.isvisible(603)|window.isvisible(762)|window.isvisible(763)</visible>


    which is more difficult to maintain, as a significant part of the line is off the right-hand side of the screen (so it is not possible to see the line in its entirety).

    Proposal
    For XML tags where the value is a boolean, accept and ignore insignifcant blanks and end-of-line characters (CRLF or whatever).
     

    catavolt

    Design Group Manager
  • Team MediaPortal
  • August 13, 2007
    14,364
    10,400
    Königstein (Taunus)
    Home Country
    Germany Germany
    Nice one - never thought about this ;)
    But I know it works with skin expressions (example from PureVisionHD:
    XML:
    <texture>#(switch(
            eq(#skin.currenttheme,'Modern UI'),'background.jpg',
            eq(#skin.background,'Animated'),'Animations\BasicHome\Animated.gif',
            eq(#skin.background,'Abstract1'),'Animations\BasicHome\Abstract1.jpg',
            eq(#skin.background,'Abstract2'),'Animations\BasicHome\Abstract2.jpg',
            eq(#skin.background,'Abstract3'),'Animations\BasicHome\Abstract3.jpg',
            eq(#skin.background,'Abstract4'),'Animations\BasicHome\Abstract4.jpg',
            eq(#skin.background,'Abstract5'),'Animations\BasicHome\Abstract5.jpg',
            eq(#skin.background,'Abstract6'),'Animations\BasicHome\Abstract6.jpg',
            eq(#skin.background,'Blue'),'Animations\BasicHome\background_Blue.jpg',
            eq(#skin.background,'Carbon'),'Animations\BasicHome\background_Carbon.jpg',
            eq(#skin.background,'Copper'),'Animations\BasicHome\background_Copper.jpg',
            eq(#skin.background,'Green'),'Animations\BasicHome\background_Green.jpg',
            eq(#skin.background,'Red'),'Animations\BasicHome\background_Red.jpg',
            eq(#skin.background,'Black'),'Animations\BasicHome\background_Black.jpg',
            eq(#skin.background,'Dark'),'Animations\BasicHome\background_Dark.jpg',
            eq(#skin.background,'DarkBlue'),'Animations\BasicHome\background_DarkBlue.jpg',
            eq(#skin.background,'DarkRed'),'Animations\BasicHome\background_DarkRed.jpg',
            eq(#skin.background,'DarkGreen'),'Animations\BasicHome\background_DarkGreen.jpg',
            eq(#skin.background,'Disco'),'musicvideos-background.jpg',
            eq(#skin.background,'MediaPool'),'MediaPool.jpg',
            eq(1,1),''))</texture>
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    But I know it works with skin expressions
    Unfortunately it seems to be more complicated than that. :( I tried using the expression notation "#(...)" with the VISIBLE tag, but it still did not allow the line to be split. :( On the other hand this works with the LABEL tag:

    Code:
    <label>#(switch(
      eq(L(100600),#currentmodule),L(100600),
      eq(L(100762),#currentmodule),L(100762),
      eq(1,1),''))</label>


    But this does not work with the COLORDIFFUSE tag:

    Code:
    <colordiffuse>#(switch(
      eq(L(100600),#currentmodule),ff004000,
      eq(L(100762),#currentmodule),ff004040,
      eq(1,1),ff400000))</colordiffuse>


    and neither does this:

    Code:
    <colordiffuse>#(switch(eq(L(100600),#currentmodule),ff004000,eq(L(100762),#currentmodule),ff004040,eq(1,1),ff400000))</colordiffuse>


    i.e. expressions/conditionals are not valid at all on COLORDIFFUSE. :eek:

    I don't know the history of MP's XML processor, but it looks as though these various capabilities (multiple lines; conditionals; expressions) were added one by one on specific tags as needed by the skin developers. I would have expected that when each of these capabilities was being added to the XML processor, they would have been added to every tag, and not restricted to those tags requested by the skin developers. :( But of course I don't know how much work was involved in adding these extra capabilities.

    -- from CyberSimian in the UK
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,849
    1,771
    Southampton
    Home Country
    United Kingdom United Kingdom
    Use an editor which will automatically show long lines with line breaks ;)
    With the programming that I do, I find that correct use of indentation greatly assists in the understanding and maintenance of code. So I don't use an editor that wraps long lines onto following lines. I also avoid long lines, by manually splitting them into two or more physical lines (obviously the programming language has to support this).

    Many of the skin developers seem to share this opinion about indentation, since most of the skin files that I have seen follow a logical tag indentation scheme. (y)

    Also, a programmer is most efficient (and, I would venture to suggest, most content) when he/she is using his/her favourite editor. The one that I use happens to be a plain ASCII editor. Yes, it can wrap lines, and in large windows it can display long lines, but I use it in non-wrapping mode with a line length of 80 characters (so that I can have six windows open simultaneously on my desktop). :)

    -- from CyberSimian in the UK
     

    catavolt

    Design Group Manager
  • Team MediaPortal
  • August 13, 2007
    14,364
    10,400
    Königstein (Taunus)
    Home Country
    Germany Germany
    I don't know the history of MP
    Yup, we had some good skin engine gurus here a long time ago, and they enhanced slowly but surely the capabilities of the skin engine - mostly without real demand of skinners ;)
    So we still have properties that don´t allow expressions, why others allow them.
    Afaik @ajs is working on resolving some of the issues you see - let´s wait and see what comes out of that ;)
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,371
    Kyiv
    Home Country
    Ukraine Ukraine
    i.e. expressions/conditionals are not valid at all on COLORDIFFUSE
    COLORDIFFUSE support only defined properties at the time of loading of the window, when this property is modified, the update value does not occur. If currentmodule at the time of loading window is not defined it will always value ff400000.
    [XMLSkinElement("colordiffuse")] protected long _diffuseColor = 0xFFFFFFFF; https://github.com/MediaPortal/MediaPortal-1/blob/master/mediaportal/Core/guilib/GUIControl.cs#L114
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,492
    10,371
    Kyiv
    Home Country
    Ukraine Ukraine
    support only defined properties at the time of loading of the window, when this property is modified, the update value does not occur.
    This is true for almost all of the properties, such as int, lont etc. and for many string properties. If there is no mechanism to change the behavior when you change the properties. How it's done in GUIImage ...
     

    Users who are viewing this thread

    Top Bottom