| 1 | import ConfigParser |
|---|
| 2 | import traceback |
|---|
| 3 | import cStringIO as StringIO |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | import codecs |
|---|
| 8 | import wx |
|---|
| 9 | |
|---|
| 10 | from MiscEvent import MiscEventSourceMixin |
|---|
| 11 | from WikiExceptions import * |
|---|
| 12 | |
|---|
| 13 | from .SystemInfo import isUnicode |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | from .SystemInfo import isOSX, isLinux, isWin9x, isWinNT, isWindows |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | from StringOps import utf8Enc, utf8Dec, mbcsDec, strToBool |
|---|
| 21 | |
|---|
| 22 | Error = ConfigParser.Error |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | class UnknownOptionException(Exception): pass |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | def _setValue(section, option, value, config): |
|---|
| 30 | """ |
|---|
| 31 | if value is of type str, it is assumed to be mbcs-coded |
|---|
| 32 | if section or option are of type str, they are assumed to be utf8 coded |
|---|
| 33 | (it is recommended to use only ascii characters for section/option |
|---|
| 34 | names) |
|---|
| 35 | """ |
|---|
| 36 | if type(section) is unicode: |
|---|
| 37 | section = utf8Enc(section)[0] |
|---|
| 38 | |
|---|
| 39 | if type(option) is unicode: |
|---|
| 40 | option = utf8Enc(option)[0] |
|---|
| 41 | |
|---|
| 42 | if type(value) is str: |
|---|
| 43 | value = utf8Enc(mbcsDec(value)[0])[0] |
|---|
| 44 | elif type(value) is unicode: |
|---|
| 45 | value = utf8Enc(value)[0] |
|---|
| 46 | else: |
|---|
| 47 | value = utf8Enc(unicode(value))[0] |
|---|
| 48 | |
|---|
| 49 | if not config.has_section(section): |
|---|
| 50 | config.add_section(section) |
|---|
| 51 | |
|---|
| 52 | config.set(section, option, value) |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | def _fillWithDefaults(config, defaults): |
|---|
| 56 | for s, o in defaults.keys(): |
|---|
| 57 | if not config.has_option(s, o) and defaults[(s, o)] is not None: |
|---|
| 58 | _setValue(s, o, defaults[(s, o)], config) |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | class _AbstractConfiguration: |
|---|
| 63 | def get(self, section, option, default=None): |
|---|
| 64 | raise NotImplementedError |
|---|
| 65 | |
|---|
| 66 | def getint(self, section, option, default=None): |
|---|
| 67 | result = self.get(section, option) |
|---|
| 68 | if result is None: |
|---|
| 69 | return default |
|---|
| 70 | |
|---|
| 71 | try: |
|---|
| 72 | return int(result) |
|---|
| 73 | except ValueError: |
|---|
| 74 | |
|---|
| 75 | return default |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | def getfloat(self, section, option, default=None): |
|---|
| 79 | result = self.get(section, option) |
|---|
| 80 | if result is None: |
|---|
| 81 | return default |
|---|
| 82 | |
|---|
| 83 | try: |
|---|
| 84 | return float(result) |
|---|
| 85 | except ValueError: |
|---|
| 86 | |
|---|
| 87 | return default |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | def getboolean(self, section, option, default=None): |
|---|
| 91 | result = self.get(section, option) |
|---|
| 92 | if result is None: |
|---|
| 93 | return default |
|---|
| 94 | |
|---|
| 95 | return strToBool(result, False) |
|---|
| 96 | |
|---|
| 97 | def isUnicode(unself): |
|---|
| 98 | """ |
|---|
| 99 | Return if GUI is in unicode mode |
|---|
| 100 | """ |
|---|
| 101 | return isUnicode() |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | class SingleConfiguration(_AbstractConfiguration, MiscEventSourceMixin): |
|---|
| 106 | """ |
|---|
| 107 | Wraps a single ConfigParser object |
|---|
| 108 | """ |
|---|
| 109 | |
|---|
| 110 | def __init__(self, configdef, fallthroughDict=None): |
|---|
| 111 | """ |
|---|
| 112 | configdef -- Dictionary with defaults for configuration file |
|---|
| 113 | fallthroughDict -- Dictionary with settings for fallthrough mode |
|---|
| 114 | (only stored here, but processed by CombinedConfiguration) |
|---|
| 115 | """ |
|---|
| 116 | MiscEventSourceMixin.__init__(self) |
|---|
| 117 | |
|---|
| 118 | self.configParserObject = None |
|---|
| 119 | self.configPath = None |
|---|
| 120 | |
|---|
| 121 | self.configDefaults = configdef |
|---|
| 122 | |
|---|
| 123 | if fallthroughDict is None: |
|---|
| 124 | self.fallthroughDict = {} |
|---|
| 125 | else: |
|---|
| 126 | self.fallthroughDict = fallthroughDict |
|---|
| 127 | self.writeAccessDenied = False |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | def get(self, section, option, default=None): |
|---|
| 131 | """ |
|---|
| 132 | Return a configuration value returned as string/unicode which |
|---|
| 133 | is entered in given section and has specified option key. |
|---|
| 134 | """ |
|---|
| 135 | if type(section) is unicode: |
|---|
| 136 | section = utf8Enc(section)[0] |
|---|
| 137 | |
|---|
| 138 | if type(option) is unicode: |
|---|
| 139 | option = utf8Enc(option)[0] |
|---|
| 140 | |
|---|
| 141 | result = None |
|---|
| 142 | |
|---|
| 143 | if self.isOptionAllowed(section, option): |
|---|
| 144 | if self.configParserObject.has_option(section, option): |
|---|
| 145 | result = self.configParserObject.get(section, option) |
|---|
| 146 | else: |
|---|
| 147 | result = self.configDefaults[(section, option)] |
|---|
| 148 | else: |
|---|
| 149 | raise UnknownOptionException, _(u"Unknown option %s:%s") % (section, option) |
|---|
| 150 | |
|---|
| 151 | if result is None: |
|---|
| 152 | return default |
|---|
| 153 | |
|---|
| 154 | try: |
|---|
| 155 | result = utf8Dec(result)[0] |
|---|
| 156 | except UnicodeError: |
|---|
| 157 | |
|---|
| 158 | try: |
|---|
| 159 | result = mbcsDec(result)[0] |
|---|
| 160 | except UnicodeError: |
|---|
| 161 | |
|---|
| 162 | result = default |
|---|
| 163 | |
|---|
| 164 | return result |
|---|
| 165 | |
|---|
| 166 | def setWriteAccessDenied(self, flag): |
|---|
| 167 | self.writeAccessDenied = flag |
|---|
| 168 | |
|---|
| 169 | def getWriteAccessDenied(self): |
|---|
| 170 | return self.writeAccessDenied |
|---|
| 171 | |
|---|
| 172 | def isReadOnlyEffect(self): |
|---|
| 173 | return self.writeAccessDenied |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | def isOptionAllowed(self, section, option): |
|---|
| 177 | """ |
|---|
| 178 | The function test if an option is valid. |
|---|
| 179 | Only options can be set/retrieved which have an entry in the |
|---|
| 180 | defaults and if the configParserObject is valid. |
|---|
| 181 | """ |
|---|
| 182 | return self.configParserObject is not None and \ |
|---|
| 183 | self.configDefaults.has_key((section, option)) |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | def set(self, section, option, value): |
|---|
| 187 | if type(section) is unicode: |
|---|
| 188 | section = utf8Enc(section)[0] |
|---|
| 189 | |
|---|
| 190 | if type(option) is unicode: |
|---|
| 191 | option = utf8Enc(option)[0] |
|---|
| 192 | |
|---|
| 193 | if self.isOptionAllowed(section, option): |
|---|
| 194 | _setValue(section, option, value, self.configParserObject) |
|---|
| 195 | else: |
|---|
| 196 | raise UnknownOptionException, _(u"Unknown option %s:%s") % (section, option) |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | def fillWithDefaults(self): |
|---|
| 200 | _fillWithDefaults(self.configParserObject, self.configDefaults) |
|---|
| 201 | |
|---|
| 202 | |
|---|
| 203 | def setConfigParserObject(self, config, fn): |
|---|
| 204 | self.configParserObject = config |
|---|
| 205 | self.configPath = fn |
|---|
| 206 | |
|---|
| 207 | def getConfigParserObject(self): |
|---|
| 208 | return self.configParserObject |
|---|
| 209 | |
|---|
| 210 | def getConfigPath(self): |
|---|
| 211 | return self.configPath |
|---|
| 212 | |
|---|
| 213 | def loadConfig(self, fn): |
|---|
| 214 | if fn is None: |
|---|
| 215 | self.setConfigParserObject(None, None) |
|---|
| 216 | return |
|---|
| 217 | |
|---|
| 218 | config = ConfigParser.ConfigParser() |
|---|
| 219 | readFiles = config.read(fn) |
|---|
| 220 | if len(readFiles) > 0: |
|---|
| 221 | self.setConfigParserObject(config, fn) |
|---|
| 222 | else: |
|---|
| 223 | raise MissingConfigurationFileException(_(u"Config file not found")) |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | def createEmptyConfig(self, fn): |
|---|
| 227 | config = ConfigParser.ConfigParser() |
|---|
| 228 | self.setConfigParserObject(config, fn) |
|---|
| 229 | |
|---|
| 230 | def getFallthroughDict(self): |
|---|
| 231 | return self.fallthroughDict |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | def save(self): |
|---|
| 235 | """ |
|---|
| 236 | Save all configurations |
|---|
| 237 | """ |
|---|
| 238 | if self.isReadOnlyEffect(): |
|---|
| 239 | return |
|---|
| 240 | |
|---|
| 241 | if self.configParserObject: |
|---|
| 242 | sfile = StringIO.StringIO() |
|---|
| 243 | self.configParserObject.write(sfile) |
|---|
| 244 | configFile = open(self.configPath, 'w') |
|---|
| 245 | try: |
|---|
| 246 | self.configParserObject.write(configFile) |
|---|
| 247 | finally: |
|---|
| 248 | configFile.close() |
|---|
| 249 | |
|---|
| 250 | def informChanged(self, oldSettings): |
|---|
| 251 | """ |
|---|
| 252 | This should be called after configuration was changed to let |
|---|
| 253 | the object send out an event. |
|---|
| 254 | The set method does not send events automatically to prevent |
|---|
| 255 | the creation of many events (one per each set call) instead |
|---|
| 256 | of one at the end of changes |
|---|
| 257 | """ |
|---|
| 258 | self.fireMiscEventProps({"changed configuration": True, |
|---|
| 259 | "old config settings": oldSettings}) |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | class CombinedConfiguration(_AbstractConfiguration): |
|---|
| 264 | """ |
|---|
| 265 | Manages global and wiki specific configuration options. |
|---|
| 266 | Mainly wraps two SingleConfiguration instances |
|---|
| 267 | """ |
|---|
| 268 | |
|---|
| 269 | def __init__(self, globalconfig, wikiconfig): |
|---|
| 270 | """ |
|---|
| 271 | globalconfig -- SingleConfiguration object for global settings |
|---|
| 272 | wikiconfig -- Same for wiki settings |
|---|
| 273 | """ |
|---|
| 274 | self.globalConfig = globalconfig |
|---|
| 275 | self.wikiConfig = wikiconfig |
|---|
| 276 | |
|---|
| 277 | def get(self, section, option, default=None): |
|---|
| 278 | """ |
|---|
| 279 | Return a configuration value returned as string/unicode which |
|---|
| 280 | is entered in given section and has specified option key. |
|---|
| 281 | """ |
|---|
| 282 | if type(section) is unicode: |
|---|
| 283 | section = utf8Enc(section)[0] |
|---|
| 284 | |
|---|
| 285 | if type(option) is unicode: |
|---|
| 286 | option = utf8Enc(option)[0] |
|---|
| 287 | |
|---|
| 288 | result = None |
|---|
| 289 | |
|---|
| 290 | checkWiki = True |
|---|
| 291 | checkGlobal = True |
|---|
| 292 | |
|---|
| 293 | if option.startswith("option/wiki/"): |
|---|
| 294 | option = option[12:] |
|---|
| 295 | checkGlobal = False |
|---|
| 296 | elif option.startswith("option/user/"): |
|---|
| 297 | option = option[12:] |
|---|
| 298 | checkWiki = False |
|---|
| 299 | |
|---|
| 300 | if checkWiki: |
|---|
| 301 | if self.wikiConfig is not None and \ |
|---|
| 302 | self.wikiConfig.isOptionAllowed(section, option): |
|---|
| 303 | result = self.wikiConfig.get(section, option, default) |
|---|
| 304 | ftDict = self.wikiConfig.getFallthroughDict() |
|---|
| 305 | if not ftDict.has_key((section, option)) or \ |
|---|
| 306 | ftDict[(section, option)] != result: |
|---|
| 307 | checkGlobal = False |
|---|
| 308 | |
|---|
| 309 | |
|---|
| 310 | elif WIKIDEFAULTS.has_key((section, option)): |
|---|
| 311 | result = default |
|---|
| 312 | checkGlobal = False |
|---|
| 313 | elif not checkGlobal: |
|---|
| 314 | raise UnknownOptionException, _(u"Unknown option %s:%s") % (section, option) |
|---|
| 315 | |
|---|
| 316 | if checkGlobal: |
|---|
| 317 | if self.globalConfig is not None: |
|---|
| 318 | result = self.globalConfig.get(section, option, default) |
|---|
| 319 | else: |
|---|
| 320 | raise UnknownOptionException, _(u"Unknown option %s:%s") % (section, option) |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | if result is None: |
|---|
| 336 | return default |
|---|
| 337 | |
|---|
| 338 | return result |
|---|
| 339 | |
|---|
| 340 | |
|---|
| 341 | |
|---|
| 342 | def set(self, section, option, value): |
|---|
| 343 | if type(section) is unicode: |
|---|
| 344 | section = utf8Enc(section)[0] |
|---|
| 345 | |
|---|
| 346 | if type(option) is unicode: |
|---|
| 347 | option = utf8Enc(option)[0] |
|---|
| 348 | |
|---|
| 349 | if option.startswith("option/wiki/"): |
|---|
| 350 | option = option[12:] |
|---|
| 351 | self.wikiConfig.set(section, option, value) |
|---|
| 352 | elif option.startswith("option/user/"): |
|---|
| 353 | option = option[12:] |
|---|
| 354 | self.globalConfig.set(section, option, value) |
|---|
| 355 | elif self.wikiConfig is not None and \ |
|---|
| 356 | self.wikiConfig.getFallthroughDict().has_key((section, option)): |
|---|
| 357 | raise UnknownOptionException, _(u"Ambiguos option set %s:%s") % (section, option) |
|---|
| 358 | else: |
|---|
| 359 | if self.wikiConfig is not None and \ |
|---|
| 360 | self.wikiConfig.isOptionAllowed(section, option): |
|---|
| 361 | self.wikiConfig.set(section, option, value) |
|---|
| 362 | elif self.globalConfig is not None: |
|---|
| 363 | self.globalConfig.set(section, option, value) |
|---|
| 364 | else: |
|---|
| 365 | raise UnknownOptionException, _(u"Unknown option %s:%s") % (section, option) |
|---|
| 366 | |
|---|
| 367 | |
|---|
| 368 | |
|---|
| 369 | |
|---|
| 370 | |
|---|
| 371 | |
|---|
| 372 | |
|---|
| 373 | |
|---|
| 374 | |
|---|
| 375 | |
|---|
| 376 | |
|---|
| 377 | |
|---|
| 378 | def fillGlobalWithDefaults(self): |
|---|
| 379 | self.globalConfig.fillWithDefaults() |
|---|
| 380 | |
|---|
| 381 | |
|---|
| 382 | def fillWikiWithDefaults(self): |
|---|
| 383 | self.wikiConfig.fillWithDefaults() |
|---|
| 384 | |
|---|
| 385 | def loadWikiConfig(self, fn): |
|---|
| 386 | self.wikiConfig.loadConfig(fn) |
|---|
| 387 | |
|---|
| 388 | def createEmptyWikiConfig(self, fn): |
|---|
| 389 | self.wikiConfig.createEmptyConfig(fn) |
|---|
| 390 | |
|---|
| 391 | def getWikiConfig(self): |
|---|
| 392 | return self.wikiConfig |
|---|
| 393 | |
|---|
| 394 | def setWikiConfig(self, config): |
|---|
| 395 | self.wikiConfig = config |
|---|
| 396 | |
|---|
| 397 | |
|---|
| 398 | def loadGlobalConfig(self, fn): |
|---|
| 399 | self.globalConfig.loadConfig(fn) |
|---|
| 400 | |
|---|
| 401 | def createEmptyGlobalConfig(self, fn): |
|---|
| 402 | self.globalConfig.createEmptyConfig(fn) |
|---|
| 403 | |
|---|
| 404 | def getGlobalConfig(self): |
|---|
| 405 | return self.globalConfig |
|---|
| 406 | |
|---|
| 407 | def setGlobalConfig(self, config): |
|---|
| 408 | self.globalConfig = config |
|---|
| 409 | |
|---|
| 410 | def saveGlobalConfig(self): |
|---|
| 411 | if self.globalConfig is not None: |
|---|
| 412 | self.globalConfig.save() |
|---|
| 413 | |
|---|
| 414 | |
|---|
| 415 | def save(self): |
|---|
| 416 | """ |
|---|
| 417 | Save all configurations |
|---|
| 418 | """ |
|---|
| 419 | self.saveGlobalConfig() |
|---|
| 420 | |
|---|
| 421 | try: |
|---|
| 422 | if self.wikiConfig is not None: |
|---|
| 423 | self.wikiConfig.save() |
|---|
| 424 | except: |
|---|
| 425 | traceback.print_exc() |
|---|
| 426 | |
|---|
| 427 | |
|---|
| 428 | def informChanged(self, oldSettings): |
|---|
| 429 | """ |
|---|
| 430 | This should be called after configuration was changed. It is called |
|---|
| 431 | for its SingleConfiguration objects in turn to let them send events |
|---|
| 432 | """ |
|---|
| 433 | if self.globalConfig is not None: |
|---|
| 434 | self.globalConfig.informChanged(oldSettings) |
|---|
| 435 | |
|---|
| 436 | if self.wikiConfig is not None: |
|---|
| 437 | self.wikiConfig.informChanged(oldSettings) |
|---|
| 438 | |
|---|
| 439 | |
|---|
| 440 | |
|---|
| 441 | GLOBALDEFAULTS = { |
|---|
| 442 | ("main", "wiki_history"): None, |
|---|
| 443 | ("main", "last_wiki"): "WikidPadHelp/WikidPadHelp.wiki", |
|---|
| 444 | ("main", "size_x"): "500", |
|---|
| 445 | ("main", "size_y"): "300", |
|---|
| 446 | |
|---|
| 447 | ("main", "pos_x"): "10", |
|---|
| 448 | ("main", "pos_y"): "10", |
|---|
| 449 | ("main", "splitter_pos"): '170', |
|---|
| 450 | ("main", "log_window_autoshow"): "True", |
|---|
| 451 | ("main", "log_window_autohide"): "True", |
|---|
| 452 | ("main", "log_window_sashPos"): "1", |
|---|
| 453 | ("main", "log_window_effectiveSashPos"): "120", |
|---|
| 454 | ("main", "docStructure_position"): "0", |
|---|
| 455 | |
|---|
| 456 | ("main", "docStructure_depth"): "15", |
|---|
| 457 | |
|---|
| 458 | ("main", "docStructure_autohide"): "False", |
|---|
| 459 | ("main", "docStructure_autofollow"): "True", |
|---|
| 460 | |
|---|
| 461 | ("main", "toolbar_show"): "True", |
|---|
| 462 | ("main", "zoom"): '0', |
|---|
| 463 | ("main", "preview_zoom"): '0', |
|---|
| 464 | ("main", "last_active_dir"): None, |
|---|
| 465 | |
|---|
| 466 | ("main", "gui_language"): u"", |
|---|
| 467 | ("main", "recentWikisList_length"): u"5", |
|---|
| 468 | ("main", "font"): None, |
|---|
| 469 | ("main", "wrap_mode"): "True", |
|---|
| 470 | ("main", "indentation_guides"): "True", |
|---|
| 471 | ("main", "auto_bullets"): "True", |
|---|
| 472 | ("main", "auto_indent"): "True", |
|---|
| 473 | ("main", "editor_tabsToSpaces"): "True", |
|---|
| 474 | ("main", "show_lineNumbers"): "False", |
|---|
| 475 | ("main", "editor_useFolding"): u"False", |
|---|
| 476 | ("main", "editor_useImeWorkaround"): u"False", |
|---|
| 477 | |
|---|
| 478 | |
|---|
| 479 | |
|---|
| 480 | ("main", "wikiWord_renameDefault_modifyWikiLinks"): u"False", |
|---|
| 481 | |
|---|
| 482 | ("main", "wikiWord_renameDefault_renameSubPages"): u"True", |
|---|
| 483 | |
|---|
| 484 | ("main", "mainTree_position"): u"0", |
|---|
| 485 | |
|---|
| 486 | ("main", "viewsTree_position"): u"0", |
|---|
| 487 | |
|---|
| 488 | ("main", "windowLayout"): "name:main area panel;"\ |
|---|
| 489 | "layout relation:left&layout relative to:main area panel&name:maintree&"\ |
|---|
| 490 | "layout sash position:170&layout sash effective position:170;"\ |
|---|
| 491 | "layout relation:below&layout relative to:main area panel&name:log&"\ |
|---|
| 492 | "layout sash position:1&layout sash effective position:120", |
|---|
| 493 | |
|---|
| 494 | |
|---|
| 495 | |
|---|
| 496 | |
|---|
| 497 | |
|---|
| 498 | |
|---|
| 499 | |
|---|
| 500 | |
|---|
| 501 | |
|---|
| 502 | |
|---|
| 503 | ("main", "chooseWikiWordDialog_sortOrder"): u"None", |
|---|
| 504 | |
|---|
| 505 | |
|---|
| 506 | |
|---|
| 507 | ("main", "hotKey_showHide_byApp"): "", |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | |
|---|
| 511 | ("main", "hotKey_showHide_byApp_isActive"): u"True", |
|---|
| 512 | |
|---|
| 513 | |
|---|
| 514 | ("main", "wikiOpenNew_defaultDir"): u"", |
|---|
| 515 | |
|---|
| 516 | |
|---|
| 517 | ("main", "wikiLockFile_ignore"): u"False", |
|---|
| 518 | |
|---|
| 519 | ("main", "wikiLockFile_create"): u"True", |
|---|
| 520 | |
|---|
| 521 | ("main", "auto_save"): "True", |
|---|
| 522 | ("main", "auto_save_delay_key_pressed"): "5", |
|---|
| 523 | ("main", "auto_save_delay_dirty"): "60", |
|---|
| 524 | |
|---|
| 525 | ("main", "hideundefined"): "False", |
|---|
| 526 | ("main", "tree_auto_follow"): "True", |
|---|
| 527 | ("main", "tree_update_after_save"): "True", |
|---|
| 528 | ("main", "tree_no_cycles"): "False", |
|---|
| 529 | ("main", "tree_autohide"): "False", |
|---|
| 530 | ("main", "tree_bg_color"): "", |
|---|
| 531 | |
|---|
| 532 | ("main", "tree_font_nativeDesc"): u"", |
|---|
| 533 | |
|---|
| 534 | ("main", "tree_updateGenerator_minDelay"): u"0.1", |
|---|
| 535 | |
|---|
| 536 | |
|---|
| 537 | |
|---|
| 538 | |
|---|
| 539 | |
|---|
| 540 | |
|---|
| 541 | |
|---|
| 542 | |
|---|
| 543 | |
|---|
| 544 | |
|---|
| 545 | |
|---|
| 546 | |
|---|
| 547 | ("main", "process_autogenerated_areas"): "False", |
|---|
| 548 | ("main", "insertions_allow_eval"): "False", |
|---|
| 549 | |
|---|
| 550 | ("main", "script_security_level"): "0", |
|---|
| 551 | |
|---|
| 552 | |
|---|
| 553 | ("main", "script_search_reverse"): "False", |
|---|
| 554 | |
|---|
| 555 | |
|---|
| 556 | |
|---|
| 557 | |
|---|
| 558 | |
|---|
| 559 | ("main", "new_window_on_follow_wiki_url"): u"1", |
|---|
| 560 | ("main", "start_browser_after_export"): u"True", |
|---|
| 561 | ("main", "facename_html_preview"): u"", |
|---|
| 562 | ("main", "html_preview_proppattern"): u"", |
|---|
| 563 | ("main", "html_preview_proppattern_is_excluding"): u"False", |
|---|
| 564 | ("main", "html_export_proppattern"): u"", |
|---|
| 565 | ("main", "html_export_proppattern_is_excluding"): u"False", |
|---|
| 566 | ("main", "html_preview_pics_as_links"): u"False", |
|---|
| 567 | ("main", "html_export_pics_as_links"): u"False", |
|---|
| 568 | ("main", "export_table_of_contents"): u"0", |
|---|
| 569 | |
|---|
| 570 | ("main", "html_toc_title"): u"Table of Contents", |
|---|
| 571 | ("main", "html_export_singlePage_sepLineCount"): u"10", |
|---|
| 572 | |
|---|
| 573 | ("main", "html_preview_renderer"): u"0", |
|---|
| 574 | ("main", "html_preview_ieShowIframes"): u"False", |
|---|
| 575 | ("main", "html_preview_webkitViKeys"): u"False", |
|---|
| 576 | |
|---|
| 577 | ("main", "html_body_link"): u"", |
|---|
| 578 | ("main", "html_body_alink"): u"", |
|---|
| 579 | ("main", "html_body_vlink"): u"", |
|---|
| 580 | ("main", "html_body_text"): u"", |
|---|
| 581 | ("main", "html_body_bgcolor"): u"", |
|---|
| 582 | ("main", "html_body_background"): u"", |
|---|
| 583 | ("main", "html_header_doctype"): u'DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"', |
|---|
| 584 | |
|---|
| 585 | |
|---|
| 586 | |
|---|
| 587 | ("main", "sync_highlight_byte_limit"): "400", |
|---|
| 588 | ("main", "async_highlight_delay"): "0.2", |
|---|
| 589 | ("main", "editor_shortHint_delay"): "500", |
|---|
| 590 | |
|---|
| 591 | ("main", "editor_autoUnbullets"): "True", |
|---|
| 592 | ("main", "editor_autoComplete_closingBracket"): "False", |
|---|
| 593 | |
|---|
| 594 | ("main", "editor_sync_byPreviewSelection"): "False", |
|---|
| 595 | |
|---|
| 596 | ("main", "editor_colorizeSearchFragments"): "False", |
|---|
| 597 | |
|---|
| 598 | ("main", "editor_tabWidth"): "4", |
|---|
| 599 | ("main", "editor_onlineSpellChecker_active"): "False", |
|---|
| 600 | ("main", "editor_imageTooltips_localUrls"): "True", |
|---|
| 601 | ("main", "editor_imageTooltips_maxWidth"): "200", |
|---|
| 602 | ("main", "editor_imageTooltips_maxHeight"): "200", |
|---|
| 603 | |
|---|
| 604 | ("main", "editor_imagePaste_filenamePrefix"): "", |
|---|
| 605 | ("main", "editor_imagePaste_fileType"): "1", |
|---|
| 606 | |
|---|
| 607 | ("main", "editor_imagePaste_quality"): "75", |
|---|
| 608 | |
|---|
| 609 | ("main", "editor_imagePaste_askOnEachPaste"): "True", |
|---|
| 610 | ("main", "editor_filePaste_prefix"): "", |
|---|
| 611 | ("main", "editor_filePaste_middle"): "\\x20", |
|---|
| 612 | ("main", "editor_filePaste_suffix"): "", |
|---|
| 613 | ("main", "editor_filePaste_bracketedUrl"): "True", |
|---|
| 614 | |
|---|
| 615 | |
|---|
| 616 | ("main", "editor_compatibility_ViKeys"): "False", |
|---|
| 617 | |
|---|
| 618 | |
|---|
| 619 | |
|---|
| 620 | ("main", "editor_plaintext_color"): "", |
|---|
| 621 | ("main", "editor_link_color"): "", |
|---|
| 622 | ("main", "editor_attribute_color"): "", |
|---|
| 623 | ("main", "editor_bg_color"): "", |
|---|
| 624 | ("main", "editor_selection_fg_color"): "", |
|---|
| 625 | ("main", "editor_selection_bg_color"): "", |
|---|
| 626 | ("main", "editor_margin_bg_color"): "", |
|---|
| 627 | ("main", "editor_caret_color"): "", |
|---|
| 628 | |
|---|
| 629 | |
|---|
| 630 | ("main", "clipboardCatcher_prefix"): ur"", |
|---|
| 631 | ("main", "clipboardCatcher_suffix"): ur"\n", |
|---|
| 632 | ("main", "clipboardCatcher_filterDouble"): "True", |
|---|
| 633 | |
|---|
| 634 | ("main", "clipboardCatcher_userNotification"): "0", |
|---|
| 635 | ("main", "clipboardCatcher_soundFile"): "", |
|---|
| 636 | |
|---|
| 637 | |
|---|
| 638 | |
|---|
| 639 | ("main", "fileLauncher_path"): u"", |
|---|
| 640 | |
|---|
| 641 | |
|---|
| 642 | |
|---|
| 643 | |
|---|
| 644 | ("main", "mouse_middleButton_withoutCtrl"): "1", |
|---|
| 645 | |
|---|
| 646 | ("main", "mouse_middleButton_withCtrl"): "0", |
|---|
| 647 | |
|---|
| 648 | ("main", "mouse_scrollUnderPointer"): "False", |
|---|
| 649 | |
|---|
| 650 | |
|---|
| 651 | |
|---|
| 652 | ("main", "userEvent_mouse/leftdoubleclick/preview/body"): u"action/none", |
|---|
| 653 | |
|---|
| 654 | |
|---|
| 655 | |
|---|
| 656 | ("main", "userEvent_mouse/middleclick/pagetab"): u"action/none", |
|---|
| 657 | |
|---|
| 658 | |
|---|
| 659 | ("main", "userEvent_mouse/leftdrop/editor/files"): u"action/editor/this/paste/files/insert/url/absolute", |
|---|
| 660 | |
|---|
| 661 | |
|---|
| 662 | |
|---|
| 663 | ("main", "userEvent_mouse/leftdrop/editor/files/modkeys/shift"): u"action/editor/this/paste/files/insert/url/relative", |
|---|
| 664 | |
|---|
| 665 | |
|---|
| 666 | ("main", "userEvent_mouse/leftdrop/editor/files/modkeys/ctrl"): u"action/editor/this/paste/files/insert/url/tostorage", |
|---|
| 667 | |
|---|
| 668 | |
|---|
| 669 | |
|---|
| 670 | ("main", "timeView_position"): "0", |
|---|
| 671 | |
|---|
| 672 | ("main", "timeView_dateFormat"): u"%Y %m %d", |
|---|
| 673 | |
|---|
| 674 | ("main", "timeView_autohide"): "False", |
|---|
| 675 | ("main", "timeView_showWordListOnHovering"): u"True", |
|---|
| 676 | |
|---|
| 677 | ("main", "timeView_showWordListOnSelect"): u"False", |
|---|
| 678 | |
|---|
| 679 | ("main", "timeView_lastSelectedTab"): u"modified", |
|---|
| 680 | |
|---|
| 681 | |
|---|
| 682 | ("main", "timeline_showEmptyDays"): u"True", |
|---|
| 683 | ("main", "timeline_sortDateAscending"): u"True", |
|---|
| 684 | |
|---|
| 685 | ("main", "versioning_dateFormat"): u"%Y %m %d", |
|---|
| 686 | |
|---|
| 687 | |
|---|
| 688 | |
|---|
| 689 | |
|---|
| 690 | ("main", "search_wiki_searchType"): "0", |
|---|
| 691 | |
|---|
| 692 | ("main", "search_wiki_caseSensitive"): "False", |
|---|
| 693 | ("main", "search_wiki_wholeWord"): "False", |
|---|
| 694 | ("main", "search_wiki_context_before"): "20", |
|---|
| 695 | ("main", "search_wiki_context_after"): "30", |
|---|
| 696 | ("main", "search_wiki_count_occurrences"): "True", |
|---|
| 697 | ("main", "search_wiki_max_count_occurrences"): "100", |
|---|
| 698 | |
|---|
| 699 | ("main", "fastSearch_sizeX"): "200", |
|---|
| 700 | ("main", "fastSearch_sizeY"): "400", |
|---|
| 701 | ("main", "incSearch_autoOffDelay"): "0", |
|---|
| 702 | |
|---|
| 703 | ("main", "fastSearch_searchType"): "0", |
|---|
| 704 | |
|---|
| 705 | ("main", "fastSearch_caseSensitive"): "False", |
|---|
| 706 | ("main", "fastSearch_wholeWord"): "False", |
|---|
| 707 | |
|---|
| 708 | ("main", "search_dontAllowCancel"): "False", |
|---|
| 709 | |
|---|
| 710 | |
|---|
| 711 | |
|---|
| 712 | |
|---|
| 713 | ("main", "print_margins"): "0,0,0,0", |
|---|
| 714 | ("main", "print_plaintext_font"): "", |
|---|
| 715 | ("main", "print_plaintext_wpseparator"): "\\n\\n\\n\\n", |
|---|
| 716 | |
|---|
| 717 | ("main", "windowmode"): "0", |
|---|
| 718 | ("main", "frame_stayOnTop"): "False", |
|---|
| 719 | ("main", "showontray"): "0", |
|---|
| 720 | ("main", "minimize_on_closeButton"): "False", |
|---|
| 721 | ("main", "mainTabs_switchMruOrder"): "True", |
|---|
| 722 | ("main", "startup_splashScreen_show"): "True", |
|---|
| 723 | ("main", "strftime"): u"%x %I:%M %p", |
|---|
| 724 | ("main", "pagestatus_timeformat"): u"%x %I:%M %p", |
|---|
| 725 | ("main", "recent_time_formats"): u"%x %I:%M %p;%m/%d/%y;%d.%m.%y;%d.%m.%Y;%a %Y-%m-%d", |
|---|
| 726 | |
|---|
| 727 | ("main", "single_process"): "True", |
|---|
| 728 | ("main", "menu_accels_kbdTranslate"): "False", |
|---|
| 729 | |
|---|
| 730 | |
|---|
| 731 | ("main", "zombieCheck"): "True", |
|---|
| 732 | |
|---|
| 733 | ("main", "tempHandling_preferMemory"): "False", |
|---|
| 734 | ("main", "tempHandling_tempMode"): u"system", |
|---|
| 735 | |
|---|
| 736 | |
|---|
| 737 | |
|---|
| 738 | ("main", "tempHandling_tempDir"): u"", |
|---|
| 739 | |
|---|
| 740 | ("main", "wikiPathes_relative"): "False", |
|---|
| 741 | |
|---|
| 742 | ("main", "openWikiWordDialog_sortOrder"): "0", |
|---|
| 743 | |
|---|
| 744 | |
|---|
| 745 | ("main", "collation_order"): "Default", |
|---|
| 746 | ("main", "collation_uppercaseFirst"): "False" |
|---|
| 747 | |
|---|
| 748 | } |
|---|
| 749 | |
|---|
| 750 | |
|---|
| 751 | |
|---|
| 752 | WIKIDEFAULTS = { |
|---|
| 753 | ("wiki_db", "data_dir"): u"data", |
|---|
| 754 | ("main", "wiki_name"): None, |
|---|
| 755 | ("main", "wiki_wikiLanguage"): "wikidpad_default_2_0", |
|---|
| 756 | ("main", "last_wiki_word"): None, |
|---|
| 757 | ("main", "tree_last_root_wiki_word"): None, |
|---|
| 758 | ("main", "tree_expandedNodes_rememberDuration"): u"2", |
|---|
| 759 | |
|---|
| 760 | ("main", "indexSearch_enabled"): u"False", |
|---|
| 761 | ("main", "indexSearch_formatNo"): u"1", |
|---|
| 762 | |
|---|
| 763 | ("main", "tabs_maxCharacters"): u"0", |
|---|
| 764 | ("main", "template_pageNamesRE"): u"^template/", |
|---|
| 765 | |
|---|
| 766 | |
|---|
| 767 | ("main", "trashcan_maxNoOfBags"): u"200", |
|---|
| 768 | |
|---|
| 769 | ("main", "trashcan_askOnDelete"): u"True", |
|---|
| 770 | |
|---|
| 771 | ("main", "trashcan_storageLocation"): "0", |
|---|
| 772 | |
|---|
| 773 | |
|---|
| 774 | |
|---|
| 775 | ("main", "tree_expandedNodes_descriptorPathes_main"): u"", |
|---|
| 776 | |
|---|
| 777 | ("main", "tree_expandedNodes_descriptorPathes_views"): u"", |
|---|
| 778 | |
|---|
| 779 | ("main", "tree_force_scratchpad_visibility"): u"True", |
|---|
| 780 | |
|---|
| 781 | |
|---|
| 782 | ("main", "further_wiki_words"): u"", |
|---|
| 783 | |
|---|
| 784 | |
|---|
| 785 | ("main", "wiki_lastTabsSubCtrls"): u"", |
|---|
| 786 | ("main", "wiki_lastActiveTabNo"): u"-1", |
|---|
| 787 | |
|---|
| 788 | |
|---|
| 789 | ("main", "first_wiki_word"): "", |
|---|
| 790 | ("main", "wiki_database_type"): u"", |
|---|
| 791 | |
|---|
| 792 | |
|---|
| 793 | |
|---|
| 794 | ("main", "db_pagefile_suffix"): ".wiki", |
|---|
| 795 | |
|---|
| 796 | ("main", "export_default_dir"): u"", |
|---|
| 797 | |
|---|
| 798 | ("main", "wiki_readOnly"): "False", |
|---|
| 799 | |
|---|
| 800 | ("main", "log_window_autoshow"): "Gray", |
|---|
| 801 | |
|---|
| 802 | |
|---|
| 803 | ("main", "wikiPageFiles_asciiOnly"): "False", |
|---|
| 804 | ("main", "wikiPageFiles_gracefulOutsideAddAndRemove"): "True", |
|---|
| 805 | |
|---|
| 806 | |
|---|
| 807 | ("main", "headingsAsAliases_depth"): "0", |
|---|
| 808 | |
|---|
| 809 | |
|---|
| 810 | ("main", "versioning_storageLocation"): "0", |
|---|
| 811 | |
|---|
| 812 | |
|---|
| 813 | ("main", "versioning_completeSteps"): u"10", |
|---|
| 814 | |
|---|
| 815 | |
|---|
| 816 | |
|---|
| 817 | ("main", "fileStorage_identity_modDateMustMatch"): "False", |
|---|
| 818 | ("main", "fileStorage_identity_filenameMustMatch"): "False", |
|---|
| 819 | ("main", "fileStorage_identity_modDateIsEnough"): "False", |
|---|
| 820 | |
|---|
| 821 | |
|---|
| 822 | ("main", "wikiPageTitlePrefix"): "++", |
|---|
| 823 | ("main", "wikiPageTitle_creationMode"): "1", |
|---|
| 824 | |
|---|
| 825 | |
|---|
| 826 | |
|---|
| 827 | ("main", "wikiPageTitle_fromLinkTitle"): "False", |
|---|
| 828 | |
|---|
| 829 | |
|---|
| 830 | ("main", "wiki_icon"): "", |
|---|
| 831 | |
|---|
| 832 | ("main", "hotKey_showHide_byWiki"): "" |
|---|
| 833 | |
|---|
| 834 | |
|---|
| 835 | } |
|---|
| 836 | |
|---|
| 837 | |
|---|
| 838 | |
|---|
| 839 | |
|---|
| 840 | |
|---|
| 841 | WIKIFALLTHROUGH ={ |
|---|
| 842 | ("main", "log_window_autoshow"): "Gray" |
|---|
| 843 | |
|---|
| 844 | } |
|---|
| 845 | |
|---|
| 846 | |
|---|
| 847 | |
|---|
| 848 | |
|---|
| 849 | |
|---|
| 850 | MIDDLE_MOUSE_CONFIG_TO_TABMODE = { |
|---|
| 851 | 0: 2, |
|---|
| 852 | 1: 3, |
|---|
| 853 | 2: 0, |
|---|
| 854 | 3: 6, |
|---|
| 855 | } |
|---|
| 856 | |
|---|
| 857 | |
|---|
| 858 | |
|---|
| 859 | |
|---|
| 860 | |
|---|
| 861 | |
|---|
| 862 | |
|---|
| 863 | |
|---|
| 864 | |
|---|
| 865 | |
|---|
| 866 | |
|---|
| 867 | |
|---|
| 868 | |
|---|
| 869 | |
|---|
| 870 | |
|---|