📄 readme
字号:
key(string, int[, string]) Binds a python statement to a key. The last argu- ment contains python code. If it is omitted then the action is to unbind the key if it is bound. The first argument is the string representation of a key from the keysymdef.h X Window header file (with or without the XK_ prefix). The second argument is zero or the inclusive OR of any of the following 27 October 2001 15cooledit(1) cooledit(1) modifiers: ShiftMask LockMask ControlMask AltMask Mod1Mask Mod2Mask Mod3Mask Mod4Mask Mod5Mask AltMask is defined in the global.h header file in the distribution and is system dependant. The usual usage of this function is to bind a key to a short python statement. The statement itself would then call functions that were previously defined. The key binding will be seen through all edit win- dows. bind(string, string, int[, function]) Binds a python function to a range of keys in the current editor. If the last argument is omitted then the action is to unbind those keys if they are bound. The first two arguments are the string rep- resentation of a range of keys from the keysymdef.h X Window header file (with or without the XK_ pre- fix) (for example bind ("A", "Z", ControlMask, con- trol_keys), which binds the keys A through Z to the function control_keys). The third argument is the modifier as with the key() function. The bound function must take two arguments: the key name as a string and the modifier as an integer. The key binding will be seen in the current (focussed) editor window only. If the same key is bound globally (using the key() function), then it will be overridden by bind(). This is useful for binding particular keys depend- ing on the type of text being edited. bind() should hence be used within the type_change() function. 27 October 2001 16cooledit(1) cooledit(1) menu(string, [string[, string]]) Creates a menu item. The last argument contains python code. If it is omitted then the action is to remove the menu item if it exists. The first argu- ment is the name of one of the menus and can be one of File, Edit, Search, Command, Options, Readme or Util. The second argument is the menu item text to be added to the given menu. If this text contains a \t then the text after the \t will be right justi- fied (eg "Open...\tC-o"). The Util menu is specific to each editor window, hence this is useful for defining tools specific to a particular file type. The Util menu is activated by pressing on the Util tool button of each editor window, or Meta-U. If only one argument is given, then this command clears the menu of all its items. replace_menu(string, string, string, string) Replaces an existing menu item with a new menu item. The arguments are respectively: The menu (i.e. File, Edit, etc.), the old menu item, the new menu item, and the python code. insert_menu(string, string, string, string) Inserts a menu item after an existing menu item. The arguments are respectively: The menu (i.e. File, Edit, etc.), the menu item before which the insertion is to be made, the new menu item, and the python code. The following functions return information about the cur- rent edit buffer: string file() Returns the file-name excluding the path. string directory() Returns the directory. int modified() Returns the flag to indicate if the buffer has been modified since the last load or save. int overwrite([int]) Returns the overwrite flag (indicating type-over mode). If an integer is given, then this sets the overwrite flag and returns the previous value of the overwrite flag. (int, int, int, int, int) markers([int, int[, int, int, int]]) Returns the state of the markers. The five values returned are: the starting marker, the ending 27 October 2001 17cooledit(1) cooledit(1) marker, a flag indicating whether column highlight- ing mode is on, the starting column and the ending column. The last two values should be ignored if column highlighting (the third value) is found to be zero. If nothing is highlighted then this function returns None. If values are passed to the function, then the state of the markers will be set to those values. Note that if the end marker is -1, then the ending marker is the cursor and movements of the cursor will change the selection. If the third argument is zero then that last two arguments are ignored. The following functions display and return information to/from the user: (tuple, tuple) generic_dialog(string, tuple, tuple, tuple, tuple, tuple, tuple, tuple [[, int], int]) This function takes a string value as the title to a dialog, then displays the dialog, returning the results of various checkboxes or input widgets. The dialog has the same format as what you will see when doing a Find file from the File menu. An arbi- trary number of input widgets or check boxes can be specified. The arguments passed to generic_dialog are as follows. string Title of the dialog. (string, string, ...) A list of default strings to go into each of the input widgets. (string, string, ...) A list of labels to go above each of the input widgets. (string, string, ...) A list of names used internally to store histories of entries to that input widget. These can be anything, although a descrip- tive name, of about 20 characters in length, will ensure uniqueness for each widget. This is actually the internal name of the widget which must be unique within the entire application. Something of the form dialogname.entryname for each input widget is fine. (string, string, ...) A list of tool hints for each input widget. 27 October 2001 18cooledit(1) cooledit(1) Elements may be null or there may be less elements than the number if widgets. (int, int, ...) A list of values for check boxes - either 0 for off or 1 for on. (string, string, ...) A list labels for each check box. (string, string, ...) A list of tool hints for each checkbox. Ele- ments may be null or there may be less ele- ments than the number if widgets. int An optional width of the dialog. This is in units of the mean character width for the current font. The default value is 60. int An optional options integer being the inclu- sive OR of one or more of the following val- ues: INPUTS_WITH_OPTIONS_BROWSE_LOAD_1 INPUTS_WITH_OPTIONS_BROWSE_SAVE_1 INPUTS_WITH_OPTIONS_BROWSE_DIR_1 INPUTS_WITH_OPTIONS_BROWSE_LOAD_2 INPUTS_WITH_OPTIONS_BROWSE_SAVE_2 INPUTS_WITH_OPTIONS_BROWSE_DIR_2 INPUTS_WITH_OPTIONS_BROWSE_LOAD_3 INPUTS_WITH_OPTIONS_BROWSE_SAVE_3 INPUTS_WITH_OPTIONS_BROWSE_DIR_3 This indicates that a `Browse' button should accompany the entry widget. The browse but- ton will open a file with behaviour appro- priate to loading, saving or selecting a directory. The return values are two tuples containing a list of the values of the input widgets and checkbox's respectively. If the dialog was canceled, the return value is null. As an example, the find file dialog can be repro- duced as follows: x = generic_dialog ("Find file", \ (".", "*.[ch]", ""), \ ( "Starting directory", \ "Filenames matching glob expression", \ "Containing" ), \ ( "find-start_dir", \ "find-glob_express", \ "find-containing" ), \ ( "Starting directory for the recursive search", \ 27 October 2001 19cooledit(1) cooledit(1) "Glob expressions such as *.[ch] or *.doc", \ "Check if file contains this sequence" ), \ (0, 0, 0, 0), \ ( "Containing reg. exp.", \ "Containing case insens.", \ "Search follows symlinks", \ "Search is case insens." ), \ ( "Enter regular expression pattern to find within file", \ "Match case insensitively when searching within files", \ "Dive into symlinks to directories", \ "Filenames are matched case insensitively" ), \ 60, INPUTS_WITH_OPTIONS_BROWSE_DIR_1 \ ) if x: inputs = x[1] checks = x[2] The following are more simplistic utility dialogs: string input_dialog(string, string, string) Brings up an input dialog. Takes a title, prompt string and default value as input. Returns the entered string or None if cancelled. string save_file_dialog(string, string, string) Brings up a file browser dialog. Takes a title, a starting directory and a default value as input. Returns the entered string or None if cancelled. string load_file_dialog(string, string, string) This has a slightly different behaviour to save_file_dialog - if a non existing file is entered, it reports an error. message_dialog(string, string) Brings up a message dialog with the given title and message. error_dialog(string, string) Brings up an error dialog with the given title and message. int query_dialog(string, string, string, ...) Brings up a query dialog. Takes a header, a prompt and a number of alternative buttons. Returns the button number or -1 on cancel. status(string) Sets the status line of the current editor. The status line will return to its usual when a key is pressed. This can be used with getkey() to inform the user of possible key presses. 27 October 2001 20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -