Plugin config order and language file strings within the plugin (1 Viewer)

Lightning303

MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    Hey,
    i have 2 small questions.

    Question 1:
    I added AtmoLight to the config/settings menu in MP2 a while ago, but what always bugged me was that the menu items are sorted alphabetically. The entries themselfs are sorted in the way i added them into the plugin.xml but not the menu items. And it makes it way harder to navigate in my opinion.
    A screenshot of how it looks like:

    config order.png


    However i would like it to be sorted like this:
    General Settings
    AtmoWin
    Hyperion
    Content Effects
    Remote Buttons
    Advanced Settings.

    plugin.xml section: https://github.com/ambilight-4-medi...ore/AtmoLight.MediaPortal2/plugin.xml#L38-L79

    Is it possible to change the order? If so how? If not, any plans to add the possiblity (pretty please)?


    Question 2:
    Is it possible to get the strings from the language files within the plugin, so i can work with them?

    I have this string in the file:
    Code:
    <string name="AtmoLight.AtmoWinConnectionLost">Connection to [Target] lost!</string>

    And i want to notify the user. However i would like to replace [Target] with something else within the plugin.
    Atm im doing this:

    Code:
          ServiceRegistration.Get<INotificationService>().EnqueueNotification(NotificationType.Error, "[AtmoLight.Name]", "[AtmoLight.AtmoWinConnectionLost]", true);

    Which of course tells me that connection to "[Target]" got lost and not to e.g. AtmoWin.
    Any method around that returns the string?
    E.g.
    GetStringFromLanguage("[AtmoLight.AtmoWinConnectionLost]") returns "Connection to [Target] lost!"

    Edit: As soon as i posted this and went to the kitchen to make something to eat i of course knew how i get the answer to question 2 myself... :p

    For everbody else curious:
    Code:
    MediaPortal.Common.Localization.LocalizationHelper.Translate("[AtmoLight.AtmoWinConnectionLost]")

    Thanks!
     
    Last edited:

    kilik360

    MP Donator
  • Premium Supporter
  • September 3, 2010
    576
    235
    Home Country
    Canada Canada
    Do I really see Hyperion ? That is promising ! What can you achieve from mediaportal ?
     

    Lightning303

    MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    Do I really see Hyperion ? That is promising ! What can you achieve from mediaportal ?

    Psst ;P

    Pretty much the same as with atmowin. We redesigned the core to make it possible to have multiple targets, even at the same time. So its possible to have atmowin and hyperion running simultaneously. Also should be pretty easy now to add support for other software aswell.

    Our current dev branch should be buildable and runable on both MP1 and MP2. This of course can change with any commit :p.
    https://github.com/ambilight-4-mediaportal/AtmoLight/tree/DEV_rework_core

    If you want to test it, go ahead, would be great to hear some more feedback ;).
     

    kilik360

    MP Donator
  • Premium Supporter
  • September 3, 2010
    576
    235
    Home Country
    Canada Canada
    Honnestly, I'm a GitHub newbie, all of this is chinese for me. I don't know how to compile those 'branch'. Maybe you can show me the path ?
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    First recommendation: don't use multiple
    XML:
     <Register Location="/Configuration/Settings/Plugins/AtmoLight">
    <ConfigSection
    Id="General"
    Redundant="true"
    Text="[AtmoLight.General]"/>
    </Register>
    <Register Location="/Configuration/Settings/Plugins/AtmoLight">
    <ConfigSection
    Id="Effects"
    Redundant="true"
    Text="[AtmoLight.Effects]"/>
    </Register>
    but combine them into single <Register>:
    XML:
     <Register Location="/Configuration/Settings/Plugins/AtmoLight">
    <ConfigSection
    Id="General"
    Redundant="true"
    Text="[AtmoLight.General]"/>
    <ConfigSection
    Id="Effects"
    Redundant="true"
    Text="[AtmoLight.Effects]"/>
    </Register>
    Probably not related, but avoiding redundancies is always good.

    And to Redundant="true" is only required, if you expect this section could have been created by another plugin. In your case you should remove it.

    I didn't find any sorting for ListItems yet, but I don't have more time now.
     

    Lightning303

    MP Donator
  • Premium Supporter
  • September 12, 2009
    798
    577
    Home Country
    Germany Germany
    Thanks for your efforts!

    I now combined them all as you suggested aswell as removed the redundant declarations.
    However the menu items are still ordered alphabetically.
     

    jehe

    Portal Pro
    February 15, 2011
    694
    216
    57
    Home Country
    Belgium Belgium

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I now combined them all as you suggested aswell as removed the redundant declarations.
    However the menu items are still ordered alphabetically.
    I've checked the code and found the reason: https://github.com/MediaPortal/Medi...ents/Configuration/ConfigurationModel.cs#L480.

    Here a WorkflowAction is created, using the label as sort criteria.

    What should we do? I would extend the config section metadata with a custom "sort" attribute, so you can define it inside plugin.xml. If it's null or empty default sorting will be title as now. Would this be what you need?
     

    Users who are viewing this thread

    Top Bottom