Christian Ziemski's
wikidPad Page


The todo-extension



Some notes at the beginning - especially for users of older versions of the extension

Since February 2008 I'm using another installation technique for the todo-extension.
Since then it has been published as beta version here.
There were no report about bugs or problems. So I decided to make this new version the default one (2008-06-09).

I will always upload the newest running version of the extension here. Changes will be documented here as well.
Comments, suggestions and bug reports are welcome and can be placed in wikidPad Yahoo! Group
The old version - created within WikidPadHooks.py - is still available on page todo_extension_older

Changes and new features

Planned changes/features

Things to think about




Preface

While trying wikidPad as ToDo-List-Helper I found the following extensions at the wikidPad Project Home Page:


Because these extensions still didn't exactly fit my needs I wrote my own, loosely based on the above.

I mainly added date calculations, date sorting, a separate calendar page and a configuration section.
(The formulas for 'date calculation from week number' I found somewhere in the WWW (link to be added later here).)


Description

If a WikiWord beginning with "ToDo" is created or selected (viewed) it automatically collects
all 'todo' entries from all other pages and inserts them on that page (after a placemark).
Of course you can write any own text before that placemark without being touched.

If the wikiWord has additional characters after the "ToDo" like "ToDoPrivate"
those characters "Private" are used as filter (case sensitive or insensitive).
If there are spaces or underlines between "ToDo" and the following character (e.g "ToDo_Private")
these are ignored and so still the filter is "Private".
Only Todos containing that filter string are collected.
(Behavior depends on configuration option below.)

(Note: If the optional Calendar feature is enabled below it's "ToDo", "ToDoCalendarPrivate" in the example above.)

The todos are sorted by 'tag' the following way:

    1.) Completely untagged                                e.g. 'todo: shopping'

    2.) Tagged with special tags.                          e.g. 'todo.High: pay taxes'
	  Sort order and display see config section below

    3.) Tagged with a date                                 e.g. 'todo.2006-10-31: Halloween 2006'
	  Sorted by date (earliest first in list)
	  Marked as 'GONE', 'TODAY', 'n hours left', 'n days left' dependent on dayrange below
	  Displayed in different formats, dependent the same way.

	  The following date formats are recognized:
	      "yyyy-mm-dd"   # standard date                               e.g. 'todo.2006-10-31: Halloween 2006'
	      "mm/dd/yyyy"   # GB/US date
	      "dd.mm.yyyy"   # European date
	      "yyyy-Wnn-d"   # Week; the DayOfWeek "d" is Mon(1)-Sun(7)    e.g. todo.2007-W03-2:  Tuesday of 3rd week in 2007
	      "yyyy-Wnn"     # Week                                        e.g. todo.2008-W12:    Week 12 in 2008  (Monday)
	      "*-mm-dd"      # a date every year                           e.g. todo.*-10-31:     Halloween, in every year
	      "*-*-dd"       # a day every month (and every year)          e.g. todo.*-*-01:      Every month, the 1st day
	      "*-*-*"        # every day
              "CWnn"         # Calendar Week
              "KWnn"         # just for testing: German: Calendar Week

	  The dates with "*" are optimistic ones: if such a date is in the past
	  it is assumed as "for next year" and not as "GONE this year".

          If there are subtags like the string "Peter" in "todo.Peter.2008-09-16: Birthday" the subtag is listed in parentheses on the todo page.

    4.) otherwise tagged                                       e.g. 'todo.family: holidays'

Note: Within the wikidPad help wiki this hook does nothing, even if you create a page ToDo there.


The following WikiDocumentAttributes will be added to that generated page (If there isn't already a custom [icon: ...] set, see configuration below):



Example

Since some pictures are able to describe better than many words here an easy example.
(The hardcopies are from an older version of wikidPad. So current ones look different.)

Imagine two wiki pages "FamilyBusiness" and "CarRelatedThings" with some data and todo tags on it:






Opening the wiki page "ToDo" now shows in Edit mode:
(In the lefthand tree view the items are sorted alphabetically, in the page view to right they are sorted by date.)




And the same in preview mode:




Configuration (optional)

Within the code there is a configuration section with default values.
In older version of this extension (prior to 2008-02-24) that was the only place to customize the extension.

        """
        Default configuration values
        ----------------------------
        Don't change them here since they will be overwritten by the next update of this program.

        Instead maintain your own local configuration in file "user_extensions/ToDoExtension.cfg".

        Simply copy one or more config values from here into that file and modify them to your needs.
        Be careful to let them begin at BoL: the "self.<...>" mustn't be indented there!
        I'll try to find a better solution...
        """

        #------------------------------------------------------------------------------------------
        # tags contain the (Tag, TagHeader, '') triples
        # TagHeaders are the descriptive headings that will be shown for each category.
        # UNTAGGED is a special one (mandantory!) to collect the untagged "todo:"

        self.tags = [
                ('UNTAGGED',     '++++ Not yet tagged', '', ''),
                ('High',         '+++  HIGH!', '', ''),
                ('Next',         '++++ Next Actions', '', ''),
                ('ThisWeek',     '++++ This Week', '', ''),
                ('SomeDay',      '++++ SomeDay / Maybe', '', ''),
                ('TimeToTime',   '++++ From time to time', '', ''),
                ('Low',          '++++ Tagged as LOW', '', ''),
                ('VeryLow',      '++++ Tagged as Very LOW', '', ''),
               ]

        #todo: make sure that UNTAGGED is always there!

        self.placemark  = "++++ ________auto-collected todos________"
        self.underline  = "_______"
        self.spacerline = "-" * 4
        self.bullet     = "   * "

        self.iconString        = '[icon: spanner]'

        self.colorStringNormal = '[color: black]'       # Colors for the ToDo entry in the tree
        self.colorStringNext   = '[color: orange]'      #
        self.colorStringToday  = '[color: red]'         #
        self.colorStringMissed = '[color: magenta]'     #

        self.notagHeading = "++++ "               # for unknown tagged entries
        self.dateHeading  = "++++ "               # for date entries far away (distance see below)
        self.dateHeadingX = "+++  "               # for date entries in near future or missed in past

        self.missedString = " ___ (+GONE+)"
        self.nowString    = " ___ !!! TODAY !!!"

        self.outDateFormat = ""         # if this is set = "" the local date format is used, else set it to "%m/%d/%Y", "%d.%m.%Y" or "%Y-%m-%d" for example
                                        # Note: On Windows the determination of the locale doesn't work yet. So you have to set it manually here.
                                        #       Or it defaults to "%Y-%m-%d".

        self.showWeekday   = True       # show weekday after dates
        self.weekdayFormat = " (%s,"    # %s is replaced by the weekday as in the array below,
                                        # together with the optional week number (see below) it gives e.g. " (Fri, W42)"

        self.weekdays      = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']  # English
        #self.weekdays     = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su']         # English
        #self.weekdays     = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So']         # German

        self.showWeeknumber   = True      # show weeknumber after dates
        self.weeknumberFormat = " W%02d)" # %02d is replaced by the weeknumber (2 digits with leading 0-padded)

        self.checkSearchString = 1      # 0 = no search string: ignore characters after 'ToDo'
                                        # 1 = case insensitive search string after 'ToDo'
                                        # 2 = case sensitive search string after 'ToDo'

        self.dayrange = 7               # to mark date entries in that range as "more important"
                                        # than the ones in "far" future

        self.showInfoPopup      = True  # about todos for today / missed ones
        self.infoPopupTimeDelta = 2     # number of minutes where no new popup is shown after last visit of ToDo page

        self.onlyRealTodos = True       # True = ignore done, wait, question etc.
                                        # False = all from wikidPads todo-like category

        self.setBookmark = True         # set the ToDo page [bookmarked=true] so it is listed in the Bookmark popup (Shift-Ctrl-B)

        self.realDatesLast = False      # False: sorting is: untagged - known tags - dates - newly tagged  (the default)
                                        # True:  sorting is: untagged - known tags - newly tagged - dates  (test for Jouni)

        self.realDatesSeparate = False  # False: all todos in one page: ToDo
                                        # True:  todos with real dates on a page "ToDoCalendar", all others on the normal page "ToDo"

        # The following feature works, but doesn't look nice, really! So better let it disabled...
        self.extendedLinks = False      # True  = create links with search capability on target page (only working in editor window!?)
                                        # False = create normal links


As of 2008-02-24 there is an (optional) configuration file ToDoExtension.cfg in the same directory user_extensions as the extension itself.

This makes code updates easier. Your local configuration changes aren't overwritten any more.

Please have a look at the example files
ToDoExtension.cfg or ToDoExtension.cfg.full.
(If you use the latter one for your installation you have to rename it to ToDoExtension.cfg of course.



Installation



Files to download

The current one (same as the 20080224b version below): ToDoExtension.py

Version history:
  [2008-02-24] ToDoExtension.py-20080224b Optional configuration file for local changes.
  [2008-02-24] ToDoExtension.py-20080224 Fallback and note for usage of outDateFormat on Windows.
  [2008-02-23] ToDoExtension.py-20080223 First beta version with new internals and new installation.


Known issues

- The automatic determination of the (locale) date format for list output doesn't work on Windows. Fallback is YYYY-MM-DD.