Exemple #1
0
def saveproject_msg(parent, url):
    """Save a project file and return status message."""
    title = _("Save LinkChecker project")
    func = QtGui.QFileDialog.getSaveFileName
    suggestedname = url_to_filename(url, ProjectExt)
    res = func(parent, title, suggestedname, ProjectFilter)
    if not res:
        # user canceled
        return _("Canceled saving a project file.")
    filename = unicode(res)
    d = dict(filename=filename)
    if not is_writable(filename):
        return _("Could not write project file %(filename)s.") % d
    user_config = get_user_config()
    if is_readable(user_config):
        # Copy user config to filename since this is the current
        # configuration.
        # This way it is not necessary to write the parent.config
        # dictionary back to a file.
        shutil.copy(user_config, filename)
        filter_comments = True
    else:
        # use default config (ie. do not write anything)
        filter_comments = False
    write_header(filename, filter_comments)
    parser = ProjectParser(parent.config, parent.options, parent.urlinput)
    with open(filename, 'a') as fp:
        parser.write(fp)
    return _("Project file %(filename)s saved successfully.") % d
def saveproject_msg(parent, url):
    """Save a project file and return status message."""
    title = _("Save LinkChecker project")
    func = QtGui.QFileDialog.getSaveFileName
    suggestedname = url_to_filename(url, ProjectExt)
    res = func(parent, title, suggestedname, ProjectFilter)
    if not res:
        # user canceled
        return _("Canceled saving a project file.")
    filename = unicode(res)
    d = dict(filename=filename)
    if not is_writable(filename):
        return _("Could not write project file %(filename)s.") % d
    user_config = get_user_config()
    if is_readable(user_config):
        # Copy user config to filename since this is the current
        # configuration.
        # This way it is not necessary to write the parent.config
        # dictionary back to a file.
        shutil.copy(user_config, filename)
        filter_comments = True
    else:
        # use default config (ie. do not write anything)
        filter_comments = False
    write_header(filename, filter_comments)
    parser = ProjectParser(parent.config, parent.options, parent.urlinput)
    with open(filename, 'a') as fp:
        parser.write(fp)
    return _("Project file %(filename)s saved successfully.") % d
 def reset(self):
     """Reset GUI and config options."""
     self.user_config = configuration.get_user_config()
     self.reset_gui_options()
     self.reset_config_options()
Exemple #4
0
 def reset (self):
     """Reset GUI and config options."""
     self.user_config = configuration.get_user_config()
     self.reset_gui_options()
     self.reset_config_options()