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
ironic_monkey Offline
Fan
Posts: 339
Joined: Nov 2013
Reputation: 23
Post: #121
you find completely untested attempts at two of these

https://github.com/notspiff/kodi-cmake/c...d372fde293

control.autoScroll(delay, time, repeat)

https://github.com/notspiff/kodi-cmake/c...bcc91573f5

list_of_selected_labels = dialog.select(stuff, multiselect=True)
find quote
Roman_V_M Offline
Fan
Posts: 613
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #122
(2014-11-16 16:04)ironic_monkey Wrote:  you find completely untested attempts at two of these

https://github.com/notspiff/kodi-cmake/c...d372fde293

control.autoScroll(delay, time, repeat)

https://github.com/notspiff/kodi-cmake/c...bcc91573f5

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?

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
ironic_monkey Offline
Fan
Posts: 339
Joined: Nov 2013
Reputation: 23
Post: #123
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..
find quote
sai7 Offline
Junior Member
Posts: 6
Joined: Sep 2014
Reputation: 0
Post: #124
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.
(This post was last modified: 2014-12-01 15:55 by sai7.)
find quote
Roman_V_M Offline
Fan
Posts: 613
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #125
(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.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
zag Offline
Team-Kodi Member
Posts: 1,921
Joined: Oct 2007
Reputation: 22
Location: UK
Post: #126
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.
find quote
pieman Offline
Junior Member
Posts: 18
Joined: Jan 2014
Reputation: 0
Post: #127
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.
find quote
MGA1500 Offline
Junior Member
Posts: 19
Joined: Apr 2014
Reputation: 0
Post: #128
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.
find quote
Roman_V_M Offline
Fan
Posts: 613
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #129
(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.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
MGA1500 Offline
Junior Member
Posts: 19
Joined: Apr 2014
Reputation: 0
Post: #130
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
find quote
Roman_V_M Offline
Fan
Posts: 613
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #131
(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.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
pieman Offline
Junior Member
Posts: 18
Joined: Jan 2014
Reputation: 0
Post: #132
(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.
find quote
Roman_V_M Offline
Fan
Posts: 613
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #133
(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.)

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
find quote
MGA1500 Offline
Junior Member
Posts: 19
Joined: Apr 2014
Reputation: 0
Post: #134
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
find quote
Roman_V_M Offline
Fan
Posts: 613
Joined: Jun 2011
Reputation: 14
Location: Kyiv, Ukraine
Post: #135
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.

AMD A4-3300 + AsRock A75M-ITX
XBMC 13.2 (custom build) on Windows 7
(This post was last modified: 2014-12-22 13:51 by Roman_V_M.)
find quote
Post Reply