X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=drlaunch%2Fsrc%2Fsig.py;fp=drlaunch%2Fsrc%2Fsig.py;h=f7cf1155f51123a7716906738544730ee4e4b23c;hb=94695a8c9a3ebf78e1f4c32d854e6b5a163d4667;hp=0000000000000000000000000000000000000000;hpb=75247cf58d8d7f5a420aa300a01b1f50e4bffb23;p=drlaunch diff --git a/drlaunch/src/sig.py b/drlaunch/src/sig.py new file mode 100644 index 0000000..f7cf115 --- /dev/null +++ b/drlaunch/src/sig.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# coding=UTF-8 +# +# Copyright (C) 2010 Stefanos Harhalakis +# +# This file is part of wifieye. +# +# wifieye is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# wifieye is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with wifieye. If not, see . +# +# $Id: 0.py 2265 2010-02-21 19:16:26Z v13 $ + +__version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $" + +import gtk + +class Disconnector(object): + def __init__(self): + self.chandles=[] + if isinstance(self, gtk.Widget): + self.c(self, 'delete-event', self.slotDiscDeleteEvent) + + def c(self, obj, signal, slot, *args): + h=obj.connect(signal, slot, *args) + self.chandles.append((obj, h)) + + return(h) + + def slotDiscDeleteEvent(self, sender, event): +# print "sig-delete-event" + self.dis_finish() + return(False) + + def dis_finish(self, obj=None): + """ Disconnect all signals. If obj is specified the only disconnect + signals from that object """ + for i in self.chandles: + if obj!=None and i[0]!=obj: + continue + #print i[0], i[1] + i[0].disconnect(i[1]) + + if obj==None: + self.chandles=[] + else: + self.chandles=[a for a in self.chandles if a[0]!=obj] + +# vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: +