|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# |
| 3 | +# Copyright 2010-2014 The pygit2 contributors |
| 4 | +# |
| 5 | +# This file is free software; you can redistribute it and/or modify |
| 6 | +# it under the terms of the GNU General Public License, version 2, |
| 7 | +# as published by the Free Software Foundation. |
| 8 | +# |
| 9 | +# In addition to the permissions in the GNU General Public License, |
| 10 | +# the authors give you unlimited permission to link the compiled |
| 11 | +# version of this file into combinations with other programs, |
| 12 | +# and to distribute those combinations without any restriction |
| 13 | +# coming from the use of this file. (The General Public License |
| 14 | +# restrictions do apply in other respects; for example, they cover |
| 15 | +# modification of the file, and distribution when not linked into |
| 16 | +# a combined executable.) |
| 17 | +# |
| 18 | +# This file is distributed in the hope that it will be useful, but |
| 19 | +# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | +# General Public License for more details. |
| 22 | +# |
| 23 | +# You should have received a copy of the GNU General Public License |
| 24 | +# along with this program; see the file COPYING. If not, write to |
| 25 | +# the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
| 26 | +# Boston, MA 02110-1301, USA. |
| 27 | + |
| 28 | +from _pygit2 import option |
| 29 | +from _pygit2 import GIT_OPT_GET_SEARCH_PATH, GIT_OPT_SET_SEARCH_PATH |
| 30 | +from _pygit2 import GIT_OPT_GET_MWINDOW_SIZE, GIT_OPT_SET_MWINDOW_SIZE |
| 31 | + |
| 32 | +class SearchPathList(object): |
| 33 | + |
| 34 | + def __getitem__(self, key): |
| 35 | + return option(GIT_OPT_GET_SEARCH_PATH, key) |
| 36 | + |
| 37 | + def __setitem__(self, key, value): |
| 38 | + option(GIT_OPT_SET_SEARCH_PATH, key, value) |
| 39 | + |
| 40 | +class Settings(object): |
| 41 | + |
| 42 | + __slots__ = ['mwindow_size', 'search_path'] |
| 43 | + |
| 44 | + search_path = SearchPathList() |
| 45 | + |
| 46 | + @property |
| 47 | + def mwindow_size(self): |
| 48 | + return option(GIT_OPT_GET_MWINDOW_SIZE) |
| 49 | + |
| 50 | + @mwindow_size.setter |
| 51 | + def mwindow_size(self, value): |
| 52 | + option(GIT_OPT_SET_MWINDOW_SIZE, value) |
0 commit comments