show new window
#16
nope, i'm not going to code this addon for you :-)
i'm willing to give advice, but you'll have to do the work ;-)

start by replacing all the tabs in your code with spaces... can't be that hard?
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#17
(2016-03-05, 22:54)ronie Wrote: nope, i'm not going to code this addon for you :-)
i'm willing to give advice, but you'll have to do the work ;-)

start by replacing all the tabs in your code with spaces... can't be that hard?

Thank you
I did not understand what you mean in the first
now i have to show list the produit in the same category In the new window
Do you have any idea ?
Reply
#18
hi all i have two window bring information from file json
this is Fille json
Code:
[
  {
    "listProduit": [
      {
        "title": "Tom Yam Kung",
        "descriptionProduit": "Soupe aux crevettes, champignons frais, citronnelle (piquant)",
        "price": "39,00DHS",
        "cat": "Soupes & Salades"
      },
      {
        "title": "Tom Kha Kai",
        "descriptionProduit": "Poulet, lait de coco, citronnelle",
        "price": "35,00DHS",
        "cat": "Soupes & Salades"
      },

      {
        "title": "Yam Kai",
        "descriptionProduit": "Fines lamelles de poulet aux épices thaï, tomates, oignons, concombres",
        "price": "55,00DHS",
        "cat": "Soupes & Salades"
      }
    ],
    "nameCategory": "Soupes & Salades",
    "imgCategory": "http://assets.hellofood.ma/dynamic/images/menucategories/13299_menu.jpg"
  },
  {
    "listProduit": [
      {
        "title": "Poh Pia Sod".............

the First window i have in list in class gui
Code:
def setup_all( self ):
        self.getControl( CONTACT_LIST ).reset()
        for category in j:
           listitem = xbmcgui.ListItem(label=category['nameCategory'], iconImage='iconwili.png')
           listitem.setProperty("MyID", "ACTUS" )
           listitem.setProperty("MyImage", category['imgCategory'] )
           self.getControl( CONTACT_LIST ).addItem( listitem )
           self.setFocus( self.getControl( CONTACT_LIST ) )
           socket.setdefaulttimeout(None)
Image

in secend window i have in class PRODUIT
when i click in the first list show the secend window
Image

but null i need how to click in the nam the category in the first window show list the produit in the secend window
Reply
#19
you can use getSelectedPosition to get the selected item from the first list.

then pass the relevant part of the json dict to your Produit class.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#20
(2016-03-09, 15:46)ronie Wrote: you can use getSelectedPosition to get the selected item from the first list.

then pass the relevant part of the json dict to your Produit class.
how i can get the posotion in the new class from the first usin constructeur argument
Reply
#21
you can pass additional args like this:
Code:
ui = Produit( "script-program-HelloFood-Produit.xml" , __cwd__, "Default", data=selected)

and pick 'm up in the other class like this:
Code:
class Produit( xbmcgui.WindowXMLDialog ):
    def __init__( self, *args, **kwargs ):
        self.data = kwargs[ "data" ]
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#22
(2016-03-09, 22:39)ronie Wrote: you can pass additional args like this:
Code:
ui = Produit( "script-program-HelloFood-Produit.xml" , __cwd__, "Default", data=selected)

and pick 'm up in the other class like this:
Code:
class Produit( xbmcgui.WindowXMLDialog ):
    def __init__( self, *args, **kwargs ):
        self.data = kwargs[ "data" ]

thank you
look when I come back from the second window to the first pictures do not move your mouse until I go back to the list
Reply
#23
(2016-03-10, 18:25)abdelfattah11 Wrote: look when I come back from the second window to the first pictures do not move your mouse until I go back to the list

sorry, i don't understand what you mean.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#24
(2016-03-10, 22:33)ronie Wrote:
(2016-03-10, 18:25)abdelfattah11 Wrote: look when I come back from the second window to the first pictures do not move your mouse until I go back to the list

sorry, i don't understand what you mean.

in this liste
Image
Code:
def onFocus( self, controlId ):
        while controlId == CONTACT_LIST:    
           list = self.getControl( CONTACT_LIST );
           item = list.getSelectedItem()
           myimage = item.getProperty("MyImage")
           xbmc.sleep(1)
           self.getControl( RECIPIENT_IMAGE ).setImage(myimage);
each label i select is show the image for it
but when i select item from the first window and show another window when i need to come back to the first window although i select an item is not show the image for it even i move the mouse into the list like when the while it was not existing !!
Reply
#25
i think it's better to handle that image in your skin xml:
Code:
<control type="image">
    ..
    <texture>$INFO[Container(ID).ListItem.Property(MyImage)]</texture>
</control>

where ID is the id of your list control.

then you can remove that onFocus code from your script.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#26
(2016-03-12, 16:55)ronie Wrote: i think it's better to handle that image in your skin xml:
Code:
<control type="image">
    ..
    <texture>$INFO[Container(ID).ListItem.Property(MyImage)]</texture>
</control>

where ID is the id of your list control.

then you can remove that onFocus code from your script.

Thank you very much Blush
Reply
#27
hi i need loop for show list produit
this structure the json
Code:
[
{
    "list": [
      {
        "listProduit": [
          {
            "title": "Four for All Chicken",
            "descriptionProduit": "Chicken strips, boneless, potatoe wedges, onion rings",
            "price": "99,00DHS",
            "cat": "Appetizers"
          }
          .....
          
        ],
        "nameCategory": "Appetizers",
        "imgCategory": "http://assets.hellofood.ma/dynamic/images/menucategories/7533_menu.jpg",
        "res": "Giovanni House"
      },
      {
        "listProduit": [
          {
            "title": "Salade Caprese",
            "descriptionProduit": "Mesclun de salade, tomates fraîches, mozzarella, basilic",
            "price": "49,00DHS",
            "cat": "Salades"
          }...
          
        ],
        "nameCategory": "Salades",
        "imgCategory": "http://assets.hellofood.ma/dynamic/images/menucategories/7532_menu.jpg",
        "res": "Giovanni House"
      },
      .....
    
    ],
    "img": "http://assets.hellofood.ma/dynamic/images/vendors/m1yz_sqp.JPG?v=20160223180539",
    "name": "Giovanni House",
    "description": "Burgers  Cuisine italienne  Pizza  Salades  Sandwichs  ",
    "livreDans": "30min",
    "fraisLaifraison": null,
    "valeurMin": "89,00DHS",
    "linkcat": "https://www.hellofood.ma//restaurant/m1yz/giovanni-house"
  }
  .....
  ]
i try this but i have in erreur
Code:
for produit in j[self.restaurant]['list']:
            for pr in j[self.category]['listProduit']:        
                listitem = xbmcgui.ListItem(label=pr['title'], iconImage='iconwili.png')
                listitem.setProperty("MyDescription",pr['descriptionProduit'])
                listitem.setProperty("MyPrice",pr['price'])
                listitem.setProperty("MyImage", j['list'][self.category]['imgCategory'])
                self.getControl( PRODUIT_LIST ).addItem( listitem )
                self.setFocus( self.getControl( PRODUIT_LIST ) )
                socket.setdefaulttimeout(None)
17:00:09 T:3572 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.KeyError'>
Error Contents: ('listProduit',)
Traceback (most recent call last):
File "C:\Users\abdelfattah\AppData\Roaming\Kodi\addons\script.program.boxty.HelloFood\resources\lib\Produit.py", line 84, in onInit
self.setup_all()
File "C:\Users\abdelfattah\AppData\Roaming\Kodi\addons\script.program.boxty.HelloFood\resources\lib\Produit.py", line 94, in setup_all
for pr in j[self.category]['listProduit']:
KeyError: ('listProduit',)
-->End of Python script error report<--
Reply
#28
The solution
for produit in j[self.restaurant]['list'][self.category]['listProduit']:
Reply
#29
how i can show window popup
Reply

Logout Mark Read Team Forum Stats Members Help
show new window2