diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-08-23 10:47:43 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-10-11 20:58:10 (GMT) |
commit | 9741582464d50c6a3367d9391068095236d3cad9 (patch) | |
tree | 22fba4d567fc48e25080513a1748acc839729cec /fontcombobox.py | |
parent | 7c84598386c1b341c7be2ca914ac9d7bf882c397 (diff) |
Initial port to Gtk3 and Abiword introspection bindings.
Signed-off-by: Carlos Garnacho <carlos.garnacho@lanedo.com>
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'fontcombobox.py')
-rw-r--r-- | fontcombobox.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/fontcombobox.py b/fontcombobox.py index 58f9140..9de5e34 100644 --- a/fontcombobox.py +++ b/fontcombobox.py @@ -15,21 +15,22 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -import gtk +from gi.repository import Gtk +from gi.repository import GObject FONT_BLACKLIST = ['cmex10', 'cmmi10', 'cmr10', 'cmsy10', 'esint10', 'eufm10', 'msam10', 'msbm10', 'rsfs10', 'wasy10'] -class FontComboBox(gtk.ComboBox): +class FontComboBox(Gtk.ComboBox): def __init__(self): - gtk.ComboBox.__init__(self) - font_renderer = gtk.CellRendererText() - self.pack_start(font_renderer) + GObject.GObject.__init__(self) + font_renderer = Gtk.CellRendererText() + self.pack_start(font_renderer, True) self.add_attribute(font_renderer, 'text', 0) self.add_attribute(font_renderer, 'font', 0) - font_model = gtk.ListStore(str) + font_model = Gtk.ListStore(str) context = self.get_pango_context() font_index = 0 @@ -39,15 +40,15 @@ class FontComboBox(gtk.ComboBox): name = family.get_name() if name not in FONT_BLACKLIST: font_model.append([name]) - font_faces = [] - for face in family.list_faces(): - face_name = face.get_face_name() - font_faces.append(face_name) - self.faces[name] = font_faces + # TODO gtk3 +# font_faces = [] +# for face in family.list_faces(): +# face_name = face.get_face_name() +# font_faces.append(face_name) +# self.faces[name] = font_faces - sorter = gtk.TreeModelSort(font_model) - sorter.set_sort_column_id(0, gtk.SORT_ASCENDING) - self.set_model(sorter) + font_model.set_sort_column_id(0, Gtk.SortType.ASCENDING) + self.set_model(font_model) self.show() def set_font_name(self, font_name): |