├── COPYING.txt
├── README.html
├── README.md
├── ikog.css
├── ikog.pdf
└── ikog.py
/COPYING.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.html:
--------------------------------------------------------------------------------
1 |
Acknowledgements
2 |
This software was written by Steve Butler, called "iKog".
Welcome to the iKog program. This is a very simple utility designed to make the management of your to-do lists quick and easy. The emphasis is on speed and portability. The program is a text-only utility with no graphical user-interface but it does include some features specifically designed to help with techniques such as Getting Things Done (GTD). If you're looking for fancy menus and windows, then iKog is not for you. If you're comfortable with text-based applications, then perhaps you'll find it useful. Anyway its free, so you've got nothing to lose.
7 |
Getting started
8 |
9 |
10 |
Add a task
11 |
>>>+ Learn how to use this program.
12 |
13 |
14 |
15 |
Add another task
16 |
>>>+ Read that book on web design.
17 |
18 |
19 |
20 |
Add another task but this time with a priority of 8. i.e quite important.
21 |
>>>+ Buy tin or red paint for the bathroom #8
22 |
23 |
24 |
25 |
Add another task, priority 7 and put it in a project called Bathroom
26 |
>>>+ Buy ceramic tiles #7 :pBathroom
27 |
28 |
29 |
30 |
Add a task that I want to put in a context list of jobs I can do at the computer.
31 |
>>>+ Search the web for a pasta recipe @computer
32 |
33 |
34 |
35 |
Add another task that I can do at the computer but use the abbreviated form.
36 |
>>>+ Buy a book from Amazon @c
37 |
38 |
39 |
40 |
Add a task that must be done on 30th August 2006
41 |
>>>+ Take the cat to the vets :d2006-08-30
42 |
43 |
44 |
45 |
List all of my tasks.
46 |
>>>list
47 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48 | [00] Buy tin of read paint for the bathroom #8 @Anywhere [2006-08-17]
49 | [01] Buy ceramic tiles #7 @Anywhere Projects: Bathroom [2006-08-17]
50 | [02] Learn how to use this program #5 @Anywhere [2006-08-17]
51 | [03] Read that book on web design #5 @Anywhere [2006-08-17]
52 | [04] Search the web for a pasta recipe #5 @Computer [2006-08-17]
53 | [05] Buy a book from Amazon #5 @Computer [2006-08-17]
54 | [06] @Date 2006-08-30 Take the cat to the vets #5 @Anywhere [2006-08-17
55 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 |
57 |
58 |
59 |
List only the tasks that I can do at the computer.
60 |
>>>list @c
61 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62 | Filter = @Computer
63 | [04] Search the web for a pasta recipe #5 @Computer [2006-08-17]
64 | [05] Buy a book from Amazon #5 @Computer [2006-08-17]
65 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66 |
67 |
68 |
69 |
Produce a list, grouped by context
70 |
>>>@
71 |
72 |
73 |
74 |
Produce a list, grouped by context, saved in %prog.html and open in a browser
75 |
>>>@>
76 |
77 |
78 |
79 |
Okay, I've bought that book from Amazon, lets get rid of it.
80 |
>>>kill 5
81 |
82 |
83 |
84 |
I want to put task 4, searching the web, into an @Internet context instead of the @Computer context.
85 |
>>>mod 4 @internet
86 |
87 |
88 |
89 |
Go to the next task in my list.
90 |
>>>next
91 |
92 |
93 |
94 |
Get help.
95 |
>>>help
96 |
97 |
98 |
99 |
General commands
100 |
101 | ? : displays a quick reference card
102 | HELP/H : displays this help.
103 | VERSION/VER : display the version.
104 | WEB : Go to the website for more information
105 | CLEARSCREEN/CLS : Clear the screen
106 | COLOR/COLOUR/C [N] : Use colour display (not Windows) N=1 for no background
107 | MONOCHROME/MONO : Use monochrome display
108 | EXPORT : Export the tasks only to filename.tasks.txt
109 | IMPORT file : Import tasks from the file
110 | REVIEW/REV ON|OFF : If on, hitting enter moves to the next task
111 | : If off, enter re-displays the current task
112 | V0 : Same as REVIEW OFF
113 | V1 : Same as REVIEW ON
114 | SAVE/S : Save the tasks
115 | O/OPEN file : Open a new data file.
116 | NEW file : Create a new data file.
117 | AUTOSAVE/AS ON|OFF : Switch autosave on or off
118 | SYS ON|OFF : Allow the program to use system calls.
119 | !CMD command : Run a system command.
120 | 2 : Start a two minute timer (for GTD)
121 | QUIT/Q : quit the program
122 |
123 |
Task entry and editing commands
124 |
125 | For the editing commands that require a task number, you can
126 | replace N by '^' or 'this' to refer to the current task.
127 | ADD/A/+ the task : add a task to the bottom of the list.
128 | : Entering any line that does not begin with
129 | : a valid command and which is greater than 10
130 | : characters long is also assumed to be an addition.
131 | EDIT/ED [N] : Create task, or edit task N, using external editor.
132 | SUB/SU N /s1/s2/ : Replace text s1 with s2 in task N. Use \/ if you
133 | : need to include the / character.
134 | NOTE/NOTES text : shorthand for ADD #0 @Notes text
135 | IMMEDIATE/I/++ : add a task to the top of the list to do today.
136 | REP/R N [text] : replace task N
137 | MOD/M N [text] : modify task N.
138 | EXTEND/E N [text] : add more text to task N
139 | FIRST/F N : move task N to the top.
140 | DOWN/D/ N : move task N down the queue
141 | UP/U/ N : move task N up the queue
142 |
143 |
Task removal commands
144 |
145 | KILL/K/X/- N : kill (delete) task N. You must define N
146 | DONE N [text] : Remove task N and move to an archive file
147 | ARCHIVE N [text] : Same as DONE
148 | CLEAR : Remove all tasks
149 |
150 |
Display commands
151 |
152 | SHOW N : display encrypted text for task N
153 | FILTER/FI [filter] : set a filter. Applies to all displays
154 | : See list for details of the filter
155 | : Setting the filter to nothing clears it.
156 | TOP/T [N] : Go to top, list N tasks, and display the top task
157 | NEXT/N : display the next task. Same as just hitting enter
158 | PREV/P : display previous task
159 | GO/G N : display task N
160 | LIST/L [filter] : list tasks. Filter = context, project, priority, date
161 | : or word. Contexts begin with @ and projects with :p
162 | : Dates begin with :d, anything else is a search word.
163 | : Precede term with - to exclude e.g. -@Computer
164 | : e.g LIST @computer or LIST #5
165 | @ : sorted list by Context.
166 | :D : sorted list by Dates
167 | :P : sorted list by Projects
168 | LIST>/L> [filter] : standard list sent to an HTML report
169 | @> : sorted list by Context sent to an HTML report
170 | :D> : sorted list by Dates sent to an HTML report
171 | :P> : sorted list by Projects sent to an HTML report
172 | : The HTML reports are sent to todoFilename.html
173 |
174 |
Advanced options
175 |
176 | The SETEDxxx commands allow you to use an external editor.
177 | Note the editor you pick should be a simple text editor. If you pick
178 | something that doesn't work, try the defaults again.
179 | Because some systems may have different editors installed, you can set
180 | more than one by separating the editors usng commas. The program will
181 | use the first one it finds.
182 | For Windows the default is edit, which works quite well in the terminal
183 | but you could change it to notepad.
184 | For Linux, the default is nano,pico,vim,emacs.
185 | To use external editors you must switch on system calls using the SYS ON
186 | command
187 | SETEDNT command : Set the external editor for Windows (NT).
188 | SETEDPOSIX command : Set the editor for posix systems.
189 | : e.g. SETEDNT edit
190 | : SETEDPOSIX nano,vim
191 | SHORTCUT/SC ? : list shortcuts
192 | SHORTCUT/SC N cmd : Set shortcut N to command cmd
193 | =N : Run shortcut N
194 | ABBREV/AB @x @full : Create new abbreviation. @x expands to @full
195 | ABBREV/AB ? : List context abbreviations.
196 | PAB :px :pfull : Project abbreviation. :px expands to :pfull
197 | PAB ? : List project abbreviations.
198 |
199 |
Contexts
200 |
201 | Any word preceded by @ will be used as a context. Contexts are like
202 | sub-categories or sub-lists. There are a number of pre-defined
203 | abbreviations that you can use as well. The recognised abbreviations
204 | are:
205 | @A = @Anywhere (this is the default)
206 | @C = @Computer
207 | @D = @Desk
208 | @E = @Errands
209 | @H = @Home
210 | @I = @Internet
211 | @L = @Lunch
212 | @M = @Meeting
213 | @N = @Next
214 | @O = @Other
215 | @P = @Phone
216 | @PW= @Password
217 | @S = @Someday/maybe
218 | @W4= @Waiting_for
219 | @W = @Work
220 |
221 |
Entering dates
222 |
223 | An @Date context is created if you embed a date in the task.
224 | Dates are embedded using the :dDATE format.
225 | Valid DATE formats are yyyy-mm-dd, mm-dd or dd
226 | You can also use : or / as the separators. So, for example:
227 | :d2006/12/22 or :d2006-11-7 or :d9/28 are all valid entries.
228 |
If you set a date, then until that date is reached, the task is given
229 | an effective priority of 0. Once the date is reached, the task's
230 | priority is increased by 11, moving it to the of the list.
231 |
A date entry of :d0 can be used to clear a date entry.
232 | A date entry of :d+X can be used to create a date entry of today + X days.
233 | So :d+1 is tomorrow and :d+0 is today.
234 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Acknowledgements
2 | ================
3 | This software was written by Steve Butler, called "iKog".
4 |
5 | Project homepage: https://sites.google.com/site/henspace/ikog
6 |
7 | Author blog: http://cuckooswearblack.blogspot.com/
8 |
9 | Author twitter: http://twitter.com/henspace
10 |
11 | About
12 | -----
13 | Welcome to the iKog program. This is a very simple utility designed to make the management of your to-do lists quick and easy. The emphasis is on speed and portability. The program is a text-only utility with no graphical user-interface but it does include some features specifically designed to help with techniques such as Getting Things Done (GTD). If you're looking for fancy menus and windows, then iKog is not for you. If you're comfortable with text-based applications, then perhaps you'll find it useful. Anyway its free, so you've got nothing to lose.
14 |
15 | Getting started
16 | ---------------
17 | - Add a task
18 |
19 | >>>+ Learn how to use this program.
20 |
21 | - Add another task
22 |
23 | >>>+ Read that book on web design.
24 |
25 | - Add another task but this time with a priority of 8. i.e quite important.
26 |
27 | >>>+ Buy tin or red paint for the bathroom #8
28 |
29 | - Add another task, priority 7 and put it in a project called Bathroom
30 |
31 | >>>+ Buy ceramic tiles #7 :pBathroom
32 |
33 | - Add a task that I want to put in a context list of jobs I can do at the computer.
34 |
35 | >>>+ Search the web for a pasta recipe @computer
36 |
37 | - Add another task that I can do at the computer but use the abbreviated form.
38 |
39 | >>>+ Buy a book from Amazon @c
40 |
41 | - Add a task that must be done on 30th August 2006
42 |
43 | >>>+ Take the cat to the vets :d2006-08-30
44 |
45 | - List all of my tasks.
46 |
47 | >>>list
48 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 | [00] Buy tin of read paint for the bathroom #8 @Anywhere [2006-08-17]
50 | [01] Buy ceramic tiles #7 @Anywhere Projects: Bathroom [2006-08-17]
51 | [02] Learn how to use this program #5 @Anywhere [2006-08-17]
52 | [03] Read that book on web design #5 @Anywhere [2006-08-17]
53 | [04] Search the web for a pasta recipe #5 @Computer [2006-08-17]
54 | [05] Buy a book from Amazon #5 @Computer [2006-08-17]
55 | [06] @Date 2006-08-30 Take the cat to the vets #5 @Anywhere [2006-08-17
56 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57 |
58 | - List only the tasks that I can do at the computer.
59 |
60 | >>>list @c
61 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62 | Filter = @Computer
63 | [04] Search the web for a pasta recipe #5 @Computer [2006-08-17]
64 | [05] Buy a book from Amazon #5 @Computer [2006-08-17]
65 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66 |
67 | - Produce a list, grouped by context
68 |
69 | >>>@
70 |
71 | - Produce a list, grouped by context, saved in %prog.html and open in a browser
72 |
73 | >>>@>
74 |
75 | - Okay, I've bought that book from Amazon, lets get rid of it.
76 |
77 | >>>kill 5
78 |
79 | - I want to put task 4, searching the web, into an @Internet context instead of the @Computer context.
80 |
81 | >>>mod 4 @internet
82 |
83 | - Go to the next task in my list.
84 |
85 | >>>next
86 |
87 | - Get help.
88 |
89 | >>>help
90 |
91 | General commands
92 | ----------------
93 |
94 | ? : displays a quick reference card
95 | HELP/H : displays this help.
96 | VERSION/VER : display the version.
97 | WEB : Go to the website for more information
98 | CLEARSCREEN/CLS : Clear the screen
99 | COLOR/COLOUR/C [N] : Use colour display (not Windows) N=1 for no background
100 | MONOCHROME/MONO : Use monochrome display
101 | EXPORT : Export the tasks only to filename.tasks.txt
102 | IMPORT file : Import tasks from the file
103 | REVIEW/REV ON|OFF : If on, hitting enter moves to the next task
104 | : If off, enter re-displays the current task
105 | V0 : Same as REVIEW OFF
106 | V1 : Same as REVIEW ON
107 | SAVE/S : Save the tasks
108 | O/OPEN file : Open a new data file.
109 | NEW file : Create a new data file.
110 | AUTOSAVE/AS ON|OFF : Switch autosave on or off
111 | SYS ON|OFF : Allow the program to use system calls.
112 | !CMD command : Run a system command.
113 | 2 : Start a two minute timer (for GTD)
114 | QUIT/Q : quit the program
115 |
120 | For the editing commands that require a task number, you can
121 | replace N by '^' or 'this' to refer to the current task.
122 | ADD/A/+ the task : add a task to the bottom of the list.
123 | : Entering any line that does not begin with
124 | : a valid command and which is greater than 10
125 | : characters long is also assumed to be an addition.
126 | EDIT/ED [N] : Create task, or edit task N, using external editor.
127 | SUB/SU N /s1/s2/ : Replace text s1 with s2 in task N. Use \/ if you
128 | : need to include the / character.
129 | NOTE/NOTES text : shorthand for ADD #0 @Notes text
130 | IMMEDIATE/I/++ : add a task to the top of the list to do today.
131 | REP/R N [text] : replace task N
132 | MOD/M N [text] : modify task N.
133 | EXTEND/E N [text] : add more text to task N
134 | FIRST/F N : move task N to the top.
135 | DOWN/D/ N : move task N down the queue
136 | UP/U/ N : move task N up the queue
137 |
142 | KILL/K/X/- N : kill (delete) task N. You must define N
143 | DONE N [text] : Remove task N and move to an archive file
144 | ARCHIVE N [text] : Same as DONE
145 | CLEAR : Remove all tasks
146 |
151 | SHOW N : display encrypted text for task N
152 | FILTER/FI [filter] : set a filter. Applies to all displays
153 | : See list for details of the filter
154 | : Setting the filter to nothing clears it.
155 | TOP/T [N] : Go to top, list N tasks, and display the top task
156 | NEXT/N : display the next task. Same as just hitting enter
157 | PREV/P : display previous task
158 | GO/G N : display task N
159 | LIST/L [filter] : list tasks. Filter = context, project, priority, date
160 | : or word. Contexts begin with @ and projects with :p
161 | : Dates begin with :d, anything else is a search word.
162 | : Precede term with - to exclude e.g. -@Computer
163 | : e.g LIST @computer or LIST #5
164 | @ : sorted list by Context.
165 | :D : sorted list by Dates
166 | :P : sorted list by Projects
167 | LIST>/L> [filter] : standard list sent to an HTML report
168 | @> : sorted list by Context sent to an HTML report
169 | :D> : sorted list by Dates sent to an HTML report
170 | :P> : sorted list by Projects sent to an HTML report
171 | : The HTML reports are sent to todoFilename.html
172 |
177 | The SETEDxxx commands allow you to use an external editor.
178 | Note the editor you pick should be a simple text editor. If you pick
179 | something that doesn't work, try the defaults again.
180 | Because some systems may have different editors installed, you can set
181 | more than one by separating the editors usng commas. The program will
182 | use the first one it finds.
183 | For Windows the default is edit, which works quite well in the terminal
184 | but you could change it to notepad.
185 | For Linux, the default is nano,pico,vim,emacs.
186 | To use external editors you must switch on system calls using the SYS ON
187 | command
188 | SETEDNT command : Set the external editor for Windows (NT).
189 | SETEDPOSIX command : Set the editor for posix systems.
190 | : e.g. SETEDNT edit
191 | : SETEDPOSIX nano,vim
192 | SHORTCUT/SC ? : list shortcuts
193 | SHORTCUT/SC N cmd : Set shortcut N to command cmd
194 | =N : Run shortcut N
195 | ABBREV/AB @x @full : Create new abbreviation. @x expands to @full
196 | ABBREV/AB ? : List context abbreviations.
197 | PAB :px :pfull : Project abbreviation. :px expands to :pfull
198 | PAB ? : List project abbreviations.
199 |
200 |
201 | Contexts
202 | --------
203 |
204 | Any word preceded by @ will be used as a context. Contexts are like
205 | sub-categories or sub-lists. There are a number of pre-defined
206 | abbreviations that you can use as well. The recognised abbreviations
207 | are:
208 | @A = @Anywhere (this is the default)
209 | @C = @Computer
210 | @D = @Desk
211 | @E = @Errands
212 | @H = @Home
213 | @I = @Internet
214 | @L = @Lunch
215 | @M = @Meeting
216 | @N = @Next
217 | @O = @Other
218 | @P = @Phone
219 | @PW= @Password
220 | @S = @Someday/maybe
221 | @W4= @Waiting_for
222 | @W = @Work
223 |
228 | An @Date context is created if you embed a date in the task.
229 | Dates are embedded using the :dDATE format.
230 | Valid DATE formats are yyyy-mm-dd, mm-dd or dd
231 | You can also use : or / as the separators. So, for example:
232 | :d2006/12/22 or :d2006-11-7 or :d9/28 are all valid entries.
233 |
234 | If you set a date, then until that date is reached, the task is given
235 | an effective priority of 0. Once the date is reached, the task's
236 | priority is increased by 11, moving it to the of the list.
237 |
238 | A date entry of :d0 can be used to clear a date entry.
239 | A date entry of :d+X can be used to create a date entry of today + X days.
240 | So :d+1 is tomorrow and :d+0 is today.
241 |
242 |
--------------------------------------------------------------------------------
/ikog.css:
--------------------------------------------------------------------------------
1 | /* Example CSS Document for ikog v1.0 2007-03-25*/
2 | .header {
3 | border: thin solid;
4 | text-align:center;
5 | }
6 | .hTitle {
7 | font-family: sans-serif;
8 | font-size: 12pt;
9 | font-weight: bold;
10 | color: Black;
11 | }
12 | .hSubTitle {
13 | font-family: sans-serif;
14 | font-size: 10pt;
15 | font-weight: bold;
16 | color: Black;
17 | }
18 | .hAction, .hProject, .hDate {
19 | font-family: sans-serif;
20 | font-size: 10pt;
21 | font-weight: bold;
22 | color: #43196F;
23 | }
24 | .hFilter {
25 | font-family: sans-serif;
26 | font-size: 10pt;
27 | font-weight: bold;
28 | color: #3CB371;
29 | }
30 | .taskArea {
31 | padding: 10px;
32 | }
33 |
34 | .itemGroup {
35 | border: none;
36 | background-color: #F0F8FF;
37 | }
38 |
39 | .evenTask {
40 | font-family: sans-serif;
41 | font-size: 10pt;
42 | font-weight: normal;
43 | color: #191970;
44 | }
45 | .oddTask {
46 | font-family: sans-serif;
47 | font-size: 10pt;
48 | font-weight: normal;
49 | color: #6F196F;
50 | }
51 | .footer {
52 | border: thin solid;
53 | text-align:center;
54 | font-size: 8pt;
55 | font-weight: normal;
56 | color:black;
57 | }
58 |
--------------------------------------------------------------------------------
/ikog.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/janosgyerik/gtd-cli-py/ba9859d8fb05ca5997b203e3213024f3ee1e8dce/ikog.pdf
--------------------------------------------------------------------------------
/ikog.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 | # Run the script for details of the licence
5 | # or refer to the notice section later in the file.
6 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 | #!<^DATA
8 | #!<^CONFIG
9 | cfgColor = 0
10 | cfgAutoSave = True
11 | cfgReviewMode = True
12 | cfgSysCalls = False
13 | cfgEditorNt = "edit"
14 | cfgEditorPosix = "nano,pico,vim,emacs"
15 | cfgShortcuts = ['', '', '', '', '', '', '', '', '', '']
16 | cfgAbbreviations = {}
17 | cfgPAbbreviations = {}
18 | #!<^CODE
19 | import sys
20 | import os
21 | import re
22 | from datetime import date
23 | from datetime import timedelta
24 | import platform
25 | import urllib
26 | import getpass
27 | from md5 import md5
28 | import struct
29 | import tempfile
30 | from threading import Timer
31 | import stat
32 |
33 | supportAes = True
34 | try:
35 | import pyRijndael
36 | except:
37 | supportAes = False
38 |
39 | try:
40 | import readline
41 | except:
42 | pass
43 |
44 | usePlugin = True
45 | try:
46 | import ikogPlugin
47 | except:
48 | usePlugin = False
49 |
50 | notice = [
51 | "ikog.py v 1.90 2008-11-14",
52 | "Copyright (C) 2006-2008 S. J. Butler",
53 | "Visit http://www.henspace.co.uk for more information.",
54 | "This program is free software; you can redistribute it and/or modify",
55 | "it under the terms of the GNU General Public Licence as published by",
56 | "the Free Software Foundation; either version 2 of the License, or",
57 | "(at your option) any later version.",
58 | "",
59 | "This program is distributed in the hope that it will be useful,",
60 | "but WITHOUT ANY WARRANTY; without even the implied warranty of",
61 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
62 | "GNU General Public License for more details. The license is available",
63 | "from http://www.gnu.org/licenses/gpl.txt"
64 | ]
65 |
66 | banner = [
67 | " _ _ ",
68 | " (_) | | __ ___ __ _",
69 | " | | | |/ / / _ \ / _` |",
70 | " | | | < | (_) | | (_| |",
71 | " |_| |_|\_\ \___/ \__, |",
72 | " _ _ _ |___/",
73 | " (_) | |_ | | __ ___ ___ _ __ ___ ___ _ __",
74 | " | | | __| | |/ / / _ \ / _ \ | '_ \ / __| / _ \ | '_ \ ",
75 | " | | | |_ | < | __/ | __/ | |_) | \__ \ | (_) | | | | |",
76 | " |_| \__| |_|\_\ \___| \___| | .__/ |___/ \___/ |_| |_|",
77 | " |_| _",
78 | " __ _ _ __ ___ __ __ (_) _ __ __ _ ",
79 | " / _` | | '__| / _ \ \ \ /\ / / | | | '_ \ / _` |",
80 | " | (_| | | | | (_) | \ V V / | | | | | | | (_| | _",
81 | " \__, | |_| \___/ \_/\_/ |_| |_| |_| \__, | (_)",
82 | " |___/ |___/",
83 | ]
84 |
85 |
86 |
87 | magicTag = "#!<^"
88 | gMaxLen = 80
89 | try:
90 | ruler = "~".ljust(gMaxLen - 1, "~")
91 | divider = "_".ljust(gMaxLen - 1, "_")
92 | except Exception:
93 | print "Error found. Probably wrong version of Python"
94 |
95 | gReqPythonMajor = 2
96 | gReqPythonMinor = 4
97 |
98 |
99 | def safeRawInput(prompt):
100 | try:
101 | entry = raw_input(prompt)
102 | except:
103 | print "\n"
104 | entry = ""
105 | return entry
106 |
107 | ### global compare function
108 | def compareTodo(a, b):
109 | return cmp(a.getEffectivePriority(), b.getEffectivePriority())
110 |
111 | def printError(msg):
112 | print gColor.code("error") + "ERROR: " + msg + gColor.code("normal")
113 |
114 |
115 | def clearScreen(useSys = False):
116 | if useSys:
117 | if os.name == "posix":
118 | os.system("clear")
119 | elif os.name in ("dos", "ce", "nt"):
120 | os.system("cls")
121 | print "\n"*25
122 | for l in banner:
123 | print l
124 |
125 | ### XTEA algorithm public domain
126 | class Xtea:
127 | def __init__(self):
128 | pass
129 |
130 | def crypt(self, key,data,iv='\00\00\00\00\00\00\00\00',n=32):
131 | def keygen(key,iv,n):
132 | while True:
133 | iv = self.xtea_encrypt(key,iv,n)
134 | for k in iv:
135 | yield ord(k)
136 | xor = [ chr(x^y) for (x,y) in zip(map(ord,data),keygen(key,iv,n)) ]
137 | return "".join(xor)
138 |
139 | def xtea_encrypt(self, key,block,n=32):
140 | v0,v1 = struct.unpack("!2L",block)
141 | k = struct.unpack("!4L",key)
142 | sum,delta,mask = 0L,0x9e3779b9L,0xffffffffL
143 | for round in range(n):
144 | v0 = (v0 + (((v1<<4 ^ v1>>5) + v1) ^ (sum + k[sum & 3]))) & mask
145 | sum = (sum + delta) & mask
146 | v1 = (v1 + (((v0<<4 ^ v0>>5) + v0) ^ (sum + k[sum>>11 & 3]))) & mask
147 | return struct.pack("!2L",v0,v1)
148 |
149 | class WordWrapper:
150 | def __init__(self, width):
151 | self.width = width
152 | self.nLines = 0
153 | self.pos = 0
154 |
155 | def addLine(self, pos):
156 | self.pos = pos
157 | self.nLines = self.nLines + 1
158 |
159 | def getNLines(self):
160 | return self.nLines
161 |
162 | def intelliLen(self, text):
163 | return len(gColor.stripCodes(text))
164 |
165 | def wrap(self, text):
166 | self.nLines = 0
167 | formatted = text.replace(" ", "\n").replace(" ", "\n")
168 | lines = formatted.splitlines()
169 | out = ""
170 | self.pos = 0
171 | for thisline in lines:
172 | newline = True
173 | words = thisline.split()
174 | if self.pos != 0:
175 | out = out + "\n"
176 | self.addLine(0)
177 | for w in words:
178 | wlen = self.intelliLen(w) + 1
179 | if (self.pos + wlen) == self.width:
180 | out = out + " " + w
181 | self.addLine(0)
182 | elif (self.pos + wlen) < self.width:
183 | if newline:
184 | out = out + w
185 | self.pos = wlen
186 | else:
187 | out = out + " " + w
188 | self.pos = self.pos + wlen + 1
189 | else:
190 | out = out + "\n" + w
191 | self.addLine(wlen)
192 | newline = False
193 | return out
194 |
195 | ### Color code class for handling color text output
196 | class ColorCoder:
197 | NONE = -1
198 | ANSI = 0
199 | codes = [{"normal":"\x1b[0;37;40m",
200 | "title":"\x1b[1;32;40m",
201 | "heading":"\x1b[1;35;40m",
202 | "bold":"\x1b[1;35;40m",
203 | "important":"\x1b[1;31;40m",
204 | "error":"\x1b[1;31;40m",
205 | "reverse":"\x1b[0;7m",
206 | "row0":"\x1b[0;35;40m",
207 | "row1":"\x1b[0;36;40m"},
208 | {"normal":"\x1b[0;37m",
209 | "title":"\x1b[1;32m",
210 | "heading":"\x1b[1;35m",
211 | "bold":"\x1b[1;35m",
212 | "important":"\x1b[1;31m",
213 | "error":"\x1b[1;31m",
214 | "reverse":"\x1b[0;7m",
215 | "row0":"\x1b[0;35m",
216 | "row1":"\x1b[0;36m"}]
217 |
218 | def __init__(self, set):
219 | self.codeSet = self.NONE
220 | self.setCodeSet(set)
221 |
222 | def stripCodes(self, text):
223 | # strip out the ansi codes
224 | ex = re.compile("\x1b\[[0-9;]*m")
225 | return ex.sub("", text)
226 |
227 | def setCodeSet(self, set):
228 | old = self.codeSet
229 | if set < 0:
230 | self.codeSet = self.NONE
231 | elif set < len(self.codes):
232 | self.codeSet = set
233 | return (old != self.codeSet)
234 |
235 | def isValidSet(self, myset):
236 | if myset < len(self.codes):
237 | return True
238 | else:
239 | return False
240 |
241 | def colorSupported(self):
242 | return (os.name == "posix" or os.name == "mac")
243 |
244 | def usingColor(self):
245 | return (self.codeSet <> self.NONE and self.colorSupported())
246 |
247 | def code(self, type):
248 | if self.codeSet == self.NONE or not self.colorSupported():
249 | return ""
250 | else:
251 | return self.codes[self.codeSet][type]
252 |
253 | def printCode(self, type):
254 | if self.codeSet != self.NONE:
255 | print self.code(type),
256 |
257 | def getCodeSet(self):
258 | return self.codeSet
259 |
260 | ### Viewer class for paging through multiple lines
261 | class ListViewer:
262 | def __init__(self, maxlines):
263 | self.maxlines = maxlines
264 |
265 | def show(self, list, pause):
266 | count = 0
267 | for line in list:
268 | if count >= self.maxlines or line == pause:
269 | io = safeRawInput("--- Press enter for more. Enter s to skip ---").strip()
270 | print ""
271 | if len(io) > 0 and io.upper()[0] == "S":
272 | break
273 | count = 0
274 | if line != pause:
275 | print line
276 | count = count + 1
277 |
278 | ### Handler for encryption
279 | class Encryptor:
280 | TYPE_OBSCURED = "xtea_"
281 | TYPE_AES = "aes_"
282 | SALT_64 = "1hJ8*gpQ"
283 |
284 | def __init__(self):
285 | self.key = ""
286 | self.encryptionType = self.TYPE_OBSCURED
287 |
288 | def setType(self, codeType):
289 | if codeType == self.TYPE_AES and supportAes == False:
290 | self.encryptionType = self.TYPE_OBSCURED
291 | else:
292 | self.encryptionType = codeType
293 | return self.encryptionType
294 |
295 | def setKey(self, key):
296 | self.key = key
297 |
298 | def getKey(self):
299 | return self.key
300 |
301 | def enterKey(self, prompt1, prompt2):
302 | done = False
303 | while not done:
304 | input1 = getpass.getpass(prompt1 + " >>>")
305 | if prompt2 != "":
306 | input2 = getpass.getpass(prompt2 + " >>>")
307 | if input1 != input2:
308 | print "You must enter the same password. Start again"
309 | else:
310 | done = True
311 | else:
312 | done = True
313 | self.key = input1
314 | return input1
315 |
316 | def complexKey(self):
317 | return md5(self.key).digest()
318 |
319 | def getSecurityClass(self, encrypted):
320 | if encrypted.startswith(self.TYPE_OBSCURED):
321 | return "private xtea"
322 | if encrypted.startswith(self.TYPE_AES):
323 | return "secret aes"
324 | return "unknown"
325 |
326 | def obscure(self, plainText):
327 | key = self.complexKey()
328 | obscured = Xtea().crypt(key, plainText, self.SALT_64)
329 | return self.TYPE_OBSCURED + obscured.encode('hex_codec')
330 |
331 | def unobscure(self, obscured):
332 | plain = ""
333 | data = obscured[len(self.TYPE_OBSCURED):]
334 | data = data.decode('hex_codec')
335 | key = self.complexKey()
336 | plain = Xtea().crypt(key, data, self.SALT_64)
337 | return plain
338 |
339 | def encryptAes(self, plainText):
340 | if len(self.key) < 16:
341 | key = self.complexKey()
342 | else:
343 | key = self.key
344 | obscured = pyRijndael.EncryptData(key, plainText)
345 | return self.TYPE_AES + obscured.encode('hex_codec')
346 |
347 | def decryptAes(self, encrypted):
348 | plain = ""
349 | data = encrypted[len(self.TYPE_AES):]
350 | data = data.decode('hex_codec')
351 | if len(self.key) < 16:
352 | key = self.complexKey()
353 | else:
354 | key = self.key
355 | plain = pyRijndael.DecryptData(key, data)
356 | return plain
357 |
358 | def enterKeyAndEncrypt(self, plainText):
359 | self.enterKey("Enter the master password.", "Re-enter the master password")
360 | return self.encrypt(plainText)
361 |
362 | def encrypt(self, plainText):
363 | if self.encryptionType == self.TYPE_AES:
364 | return self.encryptAes(plainText)
365 | else:
366 | return self.obscure(plainText)
367 |
368 | def enterKeyAndDecrypt(self, encryptedText):
369 | self.enterKey("Enter your master password", "")
370 | return self.decrypt(encryptedText)
371 |
372 | def decrypt(self, encryptedText):
373 | if encryptedText.startswith(self.TYPE_AES):
374 | if not supportAes:
375 | return "You do not have the pyRinjdael module so the text cannot be decrypted."
376 | else:
377 | return self.decryptAes(encryptedText)
378 | else:
379 | return self.unobscure(encryptedText)
380 |
381 | ### Handler for user input
382 | class InputParser:
383 | def __init__(self, prompt):
384 | self.prompt = prompt
385 |
386 | def read(self, entry = ""):
387 | if entry == "":
388 | entry = safeRawInput(self.prompt)
389 | entry = entry.strip()
390 | if entry == "":
391 | command = ""
392 | line = ""
393 | else:
394 | if usePlugin:
395 | entry = ikogPlugin.modifyUserInput(entry)
396 | if entry.find(magicTag) == 0:
397 | printError("You cannot begin lines with the sequence " + magicTag)
398 | command = ""
399 | line = ""
400 | elif entry.find(TodoItem.ENCRYPTION_MARKER) >= 0:
401 | printError ("You cannot use the special sequence " + TodoItem.ENCRYPTION_MARKER)
402 | command = ""
403 | line = ""
404 | else:
405 | n = entry.find(" ")
406 | if n >= 0:
407 | command = entry[:n]
408 | line = entry[n + 1:]
409 | else:
410 | command = entry
411 | line = ""
412 |
413 | return (command, line)
414 |
415 | class EditorLauncher:
416 | WARNING_TEXT = "# Do not enter secret or private information!"
417 | def __init__(self):
418 | pass
419 |
420 | def edit(self, text):
421 | ed = ""
422 | terminator = "\n"
423 | if os.name == "posix":
424 | ed = cfgEditorPosix
425 | elif os.name == "nt":
426 | ed = cfgEditorNt
427 | terminator = "\r\n"
428 | if ed == "":
429 | printError("Sorry, but external editing not supported on " + os.name.upper())
430 | success = False
431 | else:
432 | fname = self.makeFile(text, terminator)
433 | if fname == "":
434 | printError("Unable to create temporary file.")
435 | else:
436 | success = self.run(ed, fname)
437 | if success:
438 | (success, text) = self.readFile(fname)
439 | if text == self.orgText:
440 | print("No changes made.");
441 | success = False
442 | self.scrubFile(fname)
443 | if success:
444 | return text
445 | else:
446 | return ""
447 |
448 | def scrubFile(self, fname):
449 | try:
450 | os.remove(fname)
451 | except Exception, e:
452 | printError("Failed to remove file " + fname + ". If you entered any private data you should delete this file yourself.")
453 |
454 | def readFile(self, fname):
455 | success = False
456 | try:
457 | fh = open(fname, "rt")
458 | line = fh.readline()
459 | text = ""
460 | first = True
461 | while line != "":
462 | thisLine = self.safeString(line)
463 | if thisLine != self.WARNING_TEXT:
464 | if not first:
465 | text = text + " "
466 | text = text + thisLine
467 | first = False
468 | line = fh.readline()
469 | fh.close()
470 | success = True
471 | except Exception, e:
472 | printError("Error reading the edited text. " + str(e))
473 | return (success, text)
474 |
475 | def safeString(self, text):
476 | return text.replace("\r","").replace("\n","")
477 |
478 | def makeFile(self, text, terminator):
479 | fname = ""
480 | (fh, fname) = tempfile.mkstemp(".tmpikog","ikog")
481 | fout = os.fdopen(fh,"wt")
482 | text = text.replace(" ", " ")
483 | self.orgText = text
484 | lines = text.split(" ")
485 | fout.write(self.WARNING_TEXT + terminator)
486 | for thisline in lines:
487 | fout.write(self.safeString(thisline) + terminator)
488 | fout.close()
489 | return fname
490 |
491 | def run(self, program, file):
492 | progs = program.split(",")
493 | for prog in progs:
494 | success = self.runProgram(prog.strip(), file)
495 | if success:
496 | break;
497 | return success
498 |
499 | def runProgram(self, program, file):
500 | success = False
501 | if os.name == "posix":
502 | try:
503 | progarg = program
504 | os.spawnlp(os.P_WAIT, program, progarg, file)
505 | success = True
506 | except os.error:
507 | pass
508 | except Exception, e:
509 | printError(str(e))
510 | elif os.name == "nt":
511 | if file.find(" ") >= 0:
512 | file = "\"" + file + "\""
513 | for path in os.environ["PATH"].split(os.pathsep):
514 | try:
515 | prog = os.path.join(path, program)
516 | if prog.find(" ") >= 0:
517 | progarg = "\"" + prog + "\""
518 | else:
519 | progarg = prog
520 | os.spawnl(os.P_WAIT, prog, progarg, file)
521 | success = True
522 | if success:
523 | break
524 | except os.error:
525 | pass
526 | except Exception, e:
527 | printError(str(e))
528 | return success
529 |
530 |
531 | ### The main todo list
532 | class TodoList:
533 | quickCard = ["Quick reference card:",
534 | "? ADD/A/+ text FILTER/FI [filter]",
535 | "HELP/H IMMEDIATE/I/++ text TOP/T [N]",
536 | "COLOR/COLOUR/C [N] KILL/K/X/- N NEXT/N",
537 | "MONOCHROME/MONO CLEAR PREV/P",
538 | "EXPORT REP/R N [text] GO/G N",
539 | "IMPORT file MOD/M N [text] LIST/L [filter]",
540 | "REVIEW/REV ON/OFF EXTEND/E N [text] LIST>/L> [filter]",
541 | "V0 EDIT/ED [N] @",
542 | "V1 SUB/SU N /s1/s2/ :D",
543 | "WEB FIRST/F N :P>",
544 | "SAVE/S DOWN/D N @>",
545 | "AUTOSAVE/AS ON|OFF UP/U N :D>",
546 | "VER/VERSION NOTE/NOTES text :P>",
547 | "CLEARSCREEN/CLS O/OPEN file SHOW N",
548 | "SYS ON|OFF NEW file SETEDxx editor",
549 | "!CMD command 2 ABBREV/AB @x @full",
550 | "ABBREV/AB ? PAB ? PAB :px :pfull",
551 | "SHORTCUT/SC N cmd SHORTCUT/SC ? =N",
552 | "ARCHIVE/DONE N [text]",
553 | ]
554 |
555 | help = [ "",
556 | "Introduction",
557 | "------------",
558 | "The program is designed to help manage tasks using techniques",
559 | "such as Getting Things Done by David Allen. Check out",
560 | "http://www.henspace.co.uk for more information and detailed help.",
561 | "To use the program, simply enter the task at the prompt.",
562 | "All of the commands are displayed in the next section.",
563 | "!PAUSE!",
564 | "COMMANDS",
565 | "--------",
566 | "Commands that have more than one method of entry are shown separated by /",
567 | "e.g HELP/H means that you can enter either HELP or an H.",
568 | "All commands can be entered in upper or lower case.",
569 | "Items shown in square brackets are optional.",
570 | "Items shown separated by the | symbol are alternatives. e.g ON|OFF means",
571 | "you should type either ON or OFF.",
572 | "Note that some commands refer to adding tasks to the top or bottom of the",
573 | "list. However the task's position in the list is also determined by its.",
574 | "priority. So, for example, adding a task to the top will still not allow",
575 | "it to precede tasks that have been assigned a higher priority number. ",
576 | "!PAUSE!",
577 | "GENERAL COMMANDS",
578 | "----------------",
579 | "? : displays a quick reference card",
580 | "HELP/H : displays this help.",
581 | "VERSION/VER : display the version.",
582 | "WEB : Go to the website for more information",
583 | "CLEARSCREEN/CLS : Clear the screen",
584 | "COLOR/COLOUR/C [N] : Use colour display (not Windows) N=1 for no background",
585 | "MONOCHROME/MONO : Use monochrome display",
586 | "EXPORT : Export the tasks only to filename.tasks.txt",
587 | "IMPORT file : Import tasks from the file",
588 | "REVIEW/REV ON|OFF : If on, hitting enter moves to the next task",
589 | " : If off, enter re-displays the current task",
590 | "V0 : Same as REVIEW OFF",
591 | "V1 : Same as REVIEW ON",
592 | "SAVE/S : Save the tasks",
593 | "O/OPEN file : Open a new data file.",
594 | "NEW file : Create a new data file.",
595 | "AUTOSAVE/AS ON|OFF : Switch autosave on or off",
596 | "SYS ON|OFF : Allow the program to use system calls.",
597 | "!CMD command : Run a system command.",
598 | "2 : Start a two minute timer (for GTD)",
599 | "QUIT/Q : quit the program",
600 | "!PAUSE!",
601 | "TASK ENTRY AND EDITING COMMANDS",
602 | "-------------------------------",
603 | "For the editing commands that require a task number, you can",
604 | "replace N by '^' or 'this' to refer to the current task.",
605 | "ADD/A/+ the task : add a task to the bottom of the list.",
606 | " : Entering any line that does not begin with",
607 | " : a valid command and which is greater than 10",
608 | " : characters long is also assumed to be an addition.",
609 | "EDIT/ED [N] : Create task, or edit task N, using external editor.",
610 | "SUB/SU N /s1/s2/ : Replace text s1 with s2 in task N. Use \/ if you",
611 | " : need to include the / character.",
612 | "NOTE/NOTES text : shorthand for ADD #0 @Notes text",
613 | "IMMEDIATE/I/++ : add a task to the top of the list to do today.",
614 | "REP/R N [text] : replace task N",
615 | "MOD/M N [text] : modify task N.",
616 | "EXTEND/E N [text] : add more text to task N",
617 | "FIRST/F N : move task N to the top.",
618 | "DOWN/D/ N : move task N down the queue",
619 | "UP/U/ N : move task N up the queue",
620 | "!PAUSE!",
621 | "TASK REMOVAL COMMANDS",
622 | "---------------------",
623 | "KILL/K/X/- N : kill (delete) task N. You must define N",
624 | "DONE N [text] : Remove task N and move to an archive file",
625 | "ARCHIVE N [text] : Same as DONE",
626 | "CLEAR : Remove all tasks",
627 | "!PAUSE!",
628 | "DISPLAY COMMANDS",
629 | "----------------",
630 | "SHOW N : display encrypted text for task N",
631 | "FILTER/FI [filter] : set a filter. Applies to all displays",
632 | " : See list for details of the filter",
633 | " : Setting the filter to nothing clears it.",
634 | "TOP/T [N] : Go to top, list N tasks, and display the top task",
635 | "NEXT/N : display the next task. Same as just hitting enter",
636 | "PREV/P : display previous task",
637 | "GO/G N : display task N",
638 | "LIST/L [filter] : list tasks. Filter = context, project, priority, date",
639 | " : or word. Contexts begin with @ and projects with :p",
640 | " : Dates begin with :d, anything else is a search word.",
641 | " : Precede term with - to exclude e.g. -@Computer",
642 | " : e.g LIST @computer or LIST #5",
643 | "@ : sorted list by Context.",
644 | ":D : sorted list by Dates",
645 | ":P : sorted list by Projects",
646 | "LIST>/L> [filter] : standard list sent to an HTML report",
647 | "@> : sorted list by Context sent to an HTML report",
648 | ":D> : sorted list by Dates sent to an HTML report",
649 | ":P> : sorted list by Projects sent to an HTML report",
650 | " : The HTML reports are sent to todoFilename.html",
651 | "!PAUSE!",
652 | "ADVANCED OPTIONS",
653 | "----------------",
654 | "The SETEDxxx commands allow you to use an external editor.",
655 | "Note the editor you pick should be a simple text editor. If you pick",
656 | "something that doesn't work, try the defaults again.",
657 | "Because some systems may have different editors installed, you can set",
658 | "more than one by separating the editors usng commas. The program will",
659 | "use the first one it finds.",
660 | "For Windows the default is edit, which works quite well in the terminal",
661 | "but you could change it to notepad.",
662 | "For Linux, the default is nano,pico,vim,emacs.",
663 | "To use external editors you must switch on system calls using the SYS ON",
664 | "command",
665 | "SETEDNT command : Set the external editor for Windows (NT).",
666 | "SETEDPOSIX command : Set the editor for posix systems.",
667 | " : e.g. SETEDNT edit",
668 | " : SETEDPOSIX nano,vim",
669 | "SHORTCUT/SC ? : list shortcuts",
670 | "SHORTCUT/SC N cmd : Set shortcut N to command cmd",
671 | "=N : Run shortcut N",
672 | "!PAUSE!",
673 | "ABBREV/AB @x @full : Create new abbreviation. @x expands to @full",
674 | "ABBREV/AB ? : List context abbreviations.",
675 | "PAB :px :pfull : Project abbreviation. :px expands to :pfull",
676 | "PAB ? : List project abbreviations.",
677 | "!PAUSE!",
678 | "ENTERING TASKS",
679 | "--------------",
680 | "When you enter a task, you can embed any number of contexts in the task.",
681 | "You can also embed a project description by preceding it with :p",
682 | "You can assign a priority by preceding a number by #. e.g. #9.",
683 | "If you don't enter a number, a default of 5 is used. The higher the ",
684 | "number the more important it is. Priorities range from 1 to 10.",
685 | "Only the first # is used for the priority so you can use # as",
686 | "a normal character as long as you precede it with a priority number.",
687 | "You can define a date when the task must be done by preceding the date",
688 | "with :d, i.e :dYYYY/MM/DD or :dMM/DD or :dDD. If you omit the year/month",
689 | "they default to the current date. Adding a date automatically creates an",
690 | "@Date context for the task.",
691 | "So, for example, to add a new task to e-mail Joe, we could enter:",
692 | "+ e-mail joe @computer",
693 | "or to add a task to the decorating project, we could enter:",
694 | "+ buy wallpaper :pdecorating",
695 | "to enter a task with an importance of 9 we could enter:",
696 | "+ book that holiday #9 @Internet",
697 | "!PAUSE!",
698 | "MODIFYING AND EXTENDING TASKS",
699 | "-----------------------------",
700 | "The modify command allows you to change part of an existing task.",
701 | "So for example, imagine you have a task:",
702 | "[05] Buy some food #9 @Internet Projects:Shopping",
703 | "Enter the command M 5 and then type:",
704 | "@C",
705 | "Because the only element we have entered is a new context, only",
706 | "that part is modified, so we get.",
707 | "[05] Buy some food #9 @Computer Projects:Shopping",
708 | "Likewise, had we entered:",
709 | "Buy some tea :pEating",
710 | "We would have got",
711 | "[05] Buy some tea #9 @Internet Projects:Eating",
712 | "The extend command is similar but it appends the entry. So had",
713 | "we used the command E 5 instead of M 5 the result would have been",
714 | "[05] Buy some food ... Buy some tea #9 @Internet Projects:Eating",
715 | "!PAUSE!",
716 | "CONTEXTS",
717 | "--------",
718 | "Any word preceded by @ will be used as a context. Contexts are like",
719 | "sub-categories or sub-lists. There are a number of pre-defined",
720 | "abbreviations that you can use as well. The recognised abbreviations",
721 | "are:",
722 | "@A = @Anywhere (this is the default)",
723 | "@C = @Computer",
724 | "@D = @Desk",
725 | "@E = @Errands",
726 | "@H = @Home",
727 | "@I = @Internet",
728 | "@L = @Lunch",
729 | "@M = @Meeting",
730 | "@N = @Next",
731 | "@O = @Other",
732 | "@P = @Phone",
733 | "@PW= @Password",
734 | "@S = @Someday/maybe",
735 | "@W4= @Waiting_for",
736 | "@W = @Work",
737 | "!PAUSE!",
738 | "ENTERING DATES",
739 | "--------------",
740 | "An @Date context is created if you embed a date in the task.",
741 | "Dates are embedded using the :dDATE format.",
742 | "Valid DATE formats are yyyy-mm-dd, mm-dd or dd",
743 | "You can also use : or / as the separators. So, for example:",
744 | ":d2006/12/22 or :d2006-11-7 or :d9/28 are all valid entries.",
745 | "",
746 | "If you set a date, then until that date is reached, the task is given",
747 | "an effective priority of 0. Once the date is reached, the task's",
748 | "priority is increased by 11, moving it to the of the list.",
749 | "",
750 | "A date entry of :d0 can be used to clear a date entry.",
751 | "A date entry of :d+X can be used to create a date entry of today + X days.",
752 | "So :d+1 is tomorrow and :d+0 is today.",
753 | "!PAUSE!",
754 | "ENCRYPTING TEXT",
755 | "---------------",
756 | "If you want to encrypt text you can use the or tags or",
757 | "their abbreviations
and .",
758 | "These tags will result in all text following the tag to be encrypted.",
759 | "Note that any special commands, @contexts for example, are treated as plain",
760 | "text in the encrypted portion.",
761 | "To display the text you will need to use the SHOW command.",
762 | "",
763 | "The tag uses the inbuilt XTEA algorithm. This is supposedly a",
764 | "relatively secure method but probably not suitable for very sensitive data.",
765 | "",
766 | "The tag can only be used if you have the pyRijndael.py module.",
767 | "This uses a 256 bit Rinjdael cipher. The module can be downloaded from ",
768 | "http://jclement.ca/software/pyrijndael/",
769 | "You can install this in your Python path or just place it alongside your",
770 | "ikog file.",
771 | "Note you cannot use the extend command with encrypted text.",
772 | "",
773 | "!PAUSE!",
774 | "MARKING TASKS AS COMPLETE",
775 | "-------------------------",
776 | "The normal way to mark a task as complete is just to remove it using the",
777 | "KILL command. If you want to keep track of tasks you have finished, you",
778 | "can use the ARCHIVE or DONE command. This gives the task an @Archived",
779 | "context, changes the date to today and then moves it from the current",
780 | "file to a file with archive.dat appended. The archive file is a valid",
781 | "ikog file so you can use the OPEN command to view it, edit it and run",
782 | "reports in the normal way. So assuming your current script is ikog.py,",
783 | "to archive the current task you could enter:",
784 | "",
785 | "ARCHIVE ^ I have finished this",
786 | "",
787 | "This would move the task to a file called ikog.py.archive.dat",
788 | "",
789 | "!PAUSE!",
790 | "USING EXTERNAL DATA",
791 | "-------------------",
792 | "Normally the tasks are embedded in the main program file so all you have",
793 | "to carry around with you is the ikog.py file. The advantage is that you",
794 | "only have one file to look after; the disadvantage is that every time you",
795 | "save a task you have to save the program as well. If you want, you can",
796 | "keep your tasks in a separate file.",
797 | "To do this, use the EXPORT function to create a file ikog.py.tasks.txt",
798 | "Use the CLEAR command to remove the tasks from your main ikog.py program.",
799 | "Rename the exported file from ikog.py.tasks.txt to ikog.py.dat",
800 | "Ikog will now use this file for storing your tasks.",
801 | "",
802 | "!PAUSE!",
803 | "PASSING TASKS VIA THE COMMAND LINE",
804 | "----------------------------------",
805 | "It is possible to add tasks via the command line. The general format of",
806 | "the command line is:",
807 | " ikog.py filename commands",
808 | "The filename is the name of the data file containing your tasks. You",
809 | "can use . to represent the default internal tasks.",
810 | "Commands is a set of normal ikog commands separated by the / ",
811 | "character. Note there must be a space either side of the /.",
812 | "So to add a task and then exit the program we could just enter:",
813 | " ikog.py . + here is my task / QUIT",
814 | "Note that we added the quit command to exit ikog.",
815 | "You must make sure that you do not use any commands that require user",
816 | "input. Deleting tasks via the command line is more complicated as you",
817 | "need to find the task automatically. If you do try to delete this way,",
818 | "use the filter command to find some unique text and then delete it. eg.",
819 | " ikog.py . FI my_unique_text / KILL THIS / QUIT",
820 | "Use THIS instead of ^ as a caret has a special meaning in Windows.",
821 | "If you do intend automating ikog from the command line, you should add",
822 | "a unique reference to each task so you can find it later using FILTER. eg.",
823 | "+ this is my task ref_1256",
824 | "!PAUSE!"]
825 |
826 | MOVE_DOWN = 0
827 | MOVE_UP = 1
828 | MOVE_TOP = 2
829 | MAX_SHORTCUTS = 10
830 |
831 | def __init__(self, todoFile, externalDataFile):
832 | self.setShortcuts()
833 | self.dirty = False
834 | self.code = []
835 | self.todo = []
836 | self.autoSave = True
837 | self.review = True
838 | self.sysCalls = False
839 | self.currentTask = 0
840 | self.globalFilterText = ""
841 | self.globalFilters = []
842 | self.localFilterText = ""
843 | self.localFilters = []
844 | # split the file into the source code and the todo list
845 | self.filename = todoFile
846 | try:
847 | self.filename = os.readlink(todoFile)
848 | except Exception:
849 | pass # probably windows
850 | externalDataFile = self.makeFilename(externalDataFile)
851 | self.externalData = self.findDataSource(externalDataFile)
852 | if self.externalData:
853 | self.filename = externalDataFile
854 | else:
855 | self.splitFile(self.filename, False)
856 | self.exactPriority = False
857 | self.htmlFile = ""
858 |
859 | def setPAbbreviation(self, line):
860 | save = False
861 | elements = line.split(" ", 1)
862 | if not elements[0].lower().startswith(":p"):
863 | self.showError("Project abbreviations must begin with :p")
864 | elif len(elements) > 1:
865 | if not elements[1].lower().startswith(":p"):
866 | abb = ":p" + elements[1].title()
867 | else:
868 | abb = ":p" +elements[1][2:].title()
869 | globalPAbbr.addAbbreviation(elements[0], abb)
870 | save = True
871 | else:
872 | if not globalPAbbr.removeAbbreviation(elements[0]):
873 | self.showError("Could not find project abbreviation " + line)
874 | else:
875 | print "Project abbreviation ", line, " removed."
876 | save = True
877 | return save
878 |
879 | def showPAbbreviations(self):
880 | print globalPAbbr.toStringVerbose()
881 |
882 | def setAbbreviation(self, line):
883 | save = False
884 | elements = line.split(" ", 1)
885 | if not elements[0].startswith("@"):
886 | self.showError("Abbreviations must begin with @")
887 | elif len(elements) > 1:
888 | if not elements[1].startswith("@"):
889 | abb = "@" + elements[1].title()
890 | else:
891 | abb = "@" +elements[1][1:].title()
892 | globalAbbr.addAbbreviation(elements[0], abb)
893 | save = True
894 | else:
895 | if not globalAbbr.removeAbbreviation(elements[0]):
896 | self.showError("Could not find abbreviation " + line)
897 | else:
898 | print "Abbreviation ", line, " removed."
899 | save = True
900 | return save
901 |
902 | def showAbbreviations(self):
903 | print globalAbbr.toStringVerbose()
904 |
905 | def setShortcut(self, line, force = False):
906 | elements = line.split(" ", 1)
907 | try:
908 | index = int(elements[0])
909 | if len(elements) > 1:
910 | command = elements[1]
911 | else:
912 | command = ""
913 | except Exception, e:
914 | self.showError("Did not understand the command. Format should be SHORTCUT N my command.")
915 | return False
916 |
917 | if index < 0 or index > len(self.shortcuts):
918 | self.showError("The maximum number of shortcuts is " + str(len(self.shortcuts)) + ". Shortcuts ignored.")
919 | return False
920 | else:
921 | if self.shortcuts[index] != "" and not force:
922 | if safeRawInput("Do you want to change the current command '" + self.shortcuts[index] + "'? Enter Yes to overwrite. >>>").upper() != "YES":
923 | return False
924 | self.shortcuts[index] = command
925 | return True
926 |
927 |
928 | def showShortcuts(self):
929 | index = 0
930 | for s in self.shortcuts:
931 | if s == "":
932 | msg = "unused"
933 | else:
934 | msg = s
935 | print "=%1d %s" %(index, msg)
936 | index = index + 1
937 |
938 | def setShortcuts(self, settings = []):
939 | if len(settings) > self.MAX_SHORTCUTS:
940 | self.showError("The maximum number of shortcuts is " + str(self.MAX_SHORTCUTS) + ". Shortcuts ignored.")
941 | self.shortcuts = ["" for n in range(self.MAX_SHORTCUTS)]
942 | if len(settings) > 0:
943 | self.shortcuts[0:len(settings)] = settings
944 |
945 | def getShortcutIndex(self, command):
946 | if len(command) == 2 and command[0:1].upper() == "=":
947 | index = ord(command[1]) - ord("0")
948 | if index >= self.MAX_SHORTCUTS:
949 | index = -1
950 | else:
951 | index = -1
952 | return index
953 |
954 | def getShortcut(self, command):
955 | index = self.getShortcutIndex(command)
956 | if index >= 0:
957 | return self.shortcuts[index]
958 | else:
959 | return ""
960 |
961 | def safeSystemCall(self, line):
962 | words = line.split()
963 | if len(words) == 0:
964 | self.showError("Nothing to do.")
965 | elif words[0].upper() == "RM" or words[0].upper() == "RMDIR" or words[0].upper() == "DEL":
966 | self.showError("Sorry, but deletion commands are not permitted.")
967 | else:
968 | os.system(line)
969 | self.pause()
970 |
971 | def processCfgLine(self, line):
972 | params = line.split("=")
973 | if len(params) < 2:
974 | return
975 | cmd = params[0].strip()
976 | if cmd == "cfgEditorNt":
977 | global cfgEditorNt
978 | cfgEditorNt = params[1].replace("\"", "").strip()
979 | elif cmd == "cfgEditorPosix":
980 | global cfgEditorPosix
981 | cfgEditorPosix = params[1].replace("\"", "").strip()
982 | elif cmd == "cfgShortcuts":
983 | elements = params[1].strip()[1:-1].split(",")
984 | index = 0
985 | for e in elements:
986 | self.setShortcut(str(index) + " " + e.strip()[1:-1], True)
987 | index = index + 1
988 | elif cmd == "cfgAutoSave":
989 | if params[1].upper().strip() == "TRUE":
990 | asave = True
991 | else:
992 | asave = False
993 | self.setAutoSave(asave, False)
994 | elif cmd == "cfgReviewMode":
995 | if params[1].upper().strip() == "TRUE":
996 | self.setReview("ON")
997 | else:
998 | self.setReview("OFF")
999 | elif cmd == "cfgSysCalls":
1000 | if params[1].upper().strip() == "TRUE":
1001 | self.setSysCalls("ON")
1002 | else:
1003 | self.setSysCalls("OFF")
1004 | elif cmd == "cfgColor":
1005 | gColor.setCodeSet(int(params[1].strip()))
1006 | elif cmd == "cfgAbbreviations":
1007 | abbrs = eval(params[1].strip())
1008 | globalAbbr.setAbbreviations(abbrs)
1009 | elif cmd == "cfgPAbbreviations":
1010 | abbrs = eval(params[1].strip())
1011 | globalPAbbr.setAbbreviations(abbrs)
1012 | else:
1013 | self.showError("Unrecognised command " + cmd)
1014 |
1015 | def makeFilename(self, name):
1016 | (root, ext) = os.path.splitext(name)
1017 | if ext.upper() != ".DAT":
1018 | name = name + ".dat"
1019 | try:
1020 | name = os.path.expanduser(name)
1021 | except Exception, e:
1022 | self.showError("Failed to expand path. " + str(e))
1023 | return name
1024 |
1025 | def findDataSource(self, filename):
1026 | success = False
1027 |
1028 | try:
1029 | self.splitFile(filename, False)
1030 | print "Using external data file ", filename
1031 | success = True
1032 | except IOError:
1033 | print "No external data file ", filename, ", so using internal tasks."
1034 | return success
1035 |
1036 | def setSysCalls(self, mode):
1037 | oldCalls = self.sysCalls
1038 | mode = mode.strip().upper()
1039 | if mode == "ON":
1040 | self.sysCalls = True
1041 | print "Using system calls for clear screen"
1042 | elif mode == "OFF":
1043 | self.sysCalls = False
1044 | print "No system calls for clear screen"
1045 | else:
1046 | self.showError("Could not understand the sys command. Use SYS ON or OFF.")
1047 | return (self.sysCalls != oldCalls)
1048 |
1049 | def setAutoSave(self, asave, save):
1050 | if asave:
1051 | if self.autoSave == False:
1052 | self.autoSave = True
1053 | if save:
1054 | self.save("")
1055 | elif self.autoSave == True:
1056 | self.autoSave = False
1057 | if save:
1058 | self.save("")
1059 | if self.autoSave:
1060 | print "Autosave is on."
1061 | else:
1062 | print "Autosave is off."
1063 |
1064 |
1065 | def showError(self, msg):
1066 | printError(msg)
1067 |
1068 | def pause(self, prompt = "Press enter to continue."):
1069 | if safeRawInput(prompt).strip() != "":
1070 | print "Entry ignored!"
1071 |
1072 | def setReview(self, mode):
1073 | oldReview = self.review
1074 | mode = mode.strip().upper()
1075 | if mode == "ON":
1076 | self.review = True
1077 | print "In review mode. Enter advances to the next task"
1078 | elif mode == "OFF":
1079 | self.review = False
1080 | print "Review mode off. Enter re-displays the current task"
1081 | else:
1082 | self.showError("Could not understand the review command. Use REVIEW ON or OFF.")
1083 | return (self.review != oldReview)
1084 |
1085 | def sortByPriority(self):
1086 | self.todo.sort(key=TodoItem.getEffectivePriority, reverse = True)
1087 |
1088 |
1089 | def run(self, commandList):
1090 | if not supportAes:
1091 | print "AES encryption not available."
1092 | print("\nEnter HELP for instructions.")
1093 |
1094 | done = False
1095 | printCurrent = True
1096 | self.sortByPriority()
1097 | reopen = ""
1098 | enteredLine = ""
1099 | truncateTask = False
1100 | while not done:
1101 | self.checkCurrentTask()
1102 | if printCurrent:
1103 | self.moveToVisible()
1104 | print ruler
1105 | if truncateTask:
1106 | self.printItemTruncated(self.currentTask, "Current: ")
1107 | else:
1108 | self.printItemVerbose(self.currentTask)
1109 | print ruler
1110 | printCurrent= True
1111 | truncateTask = False
1112 | if self.dirty:
1113 | prompt = "!>>"
1114 | else:
1115 | prompt = ">>>"
1116 | if len(commandList) >= 1:
1117 | enteredLine = commandList[0]
1118 | commandList = commandList[1:]
1119 | print enteredLine
1120 | (rawcommand, line) = InputParser(prompt).read(enteredLine)
1121 | enteredLine = ""
1122 | command = rawcommand.upper()
1123 | if self.getShortcutIndex(command) >= 0:
1124 | sc = self.getShortcut(command)
1125 | if sc != "":
1126 | (rawcommand, line) = InputParser("").read(self.getShortcut(command))
1127 | else:
1128 | rawcommand = ""
1129 | line = ""
1130 | continue
1131 | print "Shortcut: ", rawcommand, " ", line
1132 | command = rawcommand.upper()
1133 | if command == "":
1134 | if self.review:
1135 | self.incTaskLoop()
1136 | elif command == "PAB":
1137 | if line.strip() == "?":
1138 | self.showPAbbreviations()
1139 | elif self.setPAbbreviation(line):
1140 | self.save("")
1141 | elif command == "ABBREV" or command == "AB":
1142 | if line.strip() == "?":
1143 | self.showAbbreviations()
1144 | elif self.setAbbreviation(line):
1145 | self.save("")
1146 | elif command == "SHORTCUT" or command == "SC":
1147 | if line.strip() == "?":
1148 | self.showShortcuts()
1149 | else:
1150 | if self.setShortcut(line):
1151 | self.save("")
1152 | printCurrent = False
1153 | elif command == "2":
1154 | enteredLine = self.runTimer(2)
1155 | printCurrent = False
1156 | elif command == "CLS" or command == "CLEARSCREEN":
1157 | clearScreen(self.sysCalls)
1158 | elif command == "SETEDNT":
1159 | global cfgEditorNt
1160 | cfgEditorNt = line
1161 | self.save("")
1162 | elif command == "SETEDPOSIX":
1163 | global cfgEditorPosix
1164 | cfgEditorPosix = line
1165 | self.save("")
1166 | elif command == "SYS":
1167 | if self.setSysCalls(line):
1168 | self.save("")
1169 | elif command == "!CMD":
1170 | if self.sysCalls:
1171 | self.safeSystemCall(line)
1172 | else:
1173 | self.showError("System calls are not allowed. Use SYS ON to enable them.")
1174 | elif command == "SHOW" or command == "SH":
1175 | self.decrypt(line)
1176 | self.pause("Press enter to clear screen and continue. ")
1177 | clearScreen(self.sysCalls)
1178 | elif command == "VERSION" or command == "VER":
1179 | print notice[0]
1180 | elif command == "SAVE" or command == "S":
1181 | if not self.dirty:
1182 | print "There's no need to save now. If the prompt shows >>> "
1183 | print "then there is nothing to save. You only need to save if the prompt "
1184 | print "shows !>>"
1185 | else:
1186 | self.forceSave("")
1187 | elif command == "NEW":
1188 | filename = self.makeFilename(line)
1189 | if self.createFile(filename):
1190 | reopen = filename
1191 | if self.dirty:
1192 | self.forceSave("")
1193 | done = True
1194 | printCurrent = False
1195 | elif command == "OPEN" or command == "O":
1196 | filename = self.makeFilename(line)
1197 | reopen = filename
1198 | if self.dirty:
1199 | self.forceSave("")
1200 | done = True
1201 | printCurrent = False
1202 | elif command == "AUTOSAVE" or command == "AS":
1203 | if line== "":
1204 | self.showError("You must enter ON or OFF for the autosave command")
1205 | else:
1206 | self.setAutoSave(line.upper() == "ON", True)
1207 | elif command == "REVIEW" or command == "REV":
1208 | if self.setReview(line):
1209 | self.save("")
1210 | elif command == "V0":
1211 | if self.setReview("OFF"):
1212 | self.save("")
1213 | elif command == "V1":
1214 | if self.setReview("ON"):
1215 | self.save("")
1216 | elif command == "?":
1217 | self.printHelp(self.quickCard)
1218 | elif command == "HELP" or command == "H":
1219 | self.printHelp(self.help)
1220 | elif command == "QUIT" or command == "Q":
1221 | if self.dirty:
1222 | self.forceSave("")
1223 | done = True
1224 | printCurrent = False
1225 | elif command == "WEB":
1226 | try:
1227 | webbrowser.open("http://www.henspace.co.uk")
1228 | except Exception, e:
1229 | self.showError("Unable to launch browser. " + str(e))
1230 | elif command == "COLOR" or command == "COLOUR" or command == "C":
1231 | try:
1232 | set = int(line, 10)
1233 | except ValueError:
1234 | set = gColor.ANSI
1235 | if not gColor.isValidSet(set):
1236 | self.showError("Invalid colour set ignored.")
1237 | elif gColor.setCodeSet(set):
1238 | self.save("")
1239 | elif command == "MONOCHROME" or command == "MONO":
1240 | if gColor.setCodeSet(gColor.NONE):
1241 | self.save("")
1242 | elif command == "EXPORT":
1243 | self.exportTasks()
1244 | elif command == "IMPORT":
1245 | if self.importTasks(line):
1246 | self.save("")
1247 | elif command == "CLEAR" and line == "":
1248 | if self.clear():
1249 | self.save("")
1250 | elif command == "FILTER" or command == "FI" or command == "=":
1251 | self.setFilterArray(False, line)
1252 | elif command == "NEXT" or command == "N":
1253 | self.incTaskLoop()
1254 | elif command == "PREV" or command == "P":
1255 | self.decTaskLoop()
1256 | elif command == "TOP" or command == "T" or command == "0":
1257 | self.currentTask = 0
1258 | if line != "":
1259 | self.setFilterArray(True, "")
1260 | self.showLocalFilter()
1261 | self.printShortList(line)
1262 | truncateTask = True
1263 | elif command == "GO" or command == "G":
1264 | self.moveTo(line)
1265 | elif command == "IMMEDIATE" or command == "I" or command == "++":
1266 | newItem = self.createItem(":d+0 " + line)
1267 | if newItem.hasHiddenTask():
1268 | clearScreen(self.sysCalls)
1269 | if newItem.hasError():
1270 | print "Errors were found:"
1271 | print newItem.getError()
1272 | print "The task was not added."
1273 | printCurrent = False
1274 | else:
1275 | self.todo.insert(0, newItem)
1276 | self.currentTask = 0
1277 | self.sortByPriority()
1278 | self.save("")
1279 | elif command == "KILL" or command == "K" or command == "-" or command == "X":
1280 | if self.removeTask(line):
1281 | self.save("")
1282 | elif command == "ARCHIVE" or command == "DONE":
1283 | if self.archiveTask(line):
1284 | self.save("")
1285 | elif command == "REP" or command =="R":
1286 | if self.modifyTask(line, TodoItem.REPLACE):
1287 | self.sortByPriority()
1288 | self.save("")
1289 | else:
1290 | printCurrent = False
1291 | elif command == "SUB" or command == "SU":
1292 | if self.substituteText(line):
1293 | self.sortByPriority()
1294 | self.save("")
1295 | elif command == "EDIT" or command == "ED":
1296 | if not self.sysCalls:
1297 | self.showError("External editing needs to use system calls. Use SYS ON to enable them.")
1298 | elif line == "":
1299 | self.addTaskExternal()
1300 | elif self.modifyTask(line, TodoItem.MODIFY, externalEditor = True):
1301 | self.sortByPriority()
1302 | self.save("")
1303 | else:
1304 | printCurrent = False
1305 | elif command == "MOD" or command == "M":
1306 | if self.modifyTask(line, TodoItem.MODIFY):
1307 | self.sortByPriority()
1308 | self.save("")
1309 | else:
1310 | printCurrent = False
1311 | elif command == "EXTEND" or command == "E":
1312 | if self.modifyTask(line, TodoItem.APPEND):
1313 | self.sortByPriority()
1314 | self.save("")
1315 | else:
1316 | printCurrent = False
1317 | elif command == "FIRST" or command == "F":
1318 | if self.moveTask(line, self.MOVE_TOP):
1319 | self.sortByPriority()
1320 | self.save("")
1321 | self.currentTask = 0
1322 | elif command == "DOWN" or command == "D":
1323 | if self.moveTask(line, self.MOVE_DOWN):
1324 | self.sortByPriority()
1325 | self.save("")
1326 | elif command == "UP" or command == "U":
1327 | if self.moveTask(line, self.MOVE_UP):
1328 | self.sortByPriority()
1329 | self.save("")
1330 | elif command == "LIST" or command == "L":
1331 | print ruler
1332 | self.setFilterArray(True, line)
1333 | self.showLocalFilter()
1334 | self.printList(False, "", "")
1335 | self.clearFilterArray(True)
1336 | print ruler
1337 | truncateTask = True
1338 | elif command == "LIST>" or command == "L>":
1339 | self.startHtml("")
1340 | self.setFilterArray(True, line)
1341 | self.showLocalFilter()
1342 | self.printList(False, "", "")
1343 | self.clearFilterArray(True)
1344 | self.endHtml()
1345 | elif command == "@":
1346 | self.listByAction()
1347 | truncateTask = True
1348 | elif command == ":P":
1349 | self.listByProject()
1350 | truncateTask = True
1351 | elif command == ":D":
1352 | self.listByDate()
1353 | truncateTask = True
1354 | elif command == "@>":
1355 | self.startHtml("Report by Context")
1356 | self.listByAction()
1357 | self.endHtml()
1358 | elif command == ":P>":
1359 | self.startHtml("Report by Project")
1360 | self.listByProject()
1361 | self.endHtml()
1362 | elif command == ":D>":
1363 | self.startHtml("Report by Date")
1364 | self.listByDate()
1365 | self.endHtml()
1366 | elif command == "ADD" or command == "A" or command == "+":
1367 | self.addTask(line)
1368 | elif command == "NOTE" or command == "NOTES":
1369 | self.addTask("#0 @Notes " + line)
1370 | elif (len(command) + len(line)) > 10:
1371 | self.addTask(rawcommand + " " + line)
1372 | elif len(command) > 0:
1373 | self.showError("Didn't understand. (Make sure you have a space after the command or your entry is longer than 10 characters)")
1374 | printCurrent = False
1375 | return reopen
1376 |
1377 | def timeout(self):
1378 | self.timerActive = False
1379 | clearScreen()
1380 | print "\n\x07Timer\x07 complete.\x07\n\x07Press enter to continue.\x07"
1381 |
1382 | def runTimer(self, delay):
1383 | self.timerActive = True
1384 | t = Timer(delay * 60 , self.timeout)
1385 | t.start()
1386 | s = raw_input(str(delay) + " minute timer running.\nAny entry will cancel the timer:\n>>>")
1387 | if self.timerActive:
1388 | t.cancel()
1389 | print "Timer cancelled."
1390 | elif s != "":
1391 | s = ""
1392 | print "Input discarded as timer has finished."
1393 | return s.strip()
1394 |
1395 | def addTaskExternal(self):
1396 | exEdit = EditorLauncher()
1397 | entry = exEdit.edit("")
1398 | if entry != "":
1399 | self.addTask(entry)
1400 | else:
1401 | self.showError("Nothing to add")
1402 |
1403 | def addTask(self, line):
1404 | newItem = self.createItem(line)
1405 | if newItem.hasError():
1406 | print "Errors were found:"
1407 | print newItem.getError()
1408 | print "The task was not added."
1409 | printCurrent = False
1410 | else:
1411 | if newItem.hasHiddenTask():
1412 | clearScreen(self.sysCalls)
1413 | self.todo.append(newItem)
1414 | self.sortByPriority()
1415 | self.save("")
1416 |
1417 | def checkCurrentTask(self):
1418 | if self.currentTask > len(self.todo) - 1:
1419 | self.currentTask = len(self.todo) - 1
1420 | if self.currentTask < 0:
1421 | self.currentTask = 0
1422 |
1423 | def writeArchive(self, item):
1424 | success = False
1425 | filename = self.filename + ".archive.dat"
1426 | try:
1427 | if not os.path.exists(filename):
1428 | f = open(filename,"wb")
1429 | f.write("# " + notice[0] + "\n")
1430 | f.write(magicTag + "DATA\n")
1431 | else:
1432 | f = open(filename,"a+b")
1433 |
1434 | f.write(item.toString())
1435 | f.write("\n")
1436 | f.close()
1437 | print "Tasks archived to " + filename
1438 | success = True
1439 | except Exception, e:
1440 | self.showError("Error trying to archive the tasks.\n" + str(e))
1441 | return success
1442 |
1443 | def exportTasks(self):
1444 | filename = self.filename + ".tasks.txt"
1445 | try:
1446 | f = open(filename,"wb")
1447 | f.write("# " + notice[0] + "\n")
1448 | f.write(magicTag + "DATA\n")
1449 | for item in self.todo:
1450 | f.write(item.toString())
1451 | f.write("\n")
1452 | f.close()
1453 | print "Tasks exported to " + filename
1454 | except Exception, e:
1455 | self.showError("Error trying to export the file.\n" + str(e))
1456 |
1457 | def importTasks(self, filename):
1458 | success = False
1459 | orgNTasks = len(self.todo)
1460 | if filename == "":
1461 | self.showError("You must supply the name of the file to import.")
1462 | return success
1463 |
1464 | try:
1465 | self.splitFile(filename, True)
1466 | if len(self.todo) == orgNTasks:
1467 | self.showError("Failed to find any tasks to import.")
1468 | else:
1469 | success = True
1470 | except Exception, e:
1471 | self.showError("Error importing tasks. " + str(e))
1472 | return success
1473 |
1474 | def createFile(self, filename):
1475 | success = False
1476 | if os.path.exists(filename):
1477 | self.showError("Sorry but " + filename + " already exists.")
1478 | else:
1479 | try:
1480 | f = open(filename, "wb")
1481 | f.write("#!/usr/bin/env python\n")
1482 | f.write("#" + ruler + "\n")
1483 | f.close()
1484 | success = True
1485 | except Exception, e:
1486 | self.showError("Error trying to create the file " + filename + ". " + str(e))
1487 | return success
1488 |
1489 | def save(self, filename):
1490 | if filename != "" or self.autoSave:
1491 | self.forceSave(filename)
1492 | else:
1493 | self.dirty = True
1494 | print "Autosave is off, so changes not saved yet."
1495 |
1496 | def forceSave(self, filename):
1497 | if filename == "":
1498 | filename = self.filename
1499 | tmpFilename = filename + ".tmp"
1500 | backupFilename = filename + ".bak"
1501 | success = False
1502 | try:
1503 | f = open(tmpFilename,"wb")
1504 | f.write("#!/usr/bin/env python\n")
1505 | f.write("# -*- coding: utf-8 -*-\n")
1506 | f.write("#" + ruler + "\n")
1507 | f.write("# Run the script for details of the licence\n")
1508 | f.write("# or refer to the notice section later in the file.\n")
1509 | f.write("#" + ruler + "\n")
1510 | f.write(magicTag + "DATA\n")
1511 | for item in self.todo:
1512 | f.write(item.toString())
1513 | f.write("\n")
1514 | f.write(magicTag + "CONFIG\n")
1515 | f.write("cfgColor = " + str(gColor.getCodeSet()) + "\n")
1516 | f.write("cfgAutoSave = " + str(self.autoSave) + "\n")
1517 | f.write("cfgReviewMode = " + str(self.review) + "\n")
1518 | f.write("cfgSysCalls = " + str(self.sysCalls) + "\n")
1519 | f.write("cfgEditorNt = \"" + cfgEditorNt + "\"\n")
1520 | f.write("cfgEditorPosix = \"" + cfgEditorPosix + "\"\n")
1521 | f.write("cfgShortcuts = " + str(self.shortcuts) + "\n")
1522 | f.write("cfgAbbreviations = " +str(globalAbbr.toString()) +"\n")
1523 | f.write("cfgPAbbreviations = " +str(globalPAbbr.toString()) +"\n")
1524 | f.write(magicTag + "CODE\n")
1525 | for codeline in self.code:
1526 | f.write(codeline.rstrip())
1527 | f.write("\n")
1528 | f.close()
1529 | success = True
1530 |
1531 | except Exception, e:
1532 | self.showError("Error trying to save the file.\n" + str(e))
1533 | if success:
1534 | try:
1535 | os.remove(backupFilename)
1536 | except Exception:
1537 | pass
1538 | try:
1539 | oldstat = os.stat(filename)
1540 | os.rename(filename, backupFilename)
1541 | os.rename(tmpFilename, filename)
1542 | os.chmod(filename, stat.S_IMODE(oldstat.st_mode)) # ensure permissions carried over
1543 | self.filename = filename
1544 | self.dirty = False
1545 | print "Tasks saved."
1546 | except Exception, e:
1547 | self.showError("Error trying to rename the backups.\n" + str(e))
1548 |
1549 | def moveTo(self, indexStr):
1550 | try:
1551 | index = int(indexStr, 10)
1552 | if index < 0 or index > len(self.todo) - 1:
1553 | self.showError("Sorry but there is no task " + indexStr)
1554 | else:
1555 | if not self.isViewable(self.todo[index]):
1556 | print "Switching off your filter so that the task can be displayed."
1557 | self.clearFilterArray(False)
1558 | self.currentTask = index
1559 | except ValueError:
1560 | self.showError("Unable to understand the task " + indexStr + " you want to show.")
1561 |
1562 |
1563 | def moveToVisible(self):
1564 | start = self.currentTask
1565 | find = True
1566 | if start < 0 or start >= len(self.todo):
1567 | return
1568 | while not self.isViewable(self.todo[self.currentTask]):
1569 | self.incTaskLoop()
1570 | if self.currentTask == start:
1571 | print "Nothing matched your filter. Removing your filter so that the current task can be displayed."
1572 | self.clearFilterArray(False)
1573 | break
1574 |
1575 | def decrypt(self, indexStr):
1576 | index = self.getRequiredTask(indexStr)
1577 | if index < 0 or index > len(self.todo) - 1:
1578 | self.showError("Sorry but there is no task " + indexStr + " to show.")
1579 | elif self.todo[index].hasHiddenTask():
1580 | ec = Encryptor()
1581 | print WordWrapper(gMaxLen).wrap(ec.enterKeyAndDecrypt(self.todo[index].getHiddenTask()))
1582 | else:
1583 | print "Task ", index, " has no encrypted data."
1584 |
1585 | def moveTask(self, indexStr, where):
1586 | success = False
1587 | if indexStr == "":
1588 | print "You must supply the number of the task to move."
1589 | return False
1590 | try:
1591 | index = self.getRequiredTask(indexStr)
1592 | if index < 0 or index > len(self.todo) - 1:
1593 | self.showError("Sorry but there is no task " + indexStr + " to move.")
1594 | elif where == self.MOVE_DOWN:
1595 | if index <= len(self.todo) - 2:
1596 | item = self.todo[index]
1597 | self.todo[index] = self.todo[index + 1]
1598 | self.todo[index + 1] = item
1599 | print "Task ", index, " moved down."
1600 | success = True
1601 | else:
1602 | self.showError("Task " + str(index) + " is already at the bottom.")
1603 | else:
1604 | if index > 0:
1605 | if where == self.MOVE_TOP:
1606 | self.todo.insert(0, self.todo.pop(index))
1607 | else:
1608 | dest = index - 1
1609 | item = self.todo[dest]
1610 | self.todo[dest] = self.todo[index]
1611 | self.todo[index] = item
1612 | print "Task ", index, " moved up."
1613 | success = True
1614 | else:
1615 | self.showError("Task " + str(index) + " is already at the top.")
1616 |
1617 |
1618 | except ValueError:
1619 | self.showError("Unable to understand the task " + indexStr + " you want to move.")
1620 |
1621 | return success
1622 |
1623 | def clear(self):
1624 | cleared = False
1625 | if safeRawInput("Are you really sure you want to remove everything? Yes or No? >>>").upper() != "YES":
1626 | print("Nothing has been removed.")
1627 | else:
1628 | del self.todo[0:]
1629 | self.currentTask = 0
1630 | cleared = True
1631 | return cleared
1632 |
1633 | def getRequiredTask(self, indexStr):
1634 | if indexStr == "^" or indexStr.upper() == "THIS":
1635 | index = self.currentTask
1636 | else:
1637 | try:
1638 | index = int(indexStr, 10)
1639 | except ValueError:
1640 | index = -1
1641 | return index
1642 |
1643 | def archiveTask(self, indexStr):
1644 | doit = False
1645 | line = indexStr.split(" ", 1)
1646 | if len(line) > 1:
1647 | indexStr = line[0]
1648 | entry = line[1]
1649 | else:
1650 | entry = ""
1651 | index = self.getRequiredTask(indexStr)
1652 | if index < 0 or index > len(self.todo) - 1:
1653 | self.showError("Sorry but there is no task " + indexStr + " to mark as done and archive.")
1654 | else:
1655 | if indexStr == "^" or indexStr.upper() == "THIS":
1656 | doit = True
1657 | else:
1658 | print "Are you sure you want to archive: ' " + self.todo[index].toStringSimple() + "'"
1659 | if safeRawInput("Enter Yes to archive this task? >>>").upper() == "YES":
1660 | doit = True
1661 | if doit:
1662 | newItem = self.createItem(":d+0")
1663 | self.todo[index].copy(newItem, TodoItem.MODIFY)
1664 | newItem = self.createItem(entry + " @Archived")
1665 | self.todo[index].copy(newItem, TodoItem.APPEND)
1666 | if self.writeArchive(self.todo[index]):
1667 | self.todo[index:index + 1] = []
1668 | print "Task ", index, " has been archived."
1669 | else:
1670 | doit = False
1671 | print "Task ", index, " marked as archived but not removed."
1672 | else:
1673 | print "Task ", index, " has not been archived."
1674 | return doit
1675 |
1676 | def removeTask(self, indexStr):
1677 | doit = False
1678 | index = self.getRequiredTask(indexStr)
1679 | if index < 0 or index > len(self.todo) - 1:
1680 | self.showError("Sorry but there is no task " + indexStr + " to delete.")
1681 | else:
1682 | if indexStr == "^" or indexStr.upper() == "THIS":
1683 | doit = True
1684 | else:
1685 | print "Are you sure you want to remove ' " + self.todo[index].toStringSimple() + "'"
1686 | if safeRawInput("Enter Yes to delete this task? >>>").upper() == "YES":
1687 | doit = True
1688 | if doit:
1689 | self.todo[index:index + 1] = []
1690 | print "Task ", index, " has been removed."
1691 | else:
1692 | print "Task ", index, " has not been removed."
1693 | return doit
1694 |
1695 | def substituteText(self, indexStr):
1696 | line = indexStr.split(" ", 1)
1697 | if len(line) > 1:
1698 | indexStr = line[0]
1699 | entry = line[1]
1700 | else:
1701 | self.showError("You need to define the task and substitution phrases. e.g SUB 0 /old/new/")
1702 | return False
1703 |
1704 |
1705 | success = False
1706 | if indexStr == "":
1707 | print "You must supply the number of the task to change."
1708 | return False
1709 |
1710 | index = self.getRequiredTask(indexStr)
1711 |
1712 | if index < 0 or index > len(self.todo) - 1:
1713 | self.showError("Sorry but there is no task " + indexStr)
1714 | else:
1715 | text = entry.replace("/", "\n")
1716 | text = text.replace("\\\n","/")
1717 | phrases = text.split("\n")
1718 | if len(phrases) != 4:
1719 | self.showError("The format of the command is incorrect. The substitution phrases should be /s1/s2/ ")
1720 | return False
1721 | oldText = self.todo[index].getTask()
1722 | newText = oldText.replace(phrases[1], phrases[2])
1723 | if newText == oldText:
1724 | self.showError("Nothing has changed.")
1725 | return False
1726 | newItem = self.createItem(newText)
1727 | if newItem.hasError():
1728 | print "With the substitution the task had errors:"
1729 | print newItem.getError()
1730 | print "Task ", index, " is unchanged."
1731 | else:
1732 | if newItem.hasHiddenTask():
1733 | clearScreen(self.sysCalls)
1734 | self.showError("It isn't possible to create private or secret data by using the substitition command.")
1735 | else:
1736 | self.todo[index].copy(newItem, TodoItem.MODIFY)
1737 | print "Task ", index, " has been changed."
1738 | success = True
1739 | return success
1740 |
1741 |
1742 | def modifyTask(self, indexStr, replace, externalEditor = False):
1743 | line = indexStr.split(" ", 1)
1744 | if len(line) > 1:
1745 | indexStr = line[0]
1746 | entry = line[1]
1747 | else:
1748 | entry = ""
1749 |
1750 | success = False
1751 | if indexStr == "":
1752 | print "You must supply the number of the task to change."
1753 | return
1754 |
1755 | index = self.getRequiredTask(indexStr)
1756 |
1757 | if index < 0 or index > len(self.todo) - 1:
1758 | self.showError("Sorry but there is no task " + indexStr)
1759 | else:
1760 | if entry == "":
1761 | if externalEditor:
1762 | exEdit = EditorLauncher()
1763 | (key, entry) = self.todo[index].toStringEditable()
1764 | entry = exEdit.edit(entry)
1765 | else:
1766 | if replace == TodoItem.REPLACE:
1767 | print "This task will completely replace the existing entry,"
1768 | print "including any projects and actions."
1769 | elif replace == TodoItem.MODIFY:
1770 | print "Only the elements you add will be replaced. So, for example,"
1771 | print "if you don't enter any projects the original projects will remain."
1772 | else:
1773 | print "Elements you enter will be appended to the current task"
1774 | entry = safeRawInput("Enter new details >>>")
1775 | if entry != "":
1776 | if replace == TodoItem.APPEND:
1777 | newItem = self.createItem(entry, password="unused") # we will discard the encrypted part on extend
1778 | elif externalEditor:
1779 | newItem = self.createItem(entry, password = key)
1780 | else:
1781 | newItem = self.createItem(entry)
1782 | if newItem.hasHiddenTask():
1783 | clearScreen(self.sysCalls)
1784 | if newItem.hasError():
1785 | print "The task had errors:"
1786 | print newItem.getError()
1787 | print "Task ", index, " is unchanged."
1788 | else:
1789 | if newItem.hasHiddenTask() and replace == TodoItem.APPEND:
1790 | self.showError("It isn't possible to extend the encrypted part of a task.\nThis part is ignored.")
1791 | self.todo[index].copy(newItem, replace)
1792 | print "Task ", index, " has been changed."
1793 | success = True
1794 | else:
1795 | print "Task ", index, " has not been touched."
1796 | return success
1797 |
1798 | def incTask(self):
1799 | if self.currentTask < len(self.todo) - 1:
1800 | self.currentTask = self.currentTask + 1
1801 |
1802 | def incTaskLoop(self):
1803 | if self.currentTask < len(self.todo) - 1:
1804 | self.currentTask = self.currentTask + 1
1805 | else:
1806 | self.currentTask = 0
1807 | def decTask(self):
1808 | if self.currentTask > 0:
1809 | self.currentTask = self.currentTask - 1
1810 |
1811 | def decTaskLoop(self):
1812 | if self.currentTask > 0:
1813 | self.currentTask = self.currentTask - 1
1814 | else:
1815 | self.currentTask = len(self.todo) - 1
1816 |
1817 | def printItemTruncated(self, index, leader):
1818 | if len(self.todo) < 1:
1819 | print leader, "no tasks"
1820 | else:
1821 | scrnline = leader + "[%02d] %s" % (index, self.todo[index].toStringSimple())
1822 | if usePlugin:
1823 | print ikogPlugin.modifyShortOutput(scrnline)
1824 | elif len(scrnline) > gMaxLen:
1825 | print scrnline[0:gMaxLen - 3] + "..."
1826 | else:
1827 | print scrnline
1828 |
1829 |
1830 | def printItem(self, index, colorType):
1831 | if len(self.todo) < 1:
1832 | self.output("There are no tasks to be done.\n", 0)
1833 | nlines = 1
1834 | else:
1835 | wrapper = WordWrapper(gMaxLen)
1836 | scrnline = wrapper.wrap("[%02d] %s" % (index, self.todo[index].toStringSimple()))
1837 | if colorType == "row0":
1838 | style = "class=\"evenTask\""
1839 | else:
1840 | style = "class=\"oddTask\""
1841 | self.output("