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

Details

    • Bug
    • Resolution: Done
    • 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)

    Description

      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.

       

       

      Attachments

        1. untitled_ui.py
          1 kB
        2. untitled.ui
          0.7 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes