[Skin] - Processing Of Skin Tags That Have Boolean Values

Discussion in 'Improvement Suggestions' started by CyberSimian, December 29, 2016.

  1. CyberSimian
    • Team MediaPortal

    CyberSimian Test Group

    Joined:
    June 10, 2013
    Messages:
    1,552
    Likes Received:
    489
    Gender:
    Male
    Location:
    Southampton
    Ratings:
    +899 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    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 (Text):
    1. <visible>window.isvisible(6)
    2.         |window.isvisible(600)
    3.         |window.isvisible(601)
    4.         |window.isvisible(603)
    5.         |window.isvisible(762)
    6.         |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 (Text):
    1. <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).
     
    • Like Like x 3
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. catavolt
    • Team MediaPortal
    • Administrator

    catavolt Design Group Manager

    Joined:
    August 13, 2007
    Messages:
    12,110
    Likes Received:
    4,863
    Gender:
    Male
    Occupation:
    Technical Documentation, Translation
    Location:
    Lanzarote
    Ratings:
    +7,216 / 38
    Home Country:
    Germany Germany
    Show System Specs
    Nice one - never thought about this ;)
    But I know it works with skin expressions (example from PureVisionHD:
    Code (XML):
    1. <texture>#(switch(
    2.         eq(#skin.currenttheme,'Modern UI'),'background.jpg',
    3.         eq(#skin.background,'Animated'),'Animations\BasicHome\Animated.gif',
    4.         eq(#skin.background,'Abstract1'),'Animations\BasicHome\Abstract1.jpg',
    5.         eq(#skin.background,'Abstract2'),'Animations\BasicHome\Abstract2.jpg',
    6.         eq(#skin.background,'Abstract3'),'Animations\BasicHome\Abstract3.jpg',
    7.         eq(#skin.background,'Abstract4'),'Animations\BasicHome\Abstract4.jpg',
    8.         eq(#skin.background,'Abstract5'),'Animations\BasicHome\Abstract5.jpg',
    9.         eq(#skin.background,'Abstract6'),'Animations\BasicHome\Abstract6.jpg',
    10.         eq(#skin.background,'Blue'),'Animations\BasicHome\background_Blue.jpg',
    11.         eq(#skin.background,'Carbon'),'Animations\BasicHome\background_Carbon.jpg',
    12.         eq(#skin.background,'Copper'),'Animations\BasicHome\background_Copper.jpg',
    13.         eq(#skin.background,'Green'),'Animations\BasicHome\background_Green.jpg',
    14.         eq(#skin.background,'Red'),'Animations\BasicHome\background_Red.jpg',
    15.         eq(#skin.background,'Black'),'Animations\BasicHome\background_Black.jpg',
    16.         eq(#skin.background,'Dark'),'Animations\BasicHome\background_Dark.jpg',
    17.         eq(#skin.background,'DarkBlue'),'Animations\BasicHome\background_DarkBlue.jpg',
    18.         eq(#skin.background,'DarkRed'),'Animations\BasicHome\background_DarkRed.jpg',
    19.         eq(#skin.background,'DarkGreen'),'Animations\BasicHome\background_DarkGreen.jpg',
    20.         eq(#skin.background,'Disco'),'musicvideos-background.jpg',
    21.         eq(#skin.background,'MediaPool'),'MediaPool.jpg',
    22.         eq(1,1),''))</texture>
     
  4. catavolt
    • Team MediaPortal
    • Administrator

    catavolt Design Group Manager

    Joined:
    August 13, 2007
    Messages:
    12,110
    Likes Received:
    4,863
    Gender:
    Male
    Occupation:
    Technical Documentation, Translation
    Location:
    Lanzarote
    Ratings:
    +7,216 / 38
    Home Country:
    Germany Germany
    Show System Specs
    Use an editor which will automatically wrap long lines ;)
     
    Last edited: December 30, 2016
  5. CyberSimian
    • Team MediaPortal

    CyberSimian Test Group

    Joined:
    June 10, 2013
    Messages:
    1,552
    Likes Received:
    489
    Gender:
    Male
    Location:
    Southampton
    Ratings:
    +899 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    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 (Text):
    1. <label>#(switch(
    2.   eq(L(100600),#currentmodule),L(100600),
    3.   eq(L(100762),#currentmodule),L(100762),
    4.   eq(1,1),''))</label>

    But this does not work with the COLORDIFFUSE tag:

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

    and neither does this:

    Code (Text):
    1. <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
     
  6. CyberSimian
    • Team MediaPortal

    CyberSimian Test Group

    Joined:
    June 10, 2013
    Messages:
    1,552
    Likes Received:
    489
    Gender:
    Male
    Location:
    Southampton
    Ratings:
    +899 / 3
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    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
     
    • Agree Agree x 1
  7. catavolt
    • Team MediaPortal
    • Administrator

    catavolt Design Group Manager

    Joined:
    August 13, 2007
    Messages:
    12,110
    Likes Received:
    4,863
    Gender:
    Male
    Occupation:
    Technical Documentation, Translation
    Location:
    Lanzarote
    Ratings:
    +7,216 / 38
    Home Country:
    Germany Germany
    Show System Specs
    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 ;)
     
  8. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,427
    Likes Received:
    2,517
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,438 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    And properties probably not work as well :)
     
  9. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,427
    Likes Received:
    2,517
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,438 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    I have a very small rasp :whistle: , and I do not know C#, so quickly I did not get anything. But it is necessary to collect comments, and if I find it is a quick fix, I'll do. :):whistle::coffee:
     
    • Like Like x 1
    • Thank You! Thank You! x 1
  10. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,427
    Likes Received:
    2,517
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,438 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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
     
    • Thank You! Thank You! x 1
    • Informative Informative x 1
  11. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,427
    Likes Received:
    2,517
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,438 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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 ...
     
    • Thank You! Thank You! x 1
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!