Sublime's quick_search api wrapper
- Total 5K
- Win 2K
- Mac 1K
- Linux 985
|Feb 18||Feb 17||Feb 16||Feb 15||Feb 14||Feb 13||Feb 12||Feb 11||Feb 10||Feb 9||Feb 8||Feb 7||Feb 6||Feb 5||Feb 4||Feb 3||Feb 2||Feb 1||Jan 31||Jan 30||Jan 29||Jan 28||Jan 27||Jan 26||Jan 25||Jan 24||Jan 23||Jan 22||Jan 21||Jan 20||Jan 19||Jan 18||Jan 17||Jan 16||Jan 15||Jan 14||Jan 13||Jan 12||Jan 11||Jan 10||Jan 9||Jan 8||Jan 7||Jan 6||Jan 5||Jan 4|
Sublime QuickSearchEnhanced plugin
Api for other plugins to use sublime's quick_search in bit better way.
This plugin is part of sublime-enhanced plugin set. You can install sublime-enhanced and this plugin will be installed automatically.
If you would like to install this package separately check “Installing packages separately” section of sublime-enhanced package.
There are two usable classes in module:
QuickSearches - container for opened panels; this class is preinstanciated under “panels” variable.
QuickSearch - quick search panel
Quick search panel are create through “create” function. Panels are stackable (new panel hides previos when showed, and shows previous when closed).
Note that inproper code that runned in callbacks can crash sublime (due to its internal bugs). So use this plugin with care.
QuickSearches.create(values = , open = None, close = None, preview = None, text = '', callers = , on_create = None, index = 0)
Creates a quick search panel.
values - list of values in following format:
- [string, string, …] - list of strings.
- [[value, line1, line2, …], [value, line1, line2, …]] - list of lists; value - any value; line1, line2, lineN - strings; note that count of lines always should be the same otherwise unexpected behavior of sublime are expected.
open(QuickSearch) - open callback; callback called when user hits enter in list; callback receive QuickSearch instance as argument.
close(QuickSearch) - close callback; callback called when user hit “escape” or “enter” (panel is closed).
preview(QuickSearch) - preview callback; callback called when user selects an item in list.
text - initial text that is entered in panel.
callers - list of callers to obtain panel instance when issuing commands over panel in following format: [[name, object], …] where name is name of caller and object - instance of caller; this is usefull when you need to check that search panel contains specific information or issues command on instance that has opened the panel
index - initial selected index
QuickSearch; created panel; note that panel have to be showed after it will be created by issuing .show() command;
from QuickSearchEnhanced import quick_search panel = quick_search.panels.create( ['a', 'b', 'c'], lambda panel: print(panel.get_current_value()) )
Closes all panels.
Removes given panel from stack.
- panel - QuickSearch; panel to remove
Returns currently opened panel (QuickSearch)
Shows panel. Note that it'll hide currently opened panel.
Get all values that are in search panel.
Set new values to panel.
Set new text to panel.
Get all callers of search panel. See “callers” argument in QuickSearches.create() above for information. Returns list of callers.
Returns caller that has specified name. If no caller found returns None.
Returns currently selected index.
Returns currenly selected value. If no value selected returns None.
Returns list currently selected desciptions (lines).
Returns current text.
Returns underlying view of opened panel.
Returns view that was focused when panel was showed.
Tells whether panel is visible or not.
QuickSearch.close(index = -1, call = True)
Closes the panel. Panel will be removed from current panels stack.
index - integer; index of value; if index == -1 than last selected index will be used.
call - boolean; if True then open callback will be called.
Hide the panel. Panel can be showed later using show() method. Panel will be not removed from panels stack.
Refreshes contents of panel. If one of callers responds to “refresh” method than “refresh” method of caller that earlier in stack will be called before panel will bee redrawed.