[PyQt] uic NoSuchWidgetError

Matteo Bertini naufraghi at develer.com
Tue Dec 9 18:08:41 GMT 2008


Searching for Q3 in my code I found this:
Don't you think filtering a name is not a very polite method?
Is'nt it better letting python rise an exception if the Widget is not 
found at runtime?

Cheers,
Matteo Bertini

Index: PyQt-x11-gpl-4.4.4/pyuic/uic/pyuic.py
================================================================================
--- PyQt-x11-gpl-4.4.4/pyuic/uic/pyuic.py (original)
+++ PyQt-x11-gpl-4.4.4/pyuic/uic/pyuic.py (modified)
@@ -78,8 +78,8 @@
      sys.stderr.write("Error in input file: %s\n" % e)

  except uic.exceptions.NoSuchWidgetError, e:
-    if e.args[0].startswith("Q3"):
-        sys.stderr.write("Error: Q3Support widgets are not supported by 
PyQt4.\n")
+    if e.args[0].startswith("QX"):
+        sys.stderr.write("Error: QXSupport widgets are not supported by 
PyQt4.\n")
      else:
          sys.stderr.write(str(e) + "\n")

Index: PyQt-x11-gpl-4.4.4/pyuic/uic/uiparser.py
================================================================================
--- PyQt-x11-gpl-4.4.4/pyuic/uic/uiparser.py (original)
+++ PyQt-x11-gpl-4.4.4/pyuic/uic/uiparser.py (modified)
@@ -650,7 +650,7 @@

          for custom_widget in iter(elem):
              classname = custom_widget.findtext("class")
-            if classname.startswith("Q3"):
+            if classname.startswith("QX"):
                  raise NoSuchWidgetError, classname
              self.factory.addCustomWidget(classname,
                                       custom_widget.findtext("extends") 
or "QWidget",


-- 
/// Matteo Bertini - Develer srl \\\
\\\    http://www.develer.com    ///


More information about the PyQt mailing list