PDA

View Full Version : app thumbnail/app variables


gregwa
May 6th, 2009, 10:09 AM
First...
Trying to create an app plugin that works with the current api. Log shows:

07:34:20 T:2885700496 M: 42344448 INFO: msg: PICTURE::CreateThumbnail: Unable to open image: app://wunderground/app.png Error:
07:34:20 T:2885700496 M: 42303488 ERROR: PICTURE::DoCreateThumbnail: Unable to create thumbfile /home/greg/.boxee/UserData/profiles/gregwa/Thumbnails/Pictures/0/0f7250d1.tbn from image app://wunderground/app.png

In the descriptor.xml file I have the <thumb> set to:
<thumb>http://127.0.0.1/app.png</thumb>
which is accessable.

I also have the png available in /home/greg/.boxee/UserData/apps/wunderground, formatted as a 200x200 png using the gradient gray background as specified in the documentation.

What's wrong?

Secondly, I've seen vague references to variables with in the app, but can't find anything solid to use as information on how to create/use them. I have a number of variables in my python code that will (hopefully) populate labels on the screen. How do I declare/use them within the main.xml file? I need to gather information from a web site, then parse it, then populate the label text after all is said and done. I've tried to do this in an <onload> of the main bitmap background and from the last label control through my inline code, but with no success.

Any help on these would be appreciated.

Thanks in advance,

Greg

jontas
May 6th, 2009, 11:23 AM
If you visit:
http://127.0.0.1/app.png

In a web browser, does it work? If so, then I'm out of ideas on the thumbnail.

If not, make sure your webserver/vhosts are configured correctly.

You can dynamically set the contents of a label from inside python anywhere in the app. It should look something like:

import mc
mc.GetWindow(int id).GetLabel(int id).SetLabel(string LabelText)

More info:
http://developer.boxee.tv/python-api-reference/#Label

gregwa
May 6th, 2009, 12:14 PM
Thanks for the quick answer...

If you visit:
http://127.0.0.1/app.png

In a web browser, does it work? If so, then I'm out of ideas on the thumbnail.



Yes, it does. I had tried that early on.

As to the label information, thanks for the tip. I'll give it a try.

jontas
May 6th, 2009, 01:21 PM
One more thought on the thumbnail is to try http://localhost instead of 127.0.0.1, or just stick it on the web somewhere like tinypic.

Jon

gregwa
May 6th, 2009, 01:22 PM
I'll give it a try.

gregwa
May 7th, 2009, 07:02 AM
I'm an idiot.

I forgot to fix it in sources.xml. :mad:

Oh well.

gregwa
May 7th, 2009, 07:03 AM
Still working on it...but I'm not having too much faith.

I'll start over and see what happens.

gregwa
May 7th, 2009, 12:26 PM
Here is a simple test that I tried. Nothing works as far as changing the text of the label. OBVIOUSLY I'm doing something wrong, but I can't figure out what.

The screen populates correctly as far as I can tell, but the update of the text in the label 106 never happens even tho I've put it in two places.


<?xml version="1.0"?>
<window type="window" id="14000">
<defaultcontrol always="true">100</defaultcontrol>
<controls>
<control type="image">
<posx>0</posx>
<posy>0</posy>
<width>1280</width>
<height>720</height>
<texture>white.png</texture>
</control>
<control type="button" id="100">
<posx>0</posx>
<posy>0</posy>
<width>1280</width>
<height>720</height>
<label>-</label>
<texturenofocus>weatherback1.png</texturenofocus>
<texturefocus>weatherback1.png</texturefocus>
<onload lang="python"><![CDATA[
from xml.dom import minidom
from xml.dom.minidom import Node
import mc
import urllib
import sys
import getopt

mc.GetWindow(14000).GetLabel(106).SetLabel("Time/Date Test")
mc.GetWindow(14000).GetControl(106).SetVisible(Tru e)
print 'set title done'
]]></onload>
</control>
<control type="label" id="106">
<visible>true</visible>
<posx>375</posx>
<posy>90</posy>
<width>800</width>
<height>80</height>
<font>font16b</font>
<align>left</align>
<aligny>top</aligny>
<label>Test</label>
<textcolor>white</textcolor>
<selectedcolor>FFFDF041</selectedcolor>
</control>
<control type="label" id="138">
<visible>true</visible>
<posx>520</posx>
<posy>430</posy>
<width>400</width>
<height>280</height>
<font>font21b</font>
<align>left</align>
<aligny>center</aligny>
<label>From the West at 7 MPH</label>
<textcolor>white</textcolor>
<selectedcolor>FFFDF041</selectedcolor>
<onload lang="python"><![CDATA[
mc.LogInfo('This is a test of wunderground')
mc.GetWindow(14000).GetLabel(106).SetLabel("Time/Date Test")
mc.GetWindow(14000).GetControl(106).SetVisible(Tru e)

]]></onload>
</control>

</controls>
</window>

matt.antone
May 7th, 2009, 12:47 PM
The Button Control doesn't have a onload event. Try changing it to a onfocus event.

Try changing the Label to <visible>true</visible> so you can be sure the label of the button is in fact no being affected before making it invisible. I'm having a similar problem with making the button visible onfocus of a different control.

One last thing. You're background is white and your text is white, so you can't read anything.

gregwa
May 7th, 2009, 12:57 PM
I'll try what you suggest. However, the background is being hidden by the image file (id=100) which is the default control.

I will also try removing the background.

gregwa
May 7th, 2009, 01:38 PM
SOME success.


print 'Obversation time=%s' % c.obtime
test = c.we
#mc.GetWindow(14000).GetLabel(106).SetLabel("This is a test of the setlabel function")
mc.GetWindow(14000).GetLabel(106).SetLabel(test)


First line (print...) puts Obversation time=May 7, 10:55 AM MDT as I would expect.

IF I uncomment the first mc.GetWindow command, the command works and changes the text in the label. However, the second one causes the following in the log...


11:32:44 T:2669001616 M: 31350784 NOTICE: Obversation time=May 7, 10:55 AM MDT
11:32:44 T:2669001616 M: 31350784 NOTICE:
11:32:44 T:2669001616 M: 31350784 NOTICE: Traceback (most recent call last):
11:32:44 T:2725510032 M: 31350784 DEBUG: Get URL: http://www.thetvdb.com/api/GetSeries.php?seriesname=stargate%20sg1&language=en
11:32:44 T:2669001616 M: 31350784 NOTICE: File "<string>", line 90, in ?
11:32:44 T:2669001616 M: 31350784 NOTICE: File "/opt/boxee/system/python/lib/mc.py", line 1727, in SetLabel
11:32:44 T:3067758368 M: 31350784 DEBUG: ------------------- GUI_MSG_WINDOW_DEINIT
11:32:44 T:3067758368 M: 31350784 DEBUG: Progress dialog
11:32:44 T:3067758368 M: 31350784 DEBUG: -------------------
11:32:44 T:2733902736 M: 31350784 DEBUG: 11:32:44 T:2669001616 M: 31350784 NOTICE:
11:32:44 T:2669001616 M: 31350784 NOTICE: return _mc.Label_SetLabel(*args)
11:32:44 T:2669001616 M: 31350784 NOTICE: TypeError
11:32:44 T:2669001616 M: 31350784 NOTICE: :
11:32:44 T:2669001616 M: 31350784 NOTICE: in method 'Label_SetLabel', argument 2 of type 'std::string const &'
11:32:44 T:2669001616 M: 31350784 NOTICE:
11:32:44 T:2669001616 M: 31350784 ERROR: Scriptresult: Error


Mean anything to anyone?

gregwa
May 7th, 2009, 02:17 PM
Ok. Took a while, but I figured it out.

Seems that my variable c.obtime is coming back as a type Unicode. By casting it directly to a string using str(c.obtime) works.

Thanks for all the help.