~ubuntu-branches/ubuntu/saucy/gaupol/saucy-proposed

« back to all changes in this revision

Viewing changes to gaupol/renderers/integer.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2013-01-06 17:10:10 UTC
  • mfrom: (1.2.8)
  • mto: (10.2.3 experimental)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: package-import@ubuntu.com-20130106171010-kmlq0sy324jlp9zz
Tags: upstream-0.21
Import upstream version 0.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
# Copyright (C) 2009-2010 Osmo Salomaa
 
4
#
 
5
# This file is part of Gaupol.
 
6
#
 
7
# Gaupol is free software: you can redistribute it and/or modify it under the
 
8
# terms of the GNU General Public License as published by the Free Software
 
9
# Foundation, either version 3 of the License, or (at your option) any later
 
10
# version.
 
11
#
 
12
# Gaupol is distributed in the hope that it will be useful, but WITHOUT ANY
 
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 
14
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License along with
 
17
# Gaupol. If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
"""Cell renderer for integer data."""
 
20
 
 
21
import aeidon
 
22
 
 
23
from gi.repository import GObject
 
24
from gi.repository import Gtk
 
25
 
 
26
__all__ = ("IntegerCellRenderer",)
 
27
 
 
28
 
 
29
class IntegerCellRenderer(Gtk.CellRendererText):
 
30
 
 
31
    """Cell renderer for integer data."""
 
32
 
 
33
    __gtype_name__ = "IntegerCellRenderer"
 
34
 
 
35
    def __init__(self):
 
36
        """Initialize a :class:`IntegerCellRenderer` object."""
 
37
        GObject.GObject.__init__(self)
 
38
        self._text = ""
 
39
        aeidon.util.connect(self, self, "editing-started")
 
40
 
 
41
    def _on_editing_started(self, renderer, editor, path):
 
42
        """Set `editor` to use same font as `self`."""
 
43
        editor.modify_font(self.props.font_desc)