The Charm editor |
:: Email ::
Download area
|
A short overview of the features of the Charm editor. GUICharm is a GUI editor, originally implemented in wxPython, and currently being "translated" to Wax. My goal is that eventually it will be 100% Wax. I like text consoles, but that just wasn't an option for the editor I had in mind. TabbedLike most modern editors, Charm can edit multiple files simultaneously. It uses a tabbed notebook for this. (I used to use vim, but one of my major gripes was that it didn't have tabs, so I would have lots of separate windows clogging up the toolbar.) You can easily go to the next/previous tab with function keys. File selectorAnother way to select the (open) file you want is the so-called file selector. This is a drop-down box that contains the names of the open files. Selecting one moves to the appropriate tab. Modality and command lineCharm is a modal editor. Vi-haters, before you walk away in disgust, be aware that Charm's modality is different from other editors. Most importantly, you are free to ignore the modes completely. But if you want to, pressing Escape switches between the current editor window and a command line. In this command line you can type, well, commands; some of them resemble vi, others don't. A few quick examples: !% foobar # run current program with parameter 'foobar' :332 # go to line 332 trans f # convert the selected text using function f # e.g. trans upper converts text to uppercase # trans rot13 uses rot13 "encoding", etc More commands will be added in the future. Typically, a command should be a quick way to do something that would otherwise be relatively complex or time-consuming. Editor featuresThe actual editor control is Wax's StyledTextBox, which is based on wxPython's wxStyledTextCtrl. This is a powerful component with lots of features, e.g. syntax highlighting, visible whitespace, indentation guides, highlighting of matching/bad braces, etc. This in addition to all the usual editor features. ProfilesCharm already has a lot of configurable options, and there will be many more in the future. The defaults are defined in options.py, but these can be overridden by so-called profiles. These are simply Python files setting options. For example, if I want to show whitespace by default, then I can make the following profile file: # profiles/show_whitespace.py options.show_whitespace = 1 And then call it on the command line with charm.py -p show_whitespace A number of built-in profiles are available, mostly to set different colors for syntax highlighting. (Note: at the moment, many of these are in the process of being converted to a new options system.) Interactive interpreterBesides editor controls, tabs can also contain other things. For example, interactive interpreters. For this, we use the PyCrust shell by Patrick O'Brien, which comes with wxPython. Besides just opening a shell (with or without "filling"), it's also possible to open a shell with the current file imported. (For example, if we're currently editing a file foo.py, then "Import in shell" will start PyCrust with foo.py imported, so you can use Integration with PyCheckerIf PyChecker is installed, Charm can use it. It's simple: select "Check with PyChecker", and the currently selected Python file will be inspected. The result will appear in a new tab. Help featuresCharm uses Python's own help features where possible. F1 opens a dialog box where a search term can be entered (e.g. 'os'); this term is then processed with pydoc, and the results are presented in a new tab. Shift-F1 opens a module read-only. This is useful for inspecting code in the standard library without running the risk of accidentally overwriting things. RequirementsI started writing Charm with a number of requirements in mind. Some of these seem minor and are mostly personal issues, like having an auto-indent feature. Others are loftier, like having a command line, and integration with PyChecker (implemented) and Bicycle Repair Man (not implemented yet). As I write this, 16 of 22 requirements have been met. Others will hopefully follow soon. |