• 1
  • 20
  • 21
  • 22(current)
  • 23
  • 24
  • 27
Release PyXBMCt: a Python framework for simple creating UI for XBMC addons
I have checked this myself and admit that the documentation was wrong. Instead of
python:
pyxbmct.skin = MySkin()
you need to use
python:
pyxbmct.addonwindow.skin = MySkin()

I've corrected the docs: http://romanvm.github.io/script.module.p...skins.html
Reply
(2018-03-14, 13:50)Roman_V_M Wrote: I have checked this myself and admit that the documentation was wrong. Instead of
python:
pyxbmct.skin = MySkin()
you need to use
python:
pyxbmct.addonwindow.skin = MySkin()

I've corrected the docs: http://romanvm.github.io/script.module.p...skins.html
 Thank you so much for the clarification/correction! Now it works like a charm! That was honestly driving me nuts for quite a bit seeing how I was seemingly following the example. But, hey, we're all human so no harm done Smile Thank you for all your hard work in the community and especially with creating & maintaining the pyxbmct module!
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
I'm still having issues with a never-ending loading wheel. When I call the dialog I'm met with a spinning dialog that doesn't go away, even after all the data is loaded on the window. Once the data finishes loading I'm presented with the window, but the loading wheel stays over-top of the window unless I right-click to get rid of it. I've saved a log (and split it to show details of each action I take) of the activity.

Roman, could you have a look and see if you can provide any incite at why this is occurring? 

Paste 1: https://pastebin.com/NZmJcy2K
Details:
This is everything that is recorded once I right-click and select the context menu item that calls the PyXBMCt window.
At this point the PyXBMCt window loads and I can see the data. However, the loading wheel continues to spin

Paste 2: https://pastebin.com/efP8KbpP
Details:
This is what's recorded after I right-click in order to get rid of the loading wheel. At this point I can now see the data on the PyXBMCt window.

Paste 3: https://pastebin.com/m8ZfYJ69
Details:
This is what's recorded after I click the Exit button on the title bar. I'm never presented with any errors in the UI, even though one is noted in the log. Any idea how I can resolve the continuous loading issue?

To give some background on the window and the detail I show in the window. I have a loop in the code that dynamically creates rows and elements according to however much data is passed to the window in the form of a json object. Could the fact that I'm dynamically creating elements be the issue for the memory leaks? Do I need to dynamically destroy all elements in addition to doing the del window command? The dynamic row-creation is vital to the data I'm presenting as each line represents a player's stats for the game. I have two functions I use in the PyXBMct dialog file, the __init__ function where all I do is a super() call to create the window and connect the backspace to the close command and the setup function where I do all the heavy-lifting and where all the fields are created dynamically. I should also mention that the window's .setGeometry is set in this function where the row_number is dynamically set to the number of values in the json object passed to the function.

To call the window I do the following:
python:
boxscore_window = boxscore.Score()
boxscore_window.setup(boxscore_obj)
boxscore_window.doModal()
del boxscore_window

For review, the entire setup function can be found here:
https://pastebin.com/r2eHzQwW

And the end-result looks like this:
Image
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
I'm afraid your spinning wheel issues have nothing to do with PyXBMCt. Normally, a script/program addon does not show any spinners unless you are explicitly doing so. If you are creating a plugin, for any plugin route that does not use xbmcplugin calls you need to set isFolder=False and do not set 'isPlayable' = 'true. Otherwise, Kodi waits for a content list/playable item showing a busy dialog.
Show your full source code so I could check it.
Reply
In order to get the context menu items to work I had to use the 'XBMC.Container.Update()' with my plugin paths. I suspect that is the issue then. Here is the full display_games function: https://pastebin.com/3aNQEVbW. If you need a wider view of the project, I'd prefer we continue that discussion in private as to not release the project until it's complete.
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
I've finally figured out the issue. It was indeed due to the use of 'XBMC.Container.Update()' for the dialogs. After replacing the function for those context menu items with 'XBMC.RunPlugin()' they work as intended and do not show the loading spinner. Thanks for sticking with me throughout the debugging process. Always nice to have someone to rubberduck with. Blush

Updated (Working) Code Snippet:
python:
list_item = xbmcgui.ListItem(label=title)
list_item.setArt({'fanart':fanart,'thumb':icon,'poster':icon})
list_item.setInfo('video',{'plot':details,'title':title})
boxscores = get_url(sport='nba', boxscores=game['FullStats'], game_obj=game)
highlights = get_url(sport='nba', highlights=game['FullStats'].replace('boxscore','video'), game_obj=game)
playbyplay = get_url(sport='nba', playbyplay=game['FullStats'].replace('boxscore','playbyplay'), game_obj=game)
teamstats = get_url(sport='nba', teamstats=game['FullStats'].replace('boxscore','matchup'), game_obj=game)
commands =
commands.append(( 'Highlights',   'XBMC.Container.Update(%s)' % highlights, ))
commands.append(( 'Box Scores',   'XBMC.RunPlugin(%s)'        % boxscores, ))
commands.append(( 'Play-By-Play', 'XBMC.RunPlugin(%s)'        % playbyplay, ))
commands.append(( 'Team Stats',   'XBMC.RunPlugin(%s)'        % teamstats, ))
list_item.addContextMenuItems( commands )
url = get_url(sport='nba', scoreboard=game['FullStats'], title=title, game_obj=game)
xbmcplugin.addDirectoryItem(_handle, url, list_item, isFolder=True)
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
I'm glad you had this sorted out.
Reply
Hello Roman, good job, Can I translate part of your code in my Csharp code (KSharp) ?
Reply
@CRial You can do whatever you want within the terms and conditions of GPL v.3 license.
Reply
Hi,
I want to create a list and set a selected item but I don't found any solution in doc to set an item selected.
Thanks for advance for your help
Reply
(2018-04-16, 00:33)mrjulien44 Wrote: Hi,
I want to create a list and set a selected item but I don't found any solution in doc to set an item selected.
Thanks for advance for your help
 Please read this post: https://forum.kodi.tv/showthread.php?tid...pid2709088
Reply
(2018-04-16, 13:43)Roman_V_M Wrote:
(2018-04-16, 00:33)mrjulien44 Wrote: Hi,
I want to create a list and set a selected item but I don't found any solution in doc to set an item selected.
Thanks for advance for your help
 Please read this post: https://forum.kodi.tv/showthread.php?tid...pid2709088

That's not true Roman, I've found a way to control the listitems now. See a working example code on my pastebin here (https://pastebin.com/3vwyQFYG)
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
(2018-04-17, 03:00)CaffeinatedMike Wrote: That's not true Roman, I've found a way to control the listitems now. See a working example code on my pastebin here
It seems that we are talking about different things. And it also seems that you have found my GitHub gist for a multi-select dialog, that I created a long ago when Kodi Python API did not expose the built-tin multi-select dialog. Now that gist is obsolete because we have Dialog().multiselect. BTW, it is better not to use label2 for storing item's properties because it may cause visual artifacts in some situations. ListItem has setProperty/getProperty methods for storing/retrieving arbitrary textual properties.
Reply
Hi, 

I am trying to use pyxbmct to create a python training program to be able to mimic IDLE on the left half of the screen and a tutorial video playing on the right. I have only just started trying today but think I have hit a snag in the fact when I press Enter it pulls up the keyboard where as ideally I would like it to drop down a line instead. Is there any way you can think of working around this? Many thanks in advance.  Below is the code used for gui.. 

called from default using - elif mode == 1: from lib import Gui; myaddon = Gui.MyAddon('PyXBMCt Example'); myaddon.doModal(); del myaddon

running with - 

import pyxbmct, xbmcplugin, xbmcgui, xbmc

# Create a class for our UI
class MyAddon(pyxbmct.AddonDialogWindow):

    def __init__(self, title=''):
        """Class constructor"""
        # Call the base class' constructor.
        super(MyAddon, self).__init__('Piece of py - Python Training')
        # Set width, height and the grid parameters
        self.setGeometry(1300, 750, 100, 50)
        # Call set controls method
        self.set_controls()
        # Call set navigation method.
        self.set_navigation()
        # Connect Backspace button to close our addon.
        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)

    def set_controls(self):
        """Set up UI controls"""
        # Image control
        background = pyxbmct.Image(xbmc.translatePath('special://home/addons/plugin.video.pieceofpy/fanart.jpg'))
        self.placeControl(background, -10, 0, 125, 55)
        # Text label
        label = pyxbmct.Label('Your Code:')
        self.placeControl(label, 300, 250)
        # Text edit control
        self.name_field = pyxbmct.Edit('')
        self.placeControl(self.name_field, -5, 0, columnspan = 25, rowspan = 100)
        # Close button
        self.close_button = pyxbmct.Button('Close')
        self.placeControl(self.close_button, 4, 0, rowspan = 10, columnspan = 5)
        # Connect close button
        self.connect(self.close_button, self.close)
        # Hello button.
        self.hello_button = pyxbmct.Button('Hello')
        self.placeControl(self.hello_button, 4, 1)
        # Connect Hello button.
        self.connect(self.hello_button, lambda:
            xbmc.executebuiltin('Notification(Hello {0}!, Welcome to PyXBMCt.)'.format(
                self.name_field.getText())))

    def set_navigation(self):
        """Set up keyboard/remote navigation between controls."""
        self.name_field.controlUp(self.hello_button)
        self.name_field.controlDown(self.hello_button)
        self.close_button.controlLeft(self.hello_button)
        self.close_button.controlRight(self.hello_button)
        self.hello_button.setNavigation(self.name_field, self.name_field, self.close_button, self.close_button)
        #Set initial focus.
        self.setFocus(self.name_field)


Obviously I need to edit the buttons after but wanted to see if this would work before I continue.
Reply
Hello Guys,

First, a big thank to @Roman_V_M for this great piece of software! I'm currently coding an addon for which I need some UI, and PyXBMCt definitely seems the way to go...

I may have missed a point, but I couldn't find any help on how I could create the following UI, with a simple menu of the left, and some content (group of controls) changing dynamically on item selection:
Code:
_____________________________________________________
| Menu Item #1 |                                    |
| Menu Item #2 |                                    |
| Menu Item #3 |  < content changing dynamically >  |
| Menu Item #4 |     < on menu item selection >     |
|              |                                    |
|              |                                    |
-----------------------------------------------------
Content structure may vary depending on the menu selection: one may display some labels, other some plugin-like listing, another one a form with edits, ...

Is there a (recommended) way to achieve that?
And, more generally, is there a dedicated OO class I should use, to hold a group of controls together? Something I could show / hide dynamically on item selection?

Thanks in advance for your help, and sorry if this is a duplicate question...

Cheers.
Reply
  • 1
  • 20
  • 21
  • 22(current)
  • 23
  • 24
  • 27

Logout Mark Read Team Forum Stats Members Help
PyXBMCt: a Python framework for simple creating UI for XBMC addons4