Re: [Pythoncad-developer] Sytile and settings In new kernel
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
|
From: Matteo B. <mat...@bo...> - 2010-05-13 06:23:33
|
Hi Gertwing,
The night helps to keep the idea in mind :-)
So now I tell you how the new style will work.
The style object will be the same as I describe you in the last mail.
The style will be stored in the database as Entity in this way:
Entity('STYLE'.....)
So each application will manage the style with the following method:
setApplicationStyle
getApplicationStyle
getApplicationStyleList
To manage the document style you can use the following method:
getActiveStyle
setActiveStyle (if the style is a document style copy the style in the
document)
getStyleList
getStyle
The Entity will have the following new method:
getStyle
setStyle
so in case you have to render a segment :
from PyQt4 import QtCore, QtGui
class Segment(QtGui.QGraphicsLineItem):
def __init__(self, entity):
super(Segment, self).__init__()
pt_begin = None
pt_end = None
# get the geometry
geometry = entity.getConstructionElements()
stl=entity.getStyle() #*** <<<<<<<<<<<<<<<<<<<<<<<<<New method
# get the begin and endpoint from the geometry
for key in geometry.keys():
if pt_begin == None:
pt_begin = geometry[key]
else:
pt_end = geometry[key]
# set the line
self.setLine(pt_begin.x, -1.0 * pt_begin.y, pt_end.x, -1.0 *
pt_end.y)
# set pen accoording to layer
color=Stl.getStyleProp("color") #*** <<<<<<<<<<<<<<<New Method
self.setPen(QtGui.QPen(QtGui.QColor.fromRgb(color)))
return
The user interface have to manage this style with a tree like (Just an
idea..)
Application
|-->Application Style
| |-->List of all the application
style
|-->Active Document Style
|-->List of all the active document
style
In a Bold or color will be indicated in the tree view the active style the
is currently set.
If the user would like to use a different style he just need to select if
from the tree view.
But we can discuss of this topic later when we will implements it on the
U/I.
Regards,
Matteo
-----Original Message-----
From: Gertwin Groen [mailto:ger...@gm...]
Sent: 12 May 2010 19:43
To: Matteo Boscolo
Cc: Pythoncad Developer List
Subject: Re: [Pythoncad-developer] Sytile and settings In new kernel
Hi Matteo,
I don't have a clear view how these styles are applied to the elements
in the drawing.
In the database the elements have a relation with a layer, the layer
triggers how the elements are drawn.
So to draw the elements for each layer we need the properties color,
line style, thickness, etc.
Can you give an example how to retrieve the properties from the Style
object?
As I understand the style object is stored in the application
configuration and not in the drawing, is this correct?
What if the drawing contain layers that are not in the application
configuration?
Maybe you can give some more clarification.
Regards,
Gertwin
2010/5/12 Matteo Boscolo <mat...@bo...>:
> Hi Gertwing, Guys,
>
> I have finished to implements the new style in the application.
>
> I would like to discuss with you what the new style object have to
contains
> and witch stucuture mast have.
>
> What I goanna do is :
>
> Have a style object that contains all the style setting like a dictionary
..
>
> So my class will be some think like this:
>
>
STYLE_KEYWORD=[color,linetype,linethicness,textstyle,textcolor
]
>
> Class Style(GeometricalEntity):
>
> Def __init__(self,**par):
>
> Self.__param=par
>
> Def getParam(self,name):
>
> #Return the param value
>
> Def setParam(self,name,value):
>
> #set the param value
>
>
.#some other useful method
>
> I would like to do the some think with the settings object
>
> The style object could be stored in application Kernel or in the single
> document (the user decide which one is the active one. Of course if the
user
> decide to use an application style, we need to copy it in the active
> document .. )
>
> The Setting object could be stored in the application Kernel only.
>
> Let me know What do you think ..
>
> Or if you have some other idea for the style or application settings in
> general ..
>
> Regards,
>
> Matteo
>
>
----------------------------------------------------------------------------
--
>
>
> _______________________________________________
> Pythoncad-developer mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pythoncad-developer
>
>
|