ui: Set all files to minimum requirement of gtk 3.8

That way gives us better feedback from glade
This commit is contained in:
Cole Robinson 2014-09-19 21:15:50 -04:00
parent f42e9bf8d4
commit 55739055fd
21 changed files with 42 additions and 34 deletions

View File

@ -15,12 +15,15 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA.
import fileinput
import fnmatch
import glob
import imp
import importlib
import os
import sys
import unittest
import xml.etree.ElementTree as ET
_badmodules = ["gi.repository.Gtk", "gi.repository.Gdk"]
@ -91,24 +94,29 @@ class TestMisc(unittest.TestCase):
def test_ui_minimum_version(self):
import glob
import xml.etree.ElementTree as ET
failures = []
for filename in glob.glob("ui/*.ui"):
root = ET.parse(filename).getroot()
required_version = None
for line in fileinput.input(filename):
# This is much faster than XML parsing the whole file
if not line.strip().startswith('<requires '):
continue
req = root[0]
if req.tag != "requires":
continue
req = ET.fromstring(line)
if (req.tag != "requires" or
req.attrib.get("lib") != "gtk+"):
continue
required_version = req.attrib["version"]
if req.attrib.get("lib") != "gtk+":
continue
version = req.attrib["version"]
if (int(version.split(".")[0]) > 3 or
int(version.split(".")[1]) > 8):
failures.append((filename, req.attrib["version"]))
if required_version is None:
raise AssertionError("ui file=%s doesn't have a <requires> "
"tag for gtk+, it should say 3.8")
if (int(required_version.split(".")[0]) != 3 or
int(required_version.split(".")[1]) != 8):
failures.append((filename, required_version))
if failures:
raise AssertionError("The following files require a gtk version "
"higher than our target of gtk-3.8:\n" +
raise AssertionError("The following files should require gtk "
"version of gtk-3.8, which is what we target:\n" +
"\n".join([("%s version=%s" % tup) for tup in failures]))

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAboutDialog" id="vmm-about">
<property name="can_focus">False</property>
<property name="destroy_with_parent">True</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">67000</property>
<property name="step_increment">1</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkWindow" id="vmm-progress">
<property name="can_focus">False</property>
<property name="border_width">12</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkDialog" id="vmm-choose-cd">
<property name="can_focus">True</property>
<property name="has_focus">True</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">128</property>
<property name="step_increment">1</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">4095</property>
<property name="step_increment">1</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkWindow" id="vmm-create-pool">
<property name="height_request">350</property>
<property name="can_focus">False</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">100000</property>
<property name="value">1</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkWindow" id="vmm-delete">
<property name="width_request">450</property>
<property name="height_request">350</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAdjustment" id="adjustment6">
<property name="upper">18446744073709</property>
<property name="step_increment">100</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkImage" id="image2">
<property name="visible">True</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">70000</property>
<property name="step_increment">1</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">60</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.6"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="can_focus">False</property>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="gtk+" version="3.8"/>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>