[pygtk] Notebook Pages Not Populatingfrom Sabrina

Giuseppe Penone giuspen at gmail.com
Fri Aug 19 01:10:23 WST 2011


Hi,
if I would be in you I would not continue to create and destroy the widgets
on the notebook pages.
For simplicity (and processing speed) I would draw in glade all possible
widgets and then from the code just show/hide what
you need according to the selected row, possibly grouping the widgets that
are together to be shown
in containers so that you just hide/show the father of all of them.
HTH, cheers,
Giuseppe.


On Thu, Aug 18, 2011 at 17:53, Sabrina Friedman <utebachmeier at gmail.com>wrote:

> Hello all,
>
> I am working on an application (ReliaFree) using pyGTK2 to provide the
> GUI.  All of the data associated with this application is stored in
> MySQL databases.  When the database is opened, the data is loaded in a
> treeview.  When the user selects an item (row) in the treeview, various
> combobox and entry widgets are populated.  These widgets are grouped and
> organized on various notebook widget pages.  Since the information can
> change depending on whether the selected item is a component or an
> assembly, the combobox and entry widgets are created "on the fly" each
> time a new item is selected in the treeview.
>
> When I first load the database into the treeview, the widgets on the
> first two pages are created, shown, and populated.  However, on the
> third page, the widgets are not shown.  No errors are thrown, so I am
> assuming they are being created and populated.
>
>    1. If I cycle through all three pages in the notebook before
> selecting a new item (row) in the treeview, all of the widgets on all
> three pages will be shown thereafter.
>
>    2. If I select a new item (row) in the treeview without first
> cycling through the pages, only the widgets on the first page are
> shown.  Cycling through the pages causes the widgets to be shown
> thereafter.
>
> I've been trying to figure out what I'm doing wrong for quite awhile
> with no success.  Hopefully someone can point me in the right
> direction.  Thanks in advance for your help.
>
> Here is part of the function that loads the third page of the notebook
> with the treeview row data:
>
>    def load_calculation_results_tab(self, _index_):
>
>        # Clear any existing widgets from previously selected objects.
>        if(self.fraRelResults.get_child() is not None):
>            self.fraRelResults.get_child().destroy()
>
> <SNIP>
>
>        # Load the calculation results with Hardware or FRACA Tree
> information.
>        elif(_index_ == 2 or _index_ == 3):
>
>            if not self.app.HARDWARE._part:
>                (quad1,
>                 quad2,
>                 quad4) =
> self.app.ASSEMBLY.load_calc_results_tab(x_size=400,
>
> y_size=300)
>
> <SNIP>
>
>            self.fraRelResults.add(quad1)
>            self.fraMaintainResults.add(quad2)
>            self.fraMiscResults.add(quad4)
>
>        # Show the calculation results page.
>        page = self.notebook.get_nth_page(3)
>        page.show_all()
>
>        return False
>
> Here is part of the function called by the preceding function:
>
>    def load_calc_results_tab(self, x_size, y_size):
>
>        layout = gtk.Layout()
>        layout.set_size(x_size, y_size + 300)
>        quadrant1 = gtk.Alignment(xalign = 0.50,
>                                  yalign = 0.50,
>                                  xscale = 1.0,
>                                  yscale = 1.0)
>        scrollwindow = gtk.ScrolledWindow()
>        scrollwindow.set_policy(gtk.POLICY_AUTOMATIC,
>                                gtk.POLICY_AUTOMATIC)
>        quadrant1.add(scrollwindow)
>        scrollwindow.add(layout)
>
>        for i in range(len(self._cr_tab_labels[0])):
>            label = _widg.make_label(self._cr_tab_labels[0][i],
>                                     150, 25)
>            layout.put(label, 5, (30 * i + 5))
>
>        self.txtActiveHt = _widg.make_entry(editable=False, bold=True)
>        layout.put(self.txtActiveHt, 155, 5)
>        self.txtDormantHt = _widg.make_entry(editable=False, bold=True)
>        layout.put(self.txtDormantHt, 155, 35)
>        self.txtSoftwareHt = _widg.make_entry(editable=False, bold=True)
>        layout.put(self.txtSoftwareHt, 155, 65)
>
> <SNIP>
>
>        quadrant1.show_all()
>
> <SNIP>
>
>        self.txtActiveHt.set_text(str(self._attribute[28]))
>        self.txtDormantHt.set_text(str(self._attribute[29]))
>        self.txtSoftwareHt.set_text(str(self._attribute[32]))
>
> <SNIP>
>
>        return(quadrant1, quadrant2, quadrant4)
>
>
> Sabrina Friedman
> Billige Flüge Marketing GmbH
> Emanuelstr. 3,
> 10317 Berlin
> Deutschland
> Telefon: +49 (33) 5310967
> Email: utebachmeier at gmail.com
> Site: http://flug.airego.de - Billige Flüge vergleichen
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20110818/b256d379/attachment.html>


More information about the pygtk mailing list