use Pango from GTK3/gobj, do not fail if gtk settings no available
Stefan Schuermans

Stefan Schuermans commited on 2013-12-01 20:47:35
Showing 2 changed files, with 8 additions and 5 deletions.

... ...
@@ -6,7 +6,7 @@
6 6
 # a blinkenarea.org project - https://www.blinkenarea.org/
7 7
 
8 8
 import re
9
-import pango
9
+from gi.repository import Pango
10 10
 
11 11
 import time_fmt
12 12
 
... ...
@@ -65,6 +65,6 @@ class Playlist:
65 65
       else:
66 66
         name = ""
67 67
         duration = "STOP"
68
-      store.append([idx, pango.WEIGHT_NORMAL, name, duration])
68
+      store.append([idx, Pango.WEIGHT_NORMAL, name, duration])
69 69
       idx = idx + 1
70 70
 
... ...
@@ -8,7 +8,7 @@
8 8
 import os
9 9
 from gi.repository import Gtk
10 10
 import gobject
11
-import pango
11
+from gi.repository import Pango
12 12
 import socket
13 13
 import struct
14 14
 import sys
... ...
@@ -128,9 +128,9 @@ class SyncGui:
128 128
     def update(model, path, it, user_data):
129 129
       (idx,) = model.get(it, 0)
130 130
       if idx == self.stEntryIdx:
131
-        weight = pango.WEIGHT_BOLD
131
+        weight = Pango.WEIGHT_BOLD
132 132
       else:
133
-        weight = pango.WEIGHT_NORMAL
133
+        weight = Pango.WEIGHT_NORMAL
134 134
       model.set(it, 1, weight)
135 135
     self.widPlaylistStore.foreach(update, None)
136 136
     # playing and (no entry or stop entry)
... ...
@@ -344,8 +344,11 @@ class SyncGui:
344 344
 # main application entry point
345 345
 if __name__ == "__main__":
346 346
   # configure settings
347
+  try:
347 348
     settings = Gtk.Settings.get_default()
348 349
     settings.props.gtk_button_images = True
350
+  except:
351
+    pass
349 352
   # create window
350 353
   app = SyncGui()
351 354
   # run application
352 355