Quote:
Originally Posted by capink
I defined a template function called selected_column (see the code at the end of this post) that gets the selected column name, if @chaley has no interest in adding something similar to calibre, I will add it to the next version of Action Chains.
|
Given that it will be rarely used and is easy to implement as a fast python stored template, I don't think adding it to base calibre is required. Action Chains users can use what you add. People who want the function can create a stored template.
You might consider whether using a stored template is a good solution for you. A stored template will work just as well, and you aren't required to maintain it.
The stored template code is (like yours):
Code:
python:
def evaluate(book, context):
from calibre.gui2.ui import get_gui
gui = get_gui()
cv = get_gui().current_view()
return cv.column_map[cv.currentIndex().column()]
Assuming the name is (like yours) "current_column" the "adding" dialog Preferences / Template functions is
I slightly prefer the name "current_column", but I think it is more important that we use the same name.