Kodi Community Forum

Full Version: Q: unlocalized label for System.CurrentWindow
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, does an "unlocalized"  info label exist for the current active window which return a textlabel??

When using the native debug overlay when using Skin.ToggleDebug()
i can see the current current window name  as textlabel.

When using
System.CurrentWindow it always return the translated string (based on current choosen language), is there any way to return the "original" text value, like it used in native debug overlay.

This will help me save variables/define conditions.
Have you tried this ?
Code:
$INFO[Window.Property(xmlfile)]
This should return which xml file is currently shown by the GUI (e.g. Home.xml)

If you want to use System.CurrentWindow as a condition you could also do something like this (e.g. for Home Window):
Code:

String.isEqual(System.CurrentWindow,$LOCALIZE[10000])
This would also return "true" if your current window is "Home" regardless of which GUI language is set.
(2021-06-13, 16:52)bkury Wrote: [ -> ]Have you tried this ?
Code:
$INFO[Window.Property(xmlfile)]
This should return which xml file is currently shown by the GUI (e.g. Home.xml)

If you want to use System.CurrentWindow as a condition you could also do something like this (e.g. for Home Window):
Code:

String.isEqual(System.CurrentWindow,$LOCALIZE[10000])
This would also return "true" if your current window is "Home" regardless of which GUI language is set.

yepp, i knowed about that.

its not pretty hard but if such label exists it'll will save a few lines.

currently i store the current window via a property by using...

condition="window.isactive(videos)">setproperty(windowname,videos,home)

also not a big deal.but i thought such label exist somewhere as it is used.

the usage background is to use a visible condition for disable view type include in common media windows (videos,music,games,programs...)
I'm confused, wouldn't that work for you ?
(no conditions required)

Put this line in all xml navigation files (MyVideoNav.xml, MyMusicNav.xml, MyGames, MyPics.xml, ...)
Code:
<onload>setproperty(windowname,$INFO[Window.Property(xmlfile)],home)</onload>
and then use
Code:
<visible>String.isEqual(Window(home).Property(windowname),MyMusicNav.xml)</visible> or
<visible>String.isEqual(Window(home).Property(windowname),MyPics.xml)</visible> ... and so on ...
 
Quote:the usage background is to use a visible condition for disable view type include in common media windows (videos,music,games,programs...)
I'm not sure why you want to use a window property at all if you just want to disable a viewtype based on content type or window active.
e.g. viewtype:
Code:

<control type="panel">
   ...
   <visible>!String.isEqual(Window.Property(xmlfile),MyPics.xml)</visible>            <!-- Hide Viewtype if window (pictures) is active -->
   <visible>!Container.Content(pictures)</visible>                                    <!-- Hide viewtype if content type are pictures (more common way to hide viewtypes) -->
   ...
</control>


Sorry if I misunderstood you. I'm still not sure if that is what you are trying to achieve
No need for excuse ;-)

May i was a bit weird in explanation.

Again, it's really a minor issue, and i have to say sorry for wasting your time by try to help by improve code with "circumstance thing".


So 1st.

I have a WIP view selctor (custom_***.xml as a dialog , video of custom dialog  ) which will offer some options (
    a) set view(id)
    b) lock/prefer view(id) for content using - here i can use the native info label $INFO[Container.Content]
                - when i use dialog from within skinsettings window i will use custom labels anyway
                - but when i use dialog from a media window i can use
xml:

                    <!--
                    
                    <include condition="string.isempty(container.content)" content="locking_containercontent">
                        <param name="lock_containercontent" value="listing" />
                        <param name="lock_containercontent_view_id" value="$PARAM[view_id]" />
                    </include>
                    <include condition="container.content(movies)" content="locking_containercontent">
                        <param name="lock_containercontent" value="movies" />
                        <param name="lock_containercontent_view_id" value="$PARAM[view_id]" />
                    </include>
                    <include condition="container.content(sets)" content="locking_containercontent">
                        <param name="lock_containercontent" value="sets" />
                        <param name="lock_containercontent_view_id" value="$PARAM[view_id]" />
                    </include>
                .... and so on
                    -->
            

                - the generated strings will then be used as visible conditions for specific container.content and force specific view id groups to a visible state and hide non matching group id's
                
    c) disbale a view(id) for/in a specific media Window ( videos,music,pictures,games,programs,addonbrowser)
- here i have to use and variable/condition to store it as an untranslated info label
                    - here will store an info label before opening the custom  dialog(1105), for reasons ;-)
                    
                    
                    because $INFO[system.currentwindow] is translated/localiced string i had to use, intentionally i was thinking abaout using
xml:

<onclick>SetProperty(view_disable_mediawindow,$INFO[System.CurrentWindow*untranslatedinfolabel],home)</onclick>
                    and i wondered why a untranslated info label isn't available even if its shown in native debugoverlay
xml:
        
                    <item>
                        <icon>buttons/viewswitch.png</icon>
                        <label>ViewMode Select</label>
                        <label2>$INFO[Container.Viewmode]</label2>
                        <onclick condition="Window.IsActive(videos)">SetProperty(view_disable_mediawindow,videos,home)</onclick>
                        <onclick condition="Window.IsActive(music)">SetProperty(view_disable_mediawindow,music,home)</onclick>
                        <onclick condition="Window.IsActive(pictures)">SetProperty(view_disable_mediawindow,pictures,home)</onclick>
                        <onclick condition="Window.IsActive(games)">SetProperty(view_disable_mediawindow,games,home)</onclick>
                        <onclick condition="Window.IsActive(programs)">SetProperty(view_disable_mediawindow,programs,home)</onclick>
                        <onclick condition="Window.IsActive(playlist)">SetProperty(view_disable_mediawindow,playlist,home)</onclick>
                        <onclick condition="Window.IsActive(addonbrowser)">SetProperty(view_disable_mediawindow,addonbrowser,home)</onclick>
                        <onclick>ActivateWindow(1105)</onclick>
                        <property name="icon">default</property>
                    </item>
    - when using that dialog from within a media window i could have used that label for auto detection like it's possible for lock/force container for content(foobar) via $INFO[Container.Content]
    - i am also able to open that dialog from skinsettings window (where i set custom properties for such labels)


To the other thing which makes you wonder. (why just not only use visible tags for correspopnding container/group )
In my experiance there is a performance improvement when DONT loading a whole inlucde  versus just hide the control via a visible condition.
    

This will become more importatnt the more viewtype containers i will offer/add in the skin.

Also i got a few a viewtypes which uses a lot of custom containers filled with dynamic and/or staic content.
When i just hide them via a visible tag, i saw in the logs, that kodi internally load the content even if its in hidden state, to have them available if a hidden state becomes true.
When exclude an specific include the "disasbled" include will not be loaded till  the skin or xml is reloadeds/refreshed