•   
  • 1
  • 21
  • 22
  • 23
  • 24(current)
  • 25
  •   
Release PyXBMCt: a Python framework for simple creating UI for XBMC addons
(2019-05-13, 21:32)Roman_V_M Wrote: Unfortunately, ControlList doesn't have a scrollbar.

Thanks for your reply. That's too bad, but I'll work around it.

I have some other layout questions if you have the time.

The reason I ask is because my controls look stretched or squashed to fill the whole cell. My only goal is to make it look clean and neat, I'm not trying to make a complex UI or use any advanced layout features. I'd also like for it to work across skins / resolutions. My needs are pretty straight forward. I need a text entry box, an int representing seconds (using a slider for this) and a multi-select list. I could use a series of three built-in dialogues but I'd like to make something more user friendly.

I could eventually figure it out with trial and error but I bet someone smarter has thought of better ways. Can you please confirm my understanding: 

- It looks like the "cells" in the grid are spread evenly and the size is based on the geometry of the Dialogue that contains them. If that's so I can easily infer the cell size from that.
- The controls appear to stretch to fill the whole cell - padding (default x)
- If I understand correctly pad_x/y will shrink the control within the cell and I can use this to get it to a proper ratio so it doesn't look so wonky.
- I don't know the correct ratios for any of these controls. Is there a reference for this somewhere? I imagine a slider has a default fixed height. If so, is this the same across all skins and resolutions?
- Is there a way for controls not to stretch and maybe have them align on the top left of the cell (or any other kind of alignment, frankly) 

Thanks for your patience and help! This is my first addon and first python project, and I last wrote code 10+ years ago... but I appreciate your help getting back on the bicycle
Hue Service  Git • Repo
Reply
Your assumptions about creating a controls layout in PyXBMCt are basically correct. This is more of a trial-and-error game until you get your layout right, and there are no specific guidelines.
I said is like a million times and repeat once again: PyXBMCt is just a thin convenience wrapper around xbmcgi Window and Control classes. It provides a grid layout instead of absolute pixel coordinates and a set of default textures to decorate your Controls, because most of xbmcgui Controls do not have their own textures.
By default, xbmcgui.Window and WindowDialog operate on a coordinate grid of 1280x720 pixes. This is a purely virtual coordinate grid that do not depend on you current skin or display resolutions (and they are different things). Controls are placed and sized in absolute pixel coordinates from the top-left screen corner. Instead of this, PyXBMCt provides a more convenient grid layout and calculates actual Controls coordinates in absolute pixels "under the hood".
Reply
(2019-05-15, 09:14)Roman_V_M Wrote: Your assumptions about creating a controls layout in PyXBMCt are basically correct. This is more of a trial-and-error game until you get your layout right, and there are no specific guidelines.
I said is like a million times and repeat once again: PyXBMCt is just a thin convenience wrapper around xbmcgi Window and Control classes. It provides a grid layout instead of absolute pixel coordinates and a set of default textures to decorate your Controls, because most of xbmcgui Controls do not have their own textures.
By default, xbmcgui.Window and WindowDialog operate on a coordinate grid of 1280x720 pixes. This is a purely virtual coordinate grid that do not depend on you current skin or display resolutions (and they are different things). Controls are placed and sized in absolute pixel coordinates from the top-left screen corner. Instead of this, PyXBMCt provides a more convenient grid layout and calculates actual Controls coordinates in absolute pixels "under the hood".
Thanks very much for your help - and for the add on in the first place !
Hue Service  Git • Repo
Reply
I was porting an addon to Py3 testing on the latest nightly, and I've incurred in an error:

import pyxbmct
class MyWindow(pyxbmct.AddonDialogWindow):
    def __init__(self, title=''):
        super(MyWindow, self).__init__(title)
        self.setGeometry(350, 150, 2, 3)

window = MyWindow('Hello, World!')
window.doModal()
del window

ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
    Error Type: <class 'AttributeError'>
    Error Contents: 'MyWindow' object has no attribute 'background'
    Traceback (most recent call last):
        File "…\plugin.video.amazon-test\default.py", line 5, in <module>
        EntryPoint()
        File "…\plugin.video.amazon-test\resources\lib\startup.py", line 24, in EntryPoint
        window = MyWindow('Hello, World!')
        File "…\plugin.video.amazon-test\resources\lib\startup.py", line 21, in __init__
        self.setGeometry(350, 150, 2, 3)
        File "…\script.module.pyxbmct\lib\pyxbmct\addonwindow.py", line 746, in setGeometry
        self.background.setPosition(self.x, self.y)
    AttributeError: 'MyWindow' object has no attribute 'background'
    -->End of Python script error report<--

This happens with both 1.3.0 and with the sources taken from master. Have I overlooked something? It seems like no matter the super(), AddonWindow.__init__(…) is not being called, resulting in an uninitialized state.

As I'm not super familiar with multiple inheritance in python, by trial and error I figured out that inverting the inheritance list of the AddonDialogWindow class declaration inside addonwindow.py fixes the issue on my end:

class AddonDialogWindow(AddonWindow, DialogWindowMixin):

I'm not sure why in the reverse order it fails, if it's a problem with the example code, Kodi's build or whatever, but inverting them worked and restored full functionality.
Reply
@Varstahl I need to investigate this.
Reply
Bonjour,
I come on this forum because I have not found any forum on the development of addon for kodi and pyxbmct in french

So I tried pyxbmct, with its nice features.
I should like to see the behavior with a long process computationnal in parallel of the gui  so i wrote a simple script add-on to test that.

Well I did not manage to synchronize pyxbmct with a long calculation. The pyxbmct checks do not respond during the calculation time.
I tried two ways, one with the calculation in the main program, the other in an appendix thread.
I'm sure I'm not an expert on python programming, but I don't think I made a big mistake in this simple program or I made a logical mistake
So if you could tell me if it is possible that kodi and pyxbmct can work while parallel calculations are done. I believe that say "thread safe" in English.

Note: my little test program is here: https://github.com/sitronet/script.testthread
if you want to take a look in the code. I describe the behavior of the program in the readme file.

Thank you for looking into this problem
Reply
Hi,
Will the demo work on Kodi 19?
And if not is there any demo I can test?
Thanks a lot,
Reply
A demo itself does not contain any Python version-specific code. You just need to bump xbmc.python version to 3.0.0 in addon.xml.
Reply
(2020-08-12, 10:23)Roman_V_M Wrote: A demo itself does not contain any Python version-specific code. You just need to bump xbmc.python version to 3.0.0 in addon.xml.
Hi,
Thanks for the replay,
I tried that but I still get errors , something with the window, I can't get it to work for some reason.
Reply
Hi,

First thanks for developing PyXBMCt - it is a very useful tool and makes building up a nice GUI very easy! I'm fairly new to Python and Kodi addons but trying to develop an add-on for launching a photo slideshow based on a windows folder directory entered in the edit field. I have added a section of my code below for connecting a button with launching the slideshow for the directory entered by the user. I'm trying to understand why this code does not work. However if I use the commented line instead, the slideshow launches fine with the button. I'm not clear why variable p is behaving differently to including the get text command directly in variable x. Please could you review? 

        self.name_field_mast = pyxbmct.Edit('')
        self.placeControl(self.name_field_mast, 0, 3)
        self.name_field_mast.setText(mastdir)
        p = self.name_field_mast.getText()
        x = lambda: xbmc.executebuiltin('RecursiveSlideshow("{0}")'.format(p))
        #x = lambda: xbmc.executebuiltin('RecursiveSlideshow("{0}")'.format(self.name_field_mast.getText()))
        self.mastdef_button = pyxbmct.Button('Launch')
        self.placeControl(self.mastdef_button, 0, 4,)
        self.connect(self.mastdef_button, x)
Reply
@mike45637 You need to understand that a GUI (any GUI, including that of Kodi) is an event-driven system and the code above is not executed linearly. Your p variable is initialized when your UI is created before you entered something in your Edit control but the event handler x is executed when you click your button. In the current variant (as above) x uses that old p value (and beware of Python's "late closure binding" - you can Google that). But in the commented variant your event handler retrieves Edit value that exists when you click your button after having entered something in the Edit control, that is, you are retrieving the current Edit value in this case.
Reply
(2021-01-20, 22:00)Roman_V_M Wrote: @mike45637 You need to understand that a GUI (any GUI, including that of Kodi) is an event-driven system and the code above is not executed linearly. Your p variable is initialized when your UI is created before you entered something in your Edit control but the event handler x is executed when you click your button. In the current variant (as above) x uses that old p value (and beware of Python's "late closure binding" - you can Google that). But in the commented variant your event handler retrieves Edit value that exists when you click your button after having entered something in the Edit control, that is, you are retrieving the current Edit value in this case.

Thanks, that helps explain it. I have since connected the button with a separate module which passes the updated edit value as desired.
Reply
Hello everyone

First of all, thanks to Roman for his work making this great framework.

I would like to ask if it is possible to construct a pyxbmct.List with different buttonTexture and buttonFocusTexture for different items within the list.

Because I see that they are parameters that can be defined when creating the list, but I do not see in the documentation any way to change that values ​(buttonTexture and buttonFocusTexture) ​at the item level.

Thank you very much for your attention.
Reply
You can provide buttonTexture and buttonFocusTexture as keyword arguments to List constructor.
Reply
(2021-04-06, 22:11)Roman_V_M Wrote: You can provide buttonTexture and buttonFocusTexture as keyword arguments to List constructor.

First of all, thank you very much for answering, Roman.

Sure enough, I can provide buttonTexture and buttonFocusTexture to List constructor , but so, it use those buttonTexture and buttonFocusTexture for all items in the list. What I would like is to know if it is possible to assign a distinct buttonTexture and buttonFocusTexture to each item in the list. By example, if I could assign buttonTexture and buttonFocusTexture in function addItem, or something similar.

Again, thank you very much for your attention.
Reply
  •   
  • 1
  • 21
  • 22
  • 23
  • 24(current)
  • 25
  •   



Logout Mark Read Team Forum Stats Members Help
PyXBMCt: a Python framework for simple creating UI for XBMC addons4
This forum uses Lukasz Tkacz MyBB addons.