@@ -255,58 +255,3 @@ def handle(*args):
255
255
signal .signal (signal .SIGINT , old_sigint_handler )
256
256
if handler_args is not None :
257
257
old_sigint_handler (* handler_args )
258
-
259
- # class _maybe_allow_interrupt:
260
- #
261
- # def __init__(self, qt_object):
262
- # self.interrupted_qobject = qt_object
263
- # self.old_fd = None
264
- # self.caught_args = None
265
- #
266
- # self.skip = False
267
- # self.old_sigint_handler = signal.getsignal(signal.SIGINT)
268
- # if self.old_sigint_handler in (None, signal.SIG_IGN, signal.SIG_DFL):
269
- # self.skip = True
270
- # return
271
- #
272
- # QAS = QtNetwork.QAbstractSocket
273
8000
code>
- # self.qt_socket = QAS(QAS.TcpSocket, qt_object)
274
- # # Create a socket pair
275
- # self.wsock, self.rsock = socket.socketpair()
276
- # # Let Qt listen on the one end
277
- # self.qt_socket.setSocketDescriptor(self.rsock.fileno())
278
- # self.wsock.setblocking(False)
279
- # self.qt_socket.readyRead.connect(self._readSignal)
280
- #
281
- # def __enter__(self):
282
- # if self.skip:
283
- # return
284
- #
285
- # signal.signal(signal.SIGINT, self._handle)
286
- # # And let Python write on the other end
287
- # self.old_fd = signal.set_wakeup_fd(self.wsock.fileno())
288
- #
289
- # def __exit__(self, type, val, traceback):
290
- # if self.skip:
291
- # return
292
- #
293
- # signal.set_wakeup_fd(self.old_fd)
294
- # signal.signal(signal.SIGINT, self.old_sigint_handler)
295
- #
296
- # self.wsock.close()
297
- # self.rsock.close()
298
- # self.qt_socket.abort()
299
- # if self.caught_args is not None:
300
- # self.old_sigint_handler(*self.caught_args)
301
- #
302
- # def _readSignal(self):
303
- # # Read the written byte to re-arm the socket if a signal different
304
- # # from SIGINT was caught.
305
- # # Since a custom handler was installed for SIGINT, KeyboardInterrupt
306
- # # is not raised here.
307
- # self.qt_socket.readData(1)
308
- #
309
- # def _handle(self, *args):
310
- # self.caught_args = args # save the caught args to call the old
311
- # # SIGINT handler afterwards
312
- # self.interrupted_qobject.quit()
0 commit comments