PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 797 - error on ui file load
: error on ui file load
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtUiTools
: HEAD
: PC Linux
: P3 normal
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2011-03-30 21:58 EEST by rocher.jm
Modified: 2011-05-26 17:03 EEST (History)
8 users (show)

See Also:


Attachments
ui file from designer (8.80 KB, application/x-designer)
2011-03-31 00:02 EEST, rocher.jm
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rocher.jm 2011-03-30 21:58:07 EEST
with the following code:

        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile("./PhilaCollection.ui")
        file.open(QtCore.QFile.ReadOnly)
        self.mainWindow = loader.load(file, self)

PySide send back the error:
Designer: An error has occurred while reading the UI file at line 1, column 0:
Premature end of document.
this occured whatever the ui file
Comment 1 Hugo Parente Lima 2011-03-30 23:48:38 EEST
Could you attach this PhilaCollection.ui file into the bug report?

This message wasn't sent by PySide but by Qt itself, your .ui file may be
corrupted or malformed.
Comment 2 rocher.jm 2011-03-31 00:02:52 EEST
Created attachment 295 [details]
ui file from designer

this file has been generated with Qt Designer 4.6.2
Comment 3 Hugo Parente Lima 2011-03-31 00:32:45 EEST
Thanks!

Your example works on C++, so it might be a PySide fault.
Comment 4 Hugo Parente Lima 2011-03-31 00:35:01 EEST
As a workaround you can use:

from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtUiTools import *

app = QApplication([])
loader = QUiLoader()
loader.load("./PhilaCollection.ui")
Comment 5 rocher.jm 2011-04-02 00:47:24 EEST
thank you for the workaround.
with that theres is no longer an error, and the display is quite correc (excep
for the size of the window)
But unfotunatly right now I don't understant how to access to the various
objects embeded in in the window
for exemple in the following code vignette is a Qlabel in wich I want to put an
image but this objetct seem unknow

import sys
import  os.path
from PySide import QtGui, QtCore
from PySide import QtUiTools
from PySide import QtWebKit
from sites import *


class Main(QtGui.QMainWindow):
    def __init__(self):

        QtGui.QMainWindow.__init__(self)
        loader = QtUiTools.QUiLoader()
        self.setCentralWidget(loader.load("./PhilaCollection.ui"))
        self.resize(1024,768)
        image=QtGui.QPixmap("7.jpg")
        self.mainWindow.Vignette.setPixmap(image)


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    window = Main()
    window.show()
    sys.exit(app.exec_())
Comment 6 Hugo Parente Lima 2011-05-04 17:01:18 EEST
Fixed in commit:

pyside/4175398b071c05bcc7166533c97972bd94a688ff
Comment 7 renato filho 2011-05-26 17:03:53 EEST
PySide release 1.0.3