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

  Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Roman_V_M Offline
Skilled Python Coder
Posts: 926
Joined: Jun 2011
Reputation: 41
Location: Kyiv, Ukraine
Post: #226
(2016-08-22 16:02)selli69 Wrote:  Thanks for your quick reply!

As you can see in the code, there are TWO buttons: one hello and one close button. both of them dont work. Look at the code I posted, i promise by my mothers life, there are two buttons.. Wink I used this code from your doc

Sorry, I have thought you have played with PyXBMCt example addon. As for your problem, I'm afraid, there is a bug in "Blank" windows that prevent connected functions from firing. I need to fix that. "Normal" windows should work OK.

Quote:One further problem:
As playing around a little more, i added a discrete running thread, which should update the text of a label in the gui. The update works, but it seems to "overwrite" the label in graphics without clearing the previous content, so there is a mashup with all the updated texts. Is it possible to "clear" a control?

And this is Python 101. Instead of updating an existing Label, you are creating a new instance of Label on the same spot over and over again so that multiple Labels are continuously stacked one of top of another.

Raspberry PI 2 + LibreELEC 7 (Kodi 16)
Acer IconiaTab A510 + Kodi 14.2 for Android
find quote
selli69 Offline
Junior Member
Posts: 10
Joined: Aug 2016
Reputation: 0
Post: #227
Hi Roman..

I have fixed the "update label" thing, setLabel was the solution. thanks anyway...
find quote
selli69 Offline
Junior Member
Posts: 10
Joined: Aug 2016
Reputation: 0
Post: #228
Hi, me again.

Quote:As for your problem, I'm afraid, there is a bug in "Blank" windows that prevent connected functions from firing. I need to fix that.

Without the want to rush you in any way, do you have a clue when this fix will be availiable? I need the blank window essentially for my application and if the fix is a long term thing for you, I have to program my addon using the standard kodi window classes (bad thing for me...), because i have a (weak) deadline.

thanks anyway!
(This post was last modified: 2016-08-22 16:56 by selli69.)
find quote
Roman_V_M Offline
Skilled Python Coder
Posts: 926
Joined: Jun 2011
Reputation: 41
Location: Kyiv, Ukraine
Post: #229
(2016-08-22 16:40)selli69 Wrote:  Hi, me again.

Quote:As for your problem, I'm afraid, there is a bug in "Blank" windows that prevent connected functions from firing. I need to fix that.

Without the want to rush you in any way, do you habe a clue when this fix will be availiable? I need the blank window essentially for my application and if the fix is a long term thing for you, I have to program my addon using the standard kodi window classes (bad thing for me...), because i have a (weak) deadline.

thanks anyway!

To make fix and to push it to my GitHub repo is easy. However, submitting the update to the Kodi official repo is a different thing. Honestly, I don't like this new procedure, though I do understand that the old mailing list system may have been not very convenient for the official repo maintainers. At this point I cannot give you specific dates for the latter.

Raspberry PI 2 + LibreELEC 7 (Kodi 16)
Acer IconiaTab A510 + Kodi 14.2 for Android
find quote
selli69 Offline
Junior Member
Posts: 10
Joined: Aug 2016
Reputation: 0
Post: #230
Ok. I understand... If it is not that Problem, fixing the bug and push it to github, this will work fine for me as log as i can install your lib manually so it runs on my laptop and i can develop and demonstrate. If it takes some weeks for an update to the official repository its also no matter for me, because i have to develop my addon, which takes some weeks and i have to bring my addon to the official repo also.

Could you please do the fix and bring it to github and inform me/us here in the thread? This will be a very nice thing!
(This post was last modified: 2016-08-22 17:18 by selli69.)
find quote
selli69 Offline
Junior Member
Posts: 10
Joined: Aug 2016
Reputation: 0
Post: #231
Hi,

I have completed my work now without using the framework, so there is no more rush for fixing the bug anymore. Thanks anyway.
find quote
koci5 Offline
Junior Member
Posts: 4
Joined: Jul 2016
Reputation: 0
Post: #232
Hello Roman!
I have a problem. I'm using multiple Buttons in a Window (20+ buttons), and i'm wondering if i can get quick info on which button is being clicked, or do i have to connect every button to its function?
find quote
Roman_V_M Offline
Skilled Python Coder
Posts: 926
Joined: Jun 2011
Reputation: 41
Location: Kyiv, Ukraine
Post: #233
(2016-08-30 18:30)koci5 Wrote:  Hello Roman!
I have a problem. I'm using multiple Buttons in a Window (20+ buttons), and i'm wondering if i can get quick info on which button is being clicked, or do i have to connect every button to its function?

You can connect all the buttons to the same function and pass some kind of button ID to this function. This is not trivial but possible. A similar problem was discussed a couple of pages back starting from this post.

Raspberry PI 2 + LibreELEC 7 (Kodi 16)
Acer IconiaTab A510 + Kodi 14.2 for Android
find quote
koci5 Offline
Junior Member
Posts: 4
Joined: Jul 2016
Reputation: 0
Post: #234
(2016-08-31 11:04)Roman_V_M Wrote:  You can connect all the buttons to the same function and pass some kind of button ID to this function. This is not trivial but possible. A similar problem was discussed a couple of pages back starting from this post.

FIrst of all, thank you for your reply! I looked at that similar problem, but i just can't seem to get it to work. CAn you please look at my code and tell me where i'm doing anything wrong? For now i just want to show a simple dialog with ID of clicked button.

Code:
def set_Connect(self):
        for i in range(0, len(self.buttons)):
            self.connect(self.buttons[i], lambda: self.get_btn_id(i))

def get_btn_id(self, i):
     def get_id():
          dialog = xbmcgui.Dialog()
          dialog.ok('XBMC', 'Button clicked: ' + str(i))
      return  get_id()
Now what do i have to change to get this to work? Thank you!
find quote
Roman_V_M Offline
Skilled Python Coder
Posts: 926
Joined: Jun 2011
Reputation: 41
Location: Kyiv, Ukraine
Post: #235
(2016-09-06 20:36)koci5 Wrote:  
Code:
def set_Connect(self):
        for i in range(0, len(self.buttons)):
            self.connect(self.buttons[i], lambda: self.get_btn_id(i))

def get_btn_id(self, i):
     def get_id():
          dialog = xbmcgui.Dialog()
          dialog.ok('XBMC', 'Button clicked: ' + str(i))
      return  get_id
Now what do i have to change to get this to work? Thank you!

Look closer at the example you have used. The factory function must return a function object, not a result of a function call. A factory function is called "factory" because it creates new functions with custom properties.

Raspberry PI 2 + LibreELEC 7 (Kodi 16)
Acer IconiaTab A510 + Kodi 14.2 for Android
(This post was last modified: 2016-09-06 21:48 by Roman_V_M.)
find quote
user76 Offline
Junior Member
Posts: 1
Joined: Sep 2016
Reputation: 0
Post: #236
Hey Roman,

This package is great, very simple and easy to use, thanks for that. I have one question. For TextBox() is there a way to get the text to autoscroll Right to Left instead of Top to Bottom?
find quote
Roman_V_M Offline
Skilled Python Coder
Posts: 926
Joined: Jun 2011
Reputation: 41
Location: Kyiv, Ukraine
Post: #237
(2016-09-21 22:47)user76 Wrote:  Hey Roman,

This package is great, very simple and easy to use, thanks for that. I have one question. For TextBox() is there a way to get the text to autoscroll Right to Left instead of Top to Bottom?

PyXBMCt does not provide any Controls by itself and can do only as much as underlying Kodi Controls can. AFAIK, ControlTextBox does not have a horizontal scrolling. And, honestly, why do you need such thing?

Raspberry PI 2 + LibreELEC 7 (Kodi 16)
Acer IconiaTab A510 + Kodi 14.2 for Android
find quote
Post Reply