source: trunk/PARPG/tools/Writing Editor/scripts/settings.py @ 217

Revision 217, 1.7 KB checked in by bretzel_parpg, 10 years ago (diff)

This is what I have so far for the writing editor. All the features in it are fully functional except
for the dialog map.
NOTE: You will have to have PyQt4 installed for this application to run. There are some instructions in
the readme but it is incomplete

Line 
1#!/usr/bin/python
2
3#   This file is part of PARPG.
4
5#   PARPG is free software: you can redistribute it and/or modify
6#   it under the terms of the GNU General Public License as published by
7#   the Free Software Foundation, either version 3 of the License, or
8#   (at your option) any later version.
9
10#   PARPG is distributed in the hope that it will be useful,
11#   but WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#   GNU General Public License for more details.
14
15#   You should have received a copy of the GNU General Public License
16#   along with PARPG.  If not, see <http://www.gnu.org/licenses/>.
17
18class Settings():
19    """
20    The class that contains all of the settings
21    """
22    def __init__(self):
23        """
24        Initialize the instance
25        """
26        self.res_width = None
27        self.res_height = None
28
29    def readSettingsFromFile(self, filename):
30        """
31        Read the settings from a file
32        @type filename: string
33        @param filename: the file to read from
34        @return: None
35        """
36        file_open = open(filename, 'r')
37        contents = file_open.read().strip()
38        file_open.close()
39
40        s_contents = contents.split('\n')
41
42        self.res_width = s_contents[0]
43        self.res_height = s_contents[1]
44
45    def writeSettingsToFile(self, filename):
46        """
47        Write the current settings to a file
48        @type filename: string
49        @param filename: the file to write to
50        @return: None
51        """
52        text_to_write = self.res_width + '\n' + self.res_height
53        file_open = open(filename, 'w')
54        file_open.write(text_to_write)
55        file_open.close()
56       
Note: See TracBrowser for help on using the repository browser.