PyQt leaves C-code in python modules

Discussion in 'Python' started by Dave, Nov 4, 2003.

  1. Dave

    Dave Guest

    I'm having a strange problem with the pyqt-tools in the latest Debian
    packages. When I run
    $ pyuic colortool.ui > colortool.py
    Extracting init()
    Extracting loadSettings()
    Extracting saveSettings()
    ....
    it produces 'colortool.py' with python function headers, but the body of the
    functions are still in C. There are no error messages, just the normal log
    of "extracting" functions.


    The file colortool.ui is the tutorial example from the Qt Designer manual,
    and it works correctly when compiled in C. The versions on all the relevant
    packages seem to be correct:

    -> pyuic is from package pyqt-tools 3.8-2.1 This package depends on:
    libc6 (>= 2.3.2-1), libgcc1 (>= 1:3.3.1-1), libqt3c102-mt (>= 3:3.2.1),
    libstdc++5 (>= 1:3.3.1-1), xlibs (>> 4.1.0)
    -> Current versions shown by dpkg are:
    libc6 2.3.2-9, libgcc1 1:3.3.2-1, libqt3c102-mt 3:3.2.1-6, libstdc++5
    1:3.3.2-1, xlibs 4.2.1-12.1
    -> designer is from package qt3-designer 3:3.2.1-6


    $ pyuic -version
    Python User Interface Compiler 3.8 for Qt version 3.2.1


    I have used Python and Qt in Redhat 9, after great effort to correct
    mismatched versions in their packaging. That is the only reason I suspected
    packaging problems here, but so far I've had much better experience with
    Debian's packages.



    This is very frustrating. I've committed to a project using Qt and Python,
    and I'm totally dependent on pyuic. Any suggestions would be much
    appreciated.



    -- Dave
     
    Dave, Nov 4, 2003
    #1
    1. Advertising

  2. On Tuesday 04 November 2003 6:45 pm, Dave wrote:
    > I'm having a strange problem with the pyqt-tools in the latest Debian
    > packages. When I run
    > $ pyuic colortool.ui > colortool.py
    > Extracting init()
    > Extracting loadSettings()
    > Extracting saveSettings()
    > ...
    > it produces 'colortool.py' with python function headers, but the body of
    > the functions are still in C. There are no error messages, just the normal
    > log of "extracting" functions.
    >
    >
    > The file colortool.ui is the tutorial example from the Qt Designer manual,
    > and it works correctly when compiled in C. The versions on all the
    > relevant packages seem to be correct:
    >
    > -> pyuic is from package pyqt-tools 3.8-2.1 This package depends on:
    > libc6 (>= 2.3.2-1), libgcc1 (>= 1:3.3.1-1), libqt3c102-mt (>= 3:3.2.1),
    > libstdc++5 (>= 1:3.3.1-1), xlibs (>> 4.1.0)
    > -> Current versions shown by dpkg are:
    > libc6 2.3.2-9, libgcc1 1:3.3.2-1, libqt3c102-mt 3:3.2.1-6, libstdc++5
    > 1:3.3.2-1, xlibs 4.2.1-12.1
    > -> designer is from package qt3-designer 3:3.2.1-6
    >
    >
    > $ pyuic -version
    > Python User Interface Compiler 3.8 for Qt version 3.2.1
    >
    >
    > I have used Python and Qt in Redhat 9, after great effort to correct
    > mismatched versions in their packaging. That is the only reason I
    > suspected packaging problems here, but so far I've had much better
    > experience with Debian's packages.
    >
    >
    >
    > This is very frustrating. I've committed to a project using Qt and Python,
    > and I'm totally dependent on pyuic. Any suggestions would be much
    > appreciated.


    That's because the form includes embedded C++ code. There is nothing to stop
    you embedding Python code (just ignore the C++ style function definition) and
    it will be properly extracted.

    What pyuic doesn't do is look at the embedded code and try to work out if it
    is Python or something else.

    Phil
     
    Phil Thompson, Nov 4, 2003
    #2
    1. Advertising

  3. Dave

    Dave Guest

    "Phil Thompson" <> wrote in message
    news:...
    > On Tuesday 04 November 2003 6:45 pm, Dave wrote:
    > > I'm having a strange problem with the pyqt-tools in the latest Debian
    > > packages. When I run
    > > $ pyuic colortool.ui > colortool.py
    > > Extracting init()
    > > Extracting loadSettings()
    > > Extracting saveSettings()
    > > ...
    > > it produces 'colortool.py' with python function headers, but the body of
    > > the functions are still in C. There are no error messages, just the

    normal
    > > log of "extracting" functions.
    > >

    [...]
    > That's because the form includes embedded C++ code. There is nothing to

    stop
    > you embedding Python code (just ignore the C++ style function definition)

    and
    > it will be properly extracted.
    >
    > What pyuic doesn't do is look at the embedded code and try to work out if

    it
    > is Python or something else.


    OK, I can ignore the C++ embedded code, but it seems that Python can't.

    Python 2.3.2 (#2, Oct 6 2003, 08:02:06)
    [GCC 3.3.2 20030908 (Debian prerelease)] on linux2
    >>> from colortool import MainForm

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "colortool.py", line 225
    QSettings settings;
    ^
    SyntaxError: invalid syntax


    I must be missing a switch or something.



    -- Dave
     
    Dave, Nov 4, 2003
    #3
  4. Dave

    Dave Guest

    "Phil Thompson" <> wrote in message
    news:...
    > On Tuesday 04 November 2003 6:45 pm, Dave wrote:
    > > I'm having a strange problem with the pyqt-tools in the latest Debian
    > > packages. When I run
    > > $ pyuic colortool.ui > colortool.py
    > > Extracting init()
    > > Extracting loadSettings()
    > > Extracting saveSettings()
    > > ...
    > > it produces 'colortool.py' with python function headers, but the body of
    > > the functions are still in C. There are no error messages, just the

    normal
    > > log of "extracting" functions.
    > >

    [...]
    > That's because the form includes embedded C++ code. There is nothing to

    stop
    > you embedding Python code (just ignore the C++ style function definition)

    and
    > it will be properly extracted.
    >
    > What pyuic doesn't do is look at the embedded code and try to work out if

    it
    > is Python or something else.


    Oops. Please ignore my previous post. I misunderstood what Phil was
    saying. I see now what to do. Just write Python code in the body of the
    C++ stub functions ( leaving the outer { } in place ) , and pyuic will copy
    that code verbatim into the body of the translated Python functions.
    Excellent.

    Many thanks.

    -- Dave
     
    Dave, Nov 5, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jorge_Beteta
    Replies:
    4
    Views:
    8,726
    Shiv Kumar
    Jan 12, 2004
  2. SpamProof

    ghostscript leaves windword processes

    SpamProof, Feb 24, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    376
    SpamProof
    Feb 25, 2004
  3. Bastian
    Replies:
    0
    Views:
    3,682
    Bastian
    Nov 21, 2005
  4. milesd
    Replies:
    0
    Views:
    613
    milesd
    Jun 14, 2005
  5. ulysses
    Replies:
    4
    Views:
    768
    Werner Schiendl
    Oct 22, 2003
Loading...

Share This Page