Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pynxc/waxy/fontdialog.py
blob: f4fbdcab3b8f4235fe80819f781144204149b508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# fontdialog.py

# Issues:
# objects' GetFont() really should return a Font instance, not a wx.Font

import wx
import waxyobject
from font import Font

class FontDialog(wx.FontDialog, waxyobject.WaxyObject):

    def __init__(self, parent, data=None):
        if not data:
            data = wx.FontData()
        wx.FontDialog.__init__(self, parent, data)

    def ShowModal(self):
        """ Simplified ShowModal(), returning strings 'ok' or 'cancel'. """
        result = wx.FontDialog.ShowModal(self)
        if result == wx.ID_OK:
            return 'ok'
        else:
            return 'cancel'

    def GetChosenFont(self):
        """ Shorthand... """
        data = self.GetFontData()
        font = data.GetChosenFont()
        font.__class__ = Font
        return font

# XXX
# Problem: GetFontData() returns a wxFontData object, whose GetChosenFont()
# still returns a wxFont, not a wax Font.  No big deal really, but inconsistent.
# Maybe Wax needs its own FontData class...?