author | Laurent Bessard |
Fri, 10 May 2013 11:48:04 +0200 | |
changeset 1114 | 1a97222ffee9 |
parent 806 | abf1afc1f04d |
child 1347 | 533741e5075c |
permissions | -rw-r--r-- |
14
eb9fdd316a40
More precise design for plugins.... to be continued...
etisserant
parents:
13
diff
changeset
|
1 |
""" |
725 | 2 |
Minimal tab controller for a simple text editor |
14
eb9fdd316a40
More precise design for plugins.... to be continued...
etisserant
parents:
13
diff
changeset
|
3 |
""" |
eb9fdd316a40
More precise design for plugins.... to be continued...
etisserant
parents:
13
diff
changeset
|
4 |
|
725 | 5 |
import os |
14
eb9fdd316a40
More precise design for plugins.... to be continued...
etisserant
parents:
13
diff
changeset
|
6 |
|
65 | 7 |
class MiniTextControler: |
8 |
||
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
9 |
def __init__(self, filepath, controller): |
65 | 10 |
self.FilePath = filepath |
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
11 |
self.BaseController = controller |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
12 |
|
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
13 |
def __del__(self): |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
14 |
self.BaseController = None |
716
180e4a7d945c
Adding search field for finding function or function block in library tree
laurent
parents:
715
diff
changeset
|
15 |
|
718 | 16 |
def CTNFullName(self): |
716
180e4a7d945c
Adding search field for finding function or function block in library tree
laurent
parents:
715
diff
changeset
|
17 |
return "" |
180e4a7d945c
Adding search field for finding function or function block in library tree
laurent
parents:
715
diff
changeset
|
18 |
|
74 | 19 |
def SetEditedElementText(self, tagname, text): |
65 | 20 |
file = open(self.FilePath, "w") |
21 |
file.write(text) |
|
22 |
file.close() |
|
23 |
||
273 | 24 |
def GetEditedElementText(self, tagname, debug = False): |
65 | 25 |
if os.path.isfile(self.FilePath): |
26 |
file = open(self.FilePath, "r") |
|
27 |
text = file.read() |
|
28 |
file.close() |
|
29 |
return text |
|
30 |
return "" |
|
31 |
||
273 | 32 |
def GetEditedElementInterfaceVars(self, tagname, debug = False): |
74 | 33 |
return [] |
34 |
||
273 | 35 |
def GetEditedElementType(self, tagname, debug = False): |
74 | 36 |
return "program" |
37 |
||
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
38 |
def GetBlockType(self, type, inputs = None, debug = False): |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
39 |
return self.BaseController.GetBlockType(type, inputs, debug) |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
40 |
|
273 | 41 |
def GetBlockTypes(self, tagname = "", debug = False): |
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
42 |
return self.BaseController.GetBlockTypes(tagname, debug) |
74 | 43 |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
624
diff
changeset
|
44 |
def GetDataTypes(self, tagname = "", basetypes = True, only_locatables = False, debug = False): |
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
45 |
return self.BaseController.GetDataTypes(tagname, basetypes, only_locatables, debug) |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
624
diff
changeset
|
46 |
|
273 | 47 |
def GetEnumeratedDataValues(self, debug = False): |
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
725
diff
changeset
|
48 |
return self.BaseController.GetEnumeratedDataValues(debug) |
74 | 49 |
|
65 | 50 |
def StartBuffering(self): |
51 |
pass |
|
52 |
||
53 |
def EndBuffering(self): |
|
54 |
pass |
|
55 |
||
56 |
def BufferProject(self): |
|
57 |
pass |
|
58 |