# HG changeset patch
# User Henrik Stuart <h...@hstuart.dk>
# Date 1269811324 -7200
# Node ID 56119077d4198328261bef8bcbc984fb69792c52
# Parent  bfa9e09d49480e0ee11bdfae5ad871bbc760bdde
gtklib: be better backward compatible

Now works with Ubuntu Jaunty again

diff -r bfa9e09d4948 -r 56119077d419 tortoisehg/hgtk/gtklib.py
--- a/tortoisehg/hgtk/gtklib.py Sun Mar 28 21:56:32 2010 +0200
+++ b/tortoisehg/hgtk/gtklib.py Sun Mar 28 23:22:04 2010 +0200
@@ -101,13 +101,13 @@
     else:
         NORMAL = str(normal)
         MAINLINE_COLOR = (
-                normal.red_float,
-                normal.green_float,
-                normal.blue_float
+                normal.red / 65535.0,
+                normal.green / 65535.0,
+                normal.blue / 65535.0
             )
         
         # adjust colors for a dark color scheme:
-        if normal.value > 0.5:
+        if hasattr(normal, 'value') and normal.value > 0.5 or 
max(MAINLINE_COLOR) > 0.5:
             global RED, GREEN, BLUE, BLACK, WHITE, \
                 DRED, DGREEN, DBLUE, DYELLOW, DORANGE, \
                 PRED, PGREEN, PBLUE, PYELLOW, PORANGE, \
@@ -877,21 +877,19 @@
        label = label.replace('_', '__')
     if kargs.get('asradio') or kargs.get('ascheck'):
         if kargs.get('asradio'):
-            menu = gtk.RadioMenuItem(kargs.get('group'), label)
+            menu = gtk.RadioMenuItem(kargs.get('group'), label, 
use_underline=use_underline)
         else:
-            menu = gtk.CheckMenuItem(label)
+            menu = gtk.CheckMenuItem(label, use_underline=use_underline)
         menu.set_active(kargs.get('check', False))
     elif icon:
         menu = gtk.ImageMenuItem(label)
         menu.set_image(get_icon_image(icon))
     else:
-        menu = gtk.MenuItem(label)
+        menu = gtk.MenuItem(label, use_underline=use_underline)
     if handler:
         args = kargs.get('args', [])
         menu.connect('activate', handler, *args)
     menu.set_sensitive(kargs.get('sensitive', True))
-    if gtk.gtk_version >= (2, 14, 0):
-       menu.set_use_underline(use_underline)
     menu.set_border_width(1)
     return menu
 

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to