summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpepperpepperpepper <pepper@scannerjammer.com>2016-03-01 21:26:05 -0800
committerpepperpepperpepper <pepper@scannerjammer.com>2016-03-01 21:26:05 -0800
commitbbc58ea395a62bb5e27a377f73ce586db7296d64 (patch)
treeb3c614931c0af5afe0502de1a0871934ef4feb29
parent04ab9aadccb96a60948eb272d8aa1ba46cc86a4a (diff)
ok even better
-rw-r--r--photoblaster/modules/base.py8
-rwxr-xr-xphotoblaster/modules/pbbreaker.py45
-rwxr-xr-xphotoblaster/modules/pbgradient.py17
3 files changed, 45 insertions, 25 deletions
diff --git a/photoblaster/modules/base.py b/photoblaster/modules/base.py
index 4d39266..86cc8dc 100644
--- a/photoblaster/modules/base.py
+++ b/photoblaster/modules/base.py
@@ -25,7 +25,7 @@ class Pb(object):
self.tag = self.__class__.__name__
self._db_url_param = None
- self.output_file = None
+ self._output_file = None
self.width = None
self.height = None
@@ -93,3 +93,9 @@ class Pb(object):
def create(self):
pass
#self._cleanup()
+
+ def get_output_file(self):
+ return self._output_file
+
+ def set_output_file(self, output_file):
+ self._output_file = output_file
diff --git a/photoblaster/modules/pbbreaker.py b/photoblaster/modules/pbbreaker.py
index 4fa654f..94bfb3c 100755
--- a/photoblaster/modules/pbbreaker.py
+++ b/photoblaster/modules/pbbreaker.py
@@ -75,11 +75,12 @@ class PbBreaker(Pb):
self.params.finalformat.set_val(DEFAULT_FINALFORMAT)
self.width, self.height = self.params.url.get_file().get_dimensions()
- self.output_file = File.from_url(
- self.params.url.url,
- extension=self.params.finalformat,
- classname=self.__class__.__name__,
- username=self.params.username
+ self.set_output_file(
+ File.from_url(
+ self.params.url.url,
+ extension=self.params.finalformat,
+ classname=self.__class__.__name__,
+ username=self.params.username)
)
self._conversion_file = File(
is_temp=True,
@@ -105,18 +106,19 @@ class PbBreaker(Pb):
def _rotate_back(self):
angle = str(360-int(self.params.breakangle))
cmd = [BIN_CONVERT,
- self.output_file.get_filepath(),
- "-rotate", angle, "+repage", self.output_file.get_filepath()]
+ self.get_output_file().get_filepath(),
+ "-rotate", angle, "+repage",
+ self.get_output_file().get_filepath()]
self._call_cmd(cmd)
if not self.params.expanded:
cmd = [BIN_CONVERT,
- self.output_file.get_filepath(),
+ self.get_output_file().get_filepath(),
"-gravity",
"Center",
"-crop",
"{}x{}+0+0".format(self.width, self.height),
"+repage",
- self.output_file.get_filepath()]
+ self.get_output_file().get_filepath()]
self._call_cmd(cmd)
def _subtle_break(self):
@@ -188,22 +190,31 @@ class PbBreaker(Pb):
self._call_cmd([
BIN_CONVERT,
self._conversion_file.get_filepath(),
- self.output_file.get_filepath()])
+ self.get_output_file().get_filepath()])
def psd_psbfilepath(num):
return os.path.join(
- re.sub(r'\.', "-%s." % num, self.output_file.get_filepath())
+ re.sub(
+ r'\.', "-%s." % num, self.get_output_file().get_filepath())
)
if str(self.params.breaktype) == 'psd':
self._call_cmd(
- ['mv', psd_psbfilepath(1), self.output_file.get_filepath()])
- self.output_file.set_filepath(filepath=psd_psbfilepath(0))
- self._files_created.append(self.output_file)
+ [
+ 'mv', psd_psbfilepath(1),
+ self.get_output_file().get_filepath()
+ ]
+ )
+ self._output_file.set_filepath(filepath=psd_psbfilepath(0))
+ self._files_created.append(self.get_output_file())
if str(self.params.breaktype) == 'psb':
self._call_cmd(
- ['mv', psd_psbfilepath(0), self.output_file.get_filepath()])
- self.output_file.set_filepath(filepath=psd_psbfilepath(1))
- self._files_created.append(self.output_file)
+ [
+ 'mv',
+ psd_psbfilepath(0),
+ self.get_output_file().get_filepath()
+ ])
+ self._output_file.set_filepath(filepath=psd_psbfilepath(1))
+ self._files_created.append(self.get_output_file())
if self.params.breakangle:
self._rotate_back()
diff --git a/photoblaster/modules/pbgradient.py b/photoblaster/modules/pbgradient.py
index b65412c..fe885b5 100755
--- a/photoblaster/modules/pbgradient.py
+++ b/photoblaster/modules/pbgradient.py
@@ -89,11 +89,12 @@ class PbGradient(Pb):
str(self.params.color2).replace(
'#', '').replace('(', '-').replace(')', '-')
)
- self.output_file = File(
- namepart=namepart,
- extension=self.params.filetype,
- classname=self.__class__.__name__,
- username=self.params.username
+ self.set_output_file(
+ File(
+ namepart=namepart,
+ extension=self.params.filetype,
+ classname=self.__class__.__name__,
+ username=self.params.username)
)
def _build_cmd(self):
@@ -186,7 +187,7 @@ class PbGradient(Pb):
self.params.hue or "100"
)
]
- cmd.append(self.output_file.get_filepath())
+ cmd.append(self.get_output_file().get_filepath())
self._call_cmd(cmd)
if self.params.bevel:
self._make_bevel()
@@ -224,7 +225,9 @@ class PbGradient(Pb):
def _make_bevel(self):
cmd = [BEVELBORDER]
cmd += self._get_bevelvalue()
- cmd += [self.output_file.get_filepath(), self.output_file.get_filepath()]
+ cmd += [
+ self.get_output_file().get_filepath(),
+ self.get_output_file().get_filepath()]
self._call_cmd(cmd)
def create(self):