Show Change log on load?
#1
Hi guys,

I'm just playing around with creating my own addon. I'd like to show the changelog text when the addon opens but I'm not sure how to do it.

Can anyone point me in the right direction?
Reply
#2
if you happen to run a nightly build, it's quite easy:
Code:
import os, xbmcgui, xbmcaddon, xbmcvfs

path   = xbmcaddon.Addon().getAddonInfo('path').decode("utf-8")

logfile = xbmcvfs.File(os.path.join(path, 'changelog.txt'))
text = logfile.read()
logfile.close()

dialog = xbmcgui.Dialog()
dialog.textviewer(xbmc.getLocalizedString(24036), text)


on Kodi Isengard (and earlier) you could use this:
Code:
import os, xbmcgui, xbmcaddon, xbmcvfs

class Gui(xbmcgui.WindowXMLDialog):
    def __init__(self, *args, **kwargs):
        xbmcgui.WindowXMLDialog.__init__(self)
        self.header = kwargs.get("header")
        self.content = kwargs.get("content")

    def onInit(self):
        self.getControl(1).setLabel(self.header)
        self.getControl(5).setText(self.content)

path   = xbmcaddon.Addon().getAddonInfo('path').decode("utf-8")

logfile = xbmcvfs.File(os.path.join(path, 'changelog.txt'))
text = logfile.read()
logfile.close()

dialog = Gui("DialogTextViewer.xml", path, header=xbmc.getLocalizedString(24036), content=text)
dialog.doModal()
del dialog
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

Logout Mark Read Team Forum Stats Members Help
Show Change log on load?0