Add GTK GUI frontend for whipper
This commit is contained in:
@@ -3,6 +3,7 @@ import re
|
||||
import shutil
|
||||
import tempfile
|
||||
import subprocess
|
||||
import signal
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
from whipper.common.common import truncate_filename
|
||||
@@ -86,6 +87,7 @@ class ReadTOCTask(task.Task):
|
||||
self.toc_path = toc_path
|
||||
self._buffer = "" # accumulate characters
|
||||
self._parser = ProgressParser()
|
||||
self._aborted = False
|
||||
|
||||
self.fd, self.tocfile = tempfile.mkstemp(
|
||||
suffix='.cdrdao.read-toc.whipper.task')
|
||||
@@ -148,6 +150,11 @@ class ReadTOCTask(task.Task):
|
||||
self._done()
|
||||
|
||||
def _done(self):
|
||||
if self._aborted:
|
||||
if os.path.exists(self.tocfile):
|
||||
os.unlink(self.tocfile)
|
||||
self.stop()
|
||||
return
|
||||
self.setProgress(1.0)
|
||||
self.toc = TocFile(self.tocfile)
|
||||
self.toc.parse()
|
||||
@@ -167,6 +174,11 @@ class ReadTOCTask(task.Task):
|
||||
self.stop()
|
||||
return
|
||||
|
||||
def abort(self):
|
||||
self._aborted = True
|
||||
if getattr(self, "_popen", None) is not None and self._popen.poll() is None:
|
||||
os.kill(self._popen.pid, signal.SIGTERM)
|
||||
|
||||
|
||||
def DetectCdr(device):
|
||||
"""Whether cdrdao detects a CD-R for ``device``."""
|
||||
|
||||
Reference in New Issue
Block a user