~francesco-marella/specto/blacklist-plugins

« back to all changes in this revision

Viewing changes to spectlib/add_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:
87
87
 
88
88
    def set_options(self, watch_type):
89
89
        """ Show the table with the right watch options. """
90
 
        values = self.specto.watch_db.plugin_dict[watch_type].get_add_gui_info()
 
90
        self.watch_options[watch_type] = []
 
91
        if hasattr(self.specto.watch_db.plugin_dict[watch_type], 'get_add_gui_info'):
 
92
            values = self.specto.watch_db.plugin_dict[watch_type].get_add_gui_info()
 
93
        else:
 
94
            values = []
 
95
        
 
96
        try:
 
97
            if self.specto.watch_db.plugin_dict[watch_type].dbus_watch == True:
 
98
                self.refresh.hide()
 
99
                self.refresh_unit.hide()
 
100
                self.wTree.get_widget("label_refresh1").hide()
 
101
        except:
 
102
            pass
91
103
 
92
104
        #create the options gui
93
 
        self.table = gtk.Table(rows=len(values), columns=1, homogeneous=False)
94
 
        self.table.set_row_spacings(6)
95
 
        self.table.set_col_spacings(6)
96
 
        self.watch_options[watch_type] = {}
97
 
 
98
 
        i = 0
99
 
        for value, widget in values:
100
 
            table, _widget = widget.get_widget()
101
 
            self.table.attach(table, 0, 1, i, i + 1)
102
 
            self.watch_options[watch_type].update({value: widget})
103
 
            i += 1
104
 
 
105
 
        self.table.show()
106
 
        vbox = self.wTree.get_widget("vbox_watch_options")
107
 
        vbox.pack_start(self.table, False, False, 0)
 
105
        if len(values) > 0:
 
106
            self.table = gtk.Table(rows=len(values), columns=1, homogeneous=False)
 
107
            self.table.set_row_spacings(6)
 
108
            self.table.set_col_spacings(6)
 
109
            self.watch_options[watch_type] = {}
 
110
 
 
111
            i = 0
 
112
            for value, widget in values:
 
113
                table, _widget = widget.get_widget()
 
114
                self.table.attach(table, 0, 1, i, i + 1)
 
115
                self.watch_options[watch_type].update({value: widget})
 
116
                i += 1
 
117
 
 
118
            self.table.show()
 
119
            vbox = self.wTree.get_widget("vbox_watch_options")
 
120
            vbox.pack_start(self.table, False, False, 0)
108
121
 
109
122
    def set_refresh_values(self, widget):
110
123
        """ Set the max and min values for the refresh unit. """
158
171
            else:
159
172
                values['open_command'] = ""
160
173
                open = True
161
 
 
162
 
            gui_values = self.specto.watch_db.plugin_dict[values['type']].get_add_gui_info()
 
174
            
 
175
            if hasattr(self.specto.watch_db.plugin_dict[values['type']], 'get_add_gui_info'):
 
176
                gui_values = self.specto.watch_db.plugin_dict[values['type']].get_add_gui_info()
163
177
            window_options = self.watch_options[values['type']]
164
178
 
165
179
            for key in window_options: