~ubuntu-branches/ubuntu/utopic/python-apptools/utopic

« back to all changes in this revision

Viewing changes to examples/appscripting/example_editor_manager.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-07-08 23:55:50 UTC
  • mfrom: (2.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110708235550-yz5u79ubeo4dhyfx
Tags: 4.0.0-1
* New upstream release
* Update debian/watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
 
16
16
# Enthought library imports.
17
 
from enthought.etsconfig.api import ETSConfig
18
 
from enthought.pyface.workbench.api import Editor, EditorManager
 
17
from traits.etsconfig.api import ETSConfig
 
18
from pyface.workbench.api import Editor, EditorManager
19
19
 
20
20
 
21
21
class _wxLabelEditor(Editor):
28
28
        style = w.GetDefaultStyle()
29
29
        style.SetAlignment(wx.TEXT_ALIGNMENT_CENTER)
30
30
        w.SetDefaultStyle(style)
31
 
        
 
31
 
32
32
        self._set_text(w)
33
33
        self._set_size_and_style(w)
34
34
 
47
47
    def _set_text(self, w):
48
48
        w.SetValue("")
49
49
        w.WriteText("%s(%d points, %s)" % (self.obj.text, self.obj.size, self.obj.style))
50
 
        
 
50
 
51
51
    def _update_size(self):
52
52
        self._set_size_and_style(self.control)
53
53
 
57
57
    def _set_size_and_style(self, w):
58
58
        import wx
59
59
        if self.obj.style == 'normal':
60
 
            style, weight = wx.NORMAL, wx.NORMAL            
 
60
            style, weight = wx.NORMAL, wx.NORMAL
61
61
        elif self.obj.style == 'italic':
62
62
            style, weight = wx.ITALIC, wx.NORMAL
63
63
        elif self.obj.style == 'bold':
64
64
            style, weight = wx.NORMAL, wx.BOLD
65
65
        else:
66
66
            raise NotImplementedError, 'style "%s" not supported' % self.obj.style
67
 
        
 
67
 
68
68
        f = wx.Font(self.obj.size, wx.ROMAN, style, weight, False)
69
69
        style = wx.TextAttr("BLACK",wx.NullColour,f)
70
70
        w.SetDefaultStyle(style)