Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1234

uic creates empty broken retranslateUi function if there is nothing to translate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • None
    • 5.14.0, 5.14.1
    • PySide, Tooling
    • None
    • Python 3.8.1150.1013 on Windows 10
    • 3f7d087d3394a0cd80042f50edd9abcc53febe18 (qt/qtbase/5.14)

      found:

      I have some Designer .ui-files that have nothing that needs translation. Currently when I do:

      uic -g python untitled.ui -o untitled_ui.py

      I get code like
          def retranslateUi(selfForm):
          # retranslateUi
      when trying to import one gets:

      Traceback (most recent call last):
      {{ File "<stdin>", line 1, in <module>}}
      {{ File "C:\Python38\lib\site-packages\PySide2\untitled_ui.py", line 37}}

      ^
      SyntaxError: unexpected EOF while parsing

      suggested result

      There could be multiple ways this could be solved:

      1. like pyside2uic used to just add a pass to these empty functions. So the code would look like:

          def retranslateUi(selfForm):
      {{        pass
          # retranslateUi}}

      1. Empty functions and calls to them could be removed alltogether!

      I personally would suggest the latter.

       

       

        1. untitled_ui.py
          1 kB
        2. untitled.ui
          0.7 kB
        For Gerrit Dashboard: PYSIDE-1234
        # Subject Branch Project Status CR V

            crmaurei Cristian Maureira-Fredes
            ewerybody Eric Werner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes