adding status page to the application, still a work in progress though

This commit is contained in:
Erik Kristensen 2010-10-17 16:45:17 -04:00
parent 9d0a04de94
commit c35530404e
3 changed files with 93 additions and 5 deletions

View File

@ -14,7 +14,7 @@ from operator import itemgetter, attrgetter
class MythBoxee(threading.Thread):
logLevel = 1
version = "4.4.23.1.beta"
userAgent = "MythBoxee v4.23.3.beta"
userAgent = "MythBoxee v4.4.23.1.beta"
tvdb_apikey = "6BEAB4CB5157AAE0"
be = None
db = None
@ -804,6 +804,78 @@ class MythBoxee(threading.Thread):
self.config.Reset("loadingsettings")
"""
StatusInit -- Function called when Status Window is opened.
This function pulls status information from the MythTV backend and displays it to the user.
Status information includes load, uptime, free space, upcoming recordings, guide data, etc ...
"""
def StatusInit(self):
self.log("def(StatusInit): Start =========================================================")
self.config.SetValue("loadingstatus", "true")
# Set the version on any page that loads
mc.GetActiveWindow().GetLabel(1013).SetLabel(self.version)
# Grab data from the backend for status screen
try:
uptime = self.be.getUptime()
load = self.be.getLoad()
freespace = self.be.getFreeSpace()
guidedata = self.be.getLastGuideData()
isRecording = self.be.isRecording(1)
freespacesummary = self.be.getFreeSpaceSummary()
recorders = self.be.getRecorderList()
upcoming = self.be.getUpcomingRecordings()
except Exception, e:
self.log("def(StatusInit): Exception: " + str(sys.exc_info()[0]))
mc.ShowDialogOk("MythBoxee", "Whoops! Something went wrong while trying to load this screen. Try again.")
self.config.Reset("loadingstatus")
mc.CloseWindow()
# Setup storage information for status screen
free_txt = "Storage:\n"
for free in freespace:
free_txt = free_txt + " " + str(free.path) + " (" + "Total: " + str(free.totalspace) + ", Free: " + str(free.freespace) + ", Used: " + str(free.usedspace) + ")\n"
guide_txt = "There is guide data until " + str(guidedata) + ".\n"
load_txt = "Load: " + str(load)
uptime_txt = "Uptime: " + str(uptime)
sys_info = load_txt + "\n\n" + uptime_txt + "\n\n" + free_txt + "\n" + guide_txt
if isRecording == True:
try:
currentRecording = self.be.getCurrentRecording(1)
except Exception, e:
self.log("def(StatusInit): Failed to get Current Recording Information")
is_recording_txt = "is recording on channel " + str(currentRecording.callsign) + " (" + str(currentRecording.channum) + ")"
itemList = mc.ListItems()
item = mc.ListItem( mc.ListItem.MEDIA_UNKNOWN )
item.SetThumbnail(self.banners[str(currentRecording.title)])
itemList.append(item)
mc.GetWindow(14003).GetList(1025).SetItems(itemList)
mc.GetWindow(14003).GetLabel(1026).SetLabel(str(currentRecording.title) + ": " + str(currentRecording.subtitle))
else:
is_recording_txt = "is not recording"
# Set encoder information up
mc.GetWindow(14003).GetLabel(1023).SetLabel("Encoder " + str(recorders[0]) + " " + is_recording_txt + ".")
mc.GetWindow(14003).GetLabel(1033).SetLabel(sys_info)
self.log("def(StatusInit): Recorders: " + str(recorders))
self.log("def(StatusInit): Uptime: " + str(uptime))
self.log("def(StatusInit): Load: " + str(load))
self.log("def(StatusInit): Free Space: " + str(freespace))
self.log("def(StatusInit): Guide Data: " + str(guidedata))
self.log("def(StatusInit): Summary: " + str(freespacesummary))
self.log("def(StatusInit): Upcoming: " + str(upcoming))
self.log("def(StatusInit): Recording: " + str(isRecording))
self.config.Reset("loadingstatus")
self.log("def(StatusInit): End ===========================================================")
"""
log - logging function mainly for debugging
"""

View File

@ -34,8 +34,8 @@ mb.stop()
</control>
<control type="grouplist" id="1040">
<posy>28</posy>
<posx>940</posx>
<width>334</width>
<posx>780</posx>
<width>500</width>
<itemgap>10</itemgap>
<orientation>horizontal</orientation>
<ondown>1030</ondown>
@ -48,6 +48,14 @@ mb.stop()
<onclick lang="python"><![CDATA[mb.RefreshMain()]]></onclick>
</control>
<control type="button" id="1042">
<label>Status</label>
<texturefocus>bg_btn.png</texturefocus>
<texturenofocus></texturenofocus>
<height>30</height>
<align>center</align>
<onclick lang="python"><![CDATA[mc.ActivateWindow(14003)]]></onclick>
</control>
<control type="button" id="1043">
<label>Settings</label>
<texturefocus>bg_btn.png</texturefocus>
<texturenofocus></texturenofocus>

View File

@ -37,8 +37,8 @@ mb.stop()
<control type="grouplist" id="1040">
<posy>28</posy>
<posx>1106</posx>
<width>166</width>
<posx>940</posx>
<width>334</width>
<itemgap>10</itemgap>
<orientation>horizontal</orientation>
<ondown>2040</ondown>
@ -53,6 +53,14 @@ mb.stop()
<onclick lang="python"><![CDATA[mb.RefreshMain()]]></onclick>
</control>
-->
<control type="button" id="1042">
<label>Status</label>
<texturefocus>bg_btn.png</texturefocus>
<texturenofocus></texturenofocus>
<height>30</height>
<align>center</align>
<onclick lang="python"><![CDATA[mc.ActivateWindow(14003)]]></onclick>
</control>
<control type="button" id="1042">
<label>Settings</label>
<texturefocus>bg_btn.png</texturefocus>