From 73a0492585e238d32869bfa9c53ddc95481ab1c5 Mon Sep 17 00:00:00 2001 From: DH4 Date: Fri, 2 Jun 2017 00:30:44 -0500 Subject: Cancel button stops pre-processing too. --- components/original.py | 9 +++++++++ components/text.py | 6 ++++++ 2 files changed, 15 insertions(+) (limited to 'components') diff --git a/components/original.py b/components/original.py index 382c3ab..e1240e9 100644 --- a/components/original.py +++ b/components/original.py @@ -27,6 +27,7 @@ class Component(__base__.Component): page.pushButton_visColor.setStyleSheet(btnStyle) page.lineEdit_visColor.textChanged.connect(self.update) self.page = page + self.canceled = False return page def update(self): @@ -59,6 +60,8 @@ class Component(__base__.Component): self.spectrumArray = {} for i in range(0, len(self.completeAudioArray), self.sampleSize): + if self.canceled: + break self.lastSpectrum = self.transformData(i, self.completeAudioArray, self.sampleSize, self.smoothConstantDown, self.smoothConstantUp, self.lastSpectrum) self.spectrumArray[i] = copy(self.lastSpectrum) @@ -142,3 +145,9 @@ class Component(__base__.Component): im.paste(imTop, (0, y), mask=imTop) return im + + def cancel(self): + self.canceled = True + + def reset(self): + self.canceled = False diff --git a/components/text.py b/components/text.py index 9237167..da2706b 100644 --- a/components/text.py +++ b/components/text.py @@ -141,3 +141,9 @@ class Component(__base__.Component): return self.page.lineEdit_textColor.setText(RGBstring) self.page.pushButton_textColor.setStyleSheet(btnStyle) + + def cancel(self): + self.canceled = True + + def reset(self): + self.canceled = False \ No newline at end of file -- cgit v1.2.3