ServiceList question

  • Hi,


    I want to pull out the last channelnumber in active bouquet from active bouquet. How can I do that within ServiceList.py? My goal is to count characters for the last number to use that to calculate column width. I just need help with getting that fuc**** number. I want to do it before the self.l.setBuildFunc(self.buildOptionEntry, True) is startet.


    Until now I have counted channels in list, but that fails when you have a bouquet with channels from e.g. 99 to 130


    I think you got the point. :smiling_face:

    - FoxyRabbit - Peter Pan team -

  • Thanks for answering!


    It seems to me that self.numberoffset always is 0 in the code. I can se a def with name setNumberOffset wich is never used in code. If this is a bug or surplus code I dont know.


    I want to calculate column width for channelnumbers by calculating the highest channel number in the current active list. Counting channels in list will fail if you got several bouquets. In my example it is only 31 channels, but I want to calculate the width of channel number 130. But I cant find a way to catch the channel number within ServiceList.


    The issue here is that we can set column wdth with component attribute in skin, but if someone have 2000 channels (covered for as attribute width) it will look very ugly in skin for people with only 80 channels. So in my opinion the width should be calculated from actual highest channel number in list.

    - FoxyRabbit - Peter Pan team -

  • Method setNumberOffset is used by ChannelSelectionBase class (called in method setRoot). :winking_face:

    So self.numberoffset is not always 0, it contains the number of all services of the previous bouquets in the list.


    e.g. you have 3 bouquets


    A (80 items)

    B (30 item)

    C --> your current bouquet --> self.numberoffset is 110


    So what you need is just to find out how many playable items (do not count the markers) are in bouquet C, then add this number to self.numberoffset and you have the final number you are searching for.

    2 Mal editiert, zuletzt von Dr.Best ()

  • I just wrote the code down for you:


    ServiceList.py, replace setRoot with this code:



    You see the print-line? That gives you the channelnumber of the last item in a bouquet.


    Have fun with the implementation of your idea! :smiling_face:


    EDIT: of course that makes only sense if self.mode is MODE_FAVOURITES, I edited the code for this cause :winking_face:

    4 Mal editiert, zuletzt von Dr.Best ()

  • Thank you very much Dr.Best ,your my hero!


    I had a feeling that the setNumberOffset was there for "something". :smiling_face:


    And thank you very much for taking the time to create a code example for me. Really appreciate that!


    Yeah, I'm not good at it, but I'm having very much fun with building my image every day! Learning something every day! :grinning_squinting_face:


    The idea is good, and should probobly be used in original code also.

    - FoxyRabbit - Peter Pan team -