Select all/none for addon updates

svn: r15744
This commit is contained in:
Doug Blank 2010-08-16 01:27:14 +00:00
parent 04d60b30ff
commit 6224028253
2 changed files with 76 additions and 1 deletions

View File

@ -31,6 +31,45 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="select_all">
<property name="label" translatable="yes">_Select All</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="select_none">
<property name="label" translatable="yes">Select _None</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="padding">8</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
@ -57,7 +96,7 @@
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<property name="layout_style">start</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
@ -70,6 +109,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
<property name="secondary">True</property>
</packing>
</child>
<child>
@ -84,6 +124,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="secondary">True</property>
</packing>
</child>
</object>

View File

@ -199,6 +199,17 @@ WIKI_HELP_PAGE_KEY = '%s_-_Keybindings' % const.URL_MANUAL_PAGE
WIKI_HELP_PAGE_MAN = '%s' % const.URL_MANUAL_PAGE
ADDONS_URL = "http://gramps-addons.svn.sourceforge.net/viewvc/gramps-addons/trunk"
#-------------------------------------------------------------------------
#
# Local Functions
#
#-------------------------------------------------------------------------
def update_rows(model, path, iter):
"""
Update the rows of a model.
"""
model.row_changed(path, iter)
#-------------------------------------------------------------------------
#
# ViewManager
@ -367,6 +378,10 @@ class ViewManager(CLIManager):
_('Available Gramps Updates for Addons'))
apply_button = glade.get_object('apply')
cancel_button = glade.get_object('cancel')
select_all = glade.get_object('select_all')
select_all.connect("clicked", self.select_all_clicked)
select_none = glade.get_object('select_none')
select_none.connect("clicked", self.select_none_clicked)
apply_button.connect("clicked", self.install_addons)
cancel_button.connect("clicked",
lambda obj: self.update_dialog.destroy())
@ -393,7 +408,26 @@ class ViewManager(CLIManager):
self.list.selection.select_iter(pos)
self.update_dialog.run()
def select_all_clicked(self, widget):
"""
Select all of the addons for download.
"""
for row in self.list.model: # treemodelrow
row[0] = True
self.list.model.foreach(update_rows)
def select_none_clicked(self, widget):
"""
Select none of the addons for download.
"""
for row in self.list.model: # treemodelrow
row[0] = False
self.list.model.foreach(update_rows)
def install_addons(self, obj):
"""
Process all of the selected addons.
"""
for row in self.list.model: # treemodelrow
if row[0]: # toggle
load_addon_file(row[4], callback=LOG.debug)