]> git.plutz.net Git - viper/blob - plugins/f_tile.py
moved from svn.imp.fu-berlin.de/viper rev33
[viper] / plugins / f_tile.py
1 #encoding: utf-8
2 #Copyright 2010 Thomas Kretzer, Paul Hänsch
3
4 #This file is part of Viper. 
5
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.
10
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.
15
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/>
18
19 from plugin import *
20
21 class F_Tile(F_Plugin):
22     def build_dialog(self):
23         self.subgets['desc'] = Label(self, text = 'Repeat image horizontally\nand vertically')
24         self.subgets['desc'].pack(side = TOP, expand = True, fill = BOTH)
25
26         self.subgets['f_label'] = Frame(self)
27         self.subgets['f_label'].pack(side = LEFT, anchor = E, fill = X)
28
29         self.subgets['l_tilesx'] = Label(self.subgets['f_label'], text = 'Tiles horizontal:')
30         self.subgets['l_tilesx'].pack(side = TOP, anchor = E)
31         self.subgets['l_tilesy'] = Label(self.subgets['f_label'], text = 'Tiles vertical:')
32         self.subgets['l_tilesy'].pack(side = TOP, anchor = E)
33         self.subgets['l_frame'] = Label(self.subgets['f_label'], text = 'Frame width:')
34         self.subgets['l_frame'].pack(side = TOP, anchor = E)
35         self.subgets['l_spacing'] = Label(self.subgets['f_label'], text = 'Tile Spacing:')
36         self.subgets['l_spacing'].pack(side = TOP, anchor = E)
37         self.subgets['l_span'] = Label(self.subgets['f_label'], text = 'Frame span:')
38         self.subgets['l_span'].pack(side = TOP, anchor = E)
39
40         self.subgets['f_spin'] = Frame(self)
41         self.subgets['f_spin'].pack(side = LEFT, anchor = W, expand = True, fill = X)
42
43         self.subgets['s_tilesx'] = Spinbox(self.subgets['f_spin'], from_ = 0, to = 128, wrap = False, width = 4, justify = RIGHT)
44         self.subgets['s_tilesx'].delete(0, END)
45         self.subgets['s_tilesx'].insert(0, 5)
46         self.subgets['s_tilesx'].pack(side = TOP, anchor = W)
47
48         self.subgets['s_tilesy'] = Spinbox(self.subgets['f_spin'], from_ = 0, to = 128, wrap = False, width = 4, justify = RIGHT)
49         self.subgets['s_tilesy'].delete(0, END)
50         self.subgets['s_tilesy'].insert(0, 5)
51         self.subgets['s_tilesy'].pack(side = TOP, anchor = W)
52
53         self.subgets['s_frame'] = Spinbox(self.subgets['f_spin'], from_ = 0, to = 1024, wrap = False, width = 4, justify = RIGHT)
54         self.subgets['s_frame'].delete(0, END)
55         self.subgets['s_frame'].insert(0, 2)
56         self.subgets['s_frame'].pack(side = TOP, anchor = W)
57
58         self.subgets['s_spacing'] = Spinbox(self.subgets['f_spin'], from_ = 0, to = 128, wrap = False, width = 4, justify = RIGHT)
59         self.subgets['s_spacing'].delete(0, END)
60         self.subgets['s_spacing'].insert(0, 4)
61         self.subgets['s_spacing'].pack(side = TOP, anchor = W)
62
63         self.subgets['s_span'] = Spinbox(self.subgets['f_spin'], from_ = 0, to = 16384, wrap = False, width = 6, justify = RIGHT)
64         self.subgets['s_span'].delete(0, END)
65         self.subgets['s_span'].insert(0, 25)
66         self.subgets['s_span'].pack(side = TOP, anchor = W)
67
68     def name(self):
69         return 'Tile'
70
71     def subcommand(self):
72         return ['-vf-add', 'tile=' + str(self.subgets['s_tilesx'].get()) + ':' + str(self.subgets['s_tilesy'].get()) + ':' + str(self.subgets['s_span'].get()) + ':' + str(self.subgets['s_frame'].get()) + ':' + str(self.subgets['s_spacing'].get())]