Release - PyXBMCt: a Python framework for simple creating UI for XBMC addons

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
hpooni Offline
Junior Member
Posts: 26
Joined: Dec 2010
Reputation: 0
Location: Mississauga, Ontario
Post: #31
Sounds great. Thanks for the detailed info. I'll experiment a bit and see what I come up it. I don't need to manually close the window so show() should be ok.
find quote
hpooni Offline
Junior Member
Posts: 26
Joined: Dec 2010
Reputation: 0
Location: Mississauga, Ontario
Post: #32
I'm trying to perform animations on the pop using setAnimations something like below:
PHP Code:
label.setAnimations([('visible''effect=fade start=0 end=100 time=2000',)]) 
But I'm not seeing any results fade results. Is this possible to do?
Ideally I would just like to add single slide in/out effect to the entire popup (something like the built-in notification) but not sure if that's possible.

Thanks for your help.
find quote
Roman_V_M Offline
Fan
Posts: 551
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #33
(2013-10-31 20:55)hpooni Wrote:  I'm trying to perform animations on the pop using setAnimations something like below:
PHP Code:
label.setAnimations([('visible''effect=fade start=0 end=100 time=2000',)]) 
But I'm not seeing any results fade results. Is this possible to do?
Ideally I would just like to add single slide in/out effect to the entire popup (something like the built-in notification) but not sure if that's possible.

Thanks for your help.

I'm not sure about 'visible' conditions, but WindowOpen and WindowClose conditions do work. Also there is a universal rule when dealing with XBMC Python controls (this applies not only to PyXBMCt): any additional properties should be changed after a control is added to a container window. Otherwise, either these additional properties do not work or you get some random and weird bugs.
So in your case it should be something like this:
PHP Code:
label Label('Your label text')
window.placeControl(label00)
label.setAnimations([('WindowOpen''effect=fade start=0 end=100 time=2000',), ('WindowClose''effect=fade start=100 end=0 time=2000',)]) 
This is a pure example and you need to adjust the code to your particular script.
I never tested animation deeply, but I suppose that in order to achieve your goal you need to add animation properties to all your controls, including PyXBMCt build-in controls (the main background and header background images and the header label) if you use AddonDialogWindow/AddonFullWindow classes.
However, there is a potential issue here. I see no problem with 'fade' animation, but animation effects that change the size and position of a control may not work properly with PyXBMCt's Geometry Manager, unless you calculate animation waypoints based on control's coordinates and size assigned by the Geometry Manager.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
hpooni Offline
Junior Member
Posts: 26
Joined: Dec 2010
Reputation: 0
Location: Mississauga, Ontario
Post: #34
Yep, I was changing properties before adding to container window. Also, WindowOpen and WindowClose types work but others do not. That's good enough for me for now. I'm only using fade and slide effects so geometry shouldn't be an issue.
Again, thanks for your detailed help.
find quote
oki_eng Offline
Junior Member
Posts: 24
Joined: Apr 2013
Reputation: 0
Post: #35
Hi,
I am trying to display of database query result which is image,description and title.

I want to use list item (for title) imagebox and text box(for description)

I fetch all data as a array. Listed all title like a list item.
When i select next list item from the list, also description is changing with below code.

# Add Image
def_img='/default/imag/file/img.jpg
self.image = Image(def_img)
self.placeControl(self.image, 1, 1, 4, 1)

# Add TextBox
self.textbox = TextBox()
self.placeControl(self.textbox, 6, 1, 4, 1)
self.textbox.setText('none')

def list_update(self):
try:
if self.getFocus() == self.list:
tx=self.list.getListItem(self.list.getSelectedPosition()).getLabel()
self.textbox.setText('new text'+tx)
else:
self.list_item_label.setLabel('')
except (RuntimeError, SystemError):
pass


But; problem is imagebox

I can set new textbox with self.texbox.setText()
How can i set new thumbnail image to imagebox?

Thanks
Oki
find quote
Roman_V_M Offline
Fan
Posts: 551
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #36
(2013-11-05 07:07)oki_eng Wrote:  I can set new textbox with self.texbox.setText()
How can i set new thumbnail image to imagebox?

Thanks
Oki

Have you read the online documentation for Image class? Because the very second method after __new__, i.e. setImage(), seems to be just what you need.Smile

And please format your code properly with code/php tags. With Python being indentation-sensitive language, such unformatted code is difficult to read.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
oki_eng Offline
Junior Member
Posts: 24
Joined: Apr 2013
Reputation: 0
Post: #37
Hi Roman,
Yes i read document. I figured out just now my image path not pass
list_update function for why image is not change.
Thanks anyway...

Oki
find quote
Roman_V_M Offline
Fan
Posts: 551
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #38
I've been testing a new version (I've added a method to simplify setting-up controls animation), and it seems that RadioButton control is broken in recent Gotham versions: unchecked and checked textures are not displayed, while unfocused and focused textures are displayed correctly. So now RadioButton looks like a simple Button. In Frodo RadioButton works OK.
Can anybody confirm this on their systems?

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
Roman_V_M Offline
Fan
Posts: 551
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #39
I have updated PyXBMCt framework to v. 1.1.
Changes:
- Added a virtual method setAnimation() to set animation property for PyXBMCt Controls.
- Fixed RadioButton according to recent Gotham API changes. This broke RadioButton's backward compatibility with Frodo.
- Minor fixes.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
(This post was last modified: 2014-02-18 14:41 by Roman_V_M.)
find quote
Roman_V_M Offline
Fan
Posts: 551
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #40
I have updated PyXBMCt framework to v. 1.1.1
Changes:
- Fixed RadioButton to make it work in Gotham and in earlier versions of XBMC as well.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
Aweponken Offline
Junior Member
Posts: 12
Joined: Oct 2013
Reputation: 0
Post: #41
Hey!
Thanks for making it easier to create a plugin!
So I'm doing this project where I will be controling the lights in my home with a relayboard hooked up to a raspberry pi.
I'm using pilight to control the relayboard and I can control it via a webUI in my web browser that looks like this:
[Image: pilight.png]
The problem is, Xbian, which I'm using, doesn't have a web browser.
So I've decided to make my own plugin to control pilight.
So basically what I'm asking is, is there a way make a button in PyXBMCt send a line of code, like done in the terminal?
Something like this:
Code:
pilight-control -l livingroom -d bookshelve -s on

Thanks in advance, and I'm sorry if this sounds like a complete mess Big Grin
find quote
nickr Online
Donor
Posts: 8,501
Joined: May 2009
Reputation: 149
Location: Christchurch NZ
Post: #42
I think the way to do this in python is to call the external command like this:

Code:
from subprocess import call
call(["pilight-control", "-l livingroom", "-d bookshelve", "-s on"])

Although I am a little hazy on quite how the quoting (") should look. It might be

Code:
from subprocess import call
call(["pilight-control", "-l", "livingroom", "-d", "bookshelve", "-s", "on"])

There is also a commonly used, but maybe deprecated, os.system call.

I am interested in this, you could perhaps make the calls user definable (via a setting) then I could use your addon to control my Philips Hue lights.

Also it'd be good to map some lighting functions to a remote button, no point in having to actually call the addon up to the screen just to flick a light on/off.

(I have the hue addon which dims the lights on movies playing and turns them on when paused/stop, but sometimes it'd just be nice to turn them up, eg if eating dinner watching TV it'd be nice to see the plate!)

EDIT I should acknowledge my source and say that there is plenty of reading on this page:

http://stackoverflow.com/questions/89228...-in-python

If I have helped you or increased your knowledge, click the plus button and increase my reputation :)
(This post was last modified: 2014-03-17 00:58 by nickr.)
find quote
phr3n1c Offline
Junior Member
Posts: 3
Joined: Mar 2014
Reputation: 0
Post: #43
Hi,

I'm currently using XBCMSwift2 for the basic UI and want to use PyXBMCt for additional windows like modals, notifications and so on.

For testing, I used the code of the example in your first post in this thread but changed the button to start playing the url (mp4):
Code:
self.connect(button, xbmc.PlayMedia(asset['path']))

But as soon as the window is shown, the video starts playing. Is there a way to prevent the automatic start?

Thank you!
find quote
Aweponken Offline
Junior Member
Posts: 12
Joined: Oct 2013
Reputation: 0
Post: #44
(2014-03-17 00:51)nickr Wrote:  I think the way to do this in python is to call the external command like this:

Code:
from subprocess import call
call(["pilight-control", "-l livingroom", "-d bookshelve", "-s on"])

Although I am a little hazy on quite how the quoting (") should look. It might be

Code:
from subprocess import call
call(["pilight-control", "-l", "livingroom", "-d", "bookshelve", "-s", "on"])

There is also a commonly used, but maybe deprecated, os.system call.

I am interested in this, you could perhaps make the calls user definable (via a setting) then I could use your addon to control my Philips Hue lights.

Also it'd be good to map some lighting functions to a remote button, no point in having to actually call the addon up to the screen just to flick a light on/off.

(I have the hue addon which dims the lights on movies playing and turns them on when paused/stop, but sometimes it'd just be nice to turn them up, eg if eating dinner watching TV it'd be nice to see the plate!)

EDIT I should acknowledge my source and say that there is plenty of reading on this page:

http://stackoverflow.com/questions/89228...-in-python

This is awesome!
Yeah, if I manage to get it working, I'll try to make it work for you to. Are you using pilight?
So the problem is, how do I execute python code in a PHP based plugin? Tongue
find quote
Roman_V_M Offline
Fan
Posts: 551
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #45
(2014-03-17 13:42)phr3n1c Wrote:  Hi,

I'm currently using XBCMSwift2 for the basic UI and want to use PyXBMCt for additional windows like modals, notifications and so on.

For testing, I used the code of the example in your first post in this thread but changed the button to start playing the url (mp4):
Code:
self.connect(button, xbmc.PlayMedia(asset['path']))

But as soon as the window is shown, the video starts playing. Is there a way to prevent the automatic start?

Thank you!

You are trying to connect a function call, which is wrong. Please read the Quick Start Guide carefully - such scenario is describe there.

(2014-03-17 14:39)Aweponken Wrote:  So the problem is, how do I execute python code in a PHP based plugin? Tongue

Not sure if I understand, but what is "PHP based plugin"? XBMC does not support PHP and all plugins are written in Python.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
Post Reply