Return extensions in default and user config-extensions files. If active_only True, only return active (enabled) extensions and optionally only editor or shell extensions. If active_only False, return all extensions.
(self, active_only=True,
editor_only=False, shell_only=False)
| 411 | return 'IDLE Modern Unix' |
| 412 | |
| 413 | def GetExtensions(self, active_only=True, |
| 414 | editor_only=False, shell_only=False): |
| 415 | """Return extensions in default and user config-extensions files. |
| 416 | |
| 417 | If active_only True, only return active (enabled) extensions |
| 418 | and optionally only editor or shell extensions. |
| 419 | If active_only False, return all extensions. |
| 420 | """ |
| 421 | extns = self.RemoveKeyBindNames( |
| 422 | self.GetSectionList('default', 'extensions')) |
| 423 | userExtns = self.RemoveKeyBindNames( |
| 424 | self.GetSectionList('user', 'extensions')) |
| 425 | for extn in userExtns: |
| 426 | if extn not in extns: #user has added own extension |
| 427 | extns.append(extn) |
| 428 | for extn in ('AutoComplete','CodeContext', |
| 429 | 'FormatParagraph','ParenMatch'): |
| 430 | extns.remove(extn) |
| 431 | # specific exclusions because we are storing config for mainlined old |
| 432 | # extensions in config-extensions.def for backward compatibility |
| 433 | if active_only: |
| 434 | activeExtns = [] |
| 435 | for extn in extns: |
| 436 | if self.GetOption('extensions', extn, 'enable', default=True, |
| 437 | type='bool'): |
| 438 | #the extension is enabled |
| 439 | if editor_only or shell_only: # TODO both True contradict |
| 440 | if editor_only: |
| 441 | option = "enable_editor" |
| 442 | else: |
| 443 | option = "enable_shell" |
| 444 | if self.GetOption('extensions', extn,option, |
| 445 | default=True, type='bool', |
| 446 | warn_on_default=False): |
| 447 | activeExtns.append(extn) |
| 448 | else: |
| 449 | activeExtns.append(extn) |
| 450 | return activeExtns |
| 451 | else: |
| 452 | return extns |
| 453 | |
| 454 | def RemoveKeyBindNames(self, extnNameList): |
| 455 | "Return extnNameList with keybinding section names removed." |
no test coverage detected