Как получить тему по умолчанию, используя python & ldquo; Gtk & rdquo; (не & ldquo; gtk & rdquo;)?

При написании линзы для Unity в python я застрял при замене «import gtk» на «из gi.repository import Gtk», потому что не могу найти эквивалент для функции: gtk.icon_theme_get_default ().

например:

import gtk, gio

if __name__ == "__main__":
  mimetype= "text/x-c"
  print "MIME=", mimetype
  iconName = gio.content_type_get_icon( mimetype )
  theme = gtk.icon_theme_get_default()
  print "ICO names=", iconName.get_names()
  icon = theme.choose_icon(iconName.get_names(), 48, 0)
  print "ICO=", icon.get_filename()

------- печать ------

MIME= text/x-c
ICO names= ['text-x-c', 'gnome-mime-text-x-c', 'text-x-generic']
ICO= /usr/share/icons/Humanity/mimes/48/text-x-c.svg
<час>

Я успешно заменил следующие 2 строки :

 from gi.repository import Gio, Gtk
   iconName = Gio.content_type_get_icon( mimetype )

Но я не могу найти способ перевести:

theme = gtk.icon_theme_get_default()

Любая помощь будет оценена.

3
задан 19 July 2012 в 21:20

1 ответ

Это Gtk.IconTheme.get_default() в привязках к самообследованию объектов.

0
ответ дан 19 July 2012 в 21:20

Другие вопросы по тегам:

Похожие вопросы: