1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import gettext
23
24 from flumotion.wizard.models import Consumer
25 from flumotion.wizard.basesteps import ConsumerStep
26
27 __version__ = "$Rev: 7015 $"
28 _ = gettext.gettext
29
30 (SIZE_KB,
31 SIZE_MB,
32 SIZE_GB,
33 SIZE_TB) = tuple([1 << (10L*i) for i in range(1, 5)])
34
35 TIME_MINUTE = 60
36 TIME_HOUR = 60*60
37 TIME_DAY = 60*60*24
38 TIME_WEEK = 60*60*24*7
39
40
42 """I am a model representing the configuration file for a
43 Disk consumer.
44
45 @ivar has_time: if rotation should be done based on time
46 @ivar has_size: if rotation should be done based on size
47 @ivar time_unit: the selected size unit,
48 size will be multiplied by this value when saved
49 @ivar size_unit: the selected time unit,
50 time will be multiplied by this value when saved
51 """
52 componentType = 'disk-consumer'
62
63
64
66 if self.has_time:
67 return 'time'
68 elif self.has_size:
69 return 'size'
70 else:
71 return 'none'
72
82
83
85 gladeFile = 'disker-wizard.glade'
86 icon = 'kcmdevices.png'
87
91
92
93
96
97
98
100 self.directory.data_type = str
101 self.start_recording.data_type = bool
102
103 self.has_time.data_type = bool
104 self.time.data_type = int
105 self.time_unit.data_type = int
106 self.time_unit.prefill([
107 (_('minute(s)'), TIME_MINUTE),
108 (_('hour(s)'), TIME_HOUR),
109 (_('day(s)'), TIME_DAY),
110 (_('week(s)'), TIME_WEEK)])
111 self.time_unit.select(TIME_HOUR)
112
113 self.has_size.data_type = bool
114 self.size.data_type = int
115 self.size_unit.data_type = long
116 self.size_unit.prefill([
117 (_('kB'), SIZE_KB),
118 (_('MB'), SIZE_MB),
119 (_('GB'), SIZE_GB),
120 (_('TB'), SIZE_TB),
121 ])
122
123 self.add_proxy(self.model,
124 ['rotate',
125 'has_size',
126 'has_time',
127 'size_unit',
128 'time_unit'])
129
130 self.add_proxy(self.model.properties,
131 ['size',
132 'time',
133 'directory',
134 'start_recording'])
135
139
140
141
143 rotate = self.rotate.get_active()
144 self.has_size.set_sensitive(rotate)
145 self.has_time.set_sensitive(rotate)
146
147 has_size = rotate and self.has_size.get_active()
148 self.size.set_sensitive(has_size)
149 self.size_unit.set_sensitive(has_size)
150
151 has_time = rotate and self.has_time.get_active()
152 self.time.set_sensitive(has_time)
153 self.time_unit.set_sensitive(has_time)
154
155
156
159
162
165
166
168 name = 'Disk (audio & video)'
169 title = _('Disk (audio and video)')
170 sidebarName = _('Disk audio/video')
171
172
173
176
177
179 name = 'Disk (audio only)'
180 title = _('Disk (audio only)')
181 sidebarName = _('Disk audio')
182
183
184
187
188
190 name = 'Disk (video only)'
191 title = _('Disk (video only)')
192 sidebarName = _('Disk video')
193
194
195
198