util/MiniTextControler.py
author laurent
Sun, 10 Jun 2012 20:18:34 +0200
changeset 764 f338651eca36
parent 725 31dade089db5
child 806 abf1afc1f04d
permissions -rw-r--r--
Fix bug project not marked as modified when changing URI_Location using discovery dialog
14
eb9fdd316a40 More precise design for plugins.... to be continued...
etisserant
parents: 13
diff changeset
     1
"""
725
31dade089db5 refactoring
Edouard Tisserant
parents: 722
diff changeset
     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
31dade089db5 refactoring
Edouard Tisserant
parents: 722
diff changeset
     5
import os
14
eb9fdd316a40 More precise design for plugins.... to be continued...
etisserant
parents: 13
diff changeset
     6
65
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
     7
class MiniTextControler:
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
     8
    
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
     9
    def __init__(self, filepath):
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    10
        self.FilePath = filepath
716
180e4a7d945c Adding search field for finding function or function block in library tree
laurent
parents: 715
diff changeset
    11
    
718
5d4dc150b956 refactoring
Edouard Tisserant
parents: 717
diff changeset
    12
    def CTNFullName(self):
716
180e4a7d945c Adding search field for finding function or function block in library tree
laurent
parents: 715
diff changeset
    13
        return ""
180e4a7d945c Adding search field for finding function or function block in library tree
laurent
parents: 715
diff changeset
    14
    
74
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    15
    def SetEditedElementText(self, tagname, text):
65
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    16
        file = open(self.FilePath, "w")
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    17
        file.write(text)
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    18
        file.close()
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    19
        
273
d15a20eb2b8b Bug with debug mode when displaying code fixed
greg
parents: 256
diff changeset
    20
    def GetEditedElementText(self, tagname, debug = False):
65
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    21
        if os.path.isfile(self.FilePath):
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    22
            file = open(self.FilePath, "r")
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    23
            text = file.read()
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    24
            file.close()
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    25
            return text
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    26
        return ""
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    27
    
273
d15a20eb2b8b Bug with debug mode when displaying code fixed
greg
parents: 256
diff changeset
    28
    def GetEditedElementInterfaceVars(self, tagname, debug = False):
74
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    29
        return []
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    30
    
273
d15a20eb2b8b Bug with debug mode when displaying code fixed
greg
parents: 256
diff changeset
    31
    def GetEditedElementType(self, tagname, debug = False):
74
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    32
        return "program"
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    33
    
273
d15a20eb2b8b Bug with debug mode when displaying code fixed
greg
parents: 256
diff changeset
    34
    def GetBlockTypes(self, tagname = "", debug = False):
74
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    35
        return []
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    36
    
630
91b2ae63ea3d Including external tools for editing plugin informations into Beremiz window
laurent
parents: 624
diff changeset
    37
    def GetDataTypes(self, tagname = "", basetypes = True, only_locatables = False, debug = False):
91b2ae63ea3d Including external tools for editing plugin informations into Beremiz window
laurent
parents: 624
diff changeset
    38
        return []
91b2ae63ea3d Including external tools for editing plugin informations into Beremiz window
laurent
parents: 624
diff changeset
    39
    
273
d15a20eb2b8b Bug with debug mode when displaying code fixed
greg
parents: 256
diff changeset
    40
    def GetEnumeratedDataValues(self, debug = False):
74
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    41
        return []
8a726a62fbfc Some bugs fixed
lbessard
parents: 66
diff changeset
    42
    
65
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    43
    def StartBuffering(self):
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    44
        pass
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    45
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    46
    def EndBuffering(self):
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    47
        pass
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    48
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    49
    def BufferProject(self):
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    50
        pass
e55d6faee9d1 Adding icons in Beremiz GUI
lbessard
parents: 64
diff changeset
    51