2.1 The First Project
After starting the graphical front end, choose the menu
File > New and select the simply.py template.
Now you should get a window like in figure 2.1. Left click
with the mouse on the report icon and gantt icon at the left
navigation-bar and you should get a window like in figure
2.2: The main-space is divided into three panes representing
different views of the project. The panes are linked, i.e. if the
cursor in one pane points on a task, the other panes will display the
selected task.
Figure 2.1:
the first project
![\includegraphics[width=\textwidth,height=.4\textheight]{tutorial/first1}](img1.png) |
Figure 2.2:
Different Views of a project
![\includegraphics[width=\textwidth,height=.4\textheight]{tutorial/first2}](img2.png) |
Let us examine the mini-project which was created as starting point:
1 # -*- coding: iso8859-15 -*-
2 from faces import *
3 from faces.lib import report
4 from faces.lib import gantt
5
6
7 def My_Project():
8 def Task1():
9 start = "2005-1-16"
10 effort = "1w"
11
12
13 project = Project(My_Project)
14
15
16 class Gantt(gantt.Standard):
17 data = project
18
19
20 class Report(report.Standard):
21 data = project
22
23 def make_report(self, data):
24 for t in data:
25 yield (t.indent_name(), t.start, t.end, t.effort)
- lines 1
- This comment tells python about the character encoding of
the file. If you only use ascii character you can omit the line.
- lines 2-4
- Import statements to get access to the faces modules.
- lines 7-10
- Here is the definition of your project. It consists of
two tasks: The main task My_Project and its subtask
Task1.
Keep in mind that task1 has a higher indentation than
my_project: Every task has the form
def Taskname():
property1 = val1
property2 = val2
...
(For python experts: A project is defined as a sequence of nested functions,
the properties of tasks are local variables of these functions)
In Task1 the properties start and effort are defined.
It is easy to guess what they mean: start is the start date of
task1 and effort is the work needed to complete the task.
As convention we start task names with an uppercase letter to distinguish them
from attributes, which start with lower case letters.
- line 12
- The class Project compiles your project definition
into a hierarchical structure of Task objects. They are needed for
any further processing. The root of this hierarchy is assigned to the
variable project. Notice that python is case sensitive, i.e. Project
is not the same as project.
- lines 14,15
- These lines declare a gantt chart on your project. The module
lib.gantt provides a collection of different gantt chart types, you can use.
Standard is an ordinary chart. The gantt chart is accessible by its class name
Gantt and this name also appears at the side-bar. The data attribute in
line 15 specifies a sequence of all Task objects, that should
be displayed by the chart. Usually you set this attribute to a Project object
(see also 2.1.1).
- lines 18-23
- These lines declare a spreadsheet report on your project.
As in line 14, the report is defined in a library module called
lib.report. The data attribute has the same meaning as in
Gantt. For specifying the displayed columns you have to
define the method make_report(). This method
iterates through the whole data sequence (line 22).
For each item in the sequence the yield statement generates a row
in the report.
Release 0.11.7, documentation updated on january 6, 2007.