Re: [PyQt] Issue installing PyQt4 installer on Win
On Fri, 1 Apr 2011 18:17:41 +0200, Detlev Offenbach det...@die-offenbachs.de wrote: Hello, I tried to install PyQt4 via the installer on an Windows machine as a normal user. The installation worked fine most of the way. However, it tried to install the menu for All users. That failed due to missing permissions and the install stopped. I don't know what it would do therafter. When I tried to import a PyQt4 package in Python (from PyQt4 import QtCore) I got an error message because loading the DLL failed. I had to copy all the DLLs from ...\PyQt4\bin into ...\PyQt4. What is going on here? I would expect PyQt4 to installable as a non-priveleged user as well. I assume this is under XP. The installer requires admin privileges and correctly asks for an appropriate password with Vista 7. I admit it could be more flexible, but I don't have the knowledge to improve it without risking breaking what seems to be fine for most people. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Issue installing PyQt4 installer on Win
On Sonntag, 17. April 2011, Phil Thompson wrote: On Fri, 1 Apr 2011 18:17:41 +0200, Detlev Offenbach det...@die-offenbachs.de wrote: Hello, I tried to install PyQt4 via the installer on an Windows machine as a normal user. The installation worked fine most of the way. However, it tried to install the menu for All users. That failed due to missing permissions and the install stopped. I don't know what it would do therafter. When I tried to import a PyQt4 package in Python (from PyQt4 import QtCore) I got an error message because loading the DLL failed. I had to copy all the DLLs from ...\PyQt4\bin into ...\PyQt4. What is going on here? I would expect PyQt4 to installable as a non-priveleged user as well. I assume this is under XP. The installer requires admin privileges and correctly asks for an appropriate password with Vista 7. I admit it could be more flexible, but I don't have the knowledge to improve it without risking breaking what seems to be fine for most people. Unfortunately this would only work, if you have access to the admin password, which will not be the case all the time. I assume, you are using some installer package to generate the exe packages. Shouldn't such an installer be able to generate a non-admin installer? At least the Mercurial people managed this with the InnoSetup installer. Unfortunately I cannot be of any help in this area because Win is not my main development environment. Maybe somebody reading this can help. Regards, Detlev -- Detlev Offenbach det...@die-offenbachs.de ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Styling an QMdiArea widget
Le 17/04/11 15:17, Sarah Mount a crit: Hi everyone, I have a main application window that I want to style with a style sheet like this: #mywidget { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; } When the project is created, the widget that I want to apply the CSS to becomes an MDI area, so presumably the styling now needs to apply to the MDI area, not the original widget, like this: class MyMainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.mdi = QtGui.QMdiArea() self.mdi.setStyleSheet("QMdiArea { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; }") self.setCentralWidget(self.mdi) ...but that doesn't work! Is this because QMdiArea widgets can't be styled with CSS, and if so, is it possible to use a QBrush to do this (including the no-repeat directive)? Or, have I just misunderstood the API? Many thanks, Sarah Hi, You can use setBackground() self.brush = QtGui.QBrush(QtGui.QPixmap("view.jpg")) self.mdi.setBackground(self.brush) but reimplement sizeEvent() for rescale the pixmap -- Vincent V.V. Oqapy ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Styling an QMdiArea widget
On Sun, Apr 17, 2011 at 15:28, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: Le 17/04/11 15:17, Sarah Mount a écrit : Hi everyone, I have a main application window that I want to style with a style sheet like this: #mywidget { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; } When the project is created, the widget that I want to apply the CSS to becomes an MDI area, so presumably the styling now needs to apply to the MDI area, not the original widget, like this: class MyMainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.mdi = QtGui.QMdiArea() self.mdi.setStyleSheet(QMdiArea { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; }) self.setCentralWidget(self.mdi) ...but that doesn't work! Is this because QMdiArea widgets can't be styled with CSS, and if so, is it possible to use a QBrush to do this (including the no-repeat directive)? Or, have I just misunderstood the API? Many thanks, Sarah Hi, You can use setBackground() self.brush = QtGui.QBrush(QtGui.QPixmap(view.jpg)) self.mdi.setBackground(self.brush) but reimplement sizeEvent() for rescale the pixmap Thanks, tried that code and the image doesn't appear :( There's no traceback so it's difficult to figure out why... Sarah -- Sarah Mount, Senior Lecturer, University of Wolverhampton website: http://www.snim2.org/ twitter: @snim2 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Styling an QMdiArea widget
Le 17/04/11 16:36, Sarah Mount a crit: On Sun, Apr 17, 2011 at 15:28, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: Le 17/04/11 15:17, Sarah Mount a crit: Hi everyone, I have a main application window that I want to style with a style sheet like this: #mywidget { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; } When the project is created, the widget that I want to apply the CSS to becomes an MDI area, so presumably the styling now needs to apply to the MDI area, not the original widget, like this: class MyMainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.mdi = QtGui.QMdiArea() self.mdi.setStyleSheet("QMdiArea { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; }") self.setCentralWidget(self.mdi) ...but that doesn't work! Is this because QMdiArea widgets can't be styled with CSS, and if so, is it possible to use a QBrush to do this (including the no-repeat directive)? Or, have I just misunderstood the API? Many thanks, Sarah Hi, You can use setBackground() self.brush = QtGui.QBrush(QtGui.QPixmap("view.jpg")) self.mdi.setBackground(self.brush) but reimplement sizeEvent() for rescale the pixmap Thanks, tried that code and the image doesn't appear :( There's no traceback so it's difficult to figure out why... Sarah Strange, if I use this code that works: class MyMainWindow(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) self.mdi = QtGui.QMdiArea() self.setCentralWidget(self.mdi) pix = QtGui.QPixmap("img.jpg") self.brush = QtGui.QBrush(pix) self.mdi.setBackground(self.brush) PyQt 4.7.0 on Linux -- Vincent V.V. Oqapy ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Styling an QMdiArea widget
On Sun Apr 17 15:36:11 BST 2011, Sarah Mount wrote: On Sun, Apr 17, 2011 at 15:28, Vincent Vande Vyvre vincent.vandevyvre at swing.be wrote: You can use setBackground() self.brush = QtGui.QBrush(QtGui.QPixmap(view.jpg)) self.mdi.setBackground(self.brush) but reimplement sizeEvent() for rescale the pixmap Thanks, tried that code and the image doesn't appear :( There's no traceback so it's difficult to figure out why... If a pixmap fails to load a file, it will fail silently rather than raising an exception. Try creating the pixmap in a separate step then inspecting it, like this: pixmap = QtGui.QPixmap(view.jpg) print pixmap.isNull() There are two main reasons why this may fail (returning True): 1. view.jpg is not in the current working directory. You can specify a more complete path to it, or create a resource file to bundle the image as part of a Python module that you can simply import. 2. JPEG support is not built-in to your version of Qt. If you can load other JPEGs using the widgets/imageviewer.py example supplied with PyQt then this probably isn't the reason why you are experiencing problems, though people sometimes have problems when using deployment tools with versions of Qt that come with plugins for decoding JPEG and other image formats. David ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Help with Design of Dialog interface
Hi I am currently writing a project which takes vocabulary words from a XML file which is created through the KDE application Parley and generates sentences based on them. The project page is here: https://sourceforge.net/projects/languagesentenc/ This is done through the user firstly creating sentence templates which contains a number of word-types put in order of how a sentence would be. The program then uses these templates to extracts vocabulary words from the XML file that are associated with these word-types and creates sentences. An example of this is if a sentence template is 'adjective adverb noun' then it will extract all adjectives adverb and nouns and generate sentences in that order. I have written a command line version of this and in the process of adding a GUI interface using PYQT. I've only used PYQT a few times and would like some advice on how to go about designing an interface for part of it. The part I am stuck at is the maintenance of the sentence templates. This part of the GUI will extract all the word types from the XML file which will used to validate the input the user enters when creating the sentence template. The only way I think I can do this is to create a widget that contains a drop down list and a button. The user selects the word type from the list and when the button is pressed the contents of the drop down list is then appended to the sentence template. This sounds a bit clunky and cumbersome to do. Is there any easier way like a line edit button which has an auto-complete option or some other method is input that I can use? I hope I have explained this properly. If not, I'm happy to explain further any questions. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Styling an QMdiArea widget
On Sun, Apr 17, 2011 at 16:48, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: Le 17/04/11 16:36, Sarah Mount a écrit : On Sun, Apr 17, 2011 at 15:28, Vincent Vande Vyvre vincent.vandevy...@swing.be wrote: Le 17/04/11 15:17, Sarah Mount a écrit : Hi everyone, I have a main application window that I want to style with a style sheet like this: #mywidget { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; } When the project is created, the widget that I want to apply the CSS to becomes an MDI area, so presumably the styling now needs to apply to the MDI area, not the original widget, like this: class MyMainWindow(QtGui.QMainWindow, Ui_MainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.mdi = QtGui.QMdiArea() self.mdi.setStyleSheet(QMdiArea { background : white; background-image : url(:/images/images/EfDChancoComposite.jpg); background-repeat : no-repeat; }) self.setCentralWidget(self.mdi) ...but that doesn't work! Is this because QMdiArea widgets can't be styled with CSS, and if so, is it possible to use a QBrush to do this (including the no-repeat directive)? Or, have I just misunderstood the API? Many thanks, Sarah Hi, You can use setBackground() self.brush = QtGui.QBrush(QtGui.QPixmap(view.jpg)) self.mdi.setBackground(self.brush) but reimplement sizeEvent() for rescale the pixmap Thanks, tried that code and the image doesn't appear :( There's no traceback so it's difficult to figure out why... Sarah Strange, if I use this code that works: class MyMainWindow(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) self.mdi = QtGui.QMdiArea() self.setCentralWidget(self.mdi) pix = QtGui.QPixmap(img.jpg) self.brush = QtGui.QBrush(pix) self.mdi.setBackground(self.brush) Thanks, you and David were both right, the error was an incorrect path for the JPG. However, what I was after was to have one image appear in the background, and not to have the image tiled. This is possible using a style sheet, but I'm not sure a) if it's possible using a brush (your code comes out with the image tiled) or b) whether it's possible to use a style sheet, as my code for that didn't work! Any advice greatly appreciated. Sarah -- Sarah Mount, Senior Lecturer, University of Wolverhampton website: http://www.snim2.org/ twitter: @snim2 ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] removeItemWidget bug
I've experienced a bug which after a few hours found someone else is experiencing also, and explained in detail In a Python program I use setItemWidget() to add widgets to columns of QTreeWidgetItems (eg QPushButton, QComboBox, etc). When a widget is no longer needed it is removed using removeItemWidget(), however this action causes the removal of the QTreeWidgetItem itself instead of just removing the item widget attached by setItemWidget(). Problem goes away if extra references to QTreeWidgetItems are kept somewhere outside the QTreeWidget instance. This problem does not occur in a C++ implementation. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599612 Are the pyqt developers aware of this? Regards Pete ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Styling an QMdiArea widget
On Sun Apr 17 19:48:16 BST 2011, Sarah Mount wrote: Thanks, you and David were both right, the error was an incorrect path for the JPG. However, what I was after was to have one image appear in the background, and not to have the image tiled. This is possible using a style sheet, but I'm not sure a) if it's possible using a brush (your code comes out with the image tiled) or b) whether it's possible to use a style sheet, as my code for that didn't work! I think the answers are: a) You can't really use a brush for this because it only supports tiled textures. b) QMdiArea doesn't support style sheets: http://doc.qt.nokia.com/4.7/stylesheet-reference.html However, I looked at qtconfig, one of the tools shipped with Qt, and it seems that there's a trick you can use if you are able to create a QMdiArea subclass and use that instead of a regular QMdiArea widget: http://www.diotavelli.net/PyQtWiki/Adding_a_background_image_to_an_MDI_area David ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Use QWebview with Flash plugin
On Sat, 16 Apr 2011 18:55:43 +0200, Gelonida Gmail wrote: I'd like to have a small QWebview window in our application, which could display the contents of a web page requiring Flash. Is this possible with PyQT? If yes, is it possible - on a Windows platform - on a linux platform Yes, on both, but much depends on the versions of the Flash plugin and the WebKit library being used. It's probably best to ask people which versions of Qt they are using successfully together with Flash then test those combinations. which version of Flash would be supported and what would be the procedure: - to install the flash plugin This would be the place used by Firefox. - tell pyqt where the plugins are located The Qt 4.5 documentation had a section about this: http://doc.qt.nokia.com/4.5/qtwebkit.html#netscape-plugin-support In other words, it shouldn't be necessary to do anything. - activate the plugin for a given QWebview window I don't think you can enable/disable plugins on a per-window basis. I could be wrong, however, and I'm sure that there are people reading this that do a lot more with WebKit than I do. What versions would be supported. I'm not sure about this. Searching this mailing list's archives and those for qt-interest might reveal some data. David ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt