diff options
| author | pepperpepperpepper <pepper@scannerjammer.com> | 2016-03-07 08:20:35 -0800 |
|---|---|---|
| committer | pepperpepperpepper <pepper@scannerjammer.com> | 2016-03-07 08:20:35 -0800 |
| commit | 31acf7bbc18454d360f026a2ba117c0e973359cc (patch) | |
| tree | c08ca7e5703c834de740e7eedb9f585a739f7f5d | |
| parent | b48dc7d1713463ce04b45a1f79b0c7061f7a08cb (diff) | |
ok
| -rw-r--r-- | photoblaster/modules/pbconcat/__init__.py | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/photoblaster/modules/pbconcat/__init__.py b/photoblaster/modules/pbconcat/__init__.py index 11e399c..797d90f 100644 --- a/photoblaster/modules/pbconcat/__init__.py +++ b/photoblaster/modules/pbconcat/__init__.py @@ -4,6 +4,25 @@ from photoblaster._file import File _DEFAULT_DIRECTION = 'right' +class PbConcatFile(File): + def __init__(self, *args, **kwargs): + super(PbConcatFile, self).__init__() + self._frames_cache = self.get_frames() + self._width = None + self._height = None + + @classmethod + def from_file(cls, file): + cls() + + def set_frames_cache(self, frames): + self._frames_cache = frames + + def get_frames_cache(self): + return self._frames_cache + + + class PbConcat(ModuleBase): example_params = { 'img_url1': ( @@ -113,8 +132,8 @@ class PbConcat(ModuleBase): #so I wouldn't want to set the frames on the original gifs at all, just need to store them into a variable, do you know what I mean? #i think so, just don't call set_frames on original gifs, it's fine to have code that does something only for part of application. - #but if I set the frames on the original gifs, I have to recompile the gif and that will make the program run wayy slower - #so yu need frames only as variable, not actually change it? right + #but if I set the frames on the original gifs, I have to recompile the gif and that will make the program run wayy slower + #so yu need frames only as variable, not actually change it? right #i need them only to merge two gifs together frame by frame, but the gifs I'm merging I don't need to change well keep get_frames then, and make #something like local variable that you can set on file, like a temporary variable inside object, this way you don't have to recomplie gif. #what could it look like? @@ -126,7 +145,7 @@ class PbConcat(ModuleBase): #ok. I find this part of programming, learning how to structure a project, very difficult and elusive, is it essentially something that #not many coders know who to do well? looks so. ok I understand, and the only way to learn is to just code a lot and make mistakes, #gradually get better that way? yep I see...one more quick question - + images = [ im1, im2 ] @@ -134,7 +153,7 @@ class PbConcat(ModuleBase): param_name = self.params.merge_direction == "right" ? "height" : "width" if self.params.merge_direction == "right" and im1[param_name] != im2[param_name]: - im_scale = im1[param_name] > im2[param_name] and self.params.dimensions_match == "smallest" ? + im_scale = im1[param_name] > im2[param_name] and self.params.dimensions_match == "smallest" ? im1 : im2 im_scale_by = im_scale == im1 ? im2 : im1 @@ -143,7 +162,7 @@ class PbConcat(ModuleBase): # something like this, could be bugs but you get the idea. #so the main idea that I need to ask about is that #file is already a class - #the image url param is also already a class + #the image url param is also already a class #but it's cool to store things in hashes that refer to the classes? sure it's temporary "object" that helps to solve this #so hashes are just fair game for anything procedural and I can throw them out without worrying about integrating #them into the class based system? yep @@ -152,10 +171,10 @@ class PbConcat(ModuleBase): # if self.params.merge_direction == "right" and \ # im1_height != im2_height: # """match heights""" -# #ok so if the first image is taller than the second, +# #ok so if the first image is taller than the second, # #and the dimensions param says to go by the smallest, shrink # #the first image, if the dimensions_param says to go by the tallest -# #make the second image bigger...do you see what I mean when I say this +# #make the second image bigger...do you see what I mean when I say this # #is sort of confusing? yeah, let's rewrite it # if im1_height > im2_height: # if self.params.dimensions_match == "smallest": @@ -249,7 +268,7 @@ class PbConcat(ModuleBase): #match_dimensions() #make_frames_count_equal() #merge_frames() - #finalize_image() + #finalize_image() #does that seem more clear? yeah i think you just need an alias for self.parameters. frames1, frames2 = self._get_frames_of_equal_count() |
