Flamenco Documentation
Customizing Flamenco
You can customize the way Flamenco displays each collection.
The display behaviour is defined in the Python module located at
target/instances/instance/Collection.py
,
where target is the target directory in which you
chose to install Flamenco
and instance is the name of the instance.
Collection.py
defines a Collection
class,
which inherits basic display behaviour
from the BaseCollection
class.
After making changes to Collection.py
,
restart the instance using
flamenco restart instance
to see the effect of your changes.
Text Strings
Many of the text strings in the Flamenco interface
are defined as class variables
on the Collection
class,
and you can assign them other values
in Collection.py
.
For a complete list, see target/python/BaseCollection.py
.
The strings you will most likely want to change are:
PAGE_TITLE
= the title of the page (shown in the window title bar)PAGE_HEADING
= the main heading at the top of the pagePAGE_SUBHEADING
= the subheading at the top of the page
Adjusting Layout
The layout of pages is also determined in part
by class variables
on the Collection
class.
Some parameters you may want to adjust are:
ITEMS_PER_GROUP
= number of items to show in each group in a grouped result listingITEMS_PER_ROW
= number of items to show on each row in a result listingITEMS_PER_HISTORY_ROW
= number of items to show on each row in a history viewITEMS_PER_GROUPED_PAGE
= maximum number of items to show on one page of grouped resultsITEMS_PER_UNGROUPED_PAGE
= maximum number of items to show on one page of ungrouped results
Displaying Items
Flamenco needs to be told how you want to display your items.
When you create a new Flamenco instance,
a default Collection.py
file is installed.
The default Collection
class
displays items by showing just the value of the first attribute.
You will probably want to customize how Flamenco displays your items
to show more information and format it in a more useful way.
The display of items is defined by two methods
in the Collection
class,
which you can edit:
itemdisplay
and
itemlisting
.
itemdisplay
is used to display
a single item on its own page.
Its arguments are item
,
the identifier of the single item being shown,
and and request
,
a WebKit HTTPResponse
object
that you can use to obtain information about the client.
The request information could be used, for example,
to restrict access to certain metadata to clients with certain IP addresses.
itemlisting
is used to display
an item in a result listing.
Its arguments are item
,
the identifier of the item,
index
,
the index (starting from zero) of the item in the result set,
link
,
a function you can use to link to a single-item page, and
query
,
the query that produced the result set.
Your best bet for customizing item display
is to start with the Collection.py
file
that has already been placed in your instance directory and edit it.