From 9741582464d50c6a3367d9391068095236d3cad9 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Thu, 23 Aug 2012 10:47:43 +0000 Subject: Initial port to Gtk3 and Abiword introspection bindings. Signed-off-by: Carlos Garnacho Signed-off-by: Gonzalo Odiard --- (limited to 'fontcombobox.py') 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): -- cgit v0.9.1