Re: [zope-pt] ArgoUML/ArchegenXML

2009-07-20 Por tôpico Rodrigo Castardo
Fala Carlos,
no ArcheTypes você pode setar com o default (valor padrão) ou o
default_method (método que retorna o valor padrão), depende do caso.

Dê uma olhada em: ArcheTypes/Field.py (é onde são definidos os fields que
podem ser usados).

Lá você vai encontrar esse trecho de código:

class Field(DefaultLayerContainer):

Extend `DefaultLayerContainer`.
Implements `IField` and `ILayerContainer` interfaces.
Class security = public with default access = allow.
Class attribute _properties is a dictionary containing all of a
field's property values.


__implements__ = IField, ILayerContainer

security = ClassSecurityInfo()

_properties = {
'old_field_name':None,
'required' : False,
'default' : None,
'default_method' : None,
'vocabulary' : (),
'vocabulary_factory' : None,
'enforceVocabulary' : False,
'multiValued' : False,
'searchable' : False,
'isMetadata' : False,

'accessor' : None,
'edit_accessor' : None,
'mutator' : None,
'mode' : 'rw',

'read_permission' : permissions.View,
'write_permission' : permissions.ModifyPortalContent,

'storage' : AttributeStorage(),

'generateMode' : 'veVc',
'force' : '',
'type' : None,
'widget': StringWidget,
'validators' : (),
'index' : None, # KeywordIndex or index_type:schema
'index_method' : '_at_accessor', # method used for the index
 # _at_accessor an _at_edit_accessor
 # are the accessor and edit
accessor
'schemata' : 'default',
'languageIndependent' : False,
}

E no ATContentTypes/content você encontra a classe que implementa o evento
do Plone, ele por exemplo seta a data de início (pelo default_method).

Como pelo que pude entender você criou um novo tipo, pode pendurar o método
neste tipo e chamar no default_method.

Bom, dá uma olhada nisso, vai te ajudar.

Boa sorte, um abraço.

2009/7/17 chgcj henri...@pgr.mpf.gov.br



 Pessoal,
 preciso coocar em um campo text o resultado de um script python. Coloquei
 no ARGOUML, em Valores Marcados (Tagged Values) o campo expression com o
 valor context.montaURL(). Aí criei um script python no zope dando um return
 'teste' mas não funcionou.

 Alguém sabe como faze isso.
 Desde já obrigado.

 Carlos Henrique

  




-- 



-- 
Rodrigo Castardo
Liberiun
COO
rodrigocasta...@liberiun.com
+55 61 9123-7847
+55 61 3468-2662


Re: [zope-pt] Ajuda com UML + ArchgenXML

2009-07-20 Por tôpico Rodrigo Castardo
Fala Marcelo,
no arquivo Archetypes/Field.py você encontra o seguinte:

class ImageField(FileField):
 implements an image attribute. it stores
it's data in an image sub-object

sizes is an dictionary containing the sizes to
scale the image to. PIL is required for that.

Format:
sizes={'mini': (50,50),
   'normal' : (100,100), ... }
syntax: {'name': (width,height), ... }

the scaled versions can then be accessed as
object/imagename_scalename

e.g. object/image_mini

where imagename is the fieldname and scalename
is the name from the dictionary

original_size -- this parameter gives the size in (w,h)
to which the original image will be scaled. If it's None,
then no scaling will take place.
This is important if you don't want to store megabytes of
imagedata if you only need a max. of 100x100 ;-)

max_size -- similar to max_size but if it's given then the image
is checked to be no bigger than any of the given values
of width or height.

example:

ImageField('image',
original_size=(600,600),
sizes={ 'mini' : (80,80),
'normal' : (200,200),
'big' : (300,300),
'maxi' : (500,500)})

will create an attribute called image
with the sizes mini, normal, big, maxi as given
and a original sized image of max 600x600.
This will be accessible as
object/image

and the sizes as

object/image_mini
object/image_normal
object/image_big
object/image_maxi

the official API to get tag (in a pagetemplate) is
obj.getField('image').tag(obj, scale='mini')
...

sizes may be the name of a method in the instance or a callable
which
returns a dict.

Don't remove scales once they exist! Instead of removing a scale
from the list of sizes you should set the size to (0,0). Thus
removeScales method is able to find the scales to delete the
data.

Scaling will only be available if PIL is installed!

If 'DELETE_IMAGE' will be given as value, then all the images
will be deleted (None is understood as no-op)


Ou seja, se seu campo se chama image e sua escala banner, basta chamar
contexto_objeto/image_banner e você tem a imagem redimensionada.

A única exigência aqui é a PIL, naturalmente.

Revisa suas definições e se der problema, mande detalhes ;)

Abraços.

2009/7/11 Marcello Bontempo Salgueiro mbsalgue...@linuxmail.org



 Salve a todos!

 Galera estou com uma pequena duvida, fiz um produdo de portifolio que
 tem duas classes, uma chamada Portifolio e outra Imagem e na classe
 imagem eu tenho um atributo do tipo image e coloquei um valuetag sizes
 com o valor {'ver':(500,400),'thumb':(58,58)} só que
 montei minha pagetemplate assim:

 $objeto/getURL/Imagem_ver

 ele não redimensiona a imagem para 500,400 alguem pode da uma forca!?

 []s

 Marcello.

  




-- 



-- 
Rodrigo Castardo
Liberiun
COO
rodrigocasta...@liberiun.com
+55 61 9123-7847
+55 61 3468-2662


Re: [zope-pt] Ajuda com UML + ArchgenXML

2009-07-20 Por tôpico Marcello Bontempo Salgueiro
Opa, eu sei eu tentei isso, vo fazer um na unha e ver o que 
ocorre... qualquer coisa volto aqui! =)

[]s

Marcello.
  

 Fala Marcelo,
 no arquivo Archetypes/Field.py você encontra o seguinte:
 
 
 class ImageField(FileField):
  implements an image attribute. it stores
 it's data in an image sub-object
 
 
 sizes is an dictionary containing the sizes to
 scale the image to. PIL is required for that.
 
 
 Format:
 sizes={'mini': (50,50),
'normal' : (100,100), ... }
 syntax: {'name': (width,height), ... }
 
 
 the scaled versions can then be accessed as
 object/imagename_scalename
 
 
 e.g. object/image_mini
 
 
 where imagename is the fieldname and scalename
 is the name from the dictionary
 
 
 original_size -- this parameter gives the size in (w,h)
 to which the original image will be scaled. If it's None,
 then no scaling will take place.
 This is important if you don't want to store megabytes of
 imagedata if you only need a max. of 100x100 ;-)
 
 
 max_size -- similar to max_size but if it's given then the
 image
 is checked to be no bigger than any of the given
 values
 of width or height.
 
 
 example:
 
 
 ImageField('image',
 original_size=(600,600),
 sizes={ 'mini' : (80,80),
 'normal' : (200,200),
 'big' : (300,300),
 'maxi' : (500,500)})
 
 
 will create an attribute called image
 with the sizes mini, normal, big, maxi as given
 and a original sized image of max 600x600.
 This will be accessible as
 object/image
 
 
 and the sizes as
 
 
 object/image_mini
 object/image_normal
 object/image_big
 object/image_maxi
 
 
 the official API to get tag (in a pagetemplate) is
 obj.getField('image').tag(obj, scale='mini')
 ...
 
 
 sizes may be the name of a method in the instance or a
 callable which
 returns a dict.
 
 Don't remove scales once they exist! Instead of removing a
 scale
 from the list of sizes you should set the size to (0,0). Thus
 removeScales method is able to find the scales to delete the
 data.
 
 
 Scaling will only be available if PIL is installed!
 
 
 If 'DELETE_IMAGE' will be given as value, then all the images
 will be deleted (None is understood as no-op)
 
 
 
 Ou seja, se seu campo se chama image e sua escala banner, basta chamar
 contexto_objeto/image_banner e você tem a imagem redimensionada.
 
 
 A única exigência aqui é a PIL, naturalmente.
 
 
 Revisa suas definições e se der problema, mande detalhes ;)
 
 
 Abraços.
 
 2009/7/11 Marcello Bontempo Salgueiro mbsalgue...@linuxmail.org
 
 
 Salve a todos!
 
 Galera estou com uma pequena duvida, fiz um produdo de
 portifolio que
 tem duas classes, uma chamada Portifolio e outra Imagem e na
 classe
 imagem eu tenho um atributo do tipo image e coloquei um
 valuetag sizes
 com o valor {'ver':(500,400),'thumb':(58,58)} só que 
 montei minha pagetemplate assim:
 
 $objeto/getURL/Imagem_ver 
 
 ele não redimensiona a imagem para 500,400 alguem pode da uma
 forca!?
 
 []s
 
 Marcello.
 
 
 
 
 
 
 
 
 -- 
 
 
 
 -- 
 Rodrigo Castardo
 Liberiun
 COO
 rodrigocasta...@liberiun.com
 +55 61 9123-7847
 +55 61 3468-2662