Fix BaseSelector to avoid long delay before display on large trees

Fixes #10634
This commit is contained in:
prculley 2018-06-21 09:29:27 -05:00 committed by Nick Hall
parent 1642757eb8
commit efb2a63492
2 changed files with 23 additions and 1 deletions

View File

@ -121,6 +121,7 @@
<property name="use_action_appearance">False</property> <property name="use_action_appearance">False</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">False</property> <property name="receives_default">False</property>
<property name="no_show_all">True</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="xalign">0.5</property> <property name="xalign">0.5</property>
@ -132,6 +133,22 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkLabel" id="loading">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Loading items...</property>
<property name="width_chars">10</property>
<attributes>
<attribute name="font-desc" value="&lt;Enter Value&gt; 20"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

View File

@ -107,7 +107,6 @@ class BaseSelector(ManagedWindow):
self.sortorder = Gtk.SortType.ASCENDING self.sortorder = Gtk.SortType.ASCENDING
self.skip_list=skip self.skip_list=skip
self.build_tree()
self.selection = self.tree.get_selection() self.selection = self.tree.get_selection()
self.track_ref_for_deletion("selection") self.track_ref_for_deletion("selection")
@ -123,6 +122,12 @@ class BaseSelector(ManagedWindow):
self.showall.show() self.showall.show()
else: else:
self.showall.hide() self.showall.hide()
while Gtk.events_pending():
Gtk.main_iteration()
self.build_tree()
loading = self.glade.get_object('loading')
loading.hide()
if default: if default:
self.goto_handle(default) self.goto_handle(default)