~francesco-marella/specto/blacklist-plugins

« back to all changes in this revision

Viewing changes to spectlib/edit_watch.py

  • Committer: Jean-François Fortin Tam
  • Date: 2009-12-29 21:02:37 UTC
  • mfrom: (98.3.84 specto-woutc)
  • Revision ID: nekohayo@gmail.com-20091229210237-pt7k7v2shsun2z49
Merge Wout's fixes and new features
- DBUS watches (including Pidgin, Evolution, Rhythmbox, and a bunch of others)
- Integration with Ubuntu's indicator applet
- Use GStreamer for playing sounds (fixes issue 289)
- Fix the Google Reader watch (issue 283)
- Various other enhancements

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
        else:
135
135
            values['open_command'] = ""
136
136
 
137
 
        gui_values = self.specto.watch_db.plugin_dict[values['type']].get_add_gui_info()
 
137
        if hasattr(self.specto.watch_db.plugin_dict[values['type']], 'get_add_gui_info'):
 
138
            gui_values = self.specto.watch_db.plugin_dict[values['type']].get_add_gui_info()
138
139
        window_options = self.watch_options[values['type']]
139
140
 
140
141
        for key in window_options:
183
184
            self.notifier.remove_notifier_entry(self.watch.id)
184
185
            self.specto.watch_db.remove(self.watch.id) #remove the watch
185
186
            self.specto.watch_io.remove_watch(self.watch.name)
186
 
            self.notifier.tray.show_tooltip()
 
187
            if self.notifier.tray:
 
188
                self.notifier.tray.show_tooltip()
187
189
 
188
190
    def clear_clicked(self, widget):
189
191
        """ Clear the log window. """
203
205
    def create_edit_gui(self):
204
206
        """ Create the gui for the different kinds of watches. """
205
207
        vbox_options = self.wTree.get_widget("vbox_watch_options")
 
208
        watch_type = self.watch.type
 
209
        self.watch_options[watch_type] = []
206
210
        try:
207
211
            self.table.destroy()
208
212
        except:
209
213
            pass
210
 
 
211
 
        watch_type = self.watch.type
212
 
        values = self.specto.watch_db.plugin_dict[watch_type].get_add_gui_info()
 
214
        
 
215
        try:
 
216
            if self.specto.watch_db.plugin_dict[watch_type].dbus_watch == True:
 
217
                self.wTree.get_widget("refresh").hide()
 
218
                self.wTree.get_widget("refresh_unit").hide()
 
219
                self.wTree.get_widget("label_refresh1").hide()
 
220
        except:
 
221
            pass
 
222
        
 
223
        if hasattr(self.specto.watch_db.plugin_dict[watch_type], 'get_add_gui_info'):
 
224
            values = self.specto.watch_db.plugin_dict[watch_type].get_add_gui_info()
 
225
        else:
 
226
            values = []
 
227
            
213
228
        watch_values = self.watch.get_values()
214
229
 
215
230
        if watch_values['command'] != "":
228
243
 
229
244
 
230
245
        # Create the options gui
231
 
        self.table = gtk.Table(rows=len(values), columns=2, homogeneous=False)
232
 
        self.table.set_row_spacings(6)
233
 
        self.table.set_col_spacings(6)
234
 
        self.watch_options[watch_type] = {}
235
 
 
236
 
        i = 0
237
 
        for value, widget in values:
238
 
            table, _widget = widget.get_widget()
239
 
            widget.set_value(watch_values[value])
240
 
            self.table.attach(table, 0, 1, i, i + 1)
241
 
            self.watch_options[watch_type].update({value: widget})
242
 
            i += 1
243
 
 
244
 
        self.table.show()
245
 
        vbox_options.pack_start(self.table, False, False, 0)
 
246
        if len(values) > 0:
 
247
            self.table = gtk.Table(rows=len(values), columns=2, homogeneous=False)
 
248
            self.table.set_row_spacings(6)
 
249
            self.table.set_col_spacings(6)
 
250
            self.watch_options[watch_type] = {}
 
251
 
 
252
            i = 0
 
253
            for value, widget in values:
 
254
                table, _widget = widget.get_widget()
 
255
                widget.set_value(watch_values[value])
 
256
                self.table.attach(table, 0, 1, i, i + 1)
 
257
                self.watch_options[watch_type].update({value: widget})
 
258
                i += 1
 
259
 
 
260
            self.table.show()
 
261
            vbox_options.pack_start(self.table, False, False, 0)
246
262
 
247
263
    def command_toggled(self, widget):
248
264
        sensitive = self.wTree.get_widget("check_command").get_active()