gnome-specimen r84 - in trunk-from-bzr: . specimen



Author: wbolster
Date: Tue Jun 17 18:42:40 2008
New Revision: 84
URL: http://svn.gnome.org/viewvc/gnome-specimen?rev=84&view=rev

Log:
* specimen/main.py:
* specimen/specimenwindow.py:
  - Get the initial preview text and preview size from
    GConf, but make sure translated versions are used in
    case the defaults aren't modified (eg. on first run)
  - Import configuration as 'specimen.config' instead of
    just 'config' to avoid naming conflicts after moving the
    lib dir to the end of the path in the previous commit.

* specimen/config.py.in:
  - Fixed typo in comment


Modified:
   trunk-from-bzr/   (props changed)
   trunk-from-bzr/specimen/config.py.in
   trunk-from-bzr/specimen/main.py
   trunk-from-bzr/specimen/specimenwindow.py

Modified: trunk-from-bzr/specimen/config.py.in
==============================================================================
--- trunk-from-bzr/specimen/config.py.in	(original)
+++ trunk-from-bzr/specimen/config.py.in	Tue Jun 17 18:42:40 2008
@@ -27,7 +27,7 @@
 # if not impossible because of the $LANG/LC_MESSAGES directories)
 LOCALEDIR   = "@LOCALEDIR@"
 
-# Allow to run uninstalled by detecint gnome-specimen.in
+# Allow to run uninstalled by detecting gnome-specimen.in
 if exists(join(dirname(__file__), '../gnome-specimen.in')):
     print "Running from source directory; not using installation paths!"
 

Modified: trunk-from-bzr/specimen/main.py
==============================================================================
--- trunk-from-bzr/specimen/main.py	(original)
+++ trunk-from-bzr/specimen/main.py	Tue Jun 17 18:42:40 2008
@@ -28,7 +28,7 @@
     import gtk.glade
     import gnome
 
-    import config
+    import specimen.config as config
 
     gettext.bindtextdomain(config.PACKAGE, config.LOCALEDIR)
     gettext.textdomain(config.PACKAGE)

Modified: trunk-from-bzr/specimen/specimenwindow.py
==============================================================================
--- trunk-from-bzr/specimen/specimenwindow.py	(original)
+++ trunk-from-bzr/specimen/specimenwindow.py	Tue Jun 17 18:42:40 2008
@@ -6,10 +6,11 @@
 import gtk.gdk
 import gtk.glade
 import pango
+import gconf
 
 from gettext import gettext as _
 
-import config
+import specimen.config as config
 
 class SpecimenWindow:
 
@@ -20,6 +21,11 @@
     # more information and possible samples for your language.
     preview_text = _('The quick brown fox jumps over the lazy dog.')
     preview_size = 12
+    # IMPORTANT: Keep the above two settings in sync with the GConf schema
+    # file. The translated string is used in case no user changes have been
+    # made to the GConf keys.
+
+    # default colors
     preview_fgcolor = gtk.gdk.color_parse('black')
     preview_bgcolor = gtk.gdk.color_parse('white')
 
@@ -56,6 +62,10 @@
         'smallcaps',
     ]
 
+    # GConf paths
+    gconf_path_preview_text = '/apps/gnome-specimen/preview_text'
+    gconf_path_preview_size = '/apps/gnome-specimen/preview_size'
+
     def __init__(self):
         'Initializes the application'
 
@@ -67,6 +77,19 @@
         # main window
         self.window = tree.get_widget('main-window')
 
+        # gconf
+        self.gconf_client = gconf.client_get_default()
+
+        # Set the text from gconf, but make sure translations work correctly
+        text = self.gconf_client.get_string(self.gconf_path_preview_text)
+        if text is not None and _(text) != self.preview_text:
+            # There is a value in GConf that differs from the default; use it
+            self.preview_text = text
+
+        # don't bother going the hard way for the size :)
+        size = self.gconf_client.get_int(self.gconf_path_preview_size)
+        if size > 0: self.preview_size = size
+
         # initialize
         self.initialize_fonts_pane(tree)
         self.initialize_previews_pane(tree)
@@ -79,11 +102,6 @@
         }
         self.update_button_sensitivity()
 
-        # update
-        self.on_preview_size_changed(self.preview_size_spinbutton)
-        self.on_preview_text_changed(self.preview_text_entry)
-        self.schedule_update_previews()
-
         # show the window
         self.window.show_all()
 



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