From 50406b13e6f04fb4109fd1977eac5772cfed24d3 Mon Sep 17 00:00:00 2001 From: js Date: Mon, 28 Jul 2008 21:36:11 +0000 Subject: [PATCH] Disable ok button if no activity is set, but enable is selected. --- src/dialogs.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dialogs.py b/src/dialogs.py index 762c6ade7..000b622a9 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -346,6 +346,7 @@ class ChangeActivityDialog: self.checkbutton = self.xml.get_widget('enable_checkbutton') self.notebook = self.xml.get_widget('notebook') self.entry = self.xml.get_widget('description_entry') + self.ok_button = self.xml.get_widget('ok_button') self.activity = None self.subactivity = None @@ -418,11 +419,19 @@ class ChangeActivityDialog: self.notebook.set_sensitive(widget.get_active()) self.entry.set_sensitive(widget.get_active()) + if widget.get_active() and (self.activity is None \ + or self.subactivity is None): + self.ok_button.set_sensitive(False) + else: + self.ok_button.set_sensitive(True) + def on_rbtn_toggled(self, widget, data): if widget.get_active(): self.activity = data[0] self.subactivity = data[1] + self.ok_button.set_sensitive(True) + def on_ok_button_clicked(self, widget): ''' Return activity and messsage (None if no activity selected)