]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/lib/analogclock/lib_setup/fontselect.py
1 # AnalogClock's font selector for setup dialog
2 # E. A. Tacao <e.a.tacao |at| estadao.com.br>
3 # http://j.domaindlx.com/elements28/wxpython/
4 # 15 Fev 2006, 22:00 GMT-03:00
5 # Distributed under the wxWidgets license.
8 from wx
.lib
.newevent
import NewEvent
9 from wx
.lib
.buttons
import GenButton
11 #----------------------------------------------------------------------------
13 (FontSelectEvent
, EVT_FONTSELECT
) = NewEvent()
15 #----------------------------------------------------------------------------
17 class FontSelect(GenButton
):
18 def __init__(self
, parent
, size
=(75, 21), value
=None):
19 GenButton
.__init
__(self
, parent
, wx
.ID_ANY
, label
="Select...",
26 self
.parent
.Bind(wx
.EVT_BUTTON
, self
.OnClick
, self
)
33 def SetValue(self
, value
):
35 value
= wx
.SystemSettings
.GetFont(wx
.SYS_DEFAULT_GUI_FONT
)
39 def OnClick(self
, event
):
41 data
.EnableEffects(False)
42 font
= self
.value
; font
.SetPointSize(10)
43 data
.SetInitialFont(font
)
45 dlg
= wx
.FontDialog(self
, data
)
46 changed
= dlg
.ShowModal() == wx
.ID_OK
49 data
= dlg
.GetFontData()
50 self
.value
= data
.GetChosenFont()
55 nevt
= FontSelectEvent(id=self
.GetId(), obj
=self
, val
=self
.value
)
56 wx
.PostEvent(self
.parent
, nevt
)