]> git.plutz.net Git - viper/commitdiff
implemeted most basic cropping controls master
authorpaul <paul@plutz.net>
Sat, 31 Dec 2011 14:55:50 +0000 (14:55 +0000)
committerpaul <paul@plutz.net>
Sat, 31 Dec 2011 14:55:50 +0000 (14:55 +0000)
svn path=/trunk/; revision=10

plugins/f_crop.py

index b377deedfc2b7f1e6c6fb8422bfb005f1daaa50f..0dd1019ff7f704eb5e3733d207786988bd331d67 100644 (file)
@@ -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. 
 
 
 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(' ')
+