/usr/share/origami/gui/config.rb is in origami-pdf 2.0.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | =begin
This file is part of PDF Walker, a graphical PDF file browser
Copyright (C) 2016 Guillaume Delugré.
PDF Walker is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PDF Walker is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
=end
require 'origami'
require 'yaml'
module PDFWalker
class Walker < Window
class Config
DEFAULT_CONFIG_FILE = "#{File.expand_path("~")}/.pdfwalker.conf.yml"
DEFAULT_CONFIG =
{
"Debug" =>
{
"Profiling" => false,
"ProfilingOutputDir" => "prof",
"Verbosity" => Origami::Parser::VERBOSE_TRACE,
"IgnoreFileHeader" => true
},
"UI" =>
{
"LastOpenedDocuments" => []
}
}
NLOG_RECENT_FILES = 5
def initialize(configfile = DEFAULT_CONFIG_FILE)
begin
@conf = YAML.load(File.open(configfile)) or DEFAULT_CONFIG
rescue
ensure
@filename = configfile
set_missing_values
end
end
def last_opened_file(filepath)
@conf["UI"]['LastOpenedDocuments'].push(filepath).uniq!
@conf["UI"]['LastOpenedDocuments'].delete_at(0) while @conf["UI"]['LastOpenedDocuments'].size > NLOG_RECENT_FILES
save
end
def recent_files(n = NLOG_RECENT_FILES)
@conf["UI"]['LastOpenedDocuments'].last(n).reverse
end
def set_profiling(bool)
@conf["Debug"]['Profiling'] = bool
save
end
def profile?
@conf["Debug"]['Profiling']
end
def profile_output_dir
@conf["Debug"]['ProfilingOutputDir']
end
def set_ignore_header(bool)
@conf["Debug"]['IgnoreFileHeader'] = bool
save
end
def ignore_header?
@conf["Debug"]['IgnoreFileHeader']
end
def set_verbosity(level)
@conf["Debug"]['Verbosity'] = level
save
end
def verbosity
@conf["Debug"]['Verbosity']
end
def save
File.open(@filename, "w").write(@conf.to_yaml)
end
private
def set_missing_values
@conf ||= {}
DEFAULT_CONFIG.each_key do |cat|
@conf[cat] = {} unless @conf.include?(cat)
DEFAULT_CONFIG[cat].each_pair do |key, value|
@conf[cat][key] = value unless @conf[cat].include?(key)
end
end
end
end
end
end
|