For some reasons, abiwords can read background style attribute but not background-color
authorgibus
Thu, 21 Jul 2011 15:02:50 +0200
changeset 365 a478cb9786fd
parent 364 41dd28557b5d
child 366 98af3be91847
For some reasons, abiwords can read background style attribute but not background-color
src/cm/converters/abi_converters.py
src/cm/converters/oo_converters.py
src/cm/utils/comment_positioning.py
--- a/src/cm/converters/abi_converters.py	Thu Jul 21 14:12:25 2011 +0200
+++ b/src/cm/converters/abi_converters.py	Thu Jul 21 15:02:50 2011 +0200
@@ -256,12 +256,12 @@
             if infile:
                 infile.close()
             top = temp_dir
-            for root, dirs, files in os.walk(top, topdown=False):
-                for name in files:
-                    os.remove(os.path.join(root, name))
-                for name in dirs:
-                    os.rmdir(os.path.join(root, name))
-            os.rmdir(top)
+            #for root, dirs, files in os.walk(top, topdown=False):
+            #    for name in files:
+            #        os.remove(os.path.join(root, name))
+            #    for name in dirs:
+            #        os.rmdir(os.path.join(root, name))
+            #os.rmdir(top)
           except:
             pass
 
--- a/src/cm/converters/oo_converters.py	Thu Jul 21 14:12:25 2011 +0200
+++ b/src/cm/converters/oo_converters.py	Thu Jul 21 15:02:50 2011 +0200
@@ -317,12 +317,12 @@
             if infile:
                 infile.close()
             top = temp_dir
-            for root, dirs, files in os.walk(top, topdown=False):
-                for name in files:
-                    os.remove(os.path.join(root, name))
-                for name in dirs:
-                    os.rmdir(os.path.join(root, name))
-            os.rmdir(top)            
+            #for root, dirs, files in os.walk(top, topdown=False):
+            #    for name in files:
+            #        os.remove(os.path.join(root, name))
+            #    for name in dirs:
+            #        os.rmdir(os.path.join(root, name))
+            #os.rmdir(top)            
         except:
             # TODO : warn
             pass
--- a/src/cm/utils/comment_positioning.py	Thu Jul 21 14:12:25 2011 +0200
+++ b/src/cm/utils/comment_positioning.py	Thu Jul 21 15:02:50 2011 +0200
@@ -130,6 +130,11 @@
         ret = "%s%s%s"%(''.join(["[%s>"%start_id for start_id in start_ids]), ret, ''.join(["<%s]"%end_id for end_id in end_ids]))
      
     if with_colors and color != 0 :
+      # For some reasons, abiwords can read background style attribute but not background-color
+      from cm.cm_settings import USE_ABI
+      if USE_ABI:
+        ret = "<span style='background:%s;'>%s</span>"%(BCKCOLORS[color], ret)
+      else:
         ret = "<span style='background-color:%s;'>%s</span>"%(BCKCOLORS[color], ret)
         
     return ret