[sulfur.events] enable/disable "Edit Set" button automatically when needed

This commit is contained in:
Fabio Erculiani
2009-07-23 22:15:33 +02:00
parent f55138d8d0
commit 577e77c5f1
2 changed files with 23 additions and 2 deletions
+21 -2
View File
@@ -639,6 +639,24 @@ class SulfurApplicationEventsMixin:
break
self.load_package_info_menu(obj)
def on_pkg_click(self, widget):
"""
When Packages View gtk.TreeView elements are single clicked.
"""
objs = self.pkgView.collect_selected_items()
obj = None
for x in objs:
if x.is_pkgset_cat:
obj = x
break
if obj is None:
# disable edit set button
self.ui.pkgsetEditButton.set_sensitive(False)
else:
# enable edit set button
self.ui.pkgsetEditButton.set_sensitive(True)
def on_license_double_clicked( self, widget, iterator, path ):
( model, iterator ) = widget.get_selection().get_selected()
if model != None and iterator != None:
@@ -823,8 +841,9 @@ class SulfurApplicationEventsMixin:
# pull the set list
objs = self.pkgView.collect_selected_items()
obj = None
for obj in objs:
if obj.pkgset:
for x in objs:
if x.is_pkgset_cat:
obj = x
break
if obj is None:
return # sorry
+2
View File
@@ -630,6 +630,7 @@
<property name="can_focus">True</property>
<property name="rules_hint">True</property>
<property name="rubber_banding">True</property>
<signal name="cursor_changed" handler="on_pkg_click"/>
<signal name="row_activated" handler="on_pkg_doubleclick"/>
</widget>
</child>
@@ -976,6 +977,7 @@
<child>
<widget class="GtkButton" id="pkgsetEditButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_pkgsetEditButton_clicked"/>