]> Pileus Git - ~andy/gtk/blobdiff - gtk/compose-parse.py
filechooserbutton: When the combo box changes, set the *file*, not the current folder
[~andy/gtk] / gtk / compose-parse.py
index 6fe1929725ba6cff5fdb2e6eaf2b53d0c28f880b..493c48873309a4b5dec58487f396ed820f1871ba 100755 (executable)
@@ -24,7 +24,7 @@ import getopt
 URL_COMPOSE = 'http://gitweb.freedesktop.org/?p=xorg/lib/libX11.git;a=blob_plain;f=nls/en_US.UTF-8/Compose.pre'
 URL_KEYSYMSTXT = "http://www.cl.cam.ac.uk/~mgk25/ucs/keysyms.txt"
 URL_GDKKEYSYMSH = "http://git.gnome.org/browse/gtk%2B/plain/gdk/gdkkeysyms.h"
-URL_UNICODEDATATXT = 'http://www.unicode.org/Public/5.2.0/ucd/UnicodeData.txt'
+URL_UNICODEDATATXT = 'http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt'
 FILENAME_COMPOSE_SUPPLEMENTARY = 'gtk-compose-lookaside.txt'
 
 # We currently support keysyms of size 2; once upstream xorg gets sorted, 
@@ -52,9 +52,7 @@ headerfile_start = """/* GTK - The GIMP Tool Kit
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -253,7 +251,7 @@ def process_gdkkeysymsh():
        for line in gdkkeysymsh.readlines():
                linenum_gdkkeysymsh += 1
                line = line.strip()
-               if line == "" or not match('^#define GDK_', line):
+               if line == "" or not match('^#define GDK_KEY_', line):
                        continue
                components = split('\s+', line)
                if len(components) < 3:
@@ -261,16 +259,16 @@ def process_gdkkeysymsh():
                        % {'linenum': linenum_gdkkeysymsh, 'filename': filename_gdkkeysymsh, 'line': line}
                        print "Was expecting 3 items in the line"
                        sys.exit(-1)
-               if not match('^GDK_', components[1]):
+               if not match('^GDK_KEY_', components[1]):
                        print "Invalid line %(linenum)d in %(filename)s: %(line)s"\
                        % {'linenum': linenum_gdkkeysymsh, 'filename': filename_gdkkeysymsh, 'line': line}
-                       print "Was expecting a keysym starting with GDK_"
+                       print "Was expecting a keysym starting with GDK_KEY_"
                        sys.exit(-1)
                if match('^0x[0-9a-fA-F]+$', components[2]):
                        unival = long(components[2][2:], 16)
                        if unival == 0:
                                continue
-                       keysymdb[components[1][4:]] = unival
+                       keysymdb[components[1][8:]] = unival
                else:
                        print "Invalid line %(linenum)d in %(filename)s: %(line)s"\
                        % {'linenum': linenum_gdkkeysymsh, 'filename': filename_gdkkeysymsh, 'line': line}
@@ -354,6 +352,8 @@ def process_keysymstxt():
        keysymdb['dead_stroke'] = 0x338
        """ This is for a missing keysym from Markus Kuhn's db """
        keysymdb['Oslash'] = 0x0d8              
+       """ This is for a missing keysym from Markus Kuhn's db """
+       keysymdb['Ssharp'] = 0x1e9e
 
        """ This is for a missing (recently added) keysym """
        keysymdb['dead_psili'] = 0x313          
@@ -755,11 +755,11 @@ for sequence in xorg_compose_sequences_algorithmic_uniqued:
 if opt_algorithmic:
        for sequence in xorg_compose_sequences_algorithmic_uniqued:
                letter = "".join(sequence[-1:])
-               print '0x%(cp)04X, %(uni)c, seq: [ <0x%(base)04X>,' % { 'cp': ord(unicode(letter)), 'uni': letter, 'base': sequence[-2] },
+               print '0x%(cp)04X, %(uni)s, seq: [ <0x%(base)04X>,' % { 'cp': ord(unicode(letter)), 'uni': letter.encode('utf-8'), 'base': sequence[-2] },
                for elem in sequence[:-2]:
                        print "<0x%(keysym)04X>," % { 'keysym': elem },
                """ Yeah, verified... We just want to keep the output similar to -u, so we can compare/sort easily """
-               print "], recomposed as", letter, "verified"
+               print "], recomposed as", letter.encode('utf-8'), "verified"
 
 def num_of_keysyms(seq):
        return len(seq) - 1
@@ -772,9 +772,9 @@ def convert_UnotationToHex(arg):
 
 def addprefix_GDK(arg):
        if match('^0x', arg):
-               return '%(arg)s, ' % { 'arg': arg } 
+               return '%(arg)s, ' % { 'arg': arg }
        else:
-               return 'GDK_%(arg)s, ' % { 'arg': arg } 
+               return 'GDK_KEY_%(arg)s, ' % { 'arg': arg }
 
 if opt_gtk:
        first_keysym = ""
@@ -818,7 +818,7 @@ if opt_gtk:
                        print "0x%(ks)04X," % { "ks": keysymvalue(i[0]) },
                        print '%(str)s' % { 'str': "".join(map(lambda x : str(x) + ", ", i[1:])) }
                elif not match('^0x', i[0]):
-                       print 'GDK_%(str)s' % { 'str': "".join(map(lambda x : str(x) + ", ", i)) }
+                       print 'GDK_KEY_%(str)s' % { 'str': "".join(map(lambda x : str(x) + ", ", i)) }
                else:
                        print '%(str)s' % { 'str': "".join(map(lambda x : str(x) + ", ", i)) }
        for i in ct_second_part: