def autoConnectSignals(self): widgets, members = super(Form, self).__dict__, Form.__dict__ for i in widgets: for m in [j for j in members if j.startswith(i+"_")]: signal = getattr(widgets[i], m[len(i)+1:], None) if signal: signal.connect(bind(members[m], self)) else: print("Signal '%s' of '%s' not found" % (m[len(i)+1:], i))
def slot_disconnected(signal, slot): try: signal.disconnect(slot) except Exception: pass yield signal.connect(slot)
def _init_signal_handler(self, callback): import signal as sig from signal import signal as connect for target_signal in self.catch_signals: connect( getattr(sig, target_signal), callback )
def autoConnectSignals(self): widgets, members = super(Form, self).__dict__, Form.__dict__ for i in widgets: for m in [j for j in members if j.startswith(i + "_")]: signal = getattr(widgets[i], m[len(i) + 1:], None) if signal: signal.connect(bind(members[m], self)) else: print("Signal '%s' of '%s' not found" % (m[len(i) + 1:], i))
def reconnect(self, signal, new, prev): signal.disconnect(prev) signal.connect(new) self.prev_slot_sr = new
def wait(self, signal, ms): signal.connect(self.onsignal) self.timer.start(ms) self.loop.exec_() return self.waited