2 #Copyright 2010 Thomas Kretzer, Paul Hänsch
4 #This file is part of Viper.
6 #Viper is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
11 #Viper is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU General Public License for more details.
16 #You should have received a copy of the GNU General Public License
17 #along with Viper. If not, see <http://www.gnu.org/licenses/>
21 class F_Scale(F_Plugin):
22 def build_dialog(self):
25 self.lock = BooleanVar(value = True)
26 self.subgets['desc'] = Label(self, text = 'Adjust image size by scaling\nthe image')
27 self.subgets['desc'].pack(side = TOP, anchor = N, expand = True, fill = BOTH)
28 self.subgets['f_spin'] = Frame(self)
29 self.subgets['f_spin'].pack(side = TOP, anchor = N, expand = True, fill = BOTH)
30 self.subgets['l_width'] = Label(self.subgets['f_spin'], text = 'Width:')
31 self.subgets['l_width'].pack(side = LEFT, anchor = N)
32 self.subgets['s_width'] = Spinbox(self.subgets['f_spin'], from_ = 0, to = 8192, wrap = False, width = 5)
33 self.subgets['s_width'].delete(0, END)
34 self.subgets['s_width'].insert(0, 320)
35 self.subgets['s_width'].pack(side = LEFT, anchor = N, fill = X)
36 self.subgets['s_height'] = Spinbox(self.subgets['f_spin'], from_ = -2, to = 8192, wrap = False, width = 5, state = DISABLED)
37 self.subgets['s_height'].delete(0, END)
38 self.subgets['s_height'].insert(0, -2)
39 self.subgets['s_height'].pack(side = RIGHT, anchor = N, fill = X)
40 self.subgets['l_height'] = Label(self.subgets['f_spin'], text = 'Height:')
41 self.subgets['l_height'].pack(side = RIGHT, anchor = N)
42 self.subgets['c_lockaspect'] = Checkbutton(self, variable = self.lock, text = 'Lock aspect', command = self.c_lockaspect)
43 self.subgets['c_lockaspect'].pack(side = TOP, anchor = N, expand = True, fill = X)
45 def c_lockaspect(self):
47 self.subgets['s_height'].configure(from_ = -2)
48 self.subgets['s_height'].delete(0, END)
49 self.subgets['s_height'].insert(0, -2)
50 self.subgets['s_height'].configure(state = DISABLED)
52 self.subgets['s_height'].configure(from_ = 0, state = NORMAL)
53 self.subgets['s_height'].delete(0, END)
54 self.subgets['s_height'].insert(0, 240)
60 return ['-vf-add', 'scale=' + str(self.subgets['s_width'].get()) + ':' + str(self.subgets['s_height'].get())]