当前位置: 首页>>代码示例>>Python>>正文


Python xbmcgui.getCurrentWindowId方法代码示例

本文整理汇总了Python中xbmcgui.getCurrentWindowId方法的典型用法代码示例。如果您正苦于以下问题:Python xbmcgui.getCurrentWindowId方法的具体用法?Python xbmcgui.getCurrentWindowId怎么用?Python xbmcgui.getCurrentWindowId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbmcgui的用法示例。


在下文中一共展示了xbmcgui.getCurrentWindowId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setupWindow

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def setupWindow(self):
        error = 0
        # get the id for the current 'active' window as an integer.
        # http://wiki.xbmc.org/index.php?title=Window_IDs
        try:
            currentWindowId = xbmcgui.getCurrentWindowId()
        except:
            currentWindowId = self.window

        if hasattr(currentWindowId, "__int__") and currentWindowId != self.windowId:
            self.removeControls()
            self.windowId = currentWindowId
            self.window = xbmcgui.Window(self.windowId)
            self.initialize()

        if not self.window or not hasattr(self.window, "addControl"):
            self.removeControls()
            error = 1
        if error:
            raise xbmcguiWindowError("xbmcgui.Window(%s)" % repr(currentWindowId))

        #self.window.setProperty("DialogDownloadProgress.IsAlive", "true") 
开发者ID:seppius-xbmc-repo,项目名称:ru,代码行数:24,代码来源:DialogDownloadProgress.py

示例2: onInit

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def onInit(self):
        xbmc.log("PostPlayInfo ->  onInit called",level=xbmc.LOGNOTICE)
        self.upNextControl = self.getControl(self.NEXTUP_LIST_ID)
        self.spoilersControl = self.getControl(self.SPOILERS_BUTTON_ID)
        self._winID = xbmcgui.getCurrentWindowId()
        playMode = self.addonSettings.getSetting("autoPlayMode")
        if playMode == "1":
            self.playAutomatically = False

        self.setInfo()
        self.setPreviousInfo()
        self.fillUpNext()
        self.prepareSpoilerButton()
        self.prepareStillWatching()
        self.startTimer()

        if self.item is not None:
            self.setFocusId(self.NEXT_BUTTON_ID)
        else:
            self.setFocusId(self.PREV_BUTTON_ID)

        xbmcgui.Window(10000).clearProperty("NextUpNotification.AutoPlayed")

        xbmc.log("PostPlayInfo ->  onInit completed",level=xbmc.LOGNOTICE) 
开发者ID:im85288,项目名称:service.nextup.notification,代码行数:26,代码来源:PostPlayInfo.py

示例3: get_cached_item

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def get_cached_item(self, cache_id):
        """Returns an item from the in memory cache

        Parameters
        ----------
        cache_id : :obj:`str`
            ID of the cache entry

        Returns
        -------
        mixed
            Contents of the requested cache item or none
        """
        ret = None
        current_window = xbmcgui.getCurrentWindowId()
        window = xbmcgui.Window(current_window)
        try:
            cached_items = pickle.loads(window.getProperty('memcache').encode('latin-1'))
            ret = cached_items.get(cache_id)
        except (EOFError, UnicodeDecodeError) as e:
            self.nx_common.log(msg='memcache: get_cached_items failed' + str(e))
            ret = None
        return ret 
开发者ID:asciidisco,项目名称:plugin.video.netflix,代码行数:25,代码来源:KodiHelper.py

示例4: run

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def run(uris, title):
    init_run()

    time.sleep(1)
    cwnd = xbmcgui.getCurrentWindowId()
    
    uri = uris
    uril = uris.split('@')
    titles = []
    for item in uril:
        titles.append(get_addon_id(item))
        
    if (SUPPORT_US == "true") and (title) and (cwnd != 10000):
            titles.append("Search with United Search ...")  
            uril.append("plugin://plugin.video.united.search/?action=search&keyword={0}".format(title))
        
    ret = 0
    if len(uril) > 0:
        if len(uril) > 1:
            ret = xbmcgui.Dialog().select("Select source", titles)
        if ret >= 0:
            uri = uril[ret]
        else:
            return
    else:
        return

    playable = ('#' == uri[0])
    uri = uri.replace('#', '')
    if (playable == True):
        run_as_content(uri)
    else: 
        if (cwnd == 10000): 
            xbmc.executebuiltin("ActivateWindow({0}, {1})".format("videos", uri))
        else:
            xbmc.executebuiltin("Container.Update({0})".format(uri))
    time.sleep(0.1) 
开发者ID:dandygithub,项目名称:kodi,代码行数:39,代码来源:default.py

示例5: onInit

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def onInit(self):
        self._winID = xbmcgui.getCurrentWindowId() 
开发者ID:elbowz,项目名称:xbmc.service.pushbullet,代码行数:4,代码来源:gui.py

示例6: focus

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def focus(i):

    #TODO find way to check this has worked (clist.getSelectedPosition returns -1)
    xbmc.sleep(int(plugin.get_setting('scroll.ms') or "0"))
    #TODO deal with hidden ..
    win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
    cid = win.getFocusId()
    if cid:
        clist = win.getControl(cid)
        if clist:
            try: clist.selectItem(i)
            except: pass 
开发者ID:primaeval,项目名称:plugin.video.iptv.recorder,代码行数:14,代码来源:main.py

示例7: get_current_window_id

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def get_current_window_id():
        import xbmcgui
        return xbmcgui.getCurrentWindowId() 
开发者ID:cguZZman,项目名称:script.module.clouddrive.common,代码行数:5,代码来源:utils.py

示例8: __init__

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def __init__(self):
        self._addon = KodiUtils.get_addon()
        self._addonid = self._addon.getAddonInfo('id')
        self._addon_name = self._addon.getAddonInfo('name')
        self._addon_url = sys.argv[0]
        self._addon_version = self._addon.getAddonInfo('version')
        self._common_addon_id = 'script.module.clouddrive.common'
        self._common_addon = KodiUtils.get_addon(self._common_addon_id)
        self._common_addon_version = self._common_addon.getAddonInfo('version')
        self._dialog = xbmcgui.Dialog()
        self._profile_path = Utils.unicode(KodiUtils.translate_path(self._addon.getAddonInfo('profile')))
        self._progress_dialog = DialogProgress(self._addon_name)
        self._progress_dialog_bg = DialogProgressBG(self._addon_name)
        self._export_progress_dialog_bg = DialogProgressBG(self._addon_name)
        self._system_monitor = KodiUtils.get_system_monitor()
        self._account_manager = AccountManager(self._profile_path)
        self._pin_dialog = None
        self.iskrypton = KodiUtils.get_home_property('iskrypton') == 'true'
        
        if len(sys.argv) > 1:
            self._addon_handle = int(sys.argv[1])
            self._addon_params = urlparse.parse_qs(sys.argv[2][1:])
            for param in self._addon_params:
                self._addon_params[param] = self._addon_params.get(param)[0]
            self._content_type = Utils.get_safe_value(self._addon_params, 'content_type')
            if not self._content_type:
                wid = xbmcgui.getCurrentWindowId()
                if wid == 10005 or wid == 10500 or wid == 10501 or wid == 10502:
                    self._content_type = 'audio'
                elif wid == 10002:
                    self._content_type = 'image'
                else:
                    self._content_type = 'video'
            xbmcplugin.addSortMethod(handle=self._addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL)
            xbmcplugin.addSortMethod(handle=self._addon_handle, sortMethod=xbmcplugin.SORT_METHOD_UNSORTED ) 
            xbmcplugin.addSortMethod(handle=self._addon_handle, sortMethod=xbmcplugin.SORT_METHOD_SIZE )
            xbmcplugin.addSortMethod(handle=self._addon_handle, sortMethod=xbmcplugin.SORT_METHOD_DATE )
            xbmcplugin.addSortMethod(handle=self._addon_handle, sortMethod=xbmcplugin.SORT_METHOD_DURATION ) 
开发者ID:cguZZman,项目名称:script.module.clouddrive.common,代码行数:40,代码来源:addon.py

示例9: list_accounts

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def list_accounts(self):
        accounts = self.get_accounts(with_format=True)
        listing = []
        for account_id in accounts:
            account = accounts[account_id]
            size = len(account['drives'])
            for drive in account['drives']:
                context_options = []
                params = {'action':'_search', 'content_type': self._content_type, 'driveid': drive['id']}
                cmd = 'ActivateWindow(%d,%s?%s)' % (xbmcgui.getCurrentWindowId(), self._addon_url, urllib.urlencode(params))
                context_options.append((self._common_addon.getLocalizedString(32039), cmd))
                params['action'] = '_remove_account'
                context_options.append((self._common_addon.getLocalizedString(32006), 'RunPlugin('+self._addon_url + '?' + urllib.urlencode(params)+')'))
                if size > 1:
                    params['action'] = '_remove_drive'
                    cmd =  'RunPlugin('+self._addon_url + '?' + urllib.urlencode(params)+')'
                    context_options.append((self._common_addon.getLocalizedString(32007), cmd))
                list_item = xbmcgui.ListItem(drive['display_name'])
                list_item.addContextMenuItems(context_options)
                params = {'action':'_list_drive', 'content_type': self._content_type, 'driveid': drive['id']}
                url = self._addon_url + '?' + urllib.urlencode(params)
                listing.append((url, list_item, True))
        list_item = xbmcgui.ListItem(self._common_addon.getLocalizedString(32005))
        params = {'action':'_add_account', 'content_type': self._content_type}
        url = self._addon_url + '?' + urllib.urlencode(params)
        listing.append((url, list_item))
        xbmcplugin.addDirectoryItems(self._addon_handle, listing, len(listing))
        xbmcplugin.endOfDirectory(self._addon_handle, True) 
开发者ID:cguZZman,项目名称:script.module.clouddrive.common,代码行数:30,代码来源:addon.py

示例10: onPlayBackStarted

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def onPlayBackStarted(self):
        pass
        LogToXBMC('%s %s %s' % (xbmcgui.getCurrentWindowId(), self.amalker, self.getPlayingFile()))
        if not self.amalker and self.winmode:
            self.parent.player.show()
            pass
        elif self.amalker:
            pass
            LogToXBMC('SHOW ADS Window')
            self.parent.amalkerWnd.show()
            LogToXBMC('END SHOW ADS Window') 
开发者ID:seppius-xbmc-repo,项目名称:ru,代码行数:13,代码来源:ts.py

示例11: run

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def run(self):
        lastwindowid = xbmcgui.getCurrentWindowId()
        lastprofile = getProfileString()
        laststereomode = getStereoscopicMode()
        interval = self.interval
        firstloop = True
        starttime = time.time()
        while not self.abort_evt.is_set():

            self._checkIdle()

            newprofile = getProfileString()
            if newprofile != lastprofile:
                self.publish(Message(Topic('onProfileChange'), profilePath=newprofile))
                lastprofile = newprofile

            newstereomode = getStereoscopicMode()
            if newstereomode != laststereomode:
                self.publish(Message(Topic('onStereoModeChange'), stereoMode=newstereomode))
                laststereomode = newstereomode

            newwindowid = xbmcgui.getCurrentWindowId()
            if newwindowid != lastwindowid:
                if lastwindowid in self.closewindowsids.keys():
                    self.publish(Message(Topic('onWindowClose', self.closewindowsids[lastwindowid])))
                if newwindowid in self.openwindowids:
                    self.publish(Message(Topic('onWindowOpen', self.openwindowids[newwindowid])))
                lastwindowid = newwindowid

            if firstloop:
                endtime = time.time()
                interval = int(interval - (endtime - starttime) * 1000)
                interval = max(5, interval)
                firstloop = False
            xbmc.sleep(interval)
        del self.player 
开发者ID:KenV99,项目名称:script.service.kodi.callbacks,代码行数:38,代码来源:loop.py

示例12: setProperty

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def setProperty(self, key, value):

        if not self._winID:
            self._winID = xbmcgui.getCurrentWindowId()

        try:
            xbmcgui.Window(self._winID).setProperty(key, value)
            xbmcgui.WindowXML.setProperty(self, key, value)
        except:
            pass 
开发者ID:im85288,项目名称:service.nextup.notification,代码行数:12,代码来源:PostPlayInfo.py

示例13: checkWindowID

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
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


    # Function that determines if a preview is allowed to be shown considering the global state 
开发者ID:maikito26,项目名称:plugin.video.surveillanceroom,代码行数:13,代码来源:monitor.py

示例14: set_main_menu_selection

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def set_main_menu_selection(self, type):
        """Persist the chosen main menu entry in memory

        Parameters
        ----------
        type : :obj:`str`
            Selected menu item
        """
        current_window = xbmcgui.getCurrentWindowId()
        xbmcgui.Window(current_window).setProperty('main_menu_selection', type) 
开发者ID:asciidisco,项目名称:plugin.video.netflix,代码行数:12,代码来源:KodiHelper.py

示例15: get_main_menu_selection

# 需要导入模块: import xbmcgui [as 别名]
# 或者: from xbmcgui import getCurrentWindowId [as 别名]
def get_main_menu_selection(self):
        """Gets the persisted chosen main menu entry from memory

        Returns
        -------
        :obj:`str`
            The last chosen main menu entry
        """
        current_window = xbmcgui.getCurrentWindowId()
        window = xbmcgui.Window(current_window)
        return window.getProperty('main_menu_selection') 
开发者ID:asciidisco,项目名称:plugin.video.netflix,代码行数:13,代码来源:KodiHelper.py


注:本文中的xbmcgui.getCurrentWindowId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。