88
88
# Connect the signals to the handlers
89
89
self.toplevel.signal_autoconnect(dic)
91
# Apply window size and position
92
width = self.pref.get_preference('window_width', 'int')
93
height = self.pref.get_preference('window_height', 'int')
94
self.window.resize(width, height)
95
x = self.pref.get_preference('window_x', 'int')
96
y = self.pref.get_preference('window_y', 'int')
97
self.window.move(x, y)
98
# Apply paned position
99
pos = self.pref.get_preference('paned_position', 'int')
100
self.comm.hpaned_main.set_position(pos)
91
102
# Load default data into the panels
92
103
self.treeview_left = self.toplevel.get_widget('treeview_left')
93
104
self.treeview_right = self.toplevel.get_widget('treeview_right')
365
383
self.config.write(fp)
368
def get_strict_commit(self):
369
""" Get strict commit preference. """
370
if self.config.has_option('preferences', 'strict_commit'):
371
return self.config.getboolean('preferences', 'strict_commit')
373
return self._get_default('strict_commit')
375
def set_strict_commit(self, value):
376
""" Set strict commit preference. """
377
if self.config.has_section('preferences'):
378
self.config.set('preferences', 'strict_commit', value)
380
self.config.add_section('preferences')
381
self.config.set('preferences', 'strict_commit', value)
383
def get_dotted_files(self):
384
""" Get dotted files preference. """
385
if self.config.has_option('preferences', 'dotted_files'):
386
return self.config.getboolean('preferences', 'dotted_files')
388
return self._get_default('dotted_files')
390
def set_dotted_files(self, value):
391
""" Set dotted files preference. """
392
if self.config.has_section('preferences'):
393
self.config.set('preferences', 'dotted_files', value)
395
self.config.add_section('preferences')
396
self.config.set('preferences', 'dotted_files', value)
386
def get_preference(self, option, kind='str'):
387
""" Get the value of the given option.
389
:param kind: str/bool/int/float. default: str
391
if self.config.has_option('preferences', option):
393
return self.config.getboolean('preferences', option)
395
return self.config.getint('preferences', option)
396
elif kind == 'float':
397
return self.config.getfloat('preferences', option)
399
return self.config.get('preferences', option)
402
return self._get_default(option)
406
def set_preference(self, option, value):
407
""" Set the value of the given option. """
408
if self.config.has_section('preferences'):
409
self.config.set('preferences', option, value)
411
self.config.add_section('preferences')
412
self.config.set('preferences', option, value)
398
414
def get_bookmarks(self):
399
415
""" Return the list of bookmarks. """
400
416
bookmarks = self.config.sections()