19 |
# Copyright 2001-2003 Free Software Foundation |
# Copyright 2001-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# WidgetFocusTab.py |
# renderers/Base/Driver.py |
23 |
# |
# |
24 |
# DESCRIPTION: |
# DESCRIPTION: |
25 |
# |
# |
29 |
from wxPython.wx import * |
from wxPython.wx import * |
30 |
|
|
31 |
class BaseRenderer: |
class BaseRenderer: |
32 |
def __init__(self, instance, workspace): |
def __init__(self, instance): |
33 |
self.instance = instance |
self.instance = instance |
|
self.workspace = workspace |
|
34 |
|
|
35 |
|
StartupStatus(_('Loading Form renderers')) |
|
StartupStatus(_('Loading Renderers')) |
|
36 |
|
|
37 |
self.init() |
self.init() |
38 |
|
|
39 |
|
# |
40 |
# For subclasses |
# For subclasses |
41 |
|
# |
42 |
def init(self): |
def init(self): |
43 |
pass |
pass |
44 |
|
|
45 |
|
|
46 |
|
# |
47 |
|
# Convenience |
48 |
|
# |
49 |
|
|
50 |
|
# |
51 |
|
# Set the font in use and |
52 |
|
# calculate the cell sizing |
53 |
|
# |
54 |
|
def resetFont(self): |
55 |
|
self.font = font = wxSystemSettings_GetFont(wxSYS_OEM_FIXED_FONT) |
56 |
|
|
57 |
|
# Get font extents |
58 |
|
tmpBitmap = wxEmptyBitmap(100,100) |
59 |
|
dc = wxMemoryDC() |
60 |
|
dc.SelectObject(tmpBitmap) |
61 |
|
dc.SetFont(font) |
62 |
|
w, h = dc.GetTextExtent('0123456789') |
63 |
|
self.cell_vert_margin = 2 |
64 |
|
self.cell_horiz_margin = 2 |
65 |
|
self.line_spacing = self.cell_vert_margin * 2 |
66 |
|
self.cell_height = h + self.line_spacing |
67 |
|
self.cell_width = int(w/10) |
68 |
|
|
69 |
|
|