~woutc/specto/specto-woutc-fake-gconf

« back to all changes in this revision

Viewing changes to spectlib/notifier.py

  • Committer: nekohayo
  • Date: 2007-03-14 03:18:57 UTC
  • Revision ID: svn-v3-trunk0:cc143b5f-0d1a-0410-b6b4-bdbe827cf625:trunk:88
    * clean up, rewrite a portion of port watch into something simpler
    * more themable icons
    * port watch is now available in the GUI, please test it. Fixes issue #32

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
#             icon = gtk.gdk.pixbuf_new_from_file(self.specto.PATH + 'icons/notifier/faded/folder.png' )
150
150
#         elif type == 3:#system process
151
151
#             icon = gtk.gdk.pixbuf_new_from_file(self.specto.PATH + 'icons/notifier/faded/process.png' )
 
152
# ... and of course the port watch
152
153
#         self.model.set_value(self.iter[id], 1, icon)
153
154
        
154
155
        if self.specto.watch_db[id].updated == False:
178
179
#                     icon = gtk.gdk.pixbuf_new_from_file(self.specto.PATH + 'icons/notifier/faded/folder.png' )
179
180
#                 elif type == 3:#system process
180
181
#                     icon = gtk.gdk.pixbuf_new_from_file(self.specto.PATH + 'icons/notifier/faded/process.png' )
 
182
# ... and of course the port watch
181
183
#                 self.model.set_value(self.iter[i], 1, icon)
182
184
 
183
185
    def refresh(self, *widget):
237
239
            icon = self.specto.icon_theme.load_icon("folder", 22, 0)
238
240
        elif type == 3:#system process
239
241
            icon = self.specto.icon_theme.load_icon("applications-system", 22, 0)
 
242
        elif type == 4:#port
 
243
            icon = self.specto.icon_theme.load_icon("network-transmit-receive", 22, 0)
240
244
        if self.model.iter_is_valid(self.iter[id]):
241
245
            self.model.set_value(self.iter[id], 1, icon)
242
246
        
283
287
                    if self.specto.watch_db[id].updated == True:
284
288
                        pass
285
289
                        #FIXME: needs to set the gtk sensitivity to True here
 
290
                elif type == 4:#port
 
291
                    icon = self.specto.icon_theme.load_icon("network-transmit-receive", 22, 0)
 
292
                    if self.specto.watch_db[id].updated == True:
 
293
                        pass
 
294
                        #FIXME: needs to set the gtk sensitivity to True here
286
295
                if self.model.iter_is_valid(self.iter[id]):
287
296
                    self.model.set_value(self.iter[id], 1, icon)
288
297
#FIXME: NEEDS GTK SENSITIVITY! this section below is for hardcoded transparent icons, will not be necessary when we figure out how to make cell contents insensitive properly        
302
311
#                     icon = gtk.gdk.pixbuf_new_from_file(dir + 'folder.png')
303
312
#                 elif type ==3:
304
313
#                     icon = gtk.gdk.pixbuf_new_from_file(dir + 'process.png')
 
314
# ... and of course the port watch
305
315
#                           
306
316
#             if self.model.iter_is_valid(self.iter[id]):
307
317
#                 self.model.set_value(self.iter[id], 1, icon)
323
333
            icon = self.specto.icon_theme.load_icon("folder", 22, 0)
324
334
        elif type == 3:#system process
325
335
            icon = self.specto.icon_theme.load_icon("applications-system", 22, 0)
 
336
        elif type == 4:#port
 
337
            icon = self.specto.icon_theme.load_icon("network-transmit-receive", 22, 0)
326
338
#        if self.model.iter_is_valid(self.iter[id]):
327
339
#            self.model.set_value(self.iter[id], 1, icon)
328
340
 
336
348
#             icon = gtk.gdk.pixbuf_new_from_file(self.specto.PATH + 'icons/notifier/faded/folder.png' )
337
349
#         elif type == 3:
338
350
#             icon = gtk.gdk.pixbuf_new_from_file(self.specto.PATH + 'icons/notifier/faded/process.png' )    
 
351
# ... and of course the port watch
339
352
 
340
353
        self.iter[i] = self.model.insert_before(None, None)
341
354
        self.model.set_value(self.iter[i], 0, 1)
381
394
            self.mail_info_table.hide()
382
395
            self.file_info_table.hide()
383
396
            self.process_info_table.hide()
 
397
            self.port_info_table.hide()
384
398
            
385
399
            id = int(model.get_value(iter, 3))
386
400
        
448
462
                self.lblProcessLastUpdateText.set_label(selected.last_updated)
449
463
                self.process_info_table.show()
450
464
                self.wTree.get_widget("imgWatch").set_from_pixbuf(self.specto.icon_theme.load_icon("applications-system", 64, 0))
 
465
 
 
466
            elif selected.type == 4:
 
467
                self.lblPortNameText.set_label(selected.name)
 
468
                self.lblPortName.set_label(selected.port)
 
469
                self.lblPortName.set_ellipsize(pango.ELLIPSIZE_START)#shorten the string if too long
 
470
                self.lblPortLastUpdateText.set_label(selected.last_updated)
 
471
                self.port_info_table.show()
 
472
                self.wTree.get_widget("imgWatch").set_from_pixbuf(self.specto.icon_theme.load_icon("network-transmit-receive", 64, 0))
451
473
                
452
474
        else:
453
475
            self.wTree.get_widget("edit").set_sensitive(False)
460
482
            self.web_info_table.hide()
461
483
            self.mail_info_table.hide()
462
484
            self.file_info_table.hide()   
463
 
            self.process_info_table.hide()         
 
485
            self.process_info_table.hide()
 
486
            self.port_info_table.hide()
464
487
        
465
488
    def open_watch(self, *args):
466
489
        """ 
891
914
        self.process_info_table.attach(self.lblProcessName, 1, 2, 2, 3)
892
915
 
893
916
        vbox_info.pack_start(self.process_info_table, False, False, 0)
 
917
 
 
918
 
 
919
 
 
920
        ###create port info        
 
921
        self.port_info_table = gtk.Table(rows=3, columns=2, homogeneous=False)
 
922
        self.port_info_table.set_col_spacings(6)
 
923
        self.port_info_table.set_row_spacings(6)
 
924
 
 
925
        #name
 
926
        lblName = gtk.Label(_("<b>Name:</b>"))
 
927
        lblName.set_alignment(xalign=0.0, yalign=0.5)
 
928
        lblName.set_use_markup(True)
 
929
        lblName.show()
 
930
        self.port_info_table.attach(lblName, 0, 1, 0, 1)
 
931
 
 
932
        self.lblPortNameText = gtk.Label()
 
933
        self.lblPortNameText.set_alignment(xalign=0.0, yalign=0.5)
 
934
        self.lblPortNameText.show()
 
935
        self.port_info_table.attach(self.lblPortNameText,1, 2, 0, 1)
 
936
 
 
937
        #last updated
 
938
        lblLastUpdate = gtk.Label(_("<b>Last Updated:</b>"))
 
939
        lblLastUpdate.set_alignment(xalign=0.0, yalign=0.5)
 
940
        lblLastUpdate.set_use_markup(True)
 
941
        lblLastUpdate.show()
 
942
        self.port_info_table.attach(lblLastUpdate,0, 1, 1, 2)
 
943
 
 
944
        self.lblPortLastUpdateText = gtk.Label()
 
945
        self.lblPortLastUpdateText.set_alignment(xalign=0.0, yalign=0.5)
 
946
        self.lblPortLastUpdateText.show()
 
947
        self.port_info_table.attach(self.lblPortLastUpdateText,1, 2, 1, 2)
 
948
 
 
949
        #port
 
950
        lblPortName = gtk.Label(_("<b>Port:</b>"))
 
951
        lblPortName.set_alignment(xalign=0.0, yalign=0.5)
 
952
        lblPortName.set_use_markup(True)
 
953
        lblPortName.show()
 
954
        self.port_info_table.attach(lblPortName, 0, 1, 2, 3)
 
955
 
 
956
        self.lblPortName = gtk.Label()
 
957
        self.lblPortName.set_alignment(xalign=0.0, yalign=0.5)
 
958
        self.lblPortName.show()
 
959
        self.port_info_table.attach(self.lblPortName, 1, 2, 2, 3)
 
960
 
 
961
        vbox_info.pack_start(self.port_info_table, False, False, 0)
 
962
 
 
963
 
 
964
 
894
965
        
895
966
    def show_add_watch(self, widget):
896
967
        """ Call the main function to show the add watch window. """