Kodi Community Forum

Full Version: Feature request - GUI.ShowNotification More Options.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
http://wiki.xbmc.org/index.php?title=JSO...tification

Current options :
Code:
5.5.4 GUI.ShowNotification
Shows a GUI notification
Permissions:
ControlGUI
Parameters:
string title
string message
[ mixed image = "" ]
[ integer displaytime = 5000 ]


I was hoping that more things could be added to this, for example.
1. Transition
2. Size of box
3. Size of image
4. Font size
5. Multi line, instead of scrolling line.
6. position on the screen of the box

Reasoning, I would like to be able to send dynamic messages to my xbmc units around the house, based on certain events. Ie. CCTV motion detected might require a larger picture box and no text. A system error on one of my systems might just needs a small scrolling msg.

What do you think?

Thx
Matt.
The size and look of the box is dictated by the skin and messing with that will ruin the look and feel of the skin.
Moved to the JSON-RPC Development forum.

As Martijn pointed out, most of these things (certainly 2, 3, 4 and 6) are up to the skinner and xbmc doesn't want to interfer with it. Not sure what you mean with Transition (1). Multiline (5) would be a general feature request for xbmc because it currently only supports a single line for notifications.
You can do this sort of thing with an addon and make it whatever you want. Then you can use Addons.ExecuteAddon to get access to it.
It may not exactly be as easy as GUI.ShowNotification, but with a little bit of python you can achieve what you want.

Here is a very basic example (located in top right).
Image

JSON:
Code:
{
    'jsonrpc': '2.0',
    'id': 0,
    'method': 'Addons.ExecuteAddon',
    'params': {
        'addonid': 'script.popup',
        'params': {
            'image': 'D:\\heartagram.jpg',
            'line1': 'Line 1',
            'line2': 'Line 2',
            'line3': 'Line 3',
            'line4': 'Line 4',
            'line5': 'Line 5',
        }
    }
}


ADDON:

Code:
import xbmc
import xbmcgui
import sys
import urlparse

class PopupWindow(xbmcgui.WindowDialog):
    def __init__(self, image, line1, line2, line3, line4, line5):
        self.addControl(xbmcgui.ControlImage(x=25, y=25, width=150, height=150, filename=image[0]))
        self.addControl(xbmcgui.ControlLabel(x=190, y=25, width=500, height=25, label=line1[0]))
        self.addControl(xbmcgui.ControlLabel(x=190, y=50, width=500, height=25, label=line2[0]))
        self.addControl(xbmcgui.ControlLabel(x=190, y=75, width=500, height=25, label=line3[0]))
        self.addControl(xbmcgui.ControlLabel(x=190, y=100, width=500, height=25, label=line4[0]))
        self.addControl(xbmcgui.ControlLabel(x=190, y=125, width=500, height=25, label=line5[0]))

if __name__ == '__main__':
    params = urlparse.parse_qs('&'.join(sys.argv[1:]))
    window = PopupWindow(**params)
    window.show()
    xbmc.sleep(5000)
    window.close()
    del window
Realise it is skin based, it is how i have changed it atm, just though it would be a good idea to have it so you could send custom notifications to it if needed.

@N3MIS15 thx, will give it a go.