fixed processus module to work with custom addons path

bzr revid: ame@tinyerp.com-20080820103632-x69sfyb2qfyp2epa
This commit is contained in:
Amit Mendapara 2008-08-20 16:06:32 +05:30
parent 2656522a63
commit 17f0040aae
2 changed files with 11 additions and 8 deletions

View File

@ -92,7 +92,7 @@
</tree>
<form string="Outgoing Transitions">
<notebook>
<page name="Description">
<page string="Description">
<field name="name"/>
<newline/>
<field name="node_from_id"/>
@ -134,7 +134,7 @@
<field name="arch" type="xml">
<form string="Transitions">
<notebook>
<page name="Description">
<page string="Description">
<field name="name"/>
<newline/>
<field name="node_from_id"/>

View File

@ -4,10 +4,12 @@ import ImageDraw
import ImageFont
import math
import addons
ROUNDED = 30
BGCOLOR = (228,233,237)
TITLECOLOR = (150,70,70)
FONT = 'addons/processus/report/sb.ttf'
FONT = addons.get_module_resource('processus', 'report/sb.ttf')
BOXSIZE = (160,120)
size = 800,600
@ -127,24 +129,25 @@ class graph(object):
def node(self, x, y, data, start_color=False):
self.draw.node(x,y,BOXSIZE[0], BOXSIZE[1], data.get('title','Unknown'), start_color and (255,125,125) or BGCOLOR)
self.draw.picture(x+35, y+BOXSIZE[1]-5, 'addons/processus/report/gtk-help.png')
self.draw.picture(x+35, y+BOXSIZE[1]-5, addons.get_module_resource('processus', 'report/gtk-help.png'))
if start_color:
self.draw.picture(x+65, y+BOXSIZE[1]-5, 'addons/processus/report/gtk-open.png')
self.draw.picture(x+95, y+BOXSIZE[1]-5, 'addons/processus/report/gtk-print.png')
self.draw.picture(x+65, y+BOXSIZE[1]-5, addons.get_module_resource('processus', 'report/gtk-open.png'))
self.draw.picture(x+95, y+BOXSIZE[1]-5, addons.get_module_resource('processus', 'report/gtk-print.png'))
y = y+25
menus = data.get('menu','').split('/')
while menus:
menu = menus.pop(0)
if menu:
if menus: menu=menu+' /'
self.draw.draw_text(x+23, y, 10, menu, color=(0,0,0), maxlength=BOXSIZE[0] - 25, font_name='addons/processus/report/ds.ttf')
self.draw.draw_text(x+23, y, 10, menu, color=(0,0,0), maxlength=BOXSIZE[0] - 25,
font_name=addons.get_module_resource('processus', 'report/ds.ttf'))
y+=15
def arrow_role(self, node_from, node_to, role='Hello'):
start = (node_from[0]+BOXSIZE[0]/2, node_from[1]+BOXSIZE[1]/2)
stop = (node_to[0]+BOXSIZE[0]/2, node_to[1]+BOXSIZE[1]/2)
(x,y) = self.draw.arrow_role(start, stop, role)
self.draw.picture(x, y-3, 'addons/processus/report/role.png')
self.draw.picture(x, y-3, addons.get_module_resource('processus', 'report/role.png'))
self.draw.draw_text(x,y-3, 12, 'Salesman', color=(0,0,0), center=True)
def arrow(self, node_from, node_to):