Re: Fwd: [Usability] Gtk+ Font Dialog improvements



Philip Ganchev wrote:
Hi Henrique

Your mockup looks nice. I do not understand exactly the problems you
wanted to solve, but I have a couple of suggestions and questions.

1. The font family names in column "Family" should be displayed in the
font family they represent. This avoids having to click on the family
name to see what the font looks like; the user can just see it from
the list. The same goes for Typeface and the "All fonts" combo box.

I threw together an example of what this might look like. Inkscape and OpenOffice both use this type of list already, and I think it works well. It's not noticeably slow or anything on win32, how does it fare on Linux?

--
Tim Evans
Applied Research Associates NZ
http://www.aranz.com/
from __future__ import division

import gtk, pango, gobject
import cgi


def families_list(parent):
    store = gtk.ListStore(pango.FontFamily, str)
    families = [(f.get_name(), f) for f in parent.get_pango_context().list_families()]
    families.sort()
    for name, family in families:
        store.append((family, ''))
    return store

def resize_families_list(store, size):
    size_str = str(size * 1024)
    for row in store:
        family = row[0]
        name = cgi.escape(family.get_name())
        markup = '<span font_family="%s" size="%s">%s</span>\n<span foreground="#666" size="small">(%s)</span>' % (name, size_str, name, name)
        row[1] = markup

def families_list_view(parent):
    store = families_list(parent)
    resize_families_list(store, 16)
    view = gtk.TreeView(store)
    view.insert_column_with_attributes(0, '', gtk.CellRendererText(), markup=1)
    view.set_rules_hint(True)
    view.set_headers_visible(False)
    scrolled = gtk.ScrolledWindow()
    scrolled.set_policy('automatic', 'always')
    scrolled.add(view)
    return scrolled

w = gtk.Window()
w.set_default_size(300, 485)
w.connect('destroy', gtk.main_quit)
w.add(families_list_view(w))
w.show_all()
gtk.main()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]