~kokoto-java/kazam/depencie-and-stuff

« back to all changes in this revision

Viewing changes to kazam/backend/prefs.py

  • Committer: David Klasinc
  • Date: 2012-11-11 19:36:05 UTC
  • mfrom: (193.2.82 unstable)
  • Revision ID: bigwhale@lubica.net-20121111193605-vh3fxglxwfhyh8ne
Merged from unstable branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from gettext import gettext as _
25
25
from xdg.BaseDirectory import xdg_config_home
26
26
 
 
27
from kazam.backend.config import KazamConfig
 
28
 
 
29
 
27
30
class Prefs():
28
31
    def __init__(self):
29
32
        """Initialize prefs and set all the preference variables to their
48
51
        self.capture_microphone = False
49
52
 
50
53
        self.capture_cursor_pic = False
 
54
        self.capture_borders_pic = False
51
55
 
52
56
        self.countdown_timer = 5
53
57
 
103
107
        self.silent = False
104
108
        self.sound = True
105
109
 
 
110
        self.config = KazamConfig()
 
111
 
 
112
        self.read_config()
 
113
 
106
114
        self.get_dirs()
107
115
 
108
116
    def get_audio_sources(self):
162
170
                    self.sound_files.append(file)
163
171
 
164
172
 
 
173
    def read_config (self):
 
174
        self.audio_source = self.config.getint("main", "audio_source")
 
175
        self.audio2_source = self.config.getint("main", "audio2_source")
 
176
 
 
177
        self.main_x = self.config.getint("main", "last_x")
 
178
        self.main_y = self.config.getint("main", "last_y")
 
179
 
 
180
        self.codec = self.config.getint("main", "codec")
 
181
 
 
182
        self.countdown_timer = self.config.getfloat("main", "counter")
 
183
        self.framerate = self.config.getfloat("main", "framerate")
 
184
 
 
185
        self.capture_cursor = self.config.getboolean("main", "capture_cursor")
 
186
        self.capture_microphone = self.config.getboolean("main", "capture_microphone")
 
187
        self.capture_speakers = self.config.getboolean("main", "capture_speakers")
 
188
 
 
189
        self.capture_cursor_pic = self.config.getboolean("main", "capture_cursor_pic")
 
190
        self.capture_borders_pic = self.config.getboolean("main", "capture_borders_pic")
 
191
 
 
192
        self.countdown_splash = self.config.getboolean("main", "countdown_splash")
 
193
 
 
194
        self.autosave_video = self.config.getboolean("main", "autosave_video")
 
195
        self.autosave_video_file = self.config.get("main", "autosave_video_file")
 
196
 
 
197
        self.autosave_picture = self.config.getboolean("main", "autosave_picture")
 
198
        self.autosave_picture_file = self.config.get("main", "autosave_picture_file")
 
199
 
 
200
        self.shutter_sound = self.config.getboolean("main", "shutter_sound")
 
201
        self.shutter_type = self.config.getint("main", "shutter_type")
 
202
 
 
203
 
 
204
    def save_config(self):
 
205
        self.config.set("main", "capture_cursor", self.capture_cursor)
 
206
        self.config.set("main", "capture_speakers", self.capture_speakers)
 
207
        self.config.set("main", "capture_microphone", self.capture_microphone)
 
208
 
 
209
        self.config.set("main", "capture_cursor_pic", self.capture_cursor_pic)
 
210
        self.config.set("main", "capture_borders_pic", self.capture_borders_pic)
 
211
 
 
212
        self.config.set("main", "last_x", self.main_x)
 
213
        self.config.set("main", "last_y", self.main_y)
 
214
 
 
215
        if self.sound:
 
216
            self.config.set("main", "audio_source", self.audio_source)
 
217
            self.config.set("main", "audio2_source", self.audio2_source)
 
218
 
 
219
        self.config.set("main", "countdown_splash", self.countdown_splash)
 
220
        self.config.set("main", "counter", self.countdown_timer)
 
221
        self.config.set("main", "codec", self.codec)
 
222
        self.config.set("main", "framerate", self.framerate)
 
223
        self.config.set("main", "autosave_video", self.autosave_video)
 
224
        self.config.set("main", "autosave_video_file", self.autosave_video_file)
 
225
        self.config.set("main", "autosave_picture", self.autosave_picture)
 
226
        self.config.set("main", "autosave_picture_file", self.autosave_picture_file)
 
227
        self.config.set("main", "shutter_sound", self.shutter_sound)
 
228
        self.config.set("main", "shutter_type", self.shutter_type)
 
229
 
 
230
        self.config.write()
 
231
 
165
232
prefs = Prefs()