Example #1
0
    def startService(self):
        log('startService')
        self.myMonitor = Monitor()
        #Random start delay, avoid all services from starting at the same time.
        self.myMonitor.waitForAbort(random.randint(5, 30))
        while not self.myMonitor.abortRequested():
            # Don't run while setting menu is opened.
            if not self.configured:
                log('startService, settings not configured')
                self.myMonitor.waitForAbort(5)
                continue

            if xbmcgui.getCurrentWindowDialogId() in [10140, 10103, 12000]:
                log('startService, settings dialog opened')
                self.myMonitor.waitForAbort(15)
                continue

            if self.myMonitor.pendingChange or self.myMonitor.waitForAbort(5):
                log('startService, waitForAbort/pendingChange')
                break

            # Don't run while playing.
            if xbmc.Player().isPlayingVideo() and IGNORE:
                log('startService, ignore during playback')
                self.myMonitor.waitForAbort(5)
                continue

            if EVENTS: self.checkEvents()
            if datetime.datetime.now() >= self.nextCHK: self.chkDeviceStatus()

        if self.myMonitor.pendingChange:
            notification(LANGUAGE(30007))
            self.restartService()
Example #2
0
 def _set_title_info(self,
                     title="",
                     duration="",
                     mpaa="",
                     genre="",
                     studio="",
                     director="",
                     cast="",
                     poster="",
                     plot="",
                     date="",
                     address="",
                     phone=""):
     # reset list
     self.getControl(100).reset()
     # set a searching message
     self.getControl(100).addItem(xbmc.getLocalizedString(30601))
     # grab the window
     wId = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
     # set our info
     wId.setProperty("Title", title)
     wId.setProperty("Duration", duration)
     wId.setProperty("MPAA", mpaa)
     wId.setProperty("Genre", genre)
     wId.setProperty("Studio", studio)
     wId.setProperty("Director", director)
     wId.setProperty("Cast", cast)
     wId.setProperty("Poster", poster)
     wId.setProperty("Plot", plot)
     wId.setProperty("Location", self.settings["local"])
     wId.setProperty("Date", date)
     wId.setProperty("Address", address)
     wId.setProperty("Phone", phone)
Example #3
0
    def startService(self):
        while not self.myMonitor.abortRequested():
            if self.myMonitor.pendingChange == True:
                self.myMonitor.pendingChange = False
                REAL_SETTINGS = xbmcaddon.Addon(id=ADDON_ID)
                waitTime = [300, 600, 900,
                            1800][int(REAL_SETTINGS.getSetting('Wait_Time'))]
                ignorePlay = REAL_SETTINGS.getSetting(
                    'Not_While_Playing') == 'true'

            # Don't run while playing.
            if xbmc.Player().isPlayingVideo() == True and ignorePlay == True:
                log('startService, ignore during playback')
                continue

            # Don't run while setting menu is opened.
            if xbmcgui.getCurrentWindowDialogId() in [10140, 10103]:
                log('startService, settings dialog opened')
                continue

            self.chkFEED()

            # Sleep
            if self.myMonitor.waitForAbort(waitTime) == True:
                log('startService, waitForAbort/pendingChange')
                break
Example #4
0
class Main:
    # grab the 1115 or 1116 window
    try:
        wid = getCurrentWindowDialogId()
    except:
        wid = 11115
    WINDOW = Window(wid)

    def __init__(self):
        self._clear_properties()
        self._set_properties()

    def _clear_properties(self):
        # Clear Feeds Properties
        for count in range(1, 31):
            self.WINDOW.clearProperty("feeds.%d.name" % (count + 1, ))
            self.WINDOW.clearProperty("feeds.%d.path" % (count + 1, ))

    def _set_properties(self):
        # recupere les rss existant de l'user
        for count, feeds in enumerate(
                sorted(parse_xml().items(), key=lambda x: str(x[0].zfill(3)))):
            idset, feeds = feeds
            # join par une virgule les liens. on va utiliser une virgule comme ceci " , " pour faire la différence des autre virgule dans les liens
            lien = " , ".join(feed["feed"] for feed in feeds["feed"])
            #print "feeds.%d.path" % ( count + 1 ), lien
            # name est le nom du site, car l'attribut name est pas supporter pour le moment dans le rssfeeds.xml
            name = " / ".join(set(findall('http://(.*?)/', lien)))
            #print "feeds.%d.name" % ( count + 1 ), name

            # set window properties
            self.WINDOW.setProperty("feeds.%d.name" % (count + 1, ), name)
            self.WINDOW.setProperty("feeds.%d.path" % (count + 1, ), lien)
Example #5
0
 def onClick(self, controlID):
     try:
         kill = None
         if controlID == 199:
             self._close_dialog()
         elif controlID == 99:
             try:
                 import shutil
                 try:
                     shutil.rmtree(DL_INFO_PATH, True)
                 except:
                     pass
                 if not os.path.exists(DL_INFO_PATH):
                     os.makedirs(DL_INFO_PATH)
             except:
                 print_exc()
             xbmc.executebuiltin("Container.Refresh")
             self._close_dialog()
         elif 1401 <= controlID <= 1412:
             kill = str(controlID)[2:]
         if kill is not None:
             win = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
             win.setProperty("progress.%s.isAlive" % kill, "kill")
             #print xbmcgui.getCurrentWindowDialogId()
     except:
         print_exc()
Example #6
0
def index():
    """
    Main add-on popup
    :return:
    """
    api = API()

    # check if current window is arwork or intro:
    window_id = getCurrentWindowDialogId()
    window = WindowDialog(window_id)

    if isinstance(window, IntroWindow) or isinstance(window, ArtworkWindow):
        log('Either IntroWindow or ArtworkWindow are already open')
    else:
        intro_window = IntroWindow(api)
        intro_window.doModal()
        section_id = intro_window.getProperty('section')
        if section_id:
            section_id = int(section_id)
            category_id = int(intro_window.getProperty('category'))
            del intro_window

            if section_id == 1:  # channels
                show_channels(section_id, category_id) if section_id != 99 else show_favorites()
            elif section_id == 3:  # atmospheres
                show_categories(section_id)
            else:
                show_favorites()  # favorites
        else:
            del intro_window
Example #7
0
    def checkWindow(self,newN):
        winID = xbmcgui.getCurrentWindowId()
        dialogID = xbmcgui.getCurrentWindowDialogId()
        if dialogID != 9999: winID = dialogID
        if winID == self.winID: return newN
        self.winID = winID
        self.updateWindowReader()
        if util.DEBUG:
            util.LOG('Window ID: {0} Handler: {1} File: {2}'.format(winID,self.windowReader.ID,xbmc.getInfoLabel('Window.Property(xmlfile)')))

        name = self.windowReader.getName()
        if name:
            self.sayText(u'{0}: {1}'.format(T(32105),name),interrupt=not newN)
            self.insertPause()
        else:
            self.sayText(u' ',interrupt=not newN)

        heading = self.windowReader.getHeading()
        if heading:
            self.sayText(heading)
            self.insertPause()

        texts = self.windowReader.getWindowTexts()
        if texts:
            self.insertPause()
            for t in texts:
                self.sayText(t)
                self.insertPause()
        return True
Example #8
0
    def Scan(self, rate=False):
        Log('def Scan ', None, xbmc.LOGDEBUG)
        if ((rate) and (time.time() < self.wait['scan'])) or (
                xbmcgui.getCurrentWindowDialogId() == 10135):
            return
        self.wait['scan'] = time.time() + 15

        songs = dict()
        for pos in range(0, self.playlist.size()):
            tk = self.playlist[pos].getProperty("%s.token" % _id)
            rt = xbmc.getInfoLabel("MusicPlayer.Position(%d).Rating" % pos)
            if (rt == ''): rt = '0'

            if tk in self.songs:
                song = self.songs[tk]
                del self.songs[tk]
                songs[tk] = song

                if (rate) and (song.get('rating', rt) != rt):
                    self.Rated(song, rt)
                elif not song.get('rating'):
                    song['rating'] = rt

        for s in self.songs:
            if (not self.songs[s].get('keep', False)) and xbmcvfs.exists(
                    self.songs[s].get('path_cch')):
                xbmcvfs.delete(self.songs[s]['path_cch'])
                Log('Scan  RM', self.songs[s], xbmc.LOGINFO)

        self.songs = songs
 def _get_vars(self):
     # get the screensaver window id
     self.winid   = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
     # init the monitor class to catch onscreensaverdeactivated calls
     self.Monitor = MyMonitor(action = self._exit)
     self.stop    = False
     self.startup = True
Example #10
0
    def setWindowProperties(self, nokill=False):
        win = None
        if self.dlInBackground and self.baseProperty:
            try:
                winID = self.winID or xbmcgui.getCurrentWindowDialogId()
                win = xbmcgui.Window(winID)
                #print "win = xbmcgui.Window(%s)" % str( winID )
            except:
                pass
        if win is not None:
            if not nokill and win.getProperty(self.baseProperty +
                                              "isAlive") == "kill":
                return True

            [
                win.setProperty(self.baseProperty + k, v)
                for k, v in (("isAlive", "true"), ("heading", self.heading),
                             ("url", self.url), ("filename", self.base_name),
                             ("destination", self.destination),
                             ("kbps", self.kbps), ("percent",
                                                   "%i" % self.percent),
                             ("currentSize",
                              self.currentSize), ("totalSize", self.totalSize),
                             ("elapsedTime",
                              self.elapsedTime), ("estimatedTimeLeft",
                                                  self.estimatedTimeLeft),
                             ("estimatedTotalTime", self.estimatedTotalTime))
            ]
            try:
                win.getControl(self.winControlID).setPercent(int(self.percent))
            except:
                pass
Example #11
0
 def debugInfo(self):
     visible = 'Window.IsActive(Pointer.xml) + String.IsEqual(Window(home).Property(service.mouse.event.debug),true)'
     if xbmc.getCondVisibility('System.HasModalDialog'):
         wid = xbmcgui.getCurrentWindowDialogId()
     else:
         visible += ' + !System.HasModalDialog'
         wid = xbmcgui.getCurrentWindowId()
     #if SETTING("debug") == "false":
     #    xbmc.executebuiltin('ClearProperty(service.mouse.event.debug,home)')
     #else:
     xbmc.executebuiltin('SetProperty(service.mouse.event.debug,%s,home)' %
                         SETTING("debug"))
     if self.windowsid.get(wid) is None:
         window = xbmcgui.Window(wid)
         label = 'Add-on Mouse Event (x:$INFO[Window(home).Property(MousePosX)], y:$INFO[Window(home).Property(MousePosY)])'
         debugLabels = [
             xbmcgui.ControlLabel(2,
                                  2,
                                  int(self.skin["width"]),
                                  50,
                                  label,
                                  alignment=0x00000006,
                                  textColor='0xFF000000'),
             xbmcgui.ControlLabel(0,
                                  0,
                                  int(self.skin["width"]),
                                  50,
                                  label,
                                  alignment=0x00000006)
         ]
         window.addControls(debugLabels)
         for label in debugLabels:
             label.setVisibleCondition(visible)
         self.windowsid[wid] = (window, debugLabels)
Example #12
0
    def onClick(self, controlID):
        try:
            kill = None
            if controlID == 199:
                self._close_dialog()
            elif controlID == 99:
                try:
                    import shutil

                    try:
                        shutil.rmtree(DL_INFO_PATH, True)
                    except:
                        pass
                    if not os.path.exists(DL_INFO_PATH):
                        os.makedirs(DL_INFO_PATH)
                except:
                    print_exc()
                xbmc.executebuiltin("Container.Refresh")
                self._close_dialog()
            elif 1401 <= controlID <= 1412:
                kill = str(controlID)[2:]
            if kill is not None:
                win = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
                win.setProperty("progress.%s.isAlive" % kill, "kill")
                # print xbmcgui.getCurrentWindowDialogId()
        except:
            print_exc()
Example #13
0
    def Scan(self, rate = False):
        if ((rate) and (time.time() < self.wait['scan'])) or (xbmcgui.getCurrentWindowDialogId() == 10135): return
        self.wait['scan'] = time.time() + 15

        songs = dict()
        for pos in range(0, self.playlist.size()):
            tk = self.playlist[pos].getProperty("%s.token" % _id)
            rt = xbmc.getInfoLabel("MusicPlayer.Position(%d).Rating" % pos)
            if (rt == ''): rt = '0'

            if tk in self.songs:
                song = self.songs[tk]
                del self.songs[tk]
                songs[tk] = song

                if (rate) and (song.get('rating', rt) != rt):
                    self.Rated(song, rt)
                elif not song.get('rating'):
                    song['rating'] = rt

        for s in self.songs:
            if (not self.songs[s].get('keep', False)) and xbmcvfs.exists(self.songs[s].get('path_cch')):
                xbmcvfs.delete(self.songs[s]['path_cch'])
                Log('Scan  RM', self.songs[s])

        self.songs = songs
Example #14
0
    def VScreate(self, title = 'vStream', desc = '', large=False):

        # Ne pas afficher le sablier si nous ne sommes pas dans un menu vStream
        currentWindow = xbmcgui.getCurrentWindowId()
        if currentWindow != 10025 : # 10025 = videonav, 10000 = home
            return empty()

        # Ne pas afficher le sablier si une dialog est ouverte, inclut le menu contextuel
        # sauf pour le spinner de chargement (10138)
        dlgId = xbmcgui.getCurrentWindowDialogId()
        if dlgId != 9999 and dlgId != 10138: # 9999 = None
            return empty()

#         # Ne pas afficher le sablier si le mode d'affichage est une liste
#         # Ne fonctionne pas car l'info correspond Ă  la fenĂŞtre precedente
#         viewMode = xbmc.getInfoLabel('Container.ViewMode')
#         VSlog('viewMode = '+ viewMode)
#         if 'list' in viewMode or 'List' in viewMode:
#             return empty()

        global PROGRESS
        if PROGRESS == None:
            if large:
                PROGRESS = xbmcgui.DialogProgress()
            elif ADDONVS.getSetting('spinner_small') == 'true':
                PROGRESS = xbmcgui.DialogProgressBG()
            else:
                PROGRESS = xbmcgui.DialogProgress()
            PROGRESS.create(title, desc)

        return self
Example #15
0
    def checkWindow(self, newN):
        winID = xbmcgui.getCurrentWindowId()
        dialogID = xbmcgui.getCurrentWindowDialogId()
        if dialogID != 9999:
            winID = dialogID
        if winID == self.winID:
            return newN
        self.winID = winID
        self.updateWindowReader()
        if module_logger.isEnabledFor(LazyLogger.DEBUG):
            module_logger.debug('Window ID: {0} Handler: {1} File: {2}'.format(
                winID, self.windowReader.ID,
                xbmc.getInfoLabel('Window.Property(xmlfile)')))

        name = self.windowReader.getName()
        if name:
            self.sayText('{0}: {1}'.format(Messages.get_msg(Messages.WINDOW),
                                           name),
                         interrupt=not newN)
            self.insertPause()
        else:
            self.sayText(' ', interrupt=not newN)

        heading = self.windowReader.getHeading()
        if heading:
            self.sayText(heading)
            self.insertPause()

        texts = self.windowReader.getWindowTexts()
        if texts:
            self.insertPause()
            for t in texts:
                self.sayText(t)
                self.insertPause()
        return True
 def onInit(self):
     homewindow.setProperty("movie.ImageColor",
                            self.tvshow["general"]["ImageColor"])
     windowid = xbmcgui.getCurrentWindowDialogId()
     xbmcgui.Window(windowid).setProperty("tmdb_logged_in", checkLogin())
     passDictToSkin(self.tvshow["general"], "movie.", False, False,
                    windowid)
     self.getControl(1000).addItems(
         CreateListItems(self.tvshow["actors"], 0))
     self.getControl(150).addItems(
         CreateListItems(self.tvshow["similar"], 0))
     self.getControl(250).addItems(
         CreateListItems(self.tvshow["seasons"], 0))
     self.getControl(550).addItems(
         CreateListItems(self.tvshow["studios"], 0))
     self.getControl(1450).addItems(
         CreateListItems(self.tvshow["networks"], 0))
     self.getControl(750).addItems(CreateListItems(self.tvshow["crew"], 0))
     self.getControl(850).addItems(CreateListItems(self.tvshow["genres"],
                                                   0))
     self.getControl(950).addItems(
         CreateListItems(self.tvshow["keywords"], 0))
     self.getControl(1150).addItems(
         CreateListItems(self.tvshow["videos"], 0))
     self.getControl(350).addItems(CreateListItems(self.youtube_vids, 0))
     self.getControl(1250).addItems(
         CreateListItems(self.tvshow["images"], 0))
     self.getControl(1350).addItems(
         CreateListItems(self.tvshow["backdrops"], 0))
def index():
    """
    Main add-on popup
    :return:
    """
    api = API()

    # check if current window is arwork or intro:
    window_id = getCurrentWindowDialogId()
    window = WindowDialog(window_id)

    if isinstance(window, IntroWindow) or isinstance(window, ArtworkWindow):
        log('Either IntroWindow or ArtworkWindow are already open')
    else:
        intro_window = IntroWindow(api)
        intro_window.doModal()
        section_id = intro_window.getProperty('section')
        if section_id:
            section_id = int(section_id)
            category_id = int(intro_window.getProperty('category'))
            del intro_window

            if section_id == 1:  # channels
                show_channels(
                    section_id,
                    category_id) if section_id != 99 else show_favorites()
            elif section_id == 3:  # atmospheres
                show_categories(section_id)
            else:
                show_favorites()  # favorites
        else:
            del intro_window
Example #18
0
    def run(self):
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
        client_do = 'client_wait'
        self.window.setProperty('clientIsRunning', 'True')
        while not client_do == 'client_stop':
            if self.window.getProperty('clientIsRunning') == "True":
                client_run = self.check_queue()
                if client_run:
                    client_do = client_run

                if client_do == 'client_stop':
                    addon_log('Got Notification: client_stop')
                    self.window.setProperty('clientIsRunning', '')
                elif client_do == 'client_wait':
                    addon_log('IrcChatIsRunning: clientIsWaiting')
                    time.sleep(0.5)
                else:
                    msg = self.get_message()
                    if msg:
                        # adjust the chatmessage delay here
                        time.sleep(1.0)
                    else:
                        time.sleep(0.2)
            else:
                break
        return
    def Scan(self, rate=True):
        if ((rate) and (time.time() < self.wait["scan"])) or (xbmcgui.getCurrentWindowDialogId() == 10135):
            return
        self.wait["scan"] = time.time() + 15

        songs = dict()
        for pos in range(0, self.playlist.size()):
            tk = self.playlist[pos].getProperty("%s.token" % _id)
            rt = xbmc.getInfoLabel("MusicPlayer.Position(%d).Rating" % pos)

            if tk in self.songs:
                song = self.songs[tk]
                del self.songs[tk]
                songs[tk] = song

                if (rate) and (song.get("rating", rt) != rt):
                    self.Rated(song, rt)
                elif not song.get("rating"):
                    song["rating"] = rt

        for s in self.songs:
            if (not self.songs[s].get("keep", False)) and xbmcvfs.exists(self.songs[s].get("path_cch")):
                xbmcvfs.delete(self.songs[s]["path_cch"])
                Log("Scan  RM", self.songs[s])

        self.songs = songs
Example #20
0
def grab_random_fanart(controlNum, special):
    global fanart
    
    get_fanart_list()
    if len(fanart) == 0:
        return
    
    # sometimes the list control isn't available yet onload
    # so add some checking to make sure
    control = common.get_control(controlNum, special)
    count = 10
    while control == "" and count > 0:
        time.sleep(0.25)
        control = common.get_control(controlNum, special)
        count = count - 1
    
    window = common.get_window_id(special)
    if control == "":
        pass
    else:
        while 1:
            if xbmcgui.getCurrentWindowDialogId() == 9999:
                art = fanart[fanart.keys()[randint(0, len(fanart) - 1)]]
                if art != "":
                    art = "$COMMA".join(art.split(","))
            
                xbmc.executebuiltin("Skin.SetString(random-fanart,%s)" % art)

            count = 4
            while count > 0:
                if window != common.get_window_id(special):
                    return
                time.sleep(2)
                count = count - 1
Example #21
0
    def onInit(self):
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
        self.season_list = self.window.getControl(210)
        self.weeks_list = self.window.getControl(220)
        self.games_list = self.window.getControl(230)
        self.live_list = self.window.getControl(240)

        if gpr.subscription == 'gamepass':
            self.window.setProperty('gamepass', 'true')

        if self.list_refill:
            self.season_list.reset()
            self.season_list.addItems(self.season_items)
            self.weeks_list.reset()
            self.weeks_list.addItems(self.weeks_items)
            self.games_list.reset()
            self.games_list.addItems(self.games_items)
            self.live_list.reset()
            self.live_list.addItems(self.live_items)
        else:
            self.window.setProperty('NW_clicked', 'false')
            self.window.setProperty('GP_clicked', 'false')

        try:
            self.setFocus(self.window.getControl(self.focusId))
        except:
            addon_log('Focus not possible: %s' % self.focusId)
def GetCurrentScreenName():
  windowid = xbmcgui.getCurrentWindowId()
  dialogid = xbmcgui.getCurrentWindowDialogId()
  LogDebug('Window ID: ' + str(windowid))
  LogDebug('Window Dialog ID: ' + str(dialogid))
  LogDebug('NumItems: ' + xbmc.getInfoLabel('Container.NumItems'))

  # TODO: Maybe make this an overlay with just one menu item
  #       Render "general" screen for now so we see the selected entry
  if dialogid == WINDOW_IDS.WINDOW_DIALOG_CONTEXT_MENU:
    return 'general'

  if windowid == WINDOW_IDS.WINDOW_HOME:
    return 'navigation'
  if windowid == WINDOW_IDS.WINDOW_MUSIC_NAV or \
     windowid == WINDOW_IDS.WINDOW_VIDEO_NAV or \
     (windowid == WINDOW_IDS.WINDOW_ADDON_BROWSER and not \
      dialogid == WINDOW_IDS.WINDOW_DIALOG_ADDON_INFO and not \
      dialogid == WINDOW_IDS.WINDOW_DIALOG_ADDON_SETTINGS) or \
     windowid == WINDOW_IDS.WINDOW_TV_CHANNELS_OLD or \
     windowid == WINDOW_IDS.WINDOW_TV_RECORDINGS_OLD or \
     windowid == WINDOW_IDS.WINDOW_RADIO_CHANNELS_OLD or \
     windowid == WINDOW_IDS.WINDOW_TV_CHANNELS or \
     windowid == WINDOW_IDS.WINDOW_TV_RECORDINGS or \
     windowid == WINDOW_IDS.WINDOW_RADIO_CHANNELS:
    return 'menu'
  if windowid == WINDOW_IDS.WINDOW_VISUALISATION or \
     windowid == WINDOW_IDS.WINDOW_FULLSCREEN_VIDEO:
    if xbmc.getCondVisibility('Pvr.IsPlayingTv') or \
       xbmc.getCondVisibility('Pvr.IsPlayingRadio'):
      return 'tvshow'
    else:
      return 'replay'
  else:
    return 'general'
Example #23
0
    def onInit(self):
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
        self.season_list = self.window.getControl(210)
        self.weeks_list = self.window.getControl(220)
        self.games_list = self.window.getControl(230)
        self.live_list = self.window.getControl(240)

        if gpr.subscription == 'gamepass':
            self.window.setProperty('gamepass', 'true')

        if self.list_refill:
            self.season_list.reset()
            self.season_list.addItems(self.season_items)
            self.weeks_list.reset()
            self.weeks_list.addItems(self.weeks_items)
            self.games_list.reset()
            self.games_list.addItems(self.games_items)
            self.live_list.reset()
            self.live_list.addItems(self.live_items)
        else:
            self.window.setProperty('NW_clicked', 'false')
            self.window.setProperty('GP_clicked', 'false')

        try:
            self.setFocus(self.window.getControl(self.focusId))
        except:
            addon_log('Focus not possible: %s' %self.focusId)
Example #24
0
 def run(self):
     self.omdb_thread.join()
     if not xbmcgui.getCurrentWindowDialogId() == self.window_id:
         return None
     pass_dict_to_skin(data=self.omdb_thread.listitems,
                       prefix="movie.omdb.",
                       window_id=self.window_id)
Example #25
0
def get(file):
    addonInfo = xbmcaddon.Addon().getAddonInfo
    addonPath = xbmc.translatePath(addonInfo('path'))
    helpFile = os.path.join(addonPath, 'lib', 'myaccounts', 'help',
                            file + '.txt')
    r = open(helpFile)
    text = r.read()
    id = 10147
    xbmc.executebuiltin('ActivateWindow(%d)' % id)
    xbmc.sleep(500)
    win = xbmcgui.Window(id)
    retry = 50
    while (retry > 0):
        try:
            xbmc.sleep(10)
            retry -= 1
            win.getControl(1).setLabel(
                '[COLOR red]My Accounts[/COLOR] -  v%s - %s' %
                (xbmcaddon.Addon().getAddonInfo('version'), file))
            win.getControl(5).setText(text)
            while xbmcgui.getCurrentWindowDialogId() == id:
                xbmc.sleep(100)
            return
        except:
            pass
Example #26
0
def grab_random_fanart(controlNum, special):
    global fanart
    
    get_fanart_list(True)
    if len(fanart) == 0:
        return
    
    # sometimes the list control isn't available yet onload
    # so add some checking to make sure
    control = common.get_list(controlNum, special)
    count = 10
    while control == "" and count > 0:
        time.sleep(0.25)
        control = common.get_list(controlNum, special)
        count = count - 1
    
    window = common.get_window_id(special)
    if control == "":
        pass
    else:
        item = control.GetItem(0)
        while 1:
            if xbmcgui.getCurrentWindowDialogId() == 9999:
                art = fanart[fanart.keys()[randint(0, len(fanart) - 1)]].encode("utf-8")
                
                item.SetProperty("fanart", str(art))

            count = 5
            while count > 0:
                if window != common.get_window_id(special):
                    return
                time.sleep(2)
                count = count - 1
 def onInit(self):
     if not self.tvshow:
         self.close()
         return
     homewindow.setProperty("movie.ImageColor", self.tvshow["general"]["ImageColor"])
     self.windowid = xbmcgui.getCurrentWindowDialogId()
     self.window = xbmcgui.Window(self.windowid)
     passDictToSkin(self.tvshow["general"], "movie.", False, False, self.windowid)
     self.window.setProperty("tmdb_logged_in", checkLogin())
     self.window.setProperty("type", "tvshow")
     self.getControl(1000).addItems(create_listitems(self.tvshow["actors"], 0))
     xbmc.sleep(200)
     prettyprint(self.tvshow["certifications"])
     self.getControl(150).addItems(create_listitems(self.tvshow["similar"], 0))
     self.getControl(250).addItems(create_listitems(self.tvshow["seasons"], 0))
     self.getControl(550).addItems(create_listitems(self.tvshow["studios"], 0))
     self.getControl(1450).addItems(create_listitems(self.tvshow["networks"], 0))
     self.getControl(650).addItems(create_listitems(self.tvshow["certifications"], 0))
     self.getControl(750).addItems(create_listitems(self.tvshow["crew"], 0))
     self.getControl(850).addItems(create_listitems(self.tvshow["genres"], 0))
     self.getControl(950).addItems(create_listitems(self.tvshow["keywords"], 0))
     self.getControl(1150).addItems(create_listitems(self.tvshow["videos"], 0))
     self.getControl(350).addItems(create_listitems(self.youtube_vids, 0))
     self.getControl(1250).addItems(create_listitems(self.tvshow["images"], 0))
     self.getControl(1350).addItems(create_listitems(self.tvshow["backdrops"], 0))
     self.UpdateStates(False)
Example #28
0
def getLogging():
    xbmc.log('LOOOK')
    xbmc.log(
        str(
            xbmcvfs.listdir(
                "plugin://plugin.video.joyn/?block_id&channel_id&channel_path&client_data&compilation_id&fav_type&mode=channels&movie_id&season_id&stream_type=LIVE&title=Live%20TV&tv_show_id&video_id&viewtype"
            )))
    xbmc.log('1')
    xbmc.log(xbmc.translatePath(xbmc.getInfoLabel('Player.Filenameandpath')))
    if (xbmc.Player().isPlayingVideo()):
        xbmc.log(xbmc.Player().getVideoInfoTag().getMediaType())
    xbmc.log('2')
    xbmc.log(xbmc.getInfoLabel('Container.FolderPath'))
    xbmc.log('3')
    xbmc.log(xbmc.getInfoLabel('Container.FolderName'))
    xbmc.log('4')
    xbmc.log(xbmc.getInfoLabel('Container.CurrentItem'))
    xbmc.log('5')
    xbmc.log(xbmc.getInfoLabel('Player.Filenameandpath'))
    xbmc.log('6')
    xbmc.log(xbmc.getInfoLabel('Player.Folderpath'))
    xbmc.log('7')
    xbmc.log(xbmc.getInfoLabel('Player.Filename'))
    xbmc.log('8')
    xbmc.log(xbmc.getInfoLabel('Player.Title'))
    xbmc.log('9')
    xbmc.log(xbmc.getInfoLabel('VideoPlayer.Title'))
    xbmc.log('10')
    xbmc.log(xbmc.getInfoLabel('VideoPlayer.DBID'))
    xbmc.log('window id')
    xbmc.log(str(xbmcgui.getCurrentWindowId()))
    xbmc.log(str(xbmcgui.getCurrentWindowDialogId()))
    xbmc.log('EEEEEND')
Example #29
0
 def onInit(self):
     self.winid = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
     self.winid.setProperty('earth_animation', ANIMATION)
     self.winid.setProperty('earth_time', TIME)
     self.PanelItems = self.getControl(101)
     self.PanelItems.addItems(list(self.prepareImages(self.earthView)))
     self.startRotation()
Example #30
0
    def setWindowProperties( self, nokill=False ):
        win = None
        if self.dlInBackground and self.baseProperty:
            try:
                winID = self.winID or xbmcgui.getCurrentWindowDialogId()
                win = xbmcgui.Window( winID )
                #print "win = xbmcgui.Window(%s)" % str( winID )
            except: pass
        if win is not None:
            if not nokill and win.getProperty( self.baseProperty + "isAlive" ) == "kill":
                return True

            [ win.setProperty( self.baseProperty + k, v ) for k, v in ( ( "isAlive", "true" ),
                ( "heading", self.heading ),
                ( "url", self.url ),
                ( "filename", self.base_name ),
                ( "destination", self.destination ),
                ( "kbps", self.kbps ),
                ( "percent", "%i" % self.percent ),
                ( "currentSize", self.currentSize ),
                ( "totalSize", self.totalSize ),
                ( "elapsedTime", self.elapsedTime ),
                ( "estimatedTimeLeft", self.estimatedTimeLeft ),
                ( "estimatedTotalTime", self.estimatedTotalTime ) )
                ]
            try: win.getControl( self.winControlID ).setPercent( int( self.percent ) )
            except: pass
Example #31
0
    def checkWindow(self,newN):
        winID = xbmcgui.getCurrentWindowId()
        dialogID = xbmcgui.getCurrentWindowDialogId()
        if dialogID != 9999: winID = dialogID
        if winID == self.winID: return newN
        self.winID = winID
        self.updateWindowReader()
        if util.DEBUG:
            util.DEBUG_LOG('Window ID: {0} Handler: {1} File: {2}'.format(winID,self.windowReader.ID,xbmc.getInfoLabel('Window.Property(xmlfile)')))

        name = self.windowReader.getName()
        if name:
            self.sayText(u'{0}: {1}'.format(T(32105),name),interrupt=not newN)
            self.insertPause()
        else:
            self.sayText(u' ',interrupt=not newN)

        heading = self.windowReader.getHeading()
        if heading:
            self.sayText(heading)
            self.insertPause()

        texts = self.windowReader.getWindowTexts()
        if texts:
            self.insertPause()
            for t in texts:
                self.sayText(t)
                self.insertPause()
        return True
 def _get_vars(self):
     # get the screensaver window id
     self.winid = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
     # init the monitor class to catch onscreensaverdeactivated calls
     self.Monitor = MyMonitor(action=self._exit)
     self.stop = False
     self.startup = True
Example #33
0
def grab_random_fanart(controlNum, special):
    global fanart

    get_fanart_list(True)
    if len(fanart) == 0:
        return

    # sometimes the list control isn't available yet onload
    # so add some checking to make sure
    control = common.get_list(controlNum, special)
    count = 10
    while control == "" and count > 0:
        time.sleep(0.25)
        control = common.get_list(controlNum, special)
        count = count - 1

    window = common.get_window_id(special)
    if control == "":
        pass
    else:
        item = control.GetItem(0)
        while 1:
            if xbmcgui.getCurrentWindowDialogId() == 9999:
                art = fanart[fanart.keys()[randint(0,
                                                   len(fanart) -
                                                   1)]].encode("utf-8")

                item.SetProperty("fanart", str(art))

            count = 5
            while count > 0:
                if window != common.get_window_id(special):
                    return
                time.sleep(2)
                count = count - 1
Example #34
0
    def __init__(self):
        params = self.get_params()
        if params:
            color_picker = cp.ColorPicker(
                "script-skin_helper_service-ColorPicker.xml", ADDON_PATH,
                "Default", "1080i")
            color_picker.skinstring = params.get("SKINSTRING", "")
            color_picker.win_property = params.get("WINPROPERTY", "")
            color_picker.active_palette = params.get("PALETTE", "")
            color_picker.header_label = params.get("HEADER", "")
            propname = params.get("SHORTCUTPROPERTY", "")
            color_picker.shortcut_property = propname
            color_picker.doModal()

            #special action when we want to set our chosen color into a skinshortcuts property
            if propname and not isinstance(color_picker.result, int):
                self.wait_for_skinshortcuts_window()
                xbmc.sleep(400)
                current_window = xbmcgui.Window(
                    xbmcgui.getCurrentWindowDialogId())
                current_window.setProperty("customProperty", propname)
                current_window.setProperty("customValue",
                                           color_picker.result[0])
                xbmc.executebuiltin("SendClick(404)")
                xbmc.sleep(250)
                current_window.setProperty("customProperty",
                                           "%s.name" % propname)
                current_window.setProperty("customValue",
                                           color_picker.result[1])
                xbmc.executebuiltin("SendClick(404)")
            del color_picker
Example #35
0
    def __init__(self):
        params = self.get_params()
        if params:
            color_picker = cp.ColorPicker("script-skin_helper_service-ColorPicker.xml", ADDON_PATH, "Default", "1080i")
            color_picker.skinstring = params.get("SKINSTRING","")
            color_picker.win_property = params.get("WINPROPERTY","")
            color_picker.active_palette = params.get("PALETTE","")
            color_picker.header_label = params.get("HEADER","")
            propname = params.get("SHORTCUTPROPERTY","")
            color_picker.shortcut_property = propname
            color_picker.doModal()

            #special action when we want to set our chosen color into a skinshortcuts property
            if propname and not isinstance(color_picker.result, int):
                wait_for_skinshortcuts_window()
                xbmc.sleep(400)
                current_window = xbmcgui.Window( xbmcgui.getCurrentWindowDialogId() )
                current_window.setProperty("customProperty", propname)
                current_window.setProperty("customValue",color_picker.result[0])
                xbmc.executebuiltin("SendClick(404)")
                xbmc.sleep(250)
                current_window.setProperty("customProperty", "%s.name" %propname)
                current_window.setProperty("customValue",color_picker.result[1])
                xbmc.executebuiltin("SendClick(404)")
            del color_picker
Example #36
0
File: dialog.py Project: menn0/XBMC
	def onInit(self):		
		win = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
		
		self.listControl = self.getControl(LIST_ITEM_CONTROL_ID)
		self.listControl.reset()

		# asynchronous initialization
		if self.__dict__.get('_async_init'):
			result = {}
			kwargs = self._async_init.get('kwargs', {})
			kwargs['result'] = result
			try:
				self._async_init['method'](**kwargs)	# method(result=result, +kwargs)
			except (AuthenticationError, ListEmptyException) as e:
				self.close()
				return
				
			self.data.update(result['result'])

		# exception of incoming data format
		if self.data.has_key('episodes'):
			self.data['items'] = self.data['episodes']
			first_episode = self.data['items'][0]
			self.data['tvshow_name'] = first_episode['tvshow_name']
			self.data['_categoryName'] = self.data['tvshow_name'] + ' - Season ' + first_episode['season_number']
			
		win.setProperty('ContainerCategory', self.data.get('_categoryName', ''))
		
		self.updateItems()
Example #37
0
    def startService(self):
        log('startService')
        self.checkSettings()
        while not self.myMonitor.abortRequested():
            for user in self.userList:
                # Don't run while pending changes and wait two seconds between each chkfeed.
                if self.myMonitor.pendingChange == True or self.myMonitor.waitForAbort(2) == True: 
                    log('startService, waitForAbort/pendingChange')
                    continue
                                    
                # Don't run while playing.
                if xbmc.Player().isPlayingVideo() == True and self.ignore == True:
                    log('startService, ignore during playback')
                    continue

                # Don't run while setting menu is opened.
                if xbmcgui.getCurrentWindowDialogId() in [10140,10103]:
                    log('startService, settings dialog opened')
                    continue

                self.chkFEED(user)
                
            if self.myMonitor.pendingChange == True or self.myMonitor.waitForAbort(self.wait) == True:
                log('startService, waitForAbort/pendingChange')
                break

        if self.myMonitor.pendingChange == True:
            xbmc.executebuiltin("Notification(%s, %s, %d, %s)" % (ADDON_NAME, LANGUAGE(30012), 4000, ICON))
            self.restartService()
    def run(self):
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
        client_do = 'client_wait'
        self.window.setProperty('clientIsRunning', 'True')
        while not client_do == 'client_stop':
            if self.window.getProperty('clientIsRunning') == "True":
                client_run = self.check_queue()
                if client_run:
                    client_do = client_run

                if client_do == 'client_stop':
                    addon_log('Got Notification: client_stop')
                    self.window.setProperty('clientIsRunning', '')
                elif client_do == 'client_wait':
                    addon_log('ChatSuperMiltonIsRunning: clientIsWaiting')
                    time.sleep(0.5)
                else:
                    msg = self.get_message()
                    if msg:
                        # adjust the chatmessage delay here
                        time.sleep(1.0)
                    else:
                        time.sleep(0.2)
            else:
                break
        return
Example #39
0
    def _set_repo_info(self,
                       name="",
                       description="",
                       creator="",
                       type="",
                       version="",
                       icon=""):
        # grab the window
        wId = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())

        # set our info
        wId.setProperty("Addon.Name", name)
        if version:
            wId.setProperty("Addon.Version", version)
        wId.setProperty("Addon.Description", description)
        wId.setProperty("Addon.Type",
                        type)  #TODO: create localized string base on the type
        wId.setProperty("Addon.Creator", creator)
        #wId.setProperty( "Addon.Disclaimer", "")
        #wId.setProperty( "Addon.Changelog", "")
        #wId.setProperty( "Addon.ID", "")
        #wId.setProperty( "Addon.Status", "Stable")
        #wId.setProperty( "Addon.Broken", "Stable")
        #wId.setProperty( "Addon.Path","")
        wId.setProperty("Addon.Icon", icon)
    def onInit(self):
        """Called after initialization, get all colors and build the listing"""
        if KODI_VERSION < 18:
            xbmc.executebuiltin("ActivateWindow(busydialog)")
        else:
            xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
        self.current_window = xbmcgui.Window(
            xbmcgui.getCurrentWindowDialogId())
        self.colors_list = self.getControl(3110)
        # set header_label
        try:
            self.getControl(1).setLabel(self.header_label)
        except Exception:
            pass

        # get current color that is stored in the skin setting
        curvalue = ""
        curvalue_name = ""
        if self.skinstring:
            curvalue = xbmc.getInfoLabel("Skin.String(%s)" % self.skinstring)
            curvalue_name = xbmc.getInfoLabel("Skin.String(%s.name)" %
                                              self.skinstring)
        if self.win_property:
            curvalue = WINDOW.getProperty(self.win_property)
            curvalue_name = xbmc.getInfoLabel('%s.name)' % self.win_property)
        if curvalue:
            self.current_window.setProperty("colorstring", curvalue)
            if curvalue != curvalue_name:
                self.current_window.setProperty("colorname", curvalue_name)
            self.current_window.setProperty("current.colorstring", curvalue)
            if curvalue != curvalue_name:
                self.current_window.setProperty("current.colorname",
                                                curvalue_name)

        # load colors in the list
        self.load_colors_palette(self.active_palette)

        # focus the current color
        if self.current_window.getProperty("colorstring"):
            self.current_window.setFocusId(3010)
        else:
            # no color setup so we just focus the colorslist
            self.current_window.setFocusId(3110)
            self.colors_list.selectItem(0)
            self.current_window.setProperty(
                "colorstring",
                self.colors_list.getSelectedItem().getProperty("colorstring"))
            self.current_window.setProperty(
                "colorname",
                self.colors_list.getSelectedItem().getLabel())

        # set opacity slider
        if self.current_window.getProperty("colorstring"):
            self.set_opacity_slider()

        if KODI_VERSION < 18:
            xbmc.executebuiltin("Dialog.Close(busydialog)")
        else:
            xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
Example #41
0
    def onInit(self):
        self._winID = xbmcgui.getCurrentWindowDialogId()
        if self.started:
            self.onReInit()

        else:
            self.started = True
            self.onFirstInit()
Example #42
0
	def onInit(self):
		window = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
		window.setProperty('caption',self.caption)
		items = []
		for i in self.select:
			items.append(xbmcgui.ListItem(i))
		self.getControl(111).addItems(items)
		self.setFocusId(111)
Example #43
0
 def onInit(self):
     self._winID = xbmcgui.getCurrentWindowDialogId()
     BaseFunctions.lastWinID = self._winID
     if self.started:
         self.onReInit()
     else:
         self.started = True
         self.onFirstInit()
Example #44
0
    def onInit(self):
        self._winID = xbmcgui.getCurrentWindowDialogId()
        if self.started:
            self.onReInit()

        else:
            self.started = True
            self.onFirstInit()
Example #45
0
    def checkWindowID(self):
        current_dialog_id = getCurrentWindowDialogId()
        current_window_id = getCurrentWindowId()

        for window_id in self._preview_disabled_window_id:
            if current_window_id == window_id or current_dialog_id == window_id:
                return True
        return False
    def checkWindowID(self):
        current_dialog_id = getCurrentWindowDialogId()
        current_window_id = getCurrentWindowId()

        for window_id in self._preview_disabled_window_id:
            if current_window_id == window_id or current_dialog_id == window_id:
                return True
        return False
Example #47
0
 def serviceStart(self): 
     self.loadMySchedule()
     while not self.myMonitor.abortRequested():
         if getProperty('MONITOR_INFOLABEL') == "True": getInfoLabel() #requires high sample rate
         elif self.myMonitor.waitForAbort(5): break
         elif xbmcgui.getCurrentWindowDialogId() == 10140: continue
         elif getProperty('CONFIG_OPEN') == "True" or self.myMonitor.pendingChange == True: continue #don't run during change
         else: schedule.run_pending()
 def onInit(self):
     try:
         self.getControl(401).addLabel(self.msg1)
         self.getControl(402).addLabel(self.msg2)
     except AttributeError:
         self.getControl(401).setLabel(self.msg1)
         self.getControl(402).setLabel(self.msg2)
     externalWindowObj = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
     externalWindowObj.setProperty('TTS.READER', 'keymapkeyinput')
Example #49
0
    def onInit(self):
        # get addon settings
        self.winid   = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
        self._get_settings()
        self._set_prop('path', self.slideshow_path)
        log('qlock image path: %s' % self.slideshow_path)

        while (not xbmc.abortRequested) and (not self.stop):
            xbmc.sleep(1000)
Example #50
0
def grab_fanart_list(listNum, special):
    global fanart_changed
    
    get_fanart_list()
    
    # sometimes the list control isn't available yet onload
    # so add some checking to make sure
    lst = common.get_list(listNum, special)
    count = 10
    while lst == "" and count > 0:
        time.sleep(0.25)
        lst = common.get_list(listNum, special)
        count = count - 1

    window = common.get_window_id(special)
    if lst == "":
        pass
    else:
        # as long as the list exists (while the window exists)
        # the list gets updated at regular intervals. otherwise
        # the fanart disappears when you change sort-orders or
        # select a genre
        # should have very little overhead because all the values
        # get cached in memory
        focusedItem = ""
        while 1:

            # don't spend any time doing stuff if a dialog is open
            # 9999 is the dialog number when no dialogs are open
            # if special == True then the scanning is happening in
            # a dialog so we DO continue processing
            if xbmcgui.getCurrentWindowDialogId() == 9999 or special:
                newFocusedItem = mc.GetInfoString("Container(%s).ListItem.Label" % listNum)
                newFocusedItem = str(newFocusedItem)
            
                if newFocusedItem != focusedItem and newFocusedItem != "":

                    lst = common.get_list(listNum, special)
                    if lst != "":
                        items = lst.GetItems()
                        if len(items) > 0:
                            for item in items:
                                grab_fanart_for_item(item)
                            focusedItem = newFocusedItem
                    
                        del items
                
            if window != common.get_window_id(special):
                return
            
            time.sleep(2)
            
            # store the fanart list for next time if the list
            # was modified
            if fanart_changed == 1:
                store_fanart_list()
 def onInit(self):
     windowid = xbmcgui.getCurrentWindowDialogId()
     xbmcgui.Window(windowid).setProperty("tmdb_logged_in", self.logged_in)
     passDictToSkin(self.season["general"], "movie.", False, False, windowid)
     self.getControl(50).addItems(CreateListItems(self.season["actors"], 0))
     self.getControl(350).addItems(CreateListItems(self.youtube_vids, 0))
     self.getControl(750).addItems(CreateListItems(self.season["crew"], 0))
     self.getControl(1150).addItems(CreateListItems(self.season["videos"], 0))
     self.getControl(1250).addItems(CreateListItems(self.season["images"], 0))
     self.getControl(1350).addItems(CreateListItems(self.season["backdrops"], 0))
 def onInit(self):
     windowid = xbmcgui.getCurrentWindowDialogId()
     passDictToSkin(self.person["general"], "actor.", False, False, windowid)
     self.getControl(150).addItems(CreateListItems(self.person["movie_roles"], 0))
     self.getControl(250).addItems(CreateListItems(self.person["tvshow_roles"], 0))
     self.getControl(350).addItems(CreateListItems(self.youtube_vids, 0))
     self.getControl(450).addItems(CreateListItems(self.person["images"], 0))
     self.getControl(550).addItems(CreateListItems(self.person["movie_crew_roles"], 0))
     self.getControl(650).addItems(CreateListItems(self.person["tvshow_crew_roles"], 0))
     self.getControl(750).addItems(CreateListItems(self.person["tagged_images"], 0))
    def onInit(self):
        self.action_exitkeys_id = [10, 13]
        xbmc.executebuiltin( "ActivateWindow(busydialog)" )
        self.currentWindow = xbmcgui.Window( xbmcgui.getCurrentWindowDialogId() )
        
        self.colorsList = self.getControl(3110)
        self.win = xbmcgui.Window( 10000 )
        
        #get current color that is stored in the skin setting
        if self.skinString:
            self.currentWindow.setProperty("colorstring", xbmc.getInfoLabel("Skin.String(" + self.skinString + ')'))
            self.currentWindow.setProperty("colorname", xbmc.getInfoLabel("Skin.String(" + self.skinString + '.name)'))
        
        #get all colors from the colors xml file and fill a list with tuples to sort later on
        allColors = []
        colors_file = os.path.join(ADDON_PATH, 'resources', 'colors','colors.xml' ).decode("utf-8")
        #prefer skin colors file
        if xbmcvfs.exists( "special://skin/extras/colors/colors.xml" ):
            colors_file = xbmc.translatePath("special://skin/extras/colors/colors.xml").decode("utf-8")
            self.colorsPath = xbmc.translatePath("special://skin/extras/colors/").decode("utf-8")
        
        if xbmcvfs.exists( colors_file ):
            doc = parse( colors_file )
            listing = doc.documentElement.getElementsByTagName( 'color' )
            for count, color in enumerate(listing):
                name = color.attributes[ 'name' ].nodeValue.lower()
                colorstring = color.childNodes [ 0 ].nodeValue.lower()
                allColors.append((name,colorstring))
                
        #sort list and fill the panel
        count = 0
        selectItem = 0
        allColors = sorted(allColors,key=itemgetter(1))
        colorstring = self.currentWindow.getProperty("colorstring")
        colorname = self.currentWindow.getProperty("colorname")
        for color in allColors:
            self.addColorToList(color[0], color[1])
            if (colorname == color[0] or colorstring == color[1]):
                selectItem = count
            count += 1

        #focus the current color
        if self.currentWindow.getProperty("colorstring"):
            #user has setup a manual color so focus the manual button
            self.currentWindow.setFocusId(3010)
        else:
            #no color setup so we just focus the colorslist
            self.currentWindow.setFocusId(3110)
            self.colorsList.selectItem(selectItem)
        
        #set opacity slider
        if self.currentWindow.getProperty("colorstring"):
            self.setOpacitySlider()
        
        xbmc.executebuiltin( "Dialog.Close(busydialog)" )
Example #54
0
 def background_task(self):
     xbmc.sleep(1000)
     while not xbmc.abortRequested and self.active:
         if self.hide_progress:
             active_window = xbmcgui.getCurrentWindowDialogId()
             if active_window in [10101, 10151]:
                 xbmc.executebuiltin("Dialog.Close(%d, true)" % active_window)
         if self.hide_info:
             if xbmc.getCondVisibility("Window.IsActive(infodialog)"):
                 xbmc.executebuiltin('Dialog.Close(infodialog, true)')
         xbmc.sleep(100)
 def onInit(self):
     HOME.setProperty("WindowColor", self.color)
     self.windowid = xbmcgui.getCurrentWindowDialogId()
     self.window = xbmcgui.Window(self.windowid)
     self.window.setProperty("WindowColor", self.color)
     self.update_ui()
     xbmc.sleep(200)
     if self.totalitems > 0:
         xbmc.executebuiltin("SetFocus(500)")
     else:
         xbmc.executebuiltin("SetFocus(6000)")
Example #56
0
    def onInit(self):
        self.window = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
        if addon.getSetting('coach_lite') == 'true':
            self.window.setProperty('coach_lite', 'true')

        self.playsList = self.window.getControl(110)
        self.window.getControl(99).setLabel(language(30032))
        self.playsList.addItems(self.playsItems)
        self.setFocus(self.playsList)
        url = self.playsList.getListItem(0).getProperty('url')
        xbmc.executebuiltin('PlayMedia(%s,False,1)' %url)
Example #57
0
 def cleanWindowProperties( self ):
     if self.baseProperty and hasattr( xbmcgui, 'Window' ):
         try:
             winID = self.winID or xbmcgui.getCurrentWindowDialogId()
             win = xbmcgui.Window( winID )
             [ win.clearProperty( self.baseProperty + k ) for k in [ "isAlive", "heading", "url", "filename", "destination",
                 "kbps", "percent", "currentSize", "totalSize", "elapsedTime", "estimatedTimeLeft", "estimatedTotalTime" ]
                 ]
         except ValueError: pass#Window id does not exist
         except:
             print_exc()
Example #58
0
 def _parse_argv(self):
     args = sys.argv
     for arg in args:
         arg = arg.replace("'\"","").replace("\"'","")
         log(arg)
         if arg == 'script.toolbox':
             continue
         elif arg.startswith('info='):
             self.infos.append(arg[5:])
         elif arg.startswith('id='):
             self.id = RemoveQuotes(arg[3:])
         elif arg.startswith('dbid='):
             self.dbid = int(arg[5:])
         elif arg.startswith('daemon='):
             self.daemon = True
         elif arg.startswith('resume='):
             self.resume = arg[7:]
         elif arg.startswith('prefix='):
             self.prefix = arg[7:]
             if not self.prefix.endswith("."):
                 self.prefix = self.prefix + "."
         elif arg.startswith('header='):
             self.header = arg[7:]
         elif arg.startswith('text='):
             self.text = arg[5:]
         elif arg.startswith('yeslabel='):
             self.yeslabel = arg[9:]
         elif arg.startswith('nolabel='):
             self.nolabel = arg[8:]
         elif arg.startswith('yesaction='):
             self.yesaction = arg[10:]
         elif arg.startswith('noaction='):
             self.noaction = arg[9:]
         elif arg.startswith('icon='):
             self.icon = arg[5:]
         elif arg.startswith('radius='):
             self.radius = int(arg[7:])
         elif arg.startswith('sound='):
             if "false" in arg or "False" in arg:
                 self.sound = False
         elif arg.startswith('time='):
             self.time = int(arg[5:])
         elif arg.startswith('window='):
             if arg[7:] == "currentdialog":
                 xbmc.sleep(300)
                 self.window = xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
             elif arg[7:] == "current":
                 xbmc.sleep(300)
                 self.window = xbmcgui.Window(xbmcgui.getCurrentWindowId())
             else:
                 self.window = xbmcgui.Window(int(arg[7:]))
         elif arg.startswith('control='):
             self.control = int(arg[8:])
Example #59
0
 def _set_repo_info( self, name="", description="", creator="", type="", version="", icon="" ):
     # grab the window
     wId = xbmcgui.Window( xbmcgui.getCurrentWindowDialogId() )
     
     # set our info
     wId.setProperty( "Name", name )
     wId.setProperty( "Description", description )
     wId.setProperty( "Creator", creator )
     wId.setProperty( "Type", type )
     if version:
         wId.setProperty( "Version", version )
     wId.setProperty( "Icon", icon )