2 # a quick script to fix Glade v3.4.0 XML errors
3 # - removes an unnecessary <property name="response_id">0</property> line / string
4 # - Changes to comply with gtk-builder format
5 # the workflow is Glade -> fix_errata -> convert to GTK-Builder XML
7 # You must have gtk-builder-convert installed on your system
9 # Copyright 2008 Neekhil <Nickel62Metal@Gmail.com>
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License with
22 # the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL-3;
23 # if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA 02111-1307 USA
27 __author__
= "Neekhil <Nickel62Metal@Gmail.com>"
28 __date__
= "$ 28 Sep 2008 $"
34 def determine_path ():
35 """Borrowed from wxglade.py"""
38 if os
.path
.islink (root
):
39 root
= os
.path
.realpath (root
)
40 return os
.path
.dirname (os
.path
.abspath (root
))
42 print "I'm sorry, but something is wrong."
43 print "There is no __file__ variable. Please contact the author."
46 original
= open(determine_path () +"/MicrodiaV4.glade","r")
47 fixed
= open(determine_path () +"/MicrodiaV4-fixed.glade",'w')
48 to_be_deleted
= "<property name=\"response_id\">0</property>"
50 lines
= original
.readlines()
53 if line
.find(to_be_deleted
) == -1:
58 temp1
= determine_path () + "/MicrodiaV4-fixed.glade"
59 temp2
= determine_path () + "/MicrodiaV4.xml"
61 system("gtk-builder-convert "+temp1
+" "+temp2
)