Hi folks,
I've just committed a new file to the repository:
quarkpy/tagging.py
This module provides a new API for tagging objects. Feel free to
check it out, and use it. It's fully documented, with docstrings! :)
Basically, this is designed to help plugin authors avoid stomping all
over each others tags, and also to do things slightly more
Pythonically than the existing API. Also, since some code in quarkpy
was using the current API, it seemed like a good idea to move tagging
code into the quarkpy module (quarkpy is meant to be independent of
plugins)!
Tags are stored by category, and each category is specified by a
'key'.
You can get all the tags in a category using gettaglist(). You can
get the most recently tagged object in a category using
getuniquetag(). If you want to only ever have one object in your
category tagged, use uniquetag() and cleartags(). If you want to
allow more than one object to be tagged, use tag(), untag() and
cleartags(). Read the docstrings, it all makes sense really.
You can get the editor to draw tags by setting a drawing function for
a particular category.
The current tagging code is a disaster area, and I decided to put
things as mundane as toolbar editing on hold until it was under
control. I need to get this API pinned down before I start cleaning
up the plugins, so what I need to know right now is:
Should I require a key to be specified for all of the tagging
functions?
'Yes' will make it harder for plugins to unwittingly mangle other
plugins' state, but might be considered too restrictive.
Your input greatly appreciated.
Peter :)
P.S. When coding with this module, DON'T TOUCH ANY FUNCTION OR
VARIABLE THAT BEGINS WITH AN UNDERSCORE! Or I will kill you. Yes.
The way the module's written at the moment, I can easily change the
way it works completely without changing the API. I'd like to keep it
that way.
--
Quake II build tools:
http://peter-b.co.uk/
Latest QuArK:
http://quark.sourceforge.net/LatestVersion
v2sw6YShw7ln5pr6ck3ma8u7Lw3+2m0l7CFi6e4+8t4Eb8Aen4g6Pa2Xs5MSr5p4
hackerkey.com