Krita Source Code Documentation
Loading...
Searching...
No Matches
document.py
Go to the documentation of this file.
1"""
2SPDX-FileCopyrightText: 2017 Eliakin Costa <eliakim170@gmail.com>
3
4SPDX-License-Identifier: GPL-2.0-or-later
5"""
6
7class Document(object):
8
9 def __init__(self, filePath):
10 self._document = []
11 self._filePath = filePath
12
13 def open(self, filePath=''):
14 if filePath:
15 self._filePath = filePath
16
17 with open(self._filePath, 'r') as pythonFile:
18 self._document = pythonFile.read()
19
20 def save(self):
21 with open(self._filePath, 'w') as pythonFile:
22 pythonFile.write(self._document)
23
24 def compare(self, new_doc):
25 if len(self._document) != len(new_doc):
26 return False
27
28 if new_doc != self._document:
29 return False
30
31 return True
32
33 @property
34 def data(self):
35 return self._document
36
37 @data.setter
38 def data(self, data):
39 self._document = data
40
41 @property
42 def filePath(self):
43 return self._filePath