Discussion:
[Bitpim-devel] Please test aggregatedisplay.py
Roger Binns
2004-12-29 10:52:25 UTC
Permalink
Just run 'python aggregatedisplay.py'

It should show all the images currently in your BitPim wallpaper directory.
(It just looks directly in the directory, ignoring the index.idx file).
In particular resize and scroll the window. You'll notice a butterfly
"watermark" in the bottom right corner.

It may be a little sluggish as each item is actual drawn using the HTML
renderer and is actually a table, but shouldn't be *that* bad. In real
use each item will draw itself directly.

The idea is that this will become the general way of displaying various
items. Wallpapers and ringtones will be the first, but it should also
work for other items as well such as call history and SMS.

(And yes the "Oranges" items are deliberately small to make the code work
harder).

It works fine for me (tm) on Windows and Linux.

Roger
Vic Heintz
2004-12-29 13:55:59 UTC
Permalink
Post by Roger Binns
Just run 'python aggregatedisplay.py'
It works fine for me (tm) on Windows and Linux.
No such luck in Mac OS Jaguar. - Vic:

Traceback (most recent call last):
File "aggregatedisplay.py", line 361, in ?
d=Display(f,ds, "wallpaper-watermark")
File "aggregatedisplay.py", line 47, in __init__
self.UpdateItems()
File "aggregatedisplay.py", line 166, in UpdateItems
self.sections=self.datasource.GetSections()
File "aggregatedisplay.py", line 351, in GetSections
return [SectionHeader(x) for x in self.SECTIONS]
File "aggregatedisplay.py", line 191, in __init__
self.InitAttributes()
File "aggregatedisplay.py", line 200, in InitAttributes
w,h,d,l=dc.GetFullTextExtent("I", font=self.font)
File
"//Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-
packages/wx/_gdi.py", line 3105, in GetFullTextExtent
return _gdi_.DC_GetFullTextExtent(*args, **kwargs)
PyAssertionError: C++ assertion "wxAssertFailure" failed in
/tmp/BUILD/wxPythonSrc-2.5.2.8/src/mac/carbon/dc.cpp(1518): Invalid DC

Variables by last 8 frames, innermost last

Frame ? in aggregatedisplay.py at line 361
WallpaperManager = <class __main__.WallpaperManager at 0x20e5930>
app = <wx._core.PySimpleApp; proxy of C++ wxPyApp instance
at _009b11f0_p_wxPyApp>
_isvisible = <function _isvisible at 0x127970>
images = ['4kids.bmp', 'Barb.jpg', 'ID-Barb.bmp',
'ID-Eric.bmp', 'ID-Laura.bmp', 'Image00
imagespath = '/Users/vic/Library/BitPim/wallpaper'
ds = <__main__.TestDS object at 0x20eb690>
pn = '/Users/vic/Library/BitPim/wallpaper'
__doc__ = 'Displays a number of sections each with a number of
items'
DataSource = <class '__main__.DataSource'>
TestItem = <class '__main__.TestItem'>
SectionHeader = <class '__main__.SectionHeader'>
__file__ = 'aggregatedisplay.py'
Item = <class '__main__.Item'>
TestDS = <class '__main__.TestDS'>
__name__ = '__main__'
Display = <class '__main__.Display'>
name = 'mushrooms.png'
f = <wx._windows.Frame; proxy of C++ wxFrame instance at
_02553760_p_wxFrame>
config = <wx._misc.Config; proxy of C++ wxConfig instance at
_02373e80_p_wxConfig>
p = '/Users/vic/Library/BitPim/wallpaper'

Frame __init__ in aggregatedisplay.py at line 47
self = <__main__.Display; proxy of C++ wxScrolledWindow
instance at _02563c50_p_wxScrol
datasource = <__main__.TestDS object at 0x20eb690>
parent = <wx._windows.Frame; proxy of C++ wxFrame instance at
_02553760_p_wxFrame>
watermark = 'wallpaper-watermark'

Frame UpdateItems in aggregatedisplay.py at line 166
self = <__main__.Display; proxy of C++ wxScrolledWindow
instance at _02563c50_p_wxScrol

Frame GetSections in aggregatedisplay.py at line 351
_[1] = <built-in method append of list object at 0x20eb710>
x = 'Camera'
self = <__main__.TestDS object at 0x20eb690>

Frame __init__ in aggregatedisplay.py at line 191
self = <__main__.SectionHeader object at 0x20eb790>
label = 'Camera'

Frame InitAttributes in aggregatedisplay.py at line 200
self = <__main__.SectionHeader object at 0x20eb790>
dc = <wx._gdi.MemoryDC; proxy of C++ wxMemoryDC instance
at _0256b1c0_p_wxMemoryDC>

Frame GetFullTextExtent in
//Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-
packages/wx/_gdi.py at line 3105
args = (<wx._gdi.MemoryDC; proxy of C++ wxMemoryDC instance
at _0256b1c0_p_wxMemoryDC>,
kwargs = Keys ['font']
{'font': <wx._gdi.Font; proxy of C++ wxFont instance
at _02567ad0_p_wxFont>}
Roger Binns
2004-12-29 19:17:12 UTC
Permalink
Post by Vic Heintz
File "aggregatedisplay.py", line 200, in InitAttributes
w,h,d,l=dc.GetFullTextExtent("I", font=self.font)
...
Post by Vic Heintz
/tmp/BUILD/wxPythonSrc-2.5.2.8/src/mac/carbon/dc.cpp(1518): Invalid DC
...
Post by Vic Heintz
dc = <wx._gdi.MemoryDC; proxy of C++ wxMemoryDC instance
You'll need to figure out what the issue is then :-)

It is definitely a device context. The only thing I can think of is that
it wants a bitmap selected to draw on. (In this case I am not drawing, I
just want to find out the height of some text).

Try adding this line before the GetFullTextExtent call:

dc.SelectObject(wx.EmptyBitmap(100,100))

If it whines after the text extent call, it may want the bitmap unselected.
You can do that with:

dc.SelectObject(wx.NullBitmap)

Roger
d***@netzero.com
2004-12-29 19:29:09 UTC
Permalink
Was able to access the developer CVS repository again and grabbed the latest update. The display looks very good, the resolution info seems kinda off though.

-Joe Pham



________________________________________________________________
NetZero Gift Certificates
Give the gift of Internet access this holiday season.
http://www.netzero.com/give
Roger Binns
2004-12-29 21:32:00 UTC
Permalink
Post by d***@netzero.com
The display looks very good, the resolution info seems kinda off though.
It is accurate to zero significant places, as is the format information
and the filename for that matter :-)

I am sometimes concerned as my main dev machine is on the higher end
(Athlon 2800, 1GB RAM)

Roger
Vic Heintz
2004-12-29 21:32:27 UTC
Permalink
Post by Roger Binns
dc.SelectObject(wx.EmptyBitmap(100,100))
Ok, that helped. I was at least able to get the attached blank window.
If I do a LOT of scrolling I can see the headers for "Wallpaper",
"Oranges", and "Lemons" but no actual images. I have to scroll down 19
window-heights to get from Camera to Wallpaper, 6 more to Oranges, 1
more to Lemons and 6 more to bottom of window. Note there is no
horizontal scroll bar.

Vic
Roger Binns
2004-12-29 21:48:38 UTC
Permalink
Post by Vic Heintz
Ok, that helped. I was at least able to get the attached blank window.
If I do a LOT of scrolling I can see the headers for "Wallpaper",
"Oranges", and "Lemons" but no actual images. I have to scroll down 19
window-heights to get from Camera to Wallpaper, 6 more to Oranges, 1
more to Lemons and 6 more to bottom of window. Note there is no
horizontal scroll bar.
There isn't supposed to be a horizontal scroll bar - the items adjust
to the available space. You may also want to try making the window bigger.

I have attached what it looks like for me (which JPEG quality jacked
way down to keep the attachment small).

Unfortunately without a Mac there isn't much I can do. Someone with a
Mac will need to figure out the problem and fix it. You may also want
to try wxPython 2.5.3.

I am expecting this to be in the next build for the wallpaper and
ringtone displays.

Roger
Steven Palm
2004-12-30 04:04:35 UTC
Permalink
Post by Roger Binns
Unfortunately without a Mac there isn't much I can do. Someone with a
Mac will need to figure out the problem and fix it. You may also want
to try wxPython 2.5.3.
Bizarre... This line:

w,h,d,l=dc.GetFullTextExtent("I", font=self.font)
print "size %d,%d,%d,%d" % (w,h,d,l)

Returns:

section -1073749104,-1107296256,0,0

Something isn't quite right here, is it?

This throws the height calculation of sections/etc way off, which may
be the issue.

I'll keep poking.
Roger Binns
2004-12-30 04:26:04 UTC
Permalink
Post by Vic Heintz
w,h,d,l=dc.GetFullTextExtent("I", font=self.font)
print "size %d,%d,%d,%d" % (w,h,d,l)
section -1073749104,-1107296256,0,0
Something isn't quite right here, is it?
Nope :-) The only values that it cares about is h (the height
of the text) and d (the descent). I have attached a screen
snippet zoomed 3 times so you can it looking cool. Since
this is almost purely cosmetic you could just call GetTextExtent
and pick 10% of that as the descent.

While you are at it, see if the GetPartialTextExtents function
does anything meaningful. I'll need to use it to truncate
names (eg making "this is a really long name" be "this is r...")

Roger
Vic Heintz
2004-12-29 23:58:26 UTC
Permalink
Post by Roger Binns
There isn't supposed to be a horizontal scroll bar - the items adjust
to the available space. You may also want to try making the window
bigger.
Maximizing the window to my iBook's 800X600 screen reduced the amount
of scrolling to about six windows total. (I guess that would be 3600
pixels.) There is still no images displayed.
Post by Roger Binns
Unfortunately without a Mac there isn't much I can do. Someone with a
Mac will need to figure out the problem and fix it.
I'd be curious what other Mac users are seeing, especially Panther
users. Remember in Jaguar even the old way was a problem with all of
the thumbnails stacked in a single column.
Post by Roger Binns
You may also want
to try wxPython 2.5.3.
Isn't that the version we tried a month or so ago that was broken for
Mac OS?
Post by Roger Binns
I am expecting this to be in the next build for the wallpaper and
ringtone displays.
Hopefully we can get it working for at least the Panther version by
then. If not, the Mac build gets skipped again. (I suppose Mac users
can stick with 0.7.22 for a bit longer.)

Vic
Adit Panchal
2004-12-30 00:19:44 UTC
Permalink
Post by Vic Heintz
Post by Roger Binns
Unfortunately without a Mac there isn't much I can do. Someone with
a Mac will need to figure out the problem and fix it.
I'd be curious what other Mac users are seeing, especially Panther
users. Remember in Jaguar even the old way was a problem with all of
the thumbnails stacked in a single column.
I get the same thing as the screenshot you posted Vic. I took a look at
the code, but I haven't had much success in locating why the images
aren't being displayed. I also noticed that there is a lot of unused
space in the window which makes scrolling it very slow.

I am using Mac OS X 10.3.7.

Adit
Roger Binns
2004-12-30 03:43:47 UTC
Permalink
Post by Adit Panchal
I get the same thing as the screenshot you posted Vic. I took a look at
the code, but I haven't had much success in locating why the images
aren't being displayed. I also noticed that there is a lot of unused
space in the window which makes scrolling it very slow.
The display of each item is done using the HTML renderer, but that is
for development/demo of the component itself only. When used by the
wallpaper/ringtone code they will do their own drawing.

There are some things you can do:

- Uncomment the line following the comment "uncomment to see exactly what
size is given". That should draw a rectangle border for each item.

- Modify the genhtml function to return some HTML of your own choosing.

Roger
Steven Palm
2004-12-30 04:38:19 UTC
Permalink
Post by Roger Binns
- Uncomment the line following the comment "uncomment to see exactly
what size is given". That should draw a rectangle border for each
item.
These draw correctly from what I can see.
Post by Roger Binns
- Modify the genhtml function to return some HTML of your own choosing.
I made it just return "TESTING", as well as a simple table of just
text, nothing displays.
Steven Palm
2004-12-30 05:02:27 UTC
Permalink
Post by Steven Palm
Post by Roger Binns
- Uncomment the line following the comment "uncomment to see exactly
what size is given". That should draw a rectangle border for each
item.
These draw correctly from what I can see.
Post by Roger Binns
- Modify the genhtml function to return some HTML of your own
choosing.
I made it just return "TESTING", as well as a simple table of just
text, nothing displays.
If I change the hdc.SetSize call from:

hdc.SetSize(99999, 9999) # width is deliberately wide so that no
wrapping happens

to:

hdc.SetSize(width, height)

Things display properly.

Interestingly enough, though, the initial draw is wrong, only one
column per row... Same for the border drawn in your test case above.
However, using the scrollbar will cause things to adjust properly.

I have a 1.5Ghz G4 Powerbook here with 1GB of RAM and performance
SUCKS BILGE WATER. :-)

If I take out the image call in the HTML code, it's reasonable,
although I wouldn't call it 'zippy'.
Roger Binns
2004-12-30 19:06:48 UTC
Permalink
Post by Steven Palm
hdc.SetSize(99999, 9999) # width is deliberately wide so that no
hdc.SetSize(width, height)
I am guessing that the Mac is using a 16 bit size internally. Changing
to 9999,9999 should do the trick then. (The HTML DC renderer won't display
an item at all if it won't fit in the allowable area).
Post by Steven Palm
Interestingly enough, though, the initial draw is wrong, only one
column per row... Same for the border drawn in your test case above.
However, using the scrollbar will cause things to adjust properly.
The scrollbar moving causes the entire window to be repainted.

Does the drawing happen correctly with resizes later on? There
is an OnSize handler that does a relayout. On Windows and Linux
I get an initial size event of the wrong size in the constructor,
and then another with the correct size.

You can try wx.CallAfter(self.OnSize, None) at the end of the
constructor and then make the OnSize method get the real window
size if evt is None.
Post by Steven Palm
If I take out the image call in the HTML code, it's reasonable,
although I wouldn't call it 'zippy'.
The HTML drawing will be slow vs custom drawing which is what I
will be using for the wallpaper and ringtone tabs. I don't know
how much slower the HTML is vs custom. The other question that
arises is if drawing itself is slow for Mac.

Roger
Steven Palm
2004-12-31 03:47:18 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
hdc.SetSize(width, height)
I am guessing that the Mac is using a 16 bit size internally. Changing
to 9999,9999 should do the trick then. (The HTML DC renderer won't display
an item at all if it won't fit in the allowable area).
That works for the camera images and for "Lemon", but for "Oranges"
the text overlays the pictures in a horrible way. I'll attach a small
snippet to show you.
Post by Roger Binns
Does the drawing happen correctly with resizes later on?
Yes. An initial resize doesn't trigger it (if done immediate after
the window and first graphic are visible). If you wait a few seconds
and *then* resize the window it does repaint properly.
Post by Roger Binns
Post by Steven Palm
If I take out the image call in the HTML code, it's reasonable,
although I wouldn't call it 'zippy'.
The HTML drawing will be slow vs custom drawing which is what I
will be using for the wallpaper and ringtone tabs. I don't know
how much slower the HTML is vs custom. The other question that
arises is if drawing itself is slow for Mac.
I can't answer that. I'm not sure it's the "drawing" per-se, I don't
know *what* it is, because even if I keep the window small so that only
two columns in one row is visible, it takes about two or three seconds
for it to register, change, and display the next set of images when I
click in the lower area of the scrollbar to cause it to display the
next set.

Changing genhtml to spit back the exact HTML code you already have,
sans the <img> tag, is great in terms of performance. I can dynamically
resize the window and the items pop to their right places in almost
real-time as you move the window sizer around. Putting the IMG tag in
there gives it molasses in the works.

For what it's worth,

Steve
Roger Binns
2004-12-31 05:05:43 UTC
Permalink
Post by Steven Palm
That works for the camera images and for "Lemon", but for "Oranges"
the text overlays the pictures in a horrible way. I'll attach a small
snippet to show you.
Ok, what it shows is that the SetClippingRegion call is ignored. I have
attached Linux and Windows shots (ignore the X image in Linux and the blue
one on Windows).

The HTML generated is too large for the space available. That was deliberate
in order to help test the code, and wx.DC.SetClippingRegion is called to
ensure it is clipped.

But it also means that when I do the derived code for the actual wallpaper
and ringtone display then each item has to ensure it doesn't display
out of its own area. Please can you check if the wx.DC.GetPartialTextExtents
function works correctly as I'll have to use it to know where to chop
strings that are too long.
Post by Steven Palm
Post by Roger Binns
Does the drawing happen correctly with resizes later on?
Yes. An initial resize doesn't trigger it (if done immediate after
the window and first graphic are visible). If you wait a few seconds
and *then* resize the window it does repaint properly.
On Windows and Linux there is an inital size event delivered just after
the constructor runs with some silly value (I think it corresponds to
wx.DefaultSize), and then a second one once the control is sized because
it becomes visible. There is also code in the OnSize method that ignores
the new size if it is the same as the old size. I used to get that happening
a lot with the earlier code and pathological scrollbar behaviour. It
happens rarely now and could be removed to make it work better on Mac.
Post by Steven Palm
Putting the IMG tag in there gives it molasses in the works.
There is various grotesqueness that happens behind the scenes for the
images (which even includes saving them out to disk at one point!).
However the results are then cached so you should find it ok viewing
a previously viewed region.

It will be better for the derived wallpaper/ringtone code as they
won't be doing things as bad as the wx.Html code does (with no
saving to temporary files).

Roger
Vic Heintz
2004-12-30 15:47:20 UTC
Permalink
Post by Steven Palm
Post by Steven Palm
Post by Roger Binns
- Uncomment the line following the comment "uncomment to see exactly
what size is given". That should draw a rectangle border for each
item.
These draw correctly from what I can see.
Post by Roger Binns
- Modify the genhtml function to return some HTML of your own
choosing.
I made it just return "TESTING", as well as a simple table of just
text, nothing displays.
hdc.SetSize(99999, 9999) # width is deliberately wide so that no
wrapping happens
hdc.SetSize(width, height)
Things display properly.
Interestingly enough, though, the initial draw is wrong, only one
column per row... Same for the border drawn in your test case above.
However, using the scrollbar will cause things to adjust properly.
I have a 1.5Ghz G4 Powerbook here with 1GB of RAM and performance
SUCKS BILGE WATER. :-)
If I take out the image call in the HTML code, it's reasonable,
although I wouldn't call it 'zippy'.
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
I tried Steven's suggestions and see pretty much what he sees.

Roger had said "It should show all the images currently in your BitPim
wallpaper directory. (It just looks directly in the directory, ignoring
the index.idx file)." I indeed see all of my camera pix and wallpapers
in each of the four sections but at different sizes depending on the
section. It always says 123X925 regardless of the section or the
original image size.

As Steven observed, even after adjusting the window width to the full
800 width of my iBook display I see only one column UNTIL I utilize the
scroll bar. Then I get three columns for Camera (with a lot of wasted
vertical white space), four for Wallpaper and Lemons, and fourteen for
Oranges.

Vic
Roger Binns
2004-12-30 19:10:04 UTC
Permalink
Post by Vic Heintz
Roger had said "It should show all the images currently in your BitPim
wallpaper directory. (It just looks directly in the directory, ignoring
the index.idx file)." I indeed see all of my camera pix and wallpapers
in each of the four sections but at different sizes depending on the
section.
That is correct. When you run the file it is just doing a self-test/demo
to see if it works and to help development.
Post by Vic Heintz
It always says 123X925 regardless of the section or the
original image size.
And all the other fields are hard coded as well. The genhtml function
will show why.

What you are seeing is a demo/test of the aggregateddisplay widget,
which will be subclassed to do wallpaper/ringtone/etc.
Post by Vic Heintz
As Steven observed, even after adjusting the window width to the full
800 width of my iBook display I see only one column UNTIL I utilize the
scroll bar. Then I get three columns for Camera (with a lot of wasted
vertical white space), four for Wallpaper and Lemons, and fourteen for
Oranges.
It sounds like the size events are not happening or something like that.

Roger
Vic Heintz
2004-12-31 13:39:49 UTC
Permalink
Post by Roger Binns
Post by Steven Palm
That works for the camera images and for "Lemon", but for "Oranges"
the text overlays the pictures in a horrible way. I'll attach a small
snippet to show you.
Ok, what it shows is that the SetClippingRegion call is ignored. I
have
attached Linux and Windows shots (ignore the X image in Linux and the
blue
one on Windows).
When I have the line
hdc.SetSize(width,height)
I see pretty much what Roger sees for "Oranges" but when I have
hdc.SetSize(9999, 9999) # width is deliberately wide so
that no wrapping happens
I see the same "Oranges" ugliness that Steve reports.
Post by Roger Binns
Post by Steven Palm
Post by Roger Binns
Does the drawing happen correctly with resizes later on?
Yes. An initial resize doesn't trigger it (if done immediate after
the window and first graphic are visible). If you wait a few seconds
and *then* resize the window it does repaint properly.
On Windows and Linux there is an inital size event delivered just after
the constructor runs with some silly value (I think it corresponds to
wx.DefaultSize), and then a second one once the control is sized
because
it becomes visible. There is also code in the OnSize method that
ignores
the new size if it is the same as the old size. I used to get that
happening
a lot with the earlier code and pathological scrollbar behaviour. It
happens rarely now and could be removed to make it work better on Mac.
Resizing once doesn't seem to redistribute the columns and rows. Using
the scroll bar after a resize or resizing even the slightest bit a
second time does. In the attached clip I have just resized down from my
full screen width which gave me three columns. The right column is
chopped off after the resize. If I now use the scroll bar (or resize
again just one pixel) it will redraw the table with only two columns.

Vic
Roger Binns
2005-01-01 02:59:29 UTC
Permalink
Post by Vic Heintz
Resizing once doesn't seem to redistribute the columns and rows. Using
the scroll bar after a resize or resizing even the slightest bit a
second time does.
It looks like the Mac is ignoring the FULL_REPAINT_ON_RESIZE style.

First, can you verify that the OnSize method is being called for
all size changes.

Once you are sure of that, add this line at the end of the OnSize
method:

wx.CallAfter(self.Refresh, False)

If that does fix it then there are some code re-organisations I
think I can do that will make it work better on all platforms.

Roger
Steven Palm
2005-01-01 05:27:45 UTC
Permalink
Post by Roger Binns
wx.CallAfter(self.Refresh, False)
That does seem to help things work properly in terms of the refresh on
resize without having to use the scrollbar.
Roger Binns
2005-01-01 06:01:29 UTC
Permalink
Post by Steven Palm
That does seem to help things work properly in terms of the refresh on
resize without having to use the scrollbar.
Can you try what I just committed? I put the logic in OnPaint instead that
looks at the current size and does a ReLayout if it was different than
when ReLayout last happened. Doing this lazily may improve performance
a bit.

The profiling shows that most of the CPU time is in the HTML DC renderer.
Run with python -O to have no profiling. Here is an example of what I
get (the top section of the three):

Ordered by: internal time, call count
List reduced from 758 to 20 due to restriction <20>

ncalls tottime percall cumtime percall filename:lineno(function)
1 48.014 48.014 99.569 99.569 _core.py:4725(MainLoop)
2174 33.777 0.016 38.855 0.018 html.py:1190(SetHtmlText)
1 5.569 5.569 5.572 5.572 randpool.py:242(_measureTickSize)
208 1.857 0.009 1.857 0.009 _gdi.py:3988(__del__)
2174 1.564 0.001 2.183 0.001 html.py:1170(__init__)
2174 1.564 0.001 1.564 0.001 html.py:1202(Render)
4348 1.539 0.000 1.539 0.000 html.py:1176(__del__)
125 1.482 0.012 1.482 0.012 _gdi.py:3037(Clear)
2174 1.264 0.001 1.264 0.001 wallpaper.py:401(statinfo)
2174 0.939 0.000 46.322 0.021 aggregatedisplay.py:498(Draw)
21 0.715 0.034 0.715 0.034 _gdi.py:594(SaveFile)
106/104 0.500 0.005 49.674 0.478 aggregatedisplay.py:95(OnPaint)
2174 0.463 0.000 3.604 0.002 wallpaper.py:472(_OpenFile)
897 0.393 0.000 0.393 0.000 _gdi.py:3078(SetFont)
2174 0.320 0.000 0.320 0.000 aggregatedisplay.py:520(genhtml)
2174 0.281 0.000 4.617 0.002 wallpaper.py:456(OpenFile)
2174 0.267 0.000 0.342 0.000 _core.py:1582(__init__)
4348 0.236 0.000 0.236 0.000 _core.py:1670(GetProtocol)
2174 0.199 0.000 0.395 0.000 html.py:372(__init__)
2174 0.197 0.000 0.264 0.000 _core.py:1481(__init__)

You can see that 2174 items where displayed (every refresh/resize/scroll causes
a redisplay of visible items).

Please also check the selection of items. The algorithm used is that the
bounding box is checked after each item is drawn. This is necessary because
an item may be in a space of 200x100 but only draw in 50x50 of it, so we
don't want to the code to act as though the item was clicked on outside of
the 50x50 but inside of the 200x100.

However it turns out that this area of wxWidgets is thick with bugs. wxGtk
is a no hoper returning mostly useless values. Windows does a lot better
with them being correct most of the time. (The bounding box values should
never be outside of the clipping area). The Draw method can return a more
accurate bounding box to use which is what the code does to work around
those bugs. On Windows the bounding box doesn't include the image. On
Gtk it is basically the entire area. No doubt the Mac will do something
else.

(And don't worry about how ugly an item looks when selected. That is just
a "feature" of the HTML DC renderer which won't be used.)

BTW I still haven't heard back from you if DC.GetPartialTextExtents returns
useful numbers or garbage.

Roger
Steven Palm
2005-01-01 06:44:35 UTC
Permalink
Post by Roger Binns
Can you try what I just committed? I put the logic in OnPaint instead that
looks at the current size and does a ReLayout if it was different than
when ReLayout last happened. Doing this lazily may improve performance
a bit.
I can't discern if performance has been enhanced at all, it's still so
slow that I'd rate it to be useless. I realize this test case is not
the same approach you will use when it's subclassed for
wallpaper/ringer views, so we'll see what develops.
Post by Roger Binns
The profiling shows that most of the CPU time is in the HTML DC renderer.
Run with python -O to have no profiling. Here is an example of what I
Ordered by: internal time, call count
List reduced from 758 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
1 48.014 48.014 99.569 99.569 _core.py:4725(MainLoop)
2174 33.777 0.016 38.855 0.018 html.py:1190(SetHtmlText)
1 5.569 5.569 5.572 5.572
randpool.py:242(_measureTickSize)
208 1.857 0.009 1.857 0.009 _gdi.py:3988(__del__)
I have:

Ordered by: internal time, call count
List reduced from 758 to 20 due to restriction <20>

ncalls tottime percall cumtime percall filename:lineno(function)
215 44.522 0.207 69.423 0.323 html.py:1190(SetHtmlText)
1 24.697 24.697 101.217 101.217 _core.py:4725(MainLoop)
63 15.128 0.240 15.192 0.241 _gdi.py:722(__init__)
215 5.181 0.024 5.181 0.024 html.py:1202(Render)
63 4.162 0.066 4.162 0.066 _gdi.py:578(SaveFile)
64 2.082 0.033 2.087 0.033 _core.py:1991(__init__)
63 1.449 0.023 1.449 0.023
_core.py:2055(FindFirstUnusedColour)
64 1.054 0.016 1.056 0.017
_core.py:2280(ConvertToBitmap)
1 1.033 1.033 1.848 1.848 guiwidgets.py:12(?)
67 1.005 0.015 1.006 0.015 _gdi.py:3814(__init__)
1 0.590 0.590 0.629 0.629 _core.py:5172(__init__)
63 0.284 0.005 0.284 0.005
aggregatedisplay.py:484(isBCI)
215 0.221 0.001 0.299 0.001 html.py:1170(__init__)
140 0.219 0.002 0.219 0.002 _gdi.py:2733(DrawText)
430 0.215 0.001 0.215 0.001 html.py:1176(__del__)
1 0.213 0.213 0.213 0.213 _core.py:6179(Show)
1 0.182 0.182 0.183 0.183 libusb.py:5(?)
1 0.164 0.164 0.170 0.170 _windows.py:394(__init__)
215 0.159 0.001 0.159 0.001 _gdi.py:3576(MinY)
183 0.101 0.001 0.113 0.001
sre_compile.py:180(_optimize_charset)
Post by Roger Binns
Please also check the selection of items.
They do not select at all. No visible indication that anything is
happening when I click anywhere in the visible area. I haven't tried to
troubleshoot this one yet, and won't this evening, it will have to be a
task for another time.
Post by Roger Binns
BTW I still haven't heard back from you if DC.GetPartialTextExtents returns
useful numbers or garbage.
I put this call inside the draw routine, just so it would be called
repeatedly:

print dc.GetPartialTextExtents("""Testing man"""), "\n"

And it returns two sets of numbers... Strange, I might have expected
the same always... ?

[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]

Steve
Roger Binns
2005-01-03 08:14:07 UTC
Permalink
Post by Steven Palm
I put this call inside the draw routine, just so it would be called
print dc.GetPartialTextExtents("""Testing man"""), "\n"
And it returns two sets of numbers... Strange, I might have expected
the same always... ?
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
It will depend on the font currently selected. That will be different
if a section header has just been drawn vs some html has just been
drawn.

I am busy writing code that uses this output now. I wonder how smart
wxWidgets is about kerning etc. That would affect

extent(stringone)+extent(stringone)==extent(stringone+stringtwo)

Roger

Vic Heintz
2005-01-01 14:25:29 UTC
Permalink
I can confirm that behavior is better for the latest cvs check-in (rows
and columns redistribute during first resize.) Performance is slow but
I thought it was just my 366Mhz G3. I can supply profiling info if
needed.

I still must edit to make it work:
diff -r1.8 aggregatedisplay.py
362a363
Post by Roger Binns
dc.SelectObject(wx.EmptyBitmap(100,100))
Vic
Post by Roger Binns
Post by Roger Binns
Can you try what I just committed? I put the logic in OnPaint
instead that
looks at the current size and does a ReLayout if it was different than
when ReLayout last happened. Doing this lazily may improve
performance
a bit.
I can't discern if performance has been enhanced at all, it's still
so slow that I'd rate it to be useless. I realize this test case is
not the same approach you will use when it's subclassed for
wallpaper/ringer views, so we'll see what develops.
Post by Roger Binns
The profiling shows that most of the CPU time is in the HTML DC
renderer.
Run with python -O to have no profiling. Here is an example of what I
Ordered by: internal time, call count
List reduced from 758 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
1 48.014 48.014 99.569 99.569 _core.py:4725(MainLoop)
2174 33.777 0.016 38.855 0.018 html.py:1190(SetHtmlText)
1 5.569 5.569 5.572 5.572
randpool.py:242(_measureTickSize)
208 1.857 0.009 1.857 0.009 _gdi.py:3988(__del__)
Ordered by: internal time, call count
List reduced from 758 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
215 44.522 0.207 69.423 0.323 html.py:1190(SetHtmlText)
1 24.697 24.697 101.217 101.217 _core.py:4725(MainLoop)
63 15.128 0.240 15.192 0.241 _gdi.py:722(__init__)
215 5.181 0.024 5.181 0.024 html.py:1202(Render)
63 4.162 0.066 4.162 0.066 _gdi.py:578(SaveFile)
64 2.082 0.033 2.087 0.033 _core.py:1991(__init__)
63 1.449 0.023 1.449 0.023
_core.py:2055(FindFirstUnusedColour)
64 1.054 0.016 1.056 0.017
_core.py:2280(ConvertToBitmap)
1 1.033 1.033 1.848 1.848 guiwidgets.py:12(?)
67 1.005 0.015 1.006 0.015 _gdi.py:3814(__init__)
1 0.590 0.590 0.629 0.629 _core.py:5172(__init__)
63 0.284 0.005 0.284 0.005
aggregatedisplay.py:484(isBCI)
215 0.221 0.001 0.299 0.001 html.py:1170(__init__)
140 0.219 0.002 0.219 0.002 _gdi.py:2733(DrawText)
430 0.215 0.001 0.215 0.001 html.py:1176(__del__)
1 0.213 0.213 0.213 0.213 _core.py:6179(Show)
1 0.182 0.182 0.183 0.183 libusb.py:5(?)
1 0.164 0.164 0.170 0.170 _windows.py:394(__init__)
215 0.159 0.001 0.159 0.001 _gdi.py:3576(MinY)
183 0.101 0.001 0.113 0.001
sre_compile.py:180(_optimize_charset)
Post by Roger Binns
Please also check the selection of items.
They do not select at all. No visible indication that anything is
happening when I click anywhere in the visible area. I haven't tried
to troubleshoot this one yet, and won't this evening, it will have to
be a task for another time.
Post by Roger Binns
BTW I still haven't heard back from you if DC.GetPartialTextExtents
returns
useful numbers or garbage.
I put this call inside the draw routine, just so it would be called
print dc.GetPartialTextExtents("""Testing man"""), "\n"
And it returns two sets of numbers... Strange, I might have expected
the same always... ?
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 16, 23, 27, 31, 39, 47, 51, 64, 71, 79]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
[9, 18, 25, 31, 34, 42, 51, 56, 68, 76, 84]
Steve
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Bitpim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Roger Binns
2005-01-01 17:34:00 UTC
Permalink
Post by Vic Heintz
diff -r1.8 aggregatedisplay.py
362a363
Post by Roger Binns
dc.SelectObject(wx.EmptyBitmap(100,100))
I jave just committed that.

Roger
Vic Heintz
2005-01-01 16:38:27 UTC
Permalink
What changed? Just did a cvs update and now bitpim is broken:

Traceback (most recent call last):
File "/Users/vic/Projects/bitpim/bp.py", line 75, in ?
import gui
File "/Users/vic/Projects/bitpim/gui.py", line 35, in ?
import phonebook
File "/Users/vic/Projects/bitpim/phonebook.py", line 2328, in ?
import native.strings
ImportError: No module named strings

Vic
Steven Palm
2005-01-01 16:47:21 UTC
Permalink
It's trying to import "strings" from the native directory in BitPim.

Did you build strings? That's the jarow stuff.

CD into the native/strings directory and do a python setup.py build
Vic Heintz
2005-01-01 16:58:37 UTC
Permalink
Post by Steven Palm
It's trying to import "strings" from the native directory in BitPim.
Did you build strings? That's the jarow stuff.
CD into the native/strings directory and do a python setup.py build
Hmm, I'm confused. There is no native/strings dir. And what is jarow?

Vic
Roger Binns
2005-01-01 17:31:03 UTC
Permalink
Post by Vic Heintz
Hmm, I'm confused. There is no native/strings dir.
You need to do your cvs updates using -dP
Post by Vic Heintz
And what is jarow?
http://article.gmane.org/gmane.comp.mobile.bitpim.devel/1414

Roger
Loading...