•   
  • 1
  • 19
  • 20
  • 21(current)
  • 22
  • 23
  • 25
  •   
Release PyXBMCt: a Python framework for simple creating UI for XBMC addons
Hey,

Mine code execute fine but when window is shown I got that "loading" icon (spinning wheel)
I need to press ESC and then it work fine.
Quote:class MyWindow(pyxbmct.BlankFullWindow): ...

window = MyWindow(input=my_data_to_process)
# xbmcplugin.endOfDirectory(int(sys.argv[1]))
window.doModal()

the endOfDirectory make it load empty list before MyWindow show up but that is not the way I would like to have this.
window.doModal() is inside function that is launched when entering specific listitem item from menu.

Any help ?

Edit:
Also when I press that ESC first time i get this in log:

Quote:13:02:05.870 T:6820   ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.video.myplugin/?mode=10&name=myplugin
13:02:05.872 T:6820   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.myplugin/?mode=10&name=myplugin) failed
13:02:06.970 T:6820 WARNING: CGUIWindowManager - CGUIWindowManager::HandleAction - ignoring action 107, because topmost modal dialog closing animation is running
Reply
@poppy_pl Please post your full code. If the code is very big, please provide a link to a pastebin or a code hosting site, e.g. GitHub. Also please describe in as much as possible details what you are trying to accomplish, what is the expected result and what is the actual result.

Also it looks like you are mixing up a program addon and a content plugin. Although PyXBMCt can be used in plugins just fine, for example to present a login dialog for a user, you need clear understanding what you are doing.
Reply
@Roman_V_M I try to show page with library alike view (image + lable), image is button because image cant have events.
When picking up menu that trigger window creation I see the window but its blackout and  I got loading spinning icon.
When I hit ESC I see the window fine.

I would like to open that window without needed of pressing ESC
currently the only workaround is putting xbmcplugin.endOfDirectory(int(sys.argv[1]))  before doModal() which triggers empty ListView to show up and then the window load correctly.
The only problem is that when I do ESC / BACK event I get into that fake empty listview and it trigger MyWindow to popup - so I would need a workaround for workaround or fix initial issue.

This is in video plugin with simple menu. so I would understand that my kodi addon starts, create and show menu, but kodi wait for script to end, but it don't end because its stack on doModal() so the window is all the time visible
Reply
@Roman_V_M I added code as you wanted;

Edit: changing BlankFullWindow with AddonDialogWindow  resolve problem, but I would like to use BlankFullWindow. Am Im missing something in my class ?
BlankDialogWindow also fix this issue but I would like to not deal with transparent background :-) also why is this problem.

For now I used BlankDialogWindow, put Image on fullscreen and then put items on top of it.
Reply
I still don't see any code, but if you have solved your problem, that is good.
Reply
I'm trying to show 4 side-by-side pyxbmct.lists and sync the scrolling between them.  However, I can't find a method that allows me to set the index of the lists. I know there is list.getSelectedPosition(), but no documentation on list.setSelectedPosition(), which I was hoping for. Is there any way that I can link the scrolling between the four lists?  

Below is the sample code in which I try to accomplish simultaneous scrolling. Any help is appreciated.

class Plays(pyxbmct.AddonFullWindow):

    def __init__(self, title='NBA'):
        super(Plays, self).__init__(title)
        #Geometry(Width, Height, Rows, Columns)
        #New Addon Windows always have 1280x720 grid
        self.setGeometry(1280, 720, 27, 4)
        
        teamheader = pyxbmct.Label('Team', alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(teamheader, 0, 0)
        timeheader = pyxbmct.Label('Time', alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(timeheader, 0, 1)
        playheader = pyxbmct.Label('Play', alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(playheader, 0, 2)
        scoreheader = pyxbmct.Label('Score', alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(scoreheader, 0, 3)
        
        self.listing1 = pyxbmct.List(_imageWidth=35, _imageHeight=35, _itemHeight=35)
        self.placeControl(self.listing1, 1, 0, rowspan=26)
        
        self.listing2 = pyxbmct.List(_imageWidth=35, _imageHeight=35, _itemHeight=35)
        self.placeControl(self.listing2, 1, 1, rowspan=26)
        
        self.listing3 = pyxbmct.List(_imageWidth=35, _imageHeight=35, _itemHeight=35)
        self.placeControl(self.listing3, 1, 2, rowspan=26)
        
        self.listing4 = pyxbmct.List(_imageWidth=35, _imageHeight=35, _itemHeight=35)
        self.placeControl(self.listing4, 1, 3, rowspan=26)
        
        self.connectEventList(
            [pyxbmct.ACTION_MOVE_DOWN,
             pyxbmct.ACTION_MOVE_UP,
             pyxbmct.ACTION_MOUSE_WHEEL_DOWN,
             pyxbmct.ACTION_MOUSE_WHEEL_UP,
             pyxbmct.ACTION_MOUSE_MOVE],
            self.list_update)
        
        # Connect a key action (Backspace) to close the window.
        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
        
    def list_update(self):
        try:
            if self.getFocus() == self.listing1:
                new_position = self.listing1.getSelectedPosition()
                self.listing2.setSelectedPosition(new_position)
                self.listing3.setSelectedPosition(new_position)
                self.listing4.setSelectedPosition(new_position)
            else:
                pass
        except (RuntimeError, SystemError):
            pass
        
    #row, column[, rowspan, columnspan]
    def setup(self, obj):
        image_items =
        time_items =
        play_items =
        score_items =
        for quarter in obj:
            for play in quarter:
                """
                list_item = xbmcgui.ListItem(label='%s %s %s' % (play['Time'], play['Play'], play['Score']))
                list_item.setArt({'icon':play['Team']})
                list_items.append(list_item)
                """
                #placeholders.append('')
                image_item = xbmcgui.ListItem(label='')
                image_item.setArt({'icon':play['Team']})
                image_items.append(image_item)
                
                time_item = xbmcgui.ListItem(label=play['Time'])
                time_items.append(time_item)
                
                play_item = xbmcgui.ListItem(label=play['Play'])
                play_items.append(play_item)
                
                score_item = xbmcgui.ListItem(label=play['Score'])
                score_items.append(score_item)
                
        #self.listing.addItems(list_items)
        self.listing1.addItems(image_items)
        self.listing2.addItems(time_items)
        self.listing3.addItems(play_items)
        self.listing4.addItems(score_items)

pbp_list = nba.get_playbyplay(playbyplay_link)
if len(pbp_list) > 0:
    playbyplay_window = playbyplay.Plays()
    playbyplay_window.setup(pbp_list)
    playbyplay_window.doModal()
    del playbyplay_window
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
I've gotten closer once I found my way to the list.selectItem() method (here). But, scrolling is still out of sync. I've updated my list_update(self) function as follows:

def list_update(self):
    try:
        if self.getFocus() == self.listing1:
            new_position = self.listing1.getSelectedPosition()
            self.listing2.selectItem(new_position)
            self.listing3.selectItem(new_position)
            self.listing4.selectItem(new_position)
        elif self.getFocus() == self.listing2:
            new_position = self.listing2.getSelectedPosition()
            self.listing1.selectItem(new_position)
            self.listing3.selectItem(new_position)
            self.listing4.selectItem(new_position)
        elif self.getFocus() == self.listing3:
            new_position = self.listing3.getSelectedPosition()
            self.listing1.selectItem(new_position)
            self.listing2.selectItem(new_position)
            self.listing4.selectItem(new_position)
        elif self.getFocus() == self.listing4:
            new_position = self.listing4.getSelectedPosition()
            self.listing1.selectItem(new_position)
            self.listing2.selectItem(new_position)
            self.listing3.selectItem(new_position)
        else:
            pass
    except (RuntimeError, SystemError):
        pass
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
(2018-03-01, 16:38)CaffeinatedMike Wrote: I've gotten closer once I found my way to the list.selectItem() method (here).

selectItem is broken and essentially there's no way to control a List programmatically.
Reply
(2018-03-01, 17:09)Roman_V_M Wrote:
(2018-03-01, 16:38)CaffeinatedMike Wrote: I've gotten closer once I found my way to the list.selectItem() method (here).

selectItem is broken and essentially there's no way to control a List programmatically. 
 It doesn't seem to be completely broken. Example, if I scroll down with the arrow keys on one of the lists the other lists follow along (using the updated code I shared). But, once you start scrolling back up and back down it starts to break the union. As long as you continue scrolling down .selectItem() does update the list positions programmatically.
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
(2018-03-01, 17:09)Roman_V_M Wrote:
(2018-03-01, 16:38)CaffeinatedMike Wrote: I've gotten closer once I found my way to the list.selectItem() method (here).

selectItem is broken and essentially there's no way to control a List programmatically. 
Also, not necessarily related (I don't think). But, when creating the single list with listitems that have icons the window never seems to finish loading. The spinning wheel doesn't go alone by itself, I have to press backspace to get rid of it and then I can interact normally with the window. Any idea why that happens?
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
As I said ControlList.selecItem() is broken, meaning that an attempt to use it brings a ControlList to an inconsistent state when its internal index does not correspond to visual selection. Regarding the spinning wheel, I have no idea. I experimented once with ListItems with icons and don't remember any issues.
Reply
Question 
Thabks for your input thus far. One thing that's plagued me for awhile now is the ability to change the titlebar's background color/texture, which for the life of me I can't seem to figure out how to accomplish such a feat. I imagine it would need to be done with one of the two Blank window classes, but beyond that I haven't a clue how to do it. Would you be able to provide a minimal, working example that changes the titlebar's background/texture (and possibly the icon too) using say an image titled red.png (and alt_icon.png if willing to show how to change the icon as well)? I've tried to use the documentation as a guide to accomplishing both these objectives, but they've been a bit difficult to understand. When the docs talk about abstract classes I get lost completely. A working example would really be appreciated.
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
(2018-03-11, 17:04)CaffeinatedMike Wrote: I've tried to use the documentation as a guide to accomplishing both these objectives, but they've been a bit difficult to understand. When the docs talk about abstract classes I get lost completely.

PyXBMCt heavily relies on Python OOP features like multiple inheritance and the documentation assumes that the reader has some knowledge of Python OOP model. I don't know a "simple" way around that. I have updated the section about PyXBMCt skins, hoping to make it more clear. And it does include a minimal working example of changing one of skin's texture images. Other skin textures are changed exactly the same way: by overriding parent skin's properties so that they return paths to your custom texture images.
Reply
(2018-03-12, 18:16)Roman_V_M Wrote:
(2018-03-11, 17:04)CaffeinatedMike Wrote: I've tried to use the documentation as a guide to accomplishing both these objectives, but they've been a bit difficult to understand. When the docs talk about abstract classes I get lost completely.

PyXBMCt heavily relies on Python OOP features like multiple inheritance and the documentation assumes that the reader has some knowledge of Python OOP model. I don't know a "simple" way around that. I have updated the section about PyXBMCt skins, hoping to make it more clear. And it does include a minimal working example of changing one of skin's texture images. Other skin textures are changed exactly the same way: by overriding parent skin's properties so that they return paths to your custom texture images.   
I am trying to use the example from the documentation, but they don't seem to work. I have the following code snippet
_url = sys.argv[0]
_handle = int(sys.argv[1])
addon_id = 'plugin.video.sports'
addon = xbmcaddon.Addon(id=addon_id)
logo = os.path.join(addon.getAddonInfo('path').decode('utf-8'), 'nhl/logo.png')
blue = os.path.join(addon.getAddonInfo('path').decode('utf-8'), 'blue.png')
red = os.path.join(addon.getAddonInfo('path').decode('utf-8'), 'red.png')

class MySkin(pyxbmct.Skin):
    @property
    def title_background_img(self):
        return red
        
    @property
    def close_button_no_focus(self):
        return logo
        
pyxbmct.skin = MySkin()

class Score(pyxbmct.AddonDialogWindow):

And I invoke the class with this snippet in the main file
score_obj = nhl_api.get_scoreboard(scoreboard_link)
if len(score_obj) > 0:
    scoreboard_window = scoreboard.Score()
    scoreboard_window.setup(score_obj)
    scoreboard_window.doModal()
    del scoreboard_window
else:
    nodata(game_obj)

And still the end result remains unchanged
Image

Any idea why it still isn't working?
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
(2018-03-12, 18:16)Roman_V_M Wrote:
(2018-03-11, 17:04)CaffeinatedMike Wrote: I've tried to use the documentation as a guide to accomplishing both these objectives, but they've been a bit difficult to understand. When the docs talk about abstract classes I get lost completely.

PyXBMCt heavily relies on Python OOP features like multiple inheritance and the documentation assumes that the reader has some knowledge of Python OOP model. I don't know a "simple" way around that. I have updated the section about PyXBMCt skins, hoping to make it more clear. And it does include a minimal working example of changing one of skin's texture images. Other skin textures are changed exactly the same way: by overriding parent skin's properties so that they return paths to your custom texture images. 
Any input on my previous comment?
Quote:pro·gram·mer (n): An organism capable of converting caffeine into code.
Reply
  •   
  • 1
  • 19
  • 20
  • 21(current)
  • 22
  • 23
  • 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.