File: task-test.py

package info (click to toggle)
planner 0.14.92-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,676 kB
  • sloc: ansic: 68,177; xml: 6,112; sql: 890; makefile: 43; sh: 42; python: 26
file content (48 lines) | stat: -rwxr-xr-x 1,071 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python

import pygtk
pygtk.require("2.0")
import mrproject

app = mrproject.Application()

project = mrproject.Project(app)
task = mrproject.Task()

task.set_property('name','test task')

root = project.get_root_task()

# FIXME: Need to make this handle None as parent
project.insert_task (root, 0, task)

#project.set_property('project_start', 200000)

task2 = mrproject.Task()
project.insert_task (task, 0, task2)

resource = mrproject.Resource()
resource.set_property('name', 'test resource')

resource.assign(task, 100)

print 'Assignments:'
for a in task.get_assignments():
    print '  Resource: ', a.get_property('resource').get_property('name'), \
          '\n  Task: ', a.get_property('task').get_property('name'), \
          '\n  Units: ', a.get_property('units')

print

print 'Assigned resources:'
for r in task.get_assigned_resources():
    print '  ', r.get_property('name')
    
print

print 'Predecessors: ', task.get_predecessor_relations()
print 'Successors: ', task.get_successor_relations()

#project.save_as('foo.mrproject', True)