Any interest in helping me create a Sports View Addon
#16
Thanks for your reply. No luck though. Where specifically would i put it? Here?: 

<control type="image" id="102" allowhiddenfocus="true">

Do i put it for all 3 menu items? Or maybe for the menu focused image (104)?:

<control type="image" id="104" allowhiddenfocus="true">

Anyway, I tired both. Couldn't get focused.png to show.
Reply
#17
(2023-06-23, 07:07)mjc_cox Wrote: Thanks for the suggestion. Yeah I've been getting familiarized with the Special protocol. Sometimes it makes sense sometimes I'm left scratching my head. The entry point seems to differ depending on what you're doing? does tha make sense? Anyway... I've made some progress. I've been able to narrow down my problems by focusing on creating the pages in the **.xml files and then I'll deal with the functionality in the default.py file later. 

I have run into a little snag here though. I've got my first page opening and i can arrange within it. But i'm trying to place an image behind whichever menu item has focus. But the log keeps saying "2023-06-23 01:05:11.953 T:23860   error <general>: Control 102 in window 13000 has been asked to focus, but it can't". This makes sense because i have 102 set as default focus. But I can't figure out WHY it can't. Here's the file:

landingpage.xml: ohinoxusam (paste)

I find those messages sometimes in context menu and similar due to skin animations running which take time to complete.  One approach I have used is:

xbmc.executebuiltin('Dialog.Close(all, true)')

I run it prior to opening another window or setting focus.  It's a bit brute force and may have unwanted side-effects but might be worth a try.  You could also try just closing the offending window / item or disabling skin animations to see if this resolves the issue.  You could also try a short sleep timer ahead of setting focus / opening a new window to give the skin time to complete.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#18
I tried these suggestions with no success.

1. xbmc.executebuiltin('Dialog.Close(all, true)')  -- It's a fresh install of Kodi. So there isn't much going that would be taking away focus. 
2. Short sleep timer ahead of setting focus / opening a new window to give the skin time to complete.

It seems like I just coded either the menu items, maybe their visibility, or the focused menu part incorrectly.
Reply
#19
(2023-06-23, 14:16)mjc_cox Wrote: Thanks for your reply. No luck though. Where specifically would i put it? Here?: 

<control type="image" id="102" allowhiddenfocus="true">

Do i put it for all 3 menu items? Or maybe for the menu focused image (104)?:

<control type="image" id="104" allowhiddenfocus="true">

Anyway, I tired both. Couldn't get focused.png to show.

 
(2023-06-23, 07:27)jepsizofye Wrote: try adding allowhiddenfocus

https://kodi.wiki/view/Conditional_visibility


that is not the correct way to add the tag, read the link i provided it shows how to put the tag in
Reply
#20
(2023-06-23, 15:51)jepsizofye Wrote:
(2023-06-23, 14:16)mjc_cox Wrote: Thanks for your reply. No luck though. Where specifically would i put it? Here?: 

<control type="image" id="102" allowhiddenfocus="true">

Do i put it for all 3 menu items? Or maybe for the menu focused image (104)?:

<control type="image" id="104" allowhiddenfocus="true">

Anyway, I tired both. Couldn't get focused.png to show.
 
(2023-06-23, 07:27)jepsizofye Wrote: try adding allowhiddenfocus

https://kodi.wiki/view/Conditional_visibility


that is not the correct way to add the tag, read the link i provided it shows how to put the tag in

Oh . Yep. Where the hell did I get so turned around on that one?
Does this look right?:

Code:

<control type="image" id="102">
        <visible allowhiddenfocus="true">true</visible>
        <top>0</top>
        <left>24%</left>
        <width>1000</width>
        <height>200</height>
        <visible>true</visible>
        <texture>special://home/addons/plugin.sportsview/resources/skins/default/media/recently_added.png</texture>
        <aspectratio>keep</aspectratio>
        <onfocus condition="true">SetProperty(Skin.String(focusedmenu), 102)</onfocus>
        <onblur condition="true">SetProperty(Skin.String(focusedmenu), -1)</onblur>
      </control>

It's still giving this error though: 2023-06-23 09:58:48.624 T:3640    error <general>: Control 102 in window 13000 has been asked to focus, but it can't
Reply
#21
Can the image control type even get focus? I'm starting to think not. This would definitely be my problem if that's the case.
Reply
#22
So i'm going to switch my images to buttons. Seems obvious now.

Question: Is there a way to maintain/keep the aspect ratio of images/textures used as buttons.  I thought this would have done it <texturenofocus aspectratio=keep>image.png</texturenofocus>. But no such luck.
Reply
#23
I'm making some good progress. But have hit a snag (again). My addon launches through the default.py and opens up to a landing page. it has it's own xml file and is controlled by the default.py. When i click on menu item "All Sports" it opens a page that will be populated with a grid of icons displaying all of the sports available from thesportsdb. The all sports page has its own allsports.py and allsports.xml file. It also uses a file called GetAllSportsScript.py to get and make a useable list of all of the sports. I ran this in the terminal and it definitely gets the image files. The problem is now i'm getting this error: 

2023-06-24 15:50:35.035 T:24796   error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'ModuleNotFoundError'>
                                                   Error Contents: No module named 'requests'
                                                   Traceback (most recent call last):
                                                     File "C:\Users\mjc_c\AppData\Roaming\Kodi\addons\plugin.sportsview\default.py", line 3, in <module>
                                                       from allsports import AllSportsPage
                                                     File "C:\Users\mjc_c\AppData\Roaming\Kodi\addons\plugin.sportsview\allsports.py", line 2, in <module>
                                                       from resources.scripts.GetAllSportsScript import get_sports
                                                     File "C:\Users\mjc_c\AppData\Roaming\Kodi\addons\plugin.sportsview\resources\scripts\GetAllSportsScript.py", line 1, in <module>
                                                       import requests
                                                   ModuleNotFoundError: No module named 'requests'
                                                   -->End of Python script error report<--

Here are the contents of my files:

default.py: https://pastebin.com/uKC1ty7j
landingpage.xml: https://pastebin.com/e9ZtjcXR
allsports.py: https://pastebin.com/wBQwkBAg
allsports.xml: https://pastebin.com/7bnCiJmB
GetAllSportsScript.py: https://pastebin.com/wHzWFJg0

Anything glaringly obvious?
Reply
#24
(2023-06-24, 22:15)mjc_cox Wrote: Here are the contents of my files:

default.py: https://pastebin.com/uKC1ty7j
landingpage.xml: https://pastebin.com/e9ZtjcXR
allsports.py: https://pastebin.com/wBQwkBAg
allsports.xml: https://pastebin.com/7bnCiJmB
GetAllSportsScript.py: https://pastebin.com/wHzWFJg0

Anything glaringly obvious?

There are some libraries that Kodi does not include in the standard library set and an addon wrapper has been written for them.  Requests is an example of this.  You can add this addon requires section in your addon.xml file or use urllib.requests etc..  instead, which is included.  An example of this can be seen here. I personally attempt to minimize the number of dependent addons with my addons, just to make support easier but that my preference.  Requests is a widely used library / addon.


Thanks,

jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#25
(2023-06-25, 00:15)jbinkley60 Wrote: You can add this addon requires section in your addon.xml file 

Thanks so much!! 

<import addon="script.module.requests" version="2.25.1" />
Reply
#26
(2023-06-25, 01:10)mjc_cox Wrote:
(2023-06-25, 00:15)jbinkley60 Wrote: You can add this addon requires section in your addon.xml file 

Thanks so much!! 

<import addon="script.module.requests" version="2.25.1" />

Happy to help. Glad this resolved things. Using the requires section of the addon.xml file is a bit more preferred since Kodi will install it sutomatically vs. manual installation.


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#27
If i can be perfectly honest i thought that requires section was just to let people who read the xml know that was a requirement. haha. I'm learning a lot of stuff and feel like i'm making progress on this. Thanks a lot!
Reply
#28
(2023-06-25, 04:33)mjc_cox Wrote: If i can be perfectly honest i thought that requires section was just to let people who read the xml know that was a requirement. haha. I'm learning a lot of stuff and feel like i'm making progress on this. Thanks a lot!

I've been watching your progress.  You are coming along well.  We all went through this.  It took me quite a while to get comfortable with addon programming and learning how Kodi operates.  I am watching your progress to learn more about skin level programming and window objects etc.  While I've done a lot of other addon programming with databases, XML parsing,website interfacing,  listitem creation and more, I've done very little with new windows. 


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#29
Does anyone have a link to information about xbmcgui? All i can find is kodistubs info.
Reply
#30
(2023-06-26, 05:19)mjc_cox Wrote: Does anyone have a link to information about xbmcgui? All i can find is kodistubs info.

https://alwinesch.github.io/group__python__xbmcgui.html
Reply

Logout Mark Read Team Forum Stats Members Help
Any interest in helping me create a Sports View Addon0