view sandbox/wx-dc.py @ 191:73f9779491ef
Renamed lib to allpy
Previously, every import looked like "from allpy.lib import ...", which
was ridiculous.
Consequences:
1. Uses of the package look like "from allpy import"
2. When testing the package locally, you have to add `pwd` to PYTHONPATH,
not `pwd`/.. (this is a good thing (tm))
3. It is now possible to make a proper Debian package
The change renames directory & fixes all imports referencing allpy.lib
The results are untested since there were no working tests before the
change.
author |
Daniil Alexeyevsky <me.dendik@gmail.com> |
date |
Thu, 18 Nov 2010 19:38:05 +0300 |
parents |
|
children |
61e5d8e146c7 |
line source
7 class Text(bufferedcanvas.BufferedCanvas):
9 def __init__(self, seqs, *args, **kw):
11 self.font = wx.FFont(12, wx.FONTFAMILY_MODERN)
12 bufferedcanvas.BufferedCanvas.__init__(self, *args, **kw)
14 dc = wx.ClientDC(self)
16 w = (len(seqs[0][1])+1) * dc.GetCharWidth()
17 h = (len(seqs)+1) * (dc.GetCharHeight() + 1)
19 self.SetVirtualSize(self.size)
21 self.Bind(wx.EVT_SCROLL, self.onPaint)
26 dc.SetBackground(wx.Brush("White"))
31 h = dc.GetCharHeight()
32 for i, (name, body, ids, colors) in enumerate(self.seqs):
33 for j in xrange(len(body)):
36 dc.SetBrush(wx.Brush(colors[j]))
37 dc.SetPen(wx.Pen(colors[j]))
38 dc.DrawRectangle(x, y, x + w, y + h)
39 dc.SetPen(wx.Pen("Black"))
40 dc.DrawText(body[j], x, y)
42 if hasattr(self, 'size'):
43 self.SetVirtualSize(self.size)
45 seqs = common.autoload('data/small.fasta')
48 top = wx.Frame(None, title='Example', size=(500, 500))
49 text = Text(seqs, top)