Dirk Meyer wrote:

<content> is only a name I choose in lack of a better one. Looking at
your screenshot, I guess you could have four areas: screen for the
background, header and body for the mail and plugin for the idlebar.


So you could do:

| skin.register ( 'mailreader', ('screen', Header(), Body(), 'plugin'))
and draw the stuff with


| skin.draw('mailreader', mail_object_to_be_shown)

Question is, what is Header() and Body():

| class Header(skin.Area):
|     """
|     the mail header
|     """
|     def __init__(self):
|         skin.Area.__init__(self, 'header')

The 'header' here refers to the fxd file. This means this area expects <header> inside the <mailreader>. Same for Body. The class has one
draw function:


|     def update_content(self):
|         self.mail    = self.menu

ok, self.menu is a bad name. I have to look inside the skin, maybe we
could find a better way to give you the object to draw. Now self.mail
is the object you added to skin.draw()

| self.content = self.calc_geometry(self.layout.content, copy_object=True)

Now you have the values were to draw inside self.content. Draw
everything you like with the drawing functions inside area.py:
drawroundbox, drawstring and drawimage.


HTH



Dischi



Okey, I've made some quick code for testing this out. It works great for the header area, although this could probably be done just as well by the info area.

The problem I'm facing is the fact that the bodytext probably needs to
be larger than the content area available. As far as I can see, this is
not possible with the drawstring() method. One approach would be to
split the text into a list of textlines and approximate how much text
is possible to draw via the font.height. This somewhat makes it possible
to scroll the text, eg:

| # how much text can we show vertically
| v_max = content.height/font.height
|
| # how much text can we show horizontally
| h_max = content.width/font.stringsize('A')
|
| h_lines,v_lines = [],[]
| v_app = v_lines.append
| h_app = h_lines.append
|
| # get the vertical text
| for line in t_lines[self.mail.v_offset:(self.mail.v_offset+v_max)]:
|    v_app(line)
|
| # get the horizontal text
| for line in v_lines:
|    h_app(line[self.mail.h_offset:(self.mail.h_offset+h_max)])
|
| # draw the text
| for line in h_lines:
|    self.drawstring(line,font,content, x, y, mode='soft')
|    y += font.height

I would prefer to use an approach where one could draw the whole text
onto a surface, like with osd.drawstringframed() and just blit this
surface when scrolling.

Am I making any sence here, or have I overlooked some other, better way
to do this?

.viggo



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freevo-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to