Got some problems with "System.GetBool(bool)"
#1
Hello

Im my SettingsWindow i use a lot of Fakelists, now i have also buttons in these Fakelists which should show the actual Setting from another Settingswindow (i.e. SettingsCathegory.xml)

to achive this, i did try to read the coresponding setting via "System.GetBool(bool)" but got some Problems with it.

"System.GetBool(bool)" is listed as "Infolabel" but doesnt/(seems not to) return a Value/String, even if i use something well knewn as "Pvr.HasTVChannels".

What i did try is, use the bool directly in the "<selected>" Tag in a Radiobutton Control, and as a second attempt as visible condition in two different ways. Non of them worked.

Hers the Code: (Bool as visible condition)
xml:

          <control type="radiobutton">
                <label>$LOCALIZE[36615]</label>
                <selected>true</selected>
                <textcolor>DialogTextColor2</textcolor>
                <visible>String.IsEqual(System.GetBool(unknownsources),true)</visible>
            </control>
            <control type="radiobutton">
                <label>$LOCALIZE[36615]</label>
                <selected>false</selected>
                <textcolor>DialogTextColor2</textcolor>
                <visible>!String.IsEqual(System.GetBool(unknownsources),true)</visible>
            </control>

xml:

          <control type="radiobutton">
                <label>$LOCALIZE[36615]</label>
                <selected>true</selected>
                <textcolor>DialogTextColor2</textcolor>
                <visible>System.GetBool(unknownsources)</visible>
            </control>
            ...

My favoret question: "Shuldnt this work"? Or in other Words: Where do i do the Mistake here?

And where do i finde the Bool for "show notifications" (Settings -> System - > Addons)?
(Didnt finde it in the GUISettings.)

Regards
Reply
#2
first off, i'm pretty sure our wiki documentation is incorrect on this one.
System.GetBool() returns a boolean and not a string.

you can use it directly (without string compare) in a visible condition, like so:
xml:
<visible>system.getbool(input.enablemouse)</visible>

second, System.GetBool() can only retrieve system settings, the ones that are listed on the various SettingsCategory windows.
to check what's available, see: https://github.com/xbmc/xbmc/blob/master...ttings.xml

'show notifications' is not a system setting, instead it's part of the AddonManager window.
and 'pvr.haschannels' is not a setting, it's an infobool.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks

stuff commes together, looks like somme bools can be integers to.

i have this as a "label2" in a button control:
xml:

    <!-- Settings Fakelist-help Button AddonupdateSettings -->
    <variable name="GeneralAddonupdatesOptionsLabel">
        <value condition="Integer.IsEqual(System.GetBool(general.addonupdates),0)">$LOCALIZE[36606]</value>
        <value condition="Integer.IsEqual(System.GetBool(general.addonupdates),1)">$LOCALIZE[36607]</value>
        <value condition="Integer.IsEqual(System.GetBool(general.addonupdates),2)">$LOCALIZE[36608]</value>
    </variable>

strange, but the label doesnt change without a "Reload.Skin"

Now im not shure, if this is related to the bool, or the Variable? (As i cant show the Integer(bool) as label, i cant test if it is realy set instantly (others i tested do.)

(does it neet a "Reload.Skin" to reevaluate the variable?)
 
Quote:<setting id="general.addonupdates" type="integer" label="36605" help="36611">
<level>0</level>
<default>0</default>
<constraints>
<options>
<option label="36606">0</option> <!-- AUTO_UPDATES_ON -->
<option label="36607">1</option> <!-- AUTO_UPDATES_NOTIFY -->
<option label="36608">2</option> <!-- AUTO_UPDATES_NEVER -->
</options>
</constraints>
<control type="list" format="string" />
</setting>
-----

the other booleans like "general.addonnotifications" i found work perfectly. (and instand)


EDIT:

Hm, seems not to be a problem of using a variable there, as it also doesnt work with three labels:
xml:

<!-- Aktualisierungen (updates) -->
            <control type="button">
                <label>$LOCALIZE[36605]</label>
                <label2>$LOCALIZE[36606]</label2>
                <!--label2>$VAR[GeneralAddonupdatesOptionsLabel]</label2-->
                <textcolor>DialogTextColor2</textcolor>
                <visible>Integer.IsEqual(System.GetBool(general.addonupdates),0)</visible>
            </control>
            
            <!-- Aktualisierungen (updates) -->
            <control type="button">
                <label>$LOCALIZE[36605]</label>
                <label2>$LOCALIZE[36607]</label2>
                <!--label2>$VAR[GeneralAddonupdatesOptionsLabel]</label2-->
                <textcolor>DialogTextColor2</textcolor>
                <visible>Integer.IsEqual(System.GetBool(general.addonupdates),1)</visible>
            </control>
            
            <!-- Aktualisierungen (updates) -->
            <control type="button">
                <label>$LOCALIZE[36605]</label>
                <label2>$LOCALIZE[36608]</label2>
                <!--label2>$VAR[GeneralAddonupdatesOptionsLabel]</label2-->
                <textcolor>DialogTextColor2</textcolor>
                <visible>Integer.IsEqual(System.GetBool(general.addonupdates),2)</visible>
            </control>
Reply
#4
As Ronie said, it's not possible. System.GetBool only returns true or false (that's why it's called boolean). It does not return a string/integer which can be compared to another one.

Edit:
Or long story short -> System.GetBool can be used for system settings that have a on/off switch. Not for settings with multiple options.
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
Reply
#5
o.k. ,got it, so only the ones marked as type "boolean" will work.

so there is no solution to get anything from these Settings marked as type="integer"
Reply
#6
No.
Reply
#7
O.K.

Guess these "internal controls" have also no id which would make it possible to get the label via "Control.GetLabel(id).Index(1)"

(just to be shure, then if not, i guess i have to give up on this special case.)


--------------------


EDIT:
At least this should work: $INFO[Container(5).ListItemAbsolute(1).Label2] (shouldnt it?)
Quote: Container(id).ListItemAbsolute(id).[infolabel] -> Shows the infolabel for an item in a Container. the item id is the absolute position in the container

I can show the position in the control Id="5" via: $INFO[Container(5).CurrentItem] which is "1", if i focus the Control from which i need the Label2, so position Number should be correct but "$INFO[Container(5).ListItemAbsolute(1).Label2]" shown in a Label control stays Empty (same window)
Reply
#8
INFO[Container(5).ListItemAbsolute(1).Label2]

o.k. guess its not working beacause the the control is in a Grouplist(id="5") -> not a real list (noticed this late), did test the same in a "normal" list control, and there it works (

looks like there is realy no solution.  (

Thnks for all the input.
Reply

Logout Mark Read Team Forum Stats Members Help
Got some problems with "System.GetBool(bool)"0