MythStatusScreenlet 0.1.1 released (theme support)

Posted on

I’m pleased to announce the 0.1.1 release of the MythStatusScreenlet. This release now is “theme-able”. I know Screenlets are theme-able already, but the standard theme support really just supports changing the background and other externally loaded graphics (png and svg). UPDATE: It appears I am running an old version of screenlets (0.0.14) and versions 0.1.2 and above have a lot more theme support.

In MythStatusScreenlet 0.1.1, I’ve extended (subclassed) the Screenlets utils.ini_reader to load extra options for the theme. These options control the layout and style of all the elements of the MythStatusScreenlet. As a proof of concept, I’ve quickly built a few other themes including “mythbuntu” and “glass”. I’ve renamed the default mepo theme to mepo-transparent, and created a new one for mepo that has a black background. This is because of a comment on the download page saying that a user sometimes found it hard to see the screenlet when backgrounds were changed.

Additionally, there is now support for GTK popups using the Screenlets Notifier class. The MythStatusScreenlet will popup a Notifier window when MythTV starts or finishes a recording.

I’ve tried to add mouseover tooltips too. However, I’ve found it to be quite unreliable, so it’s turned off by default.

I recently built a new MythTV machine. I installed mythbuntu 8.04 on it, which installed MythTv 0.21  Since then, my myth box no longer presents the Temperature information. I suspect a few other people might have the same problem (based on a comment on the gnome-look site), so I’ve fixed the code to only try and display the Temperature information if it is present. However, this means that I can’t easily test the Temperature display when building the themes. Please post a comment if you have this working, or have problems with it. Does anyone know if Temperature info is no longer presented in Myth 0.21, or is it a MythBuntu thing?

As usual, downloads are at gnome-look.

Advertisements

2 thoughts on “MythStatusScreenlet 0.1.1 released (theme support)

    Mike said:
    January 25, 2010 at 02:13

    Thanks a bunch for this screenlet! I’ve been using it for quite a while and it is very helpful to keep tabs on the backend. Not sure if you are already updating this to match the new Mythtv version 0.22 XML format. I’m a noob with Python but I just took a stab at it and it seems to be working. I have only done minimal testing. Here’s the diffs, hope this helps:

    Index: src/MythStatus/utils.py
    ===================================================================
    @@ -319,7 +318,13 @@
    ctx.restore()

    def showDiskGradiant(self, ctx, Name, myConfig):
    – if self.mythtv_version == “21”:
    + if self.mythtv_version == “22”:
    + if Name+’Direction’ in myConfig and myConfig[Name+’Direction’] == ‘horizontal’:
    + spaceUsed = float(self.__info[‘used’])/float(self.__info[‘total’]) * int(myConfig[Name+’Width’] – 2)
    + elif Name+’Direction’ in myConfig and myConfig[Name+’Direction’] == ‘vertical’:
    + spaceUsed = float(self.__info[‘used’])/float(self.__info[‘total’]) * int(myConfig[Name+’Height’] – 2)
    +
    + elif self.mythtv_version == “21”:
    if Name+’Direction’ in myConfig and myConfig[Name+’Direction’] == ‘horizontal’:
    spaceUsed = float(self.__info[‘drive_total_used’])/float(self.__info[‘drive_total_total’]) * int(myConfig[Name+’Width’] – 2)
    elif Name+’Direction’ in myConfig and myConfig[Name+’Direction’] == ‘vertical’:
    @@ -396,12 +401,15 @@
    [myConfig[Name+’FontColourError’][0], myConfig[Name+’FontColourError’][1], myConfig[Name+’FontColourError’][2], myConfig[Name+’FontColourError’][3]])

    def showDiskInfo(self, ctx, Name, myConfig):
    – if self.mythtv_version == “21”:
    + if self.mythtv_version == “22”:
    + freeSpace = self.__info[‘free’]
    +# spaceUsed = float(self.__info[‘used’])/float(self.__info[‘total’])
    + elif self.mythtv_version == “21”:
    freeSpace = self.__info[‘drive_total_free’]
    – spaceUsed = float(self.__info[‘drive_total_used’])/float(self.__info[‘drive_total_total’])
    +# spaceUsed = float(self.__info[‘drive_total_used’])/float(self.__info[‘drive_total_total’])
    else:
    freeSpace = self.__info[‘_total_free’]
    – spaceUsed = float(self.__info[‘_total_used’])/float(self.__info[‘_total_total’])
    +# spaceUsed = float(self.__info[‘_total_used’])/float(self.__info[‘_total_total’])

    if int(freeSpace) > 1024:
    freeSpace = str(float(freeSpace)/1024)[0:6] + ” ” + myConfig[Name+’SuffixGB’]
    @@ -419,6 +427,7 @@
    from xml.sax.saxutils import unescape

    f = “”
    + first_group = True
    try:
    f = urllib.urlopen(self.myth_status_url)
    self.__recordings = []
    @@ -436,6 +445,7 @@
    loadavgRE = re.compile(‘<Load .*')
    guideRE = re.compile('<Guide .*')
    thermalRE = re.compile('<Thermal .*')
    + groupRE = re.compile('<Group .*')

    encodersContextRE = re.compile('<Encoders .*')
    scheduledContextRE = re.compile('<Scheduled .*')
    @@ -491,6 +501,16 @@
    for attr in attrib.finditer(match.group()):
    self.__info[attr.group(1)] = unescape(attr.group(2))

    + # /Status/MachineInfo/Storage/Group
    + # For Mythtv 0.22 XML files the first recording group seems to be the total
    + # TODO: Confirm that the first group is always the total or
    + # fix this to recognize which one is
    + for match in groupRE.finditer(line):
    + if first_group == True:
    + first_group = False
    + for attr in attrib.finditer(match.group()):
    + self.__info[attr.group(1)] = unescape(attr.group(2))
    +
    f.close()
    return

    netwolfuk said:
    April 5, 2010 at 18:29

    Hi Mike. I finally posted the updated version. Thanks for your patch.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s