Kodi Community Forum
Release PyXBMCt: a Python framework for simple creating UI for XBMC addons - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Release PyXBMCt: a Python framework for simple creating UI for XBMC addons (/showthread.php?tid=174859)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - ironic_monkey - 2014-11-16

you find completely untested attempts at two of these

https://github.com/notspiff/kodi-cmake/commit/6d49c9413c8aae3453d9ccf14e539ed372fde293

control.autoScroll(delay, time, repeat)

https://github.com/notspiff/kodi-cmake/commit/33d60d477458b5cb3d480a5259e15ebcc91573f5

list_of_selected_labels = dialog.select(stuff, multiselect=True)


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-11-17

(2014-11-16, 16:04)ironic_monkey Wrote: you find completely untested attempts at two of these

https://github.com/notspiff/kodi-cmake/commit/6d49c9413c8aae3453d9ccf14e539ed372fde293

control.autoScroll(delay, time, repeat)

https://github.com/notspiff/kodi-cmake/commit/33d60d477458b5cb3d480a5259e15ebcc91573f5

list_of_selected_labels = dialog.select(stuff, multiselect=True)

Looks interesting. The first does not require any changes in PyXBMCt to use, as it merely wraps xbmcgui classes into Python classes providing necessary default values. As for the second, I'm not a C++ guy myself, but do I understand correctly that the method returns either an integer value or a list/tuple of integer values for a mulch-choice? If yes, it is very nice and won't break compatibility with existing code.

But as far as I understand, those changes are not in Kodi mainline?


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - ironic_monkey - 2014-11-17

second returns a list of the labels, not a list of indices.

yes, they are not in mainline, only my fork. and no, i won't do anything to get them into mainline. but if somebody else wants to that is their business..


PyXBMCt: a Python framework for simple creating UI for XBMC addons - sai7 - 2014-12-01

I have one problem.
I want to focus control Textbox while doing navigation.
How to show that textbox is selected ?

I used Control edit, but its editable.
and I want to display non editable box.
So I used Enabled=false, but its not going to focus able.

So I am using textbox, but its not going to focus.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-12-01

(2014-12-01, 15:52)sai7 Wrote: I have one problem.
I want to focus control Textbox while doing navigation.
How to show that textbox is selected ?

I used Control edit, but its editable.
and I want to display non editable box.
So I used Enabled=false, but its not going to focus able.

So I am using textbox, but its not going to focus.

Technically, TextBox can be focused (at least it has respective methods), but it has no visual feedback nor it generates any control events. If you need a 1-string focusable text label, your can use a Button which is not connected to anything.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - zag - 2014-12-16

Cool, i'm currently writing some getting started guides for Kodi python programming.

I might look at including this as its really hard for the new developer to learn skinning as well as the add-on stuff.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - pieman - 2014-12-20

Hi Roman_V_M,

Read through the full thread and looked at your start up guide but I am getting dependency issues when trying to install the demo in Gotham 13.2 on RaspBMC.I added the module first from the official repositories. Your zip file doesn't look to be right so I unzipped it and then just zipped up the inner directory. Gotham then gives dependency issues. I have added your files manually to my system and have the demo up on screen now.
You might want to look at the zip structure and dependencies.


Adding simple child window - MGA1500 - 2014-12-20

Dear Roman_V_M,

considering that only this afternoon I started with playing around with your demo application I managed to chenge it left and right and also add functions to it that controls my hardware. I think it is rightfully added to the official XBMC repo as it greatly simpifies creation of addons (which in turn will make Kodi even more popular).

Is I feel I have grasped the basics, when it comes to classes and the initialisation of them I have been able to create a second window that pops up, but controlling controls seem to be messed up.

Would it be possible to extend you demo addon code with a very simple second, child dialog window with a simple control (eg. close button)? I could take it from there. As I have seen another post in this thread also about a second window (although that is a mix-up of pyXBMCt and xbmcgui) I feel that there may be other users that would appreciate this. I certainly would!

Thanking you anyway for this great addition to the world of Kodi!

Regards, MGA.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-12-20

(2014-12-20, 16:20)MGA1500 Wrote: Dear Roman_V_M,

considering that only this afternoon I started with playing around with your demo application I managed to chenge it left and right and also add functions to it that controls my hardware. I think it is rightfully added to the official XBMC repo as it greatly simpifies creation of addons (which in turn will make Kodi even more popular).

Is I feel I have grasped the basics, when it comes to classes and the initialisation of them I have been able to create a second window that pops up, but controlling controls seem to be messed up.

Would it be possible to extend you demo addon code with a very simple second, child dialog window with a simple control (eg. close button)? I could take it from there. As I have seen another post in this thread also about a second window (although that is a mix-up of pyXBMCt and xbmcgui) I feel that there may be other users that would appreciate this. I certainly would!

Thanking you anyway for this great addition to the world of Kodi!

Regards, MGA.

Thanks for your kind words.Smile
Unfortunately, xbmcgui classes, on which PyXBMCt is based, do not allow to control "zorder" property that defines which controls appear on top of others. For this reason, opening several PyXBMCt windows at once might lead to unpredicted results.
That is why if you need to open a child window, there are 2 possible scenarios:
- Close a parent instance before opening a child, then close the child and open the parent again. Remember that closing a window does not delete it - it remains in the memory and can be opened again.
- If your child windows are really simple, consider using xbmcgui.Dialog classes - they always appear on top.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - MGA1500 - 2014-12-20

Well that's a quick reply! Shouldn't you be enjoying the weekend? ;-)

I prefer your first proposal; only one window should be in focus anyway and since the window is not closed this sounds ok to me. Your second proposal sounds like a 'if I cannot do it properly I will do it anyway' which is not in line with my taste...I'd like to stick with one way of creating all my windows in an addon and it will be pyXBMt then!

Still my second question would remain -and will try myself in the meantime- to add this 'switching between two windows by toggling visibility' functionality to the demo addon?

What would be the main difference between the main MyAddon(AddonDialogWindow) class and the second one? I tried the same structure in an earlier attempt but suspect it crashing on the __init__ part super(MyAddon, self).__init__(title) that leads to a conflict with the first?

Thanks a ton for thinking along (hm rhimes, must be the time of year!)

Regards, MGA


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-12-20

(2014-12-20, 01:29)pieman Wrote: You might want to look at the zip structure and dependencies.

I've updated the link to PyXBMCt demo add-on. Please try it.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - pieman - 2014-12-20

(2014-12-20, 20:41)Roman_V_M Wrote:
(2014-12-20, 01:29)pieman Wrote: You might want to look at the zip structure and dependencies.

I've updated the link to PyXBMCt demo add-on. Please try it.

Just tried it on a fresh system and it worked first time, thanks.


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-12-20

(2014-12-20, 17:32)MGA1500 Wrote: Well that's a quick reply! Shouldn't you be enjoying the weekend? ;-)

I prefer your first proposal; only one window should be in focus anyway and since the window is not closed this sounds ok to me. Your second proposal sounds like a 'if I cannot do it properly I will do it anyway' which is not in line with my taste...I'd like to stick with one way of creating all my windows in an addon and it will be pyXBMt then!

Still my second question would remain -and will try myself in the meantime- to add this 'switching between two windows by toggling visibility' functionality to the demo addon?

There are no big secrets there. call doModal() to display your window and call close() to close it. But I'll try to think some example.

Quote:What would be the main difference between the main MyAddon(AddonDialogWindow) class and the second one? I tried the same structure in an earlier attempt but suspect it crashing on the __init__ part super(MyAddon, self).__init__(title) that leads to a conflict with the first?

Not sure what you mean. If you mean 2 classes representing different windows, naturally, they must have 2 distinct names to avoid names conflicts and NameError/AttributeError exceptions.
I've tried to make PyXBMCt as simple as possible, but having at least some basic knowledge of Python OOP and the concept of "new" classes in Python 2.x greatly helps understand its principles. E.g. in "new" classes super() call takes a class name and its reference (self) as arguments and calls a method from a parent class. (Yes, quite weird call signature, and in Python 3, where all classes are "new", it was simplified.)


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - MGA1500 - 2014-12-22

Hi Roman,

you are right. I am the first person to admit that I am not an experienced programmer, but usually picks up quickly from other examples. I have now added a second window by copying the main window class (and renaming it ofcourse). In the second window I have added:

self.connect(ACTION_NAV_BACK, self.gobacktomain)

to the __init__ function whereas GoBackToMainWindow contains:

self.close()
window = MainWindow('Main Window')
window.doModal()

Selecting a button in the main window startt the second window like:

self.close()
childwindow = SecondWindow('Second Window')
childwindow.doModal()

This looks like what you mean and indeed works like a charm!

And on the way I get more experienced working with classes ;-) The more you know the more you know you do not know I believe is what they say...

Regards, MGA


RE: PyXBMCt: a Python framework for simple creating UI for XBMC addons - Roman_V_M - 2014-12-22

2 MGA1500

I'm glad that your experiments are successful.Smile

However, I take back my comments about the parent window needs to be closed before opening a child window. According to my quick experiments, a child window can be opened on top of the parent. The only problem I see that since the windows have semi-transparent background you can see the parent window through the child. But, as I said, I took ready-made textures from Confluence skin because my graphic skills are very limited.
But I've done only some brief experiments and do not guarantee that problems with window priorities won't happen. Closing the parent window seems to be a safe option.