How to populate a PyGTK TreeView from a very long list? - pygtk

In my PyGTK GUI, I am populating a TreeView from a ListStore. The ListStore contains 3 string fields, and this data is read into the store from a plain text file. The TreeView is set in a ScrolledWindow. The list is very long, about 80K lines, which means my ListStore list will be 80K items long. The program takes a long time to populate the TreeView. What techniques are there to avoid reading into memory the whole list in its entirety. How can I read it in steps ? And on what event should I invoke this read-into-ListStore routine ?

There are some tips in the PyGTK FAQ about loading long lists and keeping your UI responsive while loading.

Related

How do I show a “Loading . . . please wait” with gif image message in vb.net for a long loading form?

vb.net
I have a form(called Form1) that is very slow because it contain datagridview how load data from sql server.As a result the form takes a long time to loaded.
So I create a form_Wait and in the load event of Form1 I put
Form_wait.showdialog()
Load_datagridveiw1("Select * from table1")
Form_wait.close()
My problem is the Form_Wait will be appear but the gift inside it (rectangular progress bar) is not showen ?
I used VS 2015
You cannot meaningfully show and animate GIF in a same thread as your UI sits. You would have to use a BackGroundWorker, which is basically a separate thread. Then the animation will work smoothly and the UI thread will run fine too. There are plenty of BackGroundWorker tutorials on the web.
But a huge warning horn rings reading your words. If it is such a huge amount of data causing the slow loading, I would strongly suggest to reconsider how do you fetch the data. Introducing meaningful filters and pagination are basic ways to tackle this.

Generating about thousand or more controls with ExtJS

We have decided to use ExtJS for one of our large application's web-remake and we will have to generate screens/forms where we will have to render about thousand or more controls either in complete editable grid of in forms.
So may I know what is the best approach in doing so?
I have tried generating about thousand controls and it takes about more than 6 seconds on client-side and that too is going to be dependent on Client configuration about which I am positive that it will be at-least dual-core system most of the time.
But more than 6 seconds on localhost is like 10 seconds over the Internet so I am worried, I still have a choice of mixing normal html form/controls when there is high load but then it will miss the ExtJS touch (combo/number controls etc.), so any help or if you had similar experience do share.
Will XTemplate be faster in above case? I am still new to ExtJS so do share best practices if you know/used.
The best approach is not to do it this way. Creating thousands of controls will need huge amounts of memory, no matter how you do it. As you noticed, this makes an application extremely slow.
The solution is to keep the elements on the server and use some form of paging to create only the elements that the user can actually see.
Paging can be explicit ("Load next 10 rows") or implicit by firing an event when the scrollbar hits the right/bottom end and loading more rows.
Usually, you can even hide this from users. Always load a whole row (hiding elements in the same row which aren't visible because the browser window is too narrow usually doesn't help much).
On the server, you will know how many rows you have. Load the first 20 rows and display them. Find the height of the rows (ideally, they should be all the same height) and create an empty DIV below the 20 rows which expands the scrolled view. This makes it appear as if all the rows are there (user sees correct scrollbar which doesn't jump while scrolling).
As soon as that empty div comes into view, load more rows and shrink it.

Pass hidden data through XUL autocomplete textbox?

One of the controls needed in my xulrunner application is an autocompleting text box which allows the user to type a search term, then looks up completions in an array of objects (each having a generated UUID, canonical name, a list of search terms gleaned from related data, etc.) and allows the user to select just one. Currently I'm using a textbox element of type="autocomplete" and a Javascript custom search component, and it is successfully prefix searching all the search terms and providing completions below the text field, in the customary fashion.
The catch is that I'm not interested in the possibly non-unique label but the object from which the label came, and I can't see any way of passing the object or even any out-of-band UUID back into document land without modifying the XBL or rolling my own control from scratch. Essentially I'm seeking to do what could have been done in HTML with the option[value] attribute. I can't use the built-in type-to-search effect of a standalone menulist because I need to prefix search multiple fields of the object. Any recommendations? Thanks in advance.
I ended up rolling my own as a listbox inside a panel next to a textbox. Even composed into an XBL binding, this was less effort than I'd spent working with the built-in autocomplete textbox and trying to force it to handle what it wasn't intended to handle.

Silverlight UI Virtualisation for Listbox with Items having writable bitmap

I have a created a display control with two Columns - 1. A thumbails list and 2. Listbox of images.
The images are written to writeable bitmap and then added to listbox items.
I have created custom tab control so that multiple instances can be opened. The issue here is with multiple tabs open, the memory usage shoots upto 1.2GB.
Is the list box by itself use ui virtualisation?
Want to know if there are any better solutions for this.

App responsiveness during loop

I have designed an app in vb.net 2005 that at one point adds and loops over about 500k list in listbox about.
When adding these items to the listbox, the app freezes for about 5-10 minutes, then when looping over the items, processing them, the app also freezes for the same time. Am loading the data from a text file
How can I make my application
responsive during loops?
should I use a queue to process the
list?
what is the messagequeue control
for?
I recommend you to use BackgroundWorker. Store items in array, and bind listbox to it. Working with array will be much faster then with listbox'es collection.
Or you can call BeginUpdate/EndUpdate before/after adding new items.