summaryrefslogtreecommitdiff
path: root/gtk-recordmydesktop/src/rmdPrefsWidget.py
blob: f9ae395d7a825da2638d55bfc55cf3c51b70c837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
#/*********************************************************************************
#*                         gtk-recordMyDesktop                                    *
#**********************************************************************************
#*                                                                                *
#*             Copyright (C) 2006  John Varouhakis                                *
#*                                                                                *
#*                                                                                *
#*    This program is free software; you can redistribute it and/or modify        *
#*    it under the terms of the GNU General Public License as published by        *
#*    the Free Software Foundation; either version 2 of the License, or           *
#*    (at your option) any later version.                                         *
#*                                                                                *
#*    This program is distributed in the hope that it will be useful,             *
#*    but WITHOUT ANY WARRANTY; without even the implied warranty of              *
#*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
#*    GNU General Public License for more details.                                *
#*                                                                                *
#*    You should have received a copy of the GNU General Public License           *
#*    along with this program; if not, write to the Free Software                 *
#*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   *
#*                                                                                *
#*                                                                                *
#*                                                                                *
#*    For further information contact me at johnvarouhakis@gmail.com              *
#**********************************************************************************/


import pygtk
pygtk.require('2.0')
import gtk
import locale, gettext
import rmdConfig
_ = gettext.gettext
gettext.textdomain('gtk-recordMyDesktop')
gettext.bindtextdomain('gtk-recordMyDesktop',rmdConfig.locale_install_dir)
import os




class prefsWidget(object):
    labelStrings=[_('Overwite Existing Files'),_('Working Directory'),
                    _('Frames Per Second'),_('Encode On the Fly'),_('Zero Compression'),
                    _('Quick Subsampling'),_('Shared Threshold'),_('Full shots at every frame'),
                    _('Channels'),_('Frequency'),_('Device'),_('Display'),_('Mouse Cursor'),
                    _('MIT-Shm extension'),_('Video Quality'),_('Sound Quality'),
                    _('Drop Frames(encoder)'),_('Startup Delay(secs)'),]
    mouseStrings=[_('Normal'),_('White'),_('Black'),_('None')]
    stateStrings=[_('Enabled'),_('Disabled')]#0,1
    tabStrings=[_('Files'),_('Performance'),_('Sound'),_('Misc')]
    tooltipLabels=[_('By default, if you try to save under a filename that already\nexists, the new file will be renamed\n(for example if you try to save as out.ogg and that file exists, your file will be named out.ogg.1).\nBy checking this box, this behavior is disabled and the old file is overwritten.\n'),
                    _('Directory where temporary files will be saved.'),
                    _('Frames Per Second'),
                    _('Encode simultaneously with the recording.\nThis will require a lot more processing power.\n'),
                    _('Do not apply compression on the temporary files.\nIf enabled, the program will need less processing power,\nin the expense of hard disk space.\nThis option is valid only when encoding on the fly is disabled.'),
                    _('This option, if enabled, will cause the program to require less\nprocessing power, but it might make the colors look a bit more blurry.'),
                    _('Amount of screen change, within a frame that triggers retrieval\nof the screenshot through the MIT-Shared memory extension.\nThis option has no effect when using the full shots option.\n'),
                    _('This option should be enabled when recording 3d windows.\nIt is also auto-enabled when recording a\nknown 3d compositing window manager.\n '),
                    _('Number of audio channels.'),
                    _('Sound frequency.'),
                    _('ALSA sound device, that is used for sound recording.'),
                    _('Connection to the Xserver.'),
                    _('The mouse cursor that will be drawn.\nNormal is for the real cursor that you see while recording,\nwhile black and white are fake cursors, drawn by the program.\nYou can also disable cursor drawing.'),
                    _('Use the MIT-Shared memory extension, whenever appropriate,\n depending on the rest of the program settings.\nDisabling this option is not recommended,\nas it may severely slow down the program.'),
                    ]
    def __tooltips__(self):
        self.tooltips=gtk.Tooltips()
        for i in range(14):
            self.tooltips.set_tip(self.eboxes[i],self.tooltipLabels[i])


    def destroy(self,Event=None):
        self.values[0]=self.fpsSpinButton.get_value_as_int()
        self.values[1]=self.mouseComboBox.get_active()
        self.values[3]=self.fullComboBox.get_active()
        self.values[7]=self.channelsSpinButton.get_value_as_int()
        self.values[8]=self.freqSpinButton.get_value_as_int()
        self.values[9]=self.deviceEntry.get_text().replace(' ','')
        self.values[12]=self.displayEntry.get_text().replace(' ','')
        self.values[13]=self.sharedComboBox.get_active()
        self.values[15]=self.thresSpinButton.get_value_as_int()
        self.values[16]=self.quickComboBox.get_active()
        self.values[17]=self.workdirEntry.get_text()
        self.values[18]=self.onTheFlyComboBox.get_active()
        self.values[19]=self.zeroCmpComboBox.get_active()
        self.values[20]=self.overwriteFilesButton.get_active()

        self.window.destroy()
        self.optionsOpen[0]=0

    def __exit__(self,Event=None):
        gtk.main_quit()
        self.values[0]=-1
        self.optionsOpen[0]=0
        self.window.destroy()



    def __subWidgets__(self):
        self.labels={}
        self.boxes={}
        self.labelbox={}
        self.eboxes={}
        for i in range(4):
            self.labelbox[i]=gtk.VBox(homogeneous=False, spacing=20)
        self.notebook = gtk.Notebook()

#Files page
        for i in range(2):
            self.labels[i]=gtk.Label(self.labelStrings[i])
            self.labels[i].set_justify(gtk.JUSTIFY_LEFT)
            self.boxes[i]=gtk.HBox(homogeneous=False, spacing=40)
            self.boxes[i].pack_start(self.labels[i],expand=False,fill=False)
            self.labels[i].show()
            self.eboxes[i]=gtk.EventBox()
            self.eboxes[i].add(self.boxes[i])
            self.labelbox[0].pack_start(self.eboxes[i],expand=False,fill=False)

        self.overwriteFilesButton=gtk.CheckButton(label=None)
        self.overwriteFilesButton.set_active(self.values[20])
        self.overwriteFilesButton.show()
        self.boxes[0].pack_end(self.overwriteFilesButton,expand=False,fill=False)

        self.workdirEntry= gtk.Entry(max=0)
        self.workdirEntry.set_text(self.values[17])
        self.workdirEntry.show()
        self.boxes[1].pack_end(self.workdirEntry,expand=True,fill=True)

#Performance page
        for i in xrange(2,8):
            self.labels[i]=gtk.Label(self.labelStrings[i])
            self.labels[i].set_justify(gtk.JUSTIFY_LEFT)
            self.boxes[i]=gtk.HBox(homogeneous=False, spacing=40)
            self.boxes[i].pack_start(self.labels[i],expand=False,fill=False)
            self.labels[i].show()
            self.eboxes[i]=gtk.EventBox()
            self.eboxes[i].add(self.boxes[i])
            self.labelbox[1].pack_start(self.eboxes[i],expand=False,fill=False)

        self.fpsAdjustment=gtk.Adjustment(value=self.values[0], lower=1, upper=50, step_incr=1, page_incr=5, page_size=0)
        self.fpsSpinButton= gtk.SpinButton(self.fpsAdjustment, climb_rate=0.5, digits=0)
        self.fpsSpinButton.show()
        self.boxes[2].pack_end(self.fpsSpinButton,expand=False,fill=False)

        self.onTheFlyComboBox = gtk.combo_box_new_text()
        for i in range(2):
            self.onTheFlyComboBox.append_text(self.stateStrings[i])
        self.onTheFlyComboBox.set_active(self.values[18])
        self.onTheFlyComboBox.show()
        self.boxes[3].pack_end(self.onTheFlyComboBox,expand=False,fill=False)

        self.zeroCmpComboBox = gtk.combo_box_new_text()
        for i in range(2):
            self.zeroCmpComboBox.append_text(self.stateStrings[i])
        self.zeroCmpComboBox.set_active(self.values[19])
        self.zeroCmpComboBox.show()
        self.boxes[4].pack_end(self.zeroCmpComboBox,expand=False,fill=False)

        self.quickComboBox = gtk.combo_box_new_text()
        for i in range(2):
            self.quickComboBox.append_text(self.stateStrings[i])
        self.quickComboBox.set_active(self.values[16])
        self.quickComboBox.show()
        self.boxes[5].pack_end(self.quickComboBox,expand=False,fill=False)

        self.thresAdjustment=gtk.Adjustment(value=self.values[15], lower=0,upper=100, step_incr=1, page_incr=5, page_size=1)
        self.thresSpinButton= gtk.SpinButton(self.thresAdjustment, climb_rate=0.5, digits=0)
        self.thresSpinButton.show()
        self.boxes[6].pack_end(self.thresSpinButton,expand=False,fill=False)

        self.fullComboBox = gtk.combo_box_new_text()
        for i in range(2):
            self.fullComboBox.append_text(self.stateStrings[i])
        self.fullComboBox.set_active(self.values[3])
        self.fullComboBox.show()
        self.boxes[7].pack_end(self.fullComboBox,expand=False,fill=False)


#sound page
        for i in xrange(8,11):
            self.labels[i]=gtk.Label(self.labelStrings[i])
            self.labels[i].set_justify(gtk.JUSTIFY_LEFT)
            self.boxes[i]=gtk.HBox(homogeneous=False, spacing=0)
            self.boxes[i].pack_start(self.labels[i],expand=False,fill=False)
            self.labels[i].show()
            self.eboxes[i]=gtk.EventBox()
            self.eboxes[i].add(self.boxes[i])
            self.labelbox[2].pack_start(self.eboxes[i],expand=False,fill=False)


        self.channelsAdjustment=gtk.Adjustment(value=self.values[7], lower=1,upper=2, step_incr=1, page_incr=1, page_size=1)
        self.channelsSpinButton= gtk.SpinButton(self.channelsAdjustment, climb_rate=0.5, digits=0)
        self.channelsSpinButton.show()
        self.boxes[8].pack_end(self.channelsSpinButton,expand=False,fill=False)


        self.freqAdjustment=gtk.Adjustment(value=self.values[8], lower=0,upper=44100, step_incr=1, page_incr=100, page_size=0)
        self.freqSpinButton= gtk.SpinButton(self.freqAdjustment, climb_rate=0.5, digits=0)
        self.freqSpinButton.show()
        self.boxes[9].pack_end(self.freqSpinButton,expand=False,fill=False)


        self.deviceEntry= gtk.Entry(max=0)
        self.deviceEntry.set_text(self.values[9])
        self.deviceEntry.show()
        self.boxes[10].pack_end(self.deviceEntry,expand=False,fill=False)

#misc page
        for i in xrange(11,14):
            self.labels[i]=gtk.Label(self.labelStrings[i])
            self.labels[i].set_justify(gtk.JUSTIFY_LEFT)
            self.boxes[i]=gtk.HBox(homogeneous=False, spacing=0)
            self.boxes[i].pack_start(self.labels[i],expand=False,fill=False)
            self.labels[i].show()
            self.eboxes[i]=gtk.EventBox()
            self.eboxes[i].add(self.boxes[i])
            self.labelbox[3].pack_start(self.eboxes[i],expand=False,fill=False)

        self.displayEntry= gtk.Entry(max=0)
        self.displayEntry.set_text(self.values[12])
        self.displayEntry.show()
        self.boxes[11].pack_end(self.displayEntry,expand=False,fill=False)


        self.mouseComboBox = gtk.combo_box_new_text()
        for i in range(4):
            self.mouseComboBox.append_text(self.mouseStrings[i])
        self.mouseComboBox.set_active(self.values[1])
        self.mouseComboBox.show()
        self.boxes[12].pack_end(self.mouseComboBox,expand=False,fill=False)


        self.sharedComboBox = gtk.combo_box_new_text()
        for i in range(2):
            self.sharedComboBox.append_text(self.stateStrings[i])
        self.sharedComboBox.set_active(self.values[13])
        self.sharedComboBox.show()
        self.boxes[13].pack_end(self.sharedComboBox,expand=False,fill=False)

        for i in range(14):
            self.boxes[i].show()
            self.eboxes[i].show()

#append and show
        for i in range(4):
            self.notebook.append_page(self.labelbox[i],gtk.Label(self.tabStrings[i]))
        self.window.add(self.notebook)
        for i in range(4):
            self.labelbox[i].show()
        self.notebook.show()


    def __init__(self,values,optionsOpen):
        self.values=values
        self.optionsOpen=optionsOpen
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(10)
        self.window.set_title("recordMyDesktop")
        self.__subWidgets__()
        self.__tooltips__()
        self.window.show()

    def main(self):
        gtk.main()
© All Rights Reserved