[PyQt] arbitrary instance attributes on qt widgets?
Hi, Is this legal? q = QListBoxText(listbox) q.bla = 3 this sets a new attribute 'bla' to 3. I could use this to have the listboxitem carry some other data. Or should I subclass QListBoxItem to add such an attribute? with best regards, Wilbert Berendsen -- http://www.wilbertberendsen.nl/ You must be the change you wish to see in the world. -- Mahatma Gandhi ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] treeview model/view or item-based?
Hi, I have tree-structured data, something like a filesystem where you have folders and files. FolderA +-FolderA1 +-FolderA2 --+--FileA2.1 +-FolderA3 FolderB FolderC I think you know what I mean ;-) The tree has 3 to 4 levels. Let's say the first level contains 30 items, the second level 2000 and the third contains 7000 folders. The last level contains 50,000 items. I thought it would be a good idea (?) to store the data in a database like SQLite, because this is provided by PyQt and it is searchable. I would store the 50,000 items in one table like this: FOLDER_NAME_LVL1, FOLDER_NAME_LVL2, .., ITEM_NAME other data ... with such a table it would be possible to build the tree: FOLDER_NAME_LVL1 +-FOLDER_NAME_LVL2 +--ITEM_NAME etc. etc. So where is my Problem? Such a tree should be displayed with a QT-Treeview. There are two different ways: Item-based or model-view based. A model-view based approach could become difficult, because the model has to build tree-nodes from a 2-Dimensional Table. Does something like this already exist in PyQt? On the other hand, I have to create all the 50,000 nodes at once if I use the Item-based approach. Which one would you use? Or is there another (easy) way to handle such datasets. Regards, Ulrich ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] arbitrary instance attributes on qt widgets?
On Mon, May 5, 2008 at 12:17 PM, Wilbert Berendsen [EMAIL PROTECTED] wrote: Hi, Is this legal? q = QListBoxText(listbox) q.bla = 3 this sets a new attribute 'bla' to 3. I could use this to have the listboxitem carry some other data. Yes it is legal. Or should I subclass QListBoxItem to add such an attribute? Thats up to you :) One thing to be aware of is that if you access the field directly instead of through setters that you can't use it as a target for a slot. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Screenshots in linux
Hello: Does anyone have any idea how I might select a region of my desktop and then take a screen grab of it? The screenshot example shows me how to grab the snapshot, but the hard part (at least for me) is changing my mouse cursor to some crosshairs and drawing a region on the desktop that I'd like to grab. Can I make a transparent Always On Top window and get mouse clicks from it? Anyone done something like this before and have any hints? Thanks! ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] treeview model/view or item-based?
Ulrich wrote: The tree has 3 to 4 levels. Let's say the first level contains 30 items, the second level 2000 and the third contains 7000 folders. The last level contains 50,000 items. I thought it would be a good idea (?) to store the data in a database like SQLite, because this is provided by PyQt and it is searchable. I would store the 50,000 items in one table like this: FOLDER_NAME_LVL1, FOLDER_NAME_LVL2, .., ITEM_NAME other data ... with such a table it would be possible to build the tree: FOLDER_NAME_LVL1 +-FOLDER_NAME_LVL2 +--ITEM_NAME etc. etc. So where is my Problem? Such a tree should be displayed with a QT-Treeview. There are two different ways: Item-based or model-view based. A model-view based approach could become difficult, because the model has to build tree-nodes from a 2-Dimensional Table. Does something like this already exist in PyQt? On the other hand, I have to create all the 50,000 nodes at once if I use the Item-based approach. You don't actually have to create all items at once with the tree-widget item-based approach. You can just create the visible items (that have open parents). Then create a method that loads children on demand and connect it to the itemExpanded(QTreeWidgetItem*) signal. To get the + button to display properly, you can add a single dummy child item to each closed parent item, then delete it when actually loading the real children. Doug. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] treeview model/view or item-based?
That looks like a good idea and should be easy to implement. Regards, Ulrich Doug Bell wrote: You don't actually have to create all items at once with the tree-widget item-based approach. You can just create the visible items (that have open parents). Then create a method that loads children on demand and connect it to the itemExpanded(QTreeWidgetItem*) signal. To get the + button to display properly, you can add a single dummy child item to each closed parent item, then delete it when actually loading the real children. Doug. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] Re: pyqtSignature question
Hi Phil I was just playing with the examples in Mark Summerfield's book on @pyqtSignature and was wondering how signals/slots other than those for buttons etc might be written. I was having trouble with this QTableView example. Thanks Message: 4 Date: Thu, 1 May 2008 13:08:49 +0100 From: Phil Thompson [EMAIL PROTECTED] Subject: Re: [PyQt] pyqtSignature question To: pyqt@riverbankcomputing.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=iso-8859-1 On Thursday 01 May 2008, Catriona Johnson wrote: Hello I have a signal/slot connection which I want to express with @pyqtSignature syntax but am not sure how to do it. self.connect(self.myView.selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), self.changed) Any help appreciated. I don't understand the question. You don't use the signature to make the connection. You use it to associate a C++ signature with a Python method. That's not required here. Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Screenshots in linux
On Monday 05 May 2008 13:22, Jake Richards wrote: Hello: Does anyone have any idea how I might select a region of my desktop and then take a screen grab of it? The screenshot example shows me how to grab the snapshot, but the hard part (at least for me) is changing my mouse cursor to some crosshairs and drawing a region on the desktop that I'd like to grab. Can I make a transparent Always On Top window and get mouse clicks from it? Anyone done something like this before and have any hints? Thanks! In KDE you can use KSnapshot. There's also xgrab (segfaults on my system) and Gnome probably has something. For a console you can just cut and paste. KSnapshot includes a settable time delay and the ability to only grab the window containing the mouse or the entire screen or a region. You can always crop or scale a screenshot with something like xv or gimp. Jim ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] Screenshots in linux
Hi :) Does anyone have any idea how I might select a region of my desktop and then take a screen grab of it? In KDE you can use KSnapshot. There's also xgrab (segfaults on my system) and Gnome probably has something. For a console you can just cut and paste. in order to take video you have : record-my-desktop and qt/gtk GUI. clear skies, JB -- http://astrolix.org association des linuxiens astronomes ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt