From 809c1929babbe87fd904ce7f51e7f362b6222006 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 31 Dec 2011 14:55:50 +0000 Subject: [PATCH] implemeted most basic cropping controls svn path=/trunk/; revision=10 --- plugins/f_crop.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/plugins/f_crop.py b/plugins/f_crop.py index b377dee..0dd1019 100644 --- a/plugins/f_crop.py +++ b/plugins/f_crop.py @@ -1,5 +1,5 @@ #encoding: utf-8 -#Copyright 2010 Thomas Kretzer, Paul Hänsch +#Copyright 2011 Thomas Kretzer, Paul Hänsch #This file is part of Viper. @@ -18,18 +18,37 @@ from plugin import * +# TODO +# Controls to adjust cropping position + class F_Crop(F_Plugin): def build_dialog(self): - self.subgets['desc'] = Label(self, text = 'Crop') + self.subgets['desc'] = Label(self, text = 'Crop image, only centered cropping so far\n'+ + 'Cropping the image will change its resolution.\n'+ + 'When cropping only a few chunks out of a larger set\n'+ + 'you might also want to add a scale filter.') self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH) - self.subgets['filter'] = Pmw.OptionMenu(self, initialitem = 0, - items = ['-vf-add crop=320:240:10:10', - '-vf-add crop=160:120:0:0' - ]) - self.subgets['filter'].pack(side = TOP, expand = True, fill = X) + + self.subgets['f_spin'] = Frame(self) + self.subgets['f_spin'].pack(side = TOP, anchor = N, expand = True, fill = BOTH) + self.subgets['l_width'] = Label(self.subgets['f_spin'], text = 'Width:') + self.subgets['l_width'].pack(side = LEFT, anchor = N) + self.subgets['s_width'] = Spinbox(self.subgets['f_spin'], from_ = 0, to = 8192, wrap = False, width = 5) + self.subgets['s_width'].delete(0, END) + self.subgets['s_width'].insert(0, 320) + self.subgets['s_width'].pack(side = LEFT, anchor = N, fill = X) + self.subgets['s_height'] = Spinbox(self.subgets['f_spin'], from_ = -2, to = 8192, wrap = False, width = 5) + self.subgets['s_height'].delete(0, END) + self.subgets['s_height'].insert(0, 240) + self.subgets['s_height'].pack(side = RIGHT, anchor = N, fill = X) + self.subgets['l_height'] = Label(self.subgets['f_spin'], text = 'Height:') + self.subgets['l_height'].pack(side = RIGHT, anchor = N) def name(self): return 'Crop' + def subcommand(self): + return ['-vf-add', 'crop=' + str(self.subgets['s_width'].get()) + ':' + str(self.subgets['s_height'].get())] def subcommand(self): return self.subgets['filter'].getvalue().split(' ') + -- 2.39.2