示例#1
0
def load():
    global _recentfiles
    if _recentfiles is not None:
        return
    _recentfiles = []

    urls = qsettings.get_url_list(QSettings(), "recent_files")
    for url in urls:
        if os.access(url.toLocalFile(), os.R_OK):
            _recentfiles.append(url)
    del _recentfiles[MAXLEN:]
    app.aboutToQuit.connect(save)
示例#2
0
def load():
    global _recentfiles
    if _recentfiles is not None:
        return
    _recentfiles = []
    
    urls = qsettings.get_url_list(QSettings(), "recent_files")
    for url in urls:
        if os.access(url.toLocalFile(), os.R_OK):
            _recentfiles.append(url)
    del _recentfiles[MAXLEN:]
    app.aboutToQuit.connect(save)
示例#3
0
def loadSession(name):
    """Loads the given session (without closing other docs first).
    
    Return the document that should become the active one.
    If None is returned, the session did not open any documents!
    
    """
    session = sessionGroup(name)
    urls = qsettings.get_url_list(session, "urls")
    active = session.value("active", -1, int)
    result = None
    docs = []
    for url in urls:
        try:
            doc = app.openUrl(url)
        except IOError:
            pass
        else:
            docs.append(doc)
    setCurrentSession(name)
    if docs:
        if active not in range(len(docs)):
            active = 0
        return docs[active]
示例#4
0
def loadSession(name):
    """Loads the given session (without closing other docs first).

    Return the document that should become the active one.
    If None is returned, the session did not open any documents!

    """
    session = sessionGroup(name)
    urls = qsettings.get_url_list(session, "urls")
    active = session.value("active", -1, int)
    result = None
    docs = []
    for url in urls:
        try:
            doc = app.openUrl(url)
        except IOError:
            pass
        else:
            docs.append(doc)
    setCurrentSession(name)
    if docs:
        if active not in range(len(docs)):
            active = 0
        return docs[active]