author | Edouard Tisserant |
Sat, 09 Jun 2012 00:08:34 +0200 | |
changeset 763 | c1104099c151 |
parent 751 | a8dace95f965 |
child 782 | 6f0e10085df9 |
permissions | -rw-r--r-- |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
1 |
import keyword |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
2 |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
3 |
import wx |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
4 |
import wx.grid |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
5 |
import wx.stc as stc |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
6 |
import wx.lib.buttons |
742
41a4a560406c
Fixed runtime problems with python 2.6 without wx installed
Edouard Tisserant
parents:
738
diff
changeset
|
7 |
from util.misc import opjimg |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
8 |
|
738 | 9 |
from controls import CustomGrid, CustomTable |
10 |
from ConfTreeNodeEditor import ConfTreeNodeEditor |
|
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
11 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
12 |
if wx.Platform == '__WXMSW__': |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
13 |
faces = { 'times': 'Times New Roman', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
14 |
'mono' : 'Courier New', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
15 |
'helv' : 'Arial', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
16 |
'other': 'Comic Sans MS', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
17 |
'size' : 10, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
18 |
'size2': 8, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
19 |
} |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
20 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
21 |
faces = { 'times': 'Times', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
22 |
'mono' : 'Courier', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
23 |
'helv' : 'Helvetica', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
24 |
'other': 'new century schoolbook', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
25 |
'size' : 12, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
26 |
'size2': 10, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
27 |
} |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
28 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
29 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
30 |
def AppendMenu(parent, help, id, kind, text): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
31 |
if wx.VERSION >= (2, 6, 0): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
32 |
parent.Append(help=help, id=id, kind=kind, text=text) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
33 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
34 |
parent.Append(helpString=help, id=id, kind=kind, item=text) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
35 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
36 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
37 |
[ID_CPPEDITOR, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
38 |
] = [wx.NewId() for _init_ctrls in range(1)] |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
39 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
40 |
CPP_KEYWORDS = ["asm", "auto", "bool", "break", "case", "catch", "char", "class", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
41 |
"const", "const_cast", "continue", "default", "delete", "do", "double", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
42 |
"dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
43 |
"float", "for", "friend", "goto", "if", "inline", "int", "long", "mutable", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
44 |
"namespace", "new", "operator", "private", "protected", "public", "register", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
45 |
"reinterpret_cast", "return", "short", "signed", "sizeof", "static", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
46 |
"static_cast", "struct", "switch", "template", "this", "throw", "true", "try", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
47 |
"typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
48 |
"void", "volatile", "wchar_t", "while"] |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
49 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
50 |
def GetCursorPos(old, new): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
51 |
old_length = len(old) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
52 |
new_length = len(new) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
53 |
common_length = min(old_length, new_length) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
54 |
i = 0 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
55 |
for i in xrange(common_length): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
56 |
if old[i] != new[i]: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
57 |
break |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
58 |
if old_length < new_length: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
59 |
if common_length > 0 and old[i] != new[i]: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
60 |
return i + new_length - old_length |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
61 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
62 |
return i + new_length - old_length + 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
63 |
elif old_length > new_length or i < min(old_length, new_length) - 1: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
64 |
if common_length > 0 and old[i] != new[i]: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
65 |
return i |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
66 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
67 |
return i + 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
68 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
69 |
return None |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
70 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
71 |
class CppEditor(stc.StyledTextCtrl): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
72 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
73 |
fold_symbols = 3 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
74 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
75 |
def __init__(self, parent, name, window, controler): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
76 |
stc.StyledTextCtrl.__init__(self, parent, ID_CPPEDITOR, wx.DefaultPosition, |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
77 |
wx.Size(0, 0), 0) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
78 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
79 |
self.SetMarginType(1, stc.STC_MARGIN_NUMBER) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
80 |
self.SetMarginWidth(1, 25) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
81 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
82 |
self.CmdKeyAssign(ord('B'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMIN) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
83 |
self.CmdKeyAssign(ord('N'), stc.STC_SCMOD_CTRL, stc.STC_CMD_ZOOMOUT) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
84 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
85 |
self.SetLexer(stc.STC_LEX_CPP) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
86 |
self.SetKeyWords(0, " ".join(CPP_KEYWORDS)) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
87 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
88 |
self.SetProperty("fold", "1") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
89 |
self.SetProperty("tab.timmy.whinge.level", "1") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
90 |
self.SetMargins(0,0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
91 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
92 |
self.SetViewWhiteSpace(False) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
93 |
#self.SetBufferedDraw(False) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
94 |
#self.SetViewEOL(True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
95 |
#self.SetEOLMode(stc.STC_EOL_CRLF) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
96 |
#self.SetUseAntiAliasing(True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
97 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
98 |
self.SetEdgeMode(stc.STC_EDGE_BACKGROUND) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
99 |
self.SetEdgeColumn(78) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
100 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
101 |
# Setup a margin to hold fold markers |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
102 |
#self.SetFoldFlags(16) ### WHAT IS THIS VALUE? WHAT ARE THE OTHER FLAGS? DOES IT MATTER? |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
103 |
self.SetMarginType(2, stc.STC_MARGIN_SYMBOL) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
104 |
self.SetMarginMask(2, stc.STC_MASK_FOLDERS) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
105 |
self.SetMarginSensitive(2, True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
106 |
self.SetMarginWidth(2, 12) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
107 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
108 |
if self.fold_symbols == 0: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
109 |
# Arrow pointing right for contracted folders, arrow pointing down for expanded |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
110 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_ARROWDOWN, "black", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
111 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_ARROW, "black", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
112 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "black", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
113 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "black", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
114 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
115 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
116 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
117 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
118 |
elif self.fold_symbols == 1: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
119 |
# Plus for contracted folders, minus for expanded |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
120 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_MINUS, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
121 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_PLUS, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
122 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
123 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
124 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
125 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
126 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
127 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
128 |
elif self.fold_symbols == 2: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
129 |
# Like a flattened tree control using circular headers and curved joins |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
130 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_CIRCLEMINUS, "white", "#404040") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
131 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_CIRCLEPLUS, "white", "#404040") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
132 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#404040") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
133 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNERCURVE, "white", "#404040") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
134 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
135 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
136 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE, "white", "#404040") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
137 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
138 |
elif self.fold_symbols == 3: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
139 |
# Like a flattened tree control using square headers |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
140 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_BOXMINUS, "white", "#808080") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
141 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_BOXPLUS, "white", "#808080") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
142 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#808080") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
143 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNER, "white", "#808080") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
144 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_BOXPLUSCONNECTED, "white", "#808080") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
145 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
146 |
self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER, "white", "#808080") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
147 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
148 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
149 |
self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
150 |
self.Bind(stc.EVT_STC_MARGINCLICK, self.OnMarginClick) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
151 |
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPressed) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
152 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
153 |
# Make some styles, The lexer defines what each style is used for, we |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
154 |
# just have to define what each style looks like. This set is adapted from |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
155 |
# Scintilla sample property files. |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
156 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
157 |
# Global default styles for all languages |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
158 |
self.StyleSetSpec(stc.STC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
159 |
self.StyleClearAll() # Reset all to be like the default |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
160 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
161 |
# Global default styles for all languages |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
162 |
self.StyleSetSpec(stc.STC_STYLE_DEFAULT, "face:%(mono)s,size:%(size)d" % faces) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
163 |
self.StyleSetSpec(stc.STC_STYLE_LINENUMBER, "back:#C0C0C0,face:%(helv)s,size:%(size2)d" % faces) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
164 |
self.StyleSetSpec(stc.STC_STYLE_CONTROLCHAR, "face:%(other)s" % faces) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
165 |
self.StyleSetSpec(stc.STC_STYLE_BRACELIGHT, "fore:#FFFFFF,back:#0000FF,bold") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
166 |
self.StyleSetSpec(stc.STC_STYLE_BRACEBAD, "fore:#000000,back:#FF0000,bold") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
167 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
168 |
self.StyleSetSpec(stc.STC_C_COMMENT, 'fore:#408060') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
169 |
self.StyleSetSpec(stc.STC_C_COMMENTLINE, 'fore:#408060') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
170 |
self.StyleSetSpec(stc.STC_C_COMMENTDOC, 'fore:#408060') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
171 |
self.StyleSetSpec(stc.STC_C_NUMBER, 'fore:#0076AE') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
172 |
self.StyleSetSpec(stc.STC_C_WORD, 'bold,fore:#800056') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
173 |
self.StyleSetSpec(stc.STC_C_STRING, 'fore:#2a00ff') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
174 |
self.StyleSetSpec(stc.STC_C_PREPROCESSOR, 'bold,fore:#800056') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
175 |
self.StyleSetSpec(stc.STC_C_OPERATOR, 'bold') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
176 |
self.StyleSetSpec(stc.STC_C_STRINGEOL, 'back:#FFD5FF') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
177 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
178 |
# register some images for use in the AutoComplete box. |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
179 |
#self.RegisterImage(1, images.getSmilesBitmap()) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
180 |
self.RegisterImage(1, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
181 |
wx.ArtProvider.GetBitmap(wx.ART_DELETE, size=(16,16))) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
182 |
self.RegisterImage(2, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
183 |
wx.ArtProvider.GetBitmap(wx.ART_NEW, size=(16,16))) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
184 |
self.RegisterImage(3, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
185 |
wx.ArtProvider.GetBitmap(wx.ART_COPY, size=(16,16))) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
186 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
187 |
# Indentation size |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
188 |
self.SetTabWidth(2) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
189 |
self.SetUseTabs(0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
190 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
191 |
self.Controler = controler |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
192 |
self.ParentWindow = window |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
193 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
194 |
self.DisableEvents = True |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
195 |
self.Name = name |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
196 |
self.CurrentAction = None |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
197 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
198 |
self.SetModEventMask(wx.stc.STC_MOD_BEFOREINSERT|wx.stc.STC_MOD_BEFOREDELETE) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
199 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
200 |
self.Bind(wx.stc.EVT_STC_DO_DROP, self.OnDoDrop, id=ID_CPPEDITOR) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
201 |
self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
202 |
self.Bind(wx.stc.EVT_STC_MODIFIED, self.OnModification, id=ID_CPPEDITOR) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
203 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
204 |
def OnModification(self, event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
205 |
if not self.DisableEvents: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
206 |
mod_type = event.GetModificationType() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
207 |
if not (mod_type&wx.stc.STC_PERFORMED_UNDO or mod_type&wx.stc.STC_PERFORMED_REDO): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
208 |
if mod_type&wx.stc.STC_MOD_BEFOREINSERT: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
209 |
if self.CurrentAction == None: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
210 |
self.StartBuffering() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
211 |
elif self.CurrentAction[0] != "Add" or self.CurrentAction[1] != event.GetPosition() - 1: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
212 |
self.Controler.EndBuffering() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
213 |
self.StartBuffering() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
214 |
self.CurrentAction = ("Add", event.GetPosition()) |
658 | 215 |
wx.CallAfter(self.RefreshModel) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
216 |
elif mod_type&wx.stc.STC_MOD_BEFOREDELETE: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
217 |
if self.CurrentAction == None: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
218 |
self.StartBuffering() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
219 |
elif self.CurrentAction[0] != "Delete" or self.CurrentAction[1] != event.GetPosition() + 1: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
220 |
self.Controler.EndBuffering() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
221 |
self.StartBuffering() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
222 |
self.CurrentAction = ("Delete", event.GetPosition()) |
658 | 223 |
wx.CallAfter(self.RefreshModel) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
224 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
225 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
226 |
def OnDoDrop(self, event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
227 |
self.ResetBuffer() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
228 |
wx.CallAfter(self.RefreshModel) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
229 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
230 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
231 |
# Buffer the last model state |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
232 |
def RefreshBuffer(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
233 |
self.Controler.BufferCFile() |
658 | 234 |
if self.ParentWindow is not None: |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
235 |
self.ParentWindow.RefreshTitle() |
587 | 236 |
self.ParentWindow.RefreshFileMenu() |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
237 |
self.ParentWindow.RefreshEditMenu() |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
238 |
self.ParentWindow.RefreshPageTitles() |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
239 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
240 |
def StartBuffering(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
241 |
self.Controler.StartBuffering() |
658 | 242 |
if self.ParentWindow is not None: |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
243 |
self.ParentWindow.RefreshTitle() |
587 | 244 |
self.ParentWindow.RefreshFileMenu() |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
245 |
self.ParentWindow.RefreshEditMenu() |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
246 |
self.ParentWindow.RefreshPageTitles() |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
247 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
248 |
def ResetBuffer(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
249 |
if self.CurrentAction != None: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
250 |
self.Controler.EndBuffering() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
251 |
self.CurrentAction = None |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
252 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
253 |
def RefreshView(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
254 |
self.ResetBuffer() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
255 |
self.DisableEvents = True |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
256 |
old_cursor_pos = self.GetCurrentPos() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
257 |
old_text = self.GetText() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
258 |
new_text = self.Controler.GetPartText(self.Name) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
259 |
self.SetText(new_text) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
260 |
new_cursor_pos = GetCursorPos(old_text, new_text) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
261 |
if new_cursor_pos != None: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
262 |
self.GotoPos(new_cursor_pos) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
263 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
264 |
self.GotoPos(old_cursor_pos) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
265 |
self.ScrollToColumn(0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
266 |
self.EmptyUndoBuffer() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
267 |
self.DisableEvents = False |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
268 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
269 |
self.Colourise(0, -1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
270 |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
271 |
def DoGetBestSize(self): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
272 |
return self.ParentWindow.GetPanelBestSize() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
273 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
274 |
def RefreshModel(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
275 |
self.Controler.SetPartText(self.Name, self.GetText()) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
276 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
277 |
def OnKeyPressed(self, event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
278 |
if self.CallTipActive(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
279 |
self.CallTipCancel() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
280 |
key = event.GetKeyCode() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
281 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
282 |
if key == 32 and event.ControlDown(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
283 |
pos = self.GetCurrentPos() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
284 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
285 |
# Tips |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
286 |
if event.ShiftDown(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
287 |
pass |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
288 |
## self.CallTipSetBackground("yellow") |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
289 |
## self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n' |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
290 |
## 'show some suff, maybe parameters..\n\n' |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
291 |
## 'fubar(param1, param2)') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
292 |
# Code completion |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
293 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
294 |
self.AutoCompSetIgnoreCase(False) # so this needs to match |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
295 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
296 |
# Images are specified with a appended "?type" |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
297 |
self.AutoCompShow(0, " ".join([word + "?1" for word in CPP_KEYWORDS])) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
298 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
299 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
300 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
301 |
def OnKillFocus(self, event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
302 |
self.AutoCompCancel() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
303 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
304 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
305 |
def OnUpdateUI(self, evt): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
306 |
# check for matching braces |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
307 |
braceAtCaret = -1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
308 |
braceOpposite = -1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
309 |
charBefore = None |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
310 |
caretPos = self.GetCurrentPos() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
311 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
312 |
if caretPos > 0: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
313 |
charBefore = self.GetCharAt(caretPos - 1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
314 |
styleBefore = self.GetStyleAt(caretPos - 1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
315 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
316 |
# check before |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
317 |
if charBefore and chr(charBefore) in "[]{}()" and styleBefore == stc.STC_P_OPERATOR: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
318 |
braceAtCaret = caretPos - 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
319 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
320 |
# check after |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
321 |
if braceAtCaret < 0: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
322 |
charAfter = self.GetCharAt(caretPos) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
323 |
styleAfter = self.GetStyleAt(caretPos) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
324 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
325 |
if charAfter and chr(charAfter) in "[]{}()" and styleAfter == stc.STC_P_OPERATOR: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
326 |
braceAtCaret = caretPos |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
327 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
328 |
if braceAtCaret >= 0: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
329 |
braceOpposite = self.BraceMatch(braceAtCaret) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
330 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
331 |
if braceAtCaret != -1 and braceOpposite == -1: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
332 |
self.BraceBadLight(braceAtCaret) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
333 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
334 |
self.BraceHighlight(braceAtCaret, braceOpposite) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
335 |
#pt = self.PointFromPosition(braceOpposite) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
336 |
#self.Refresh(True, wxRect(pt.x, pt.y, 5,5)) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
337 |
#print pt |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
338 |
#self.Refresh(False) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
339 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
340 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
341 |
def OnMarginClick(self, evt): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
342 |
# fold and unfold as needed |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
343 |
if evt.GetMargin() == 2: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
344 |
if evt.GetShift() and evt.GetControl(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
345 |
self.FoldAll() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
346 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
347 |
lineClicked = self.LineFromPosition(evt.GetPosition()) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
348 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
349 |
if self.GetFoldLevel(lineClicked) & stc.STC_FOLDLEVELHEADERFLAG: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
350 |
if evt.GetShift(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
351 |
self.SetFoldExpanded(lineClicked, True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
352 |
self.Expand(lineClicked, True, True, 1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
353 |
elif evt.GetControl(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
354 |
if self.GetFoldExpanded(lineClicked): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
355 |
self.SetFoldExpanded(lineClicked, False) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
356 |
self.Expand(lineClicked, False, True, 0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
357 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
358 |
self.SetFoldExpanded(lineClicked, True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
359 |
self.Expand(lineClicked, True, True, 100) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
360 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
361 |
self.ToggleFold(lineClicked) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
362 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
363 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
364 |
def FoldAll(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
365 |
lineCount = self.GetLineCount() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
366 |
expanding = True |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
367 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
368 |
# find out if we are folding or unfolding |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
369 |
for lineNum in range(lineCount): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
370 |
if self.GetFoldLevel(lineNum) & stc.STC_FOLDLEVELHEADERFLAG: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
371 |
expanding = not self.GetFoldExpanded(lineNum) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
372 |
break |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
373 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
374 |
lineNum = 0 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
375 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
376 |
while lineNum < lineCount: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
377 |
level = self.GetFoldLevel(lineNum) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
378 |
if level & stc.STC_FOLDLEVELHEADERFLAG and \ |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
379 |
(level & stc.STC_FOLDLEVELNUMBERMASK) == stc.STC_FOLDLEVELBASE: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
380 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
381 |
if expanding: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
382 |
self.SetFoldExpanded(lineNum, True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
383 |
lineNum = self.Expand(lineNum, True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
384 |
lineNum = lineNum - 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
385 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
386 |
lastChild = self.GetLastChild(lineNum, -1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
387 |
self.SetFoldExpanded(lineNum, False) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
388 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
389 |
if lastChild > lineNum: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
390 |
self.HideLines(lineNum+1, lastChild) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
391 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
392 |
lineNum = lineNum + 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
393 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
394 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
395 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
396 |
def Expand(self, line, doExpand, force=False, visLevels=0, level=-1): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
397 |
lastChild = self.GetLastChild(line, level) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
398 |
line = line + 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
399 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
400 |
while line <= lastChild: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
401 |
if force: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
402 |
if visLevels > 0: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
403 |
self.ShowLines(line, line) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
404 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
405 |
self.HideLines(line, line) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
406 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
407 |
if doExpand: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
408 |
self.ShowLines(line, line) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
409 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
410 |
if level == -1: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
411 |
level = self.GetFoldLevel(line) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
412 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
413 |
if level & stc.STC_FOLDLEVELHEADERFLAG: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
414 |
if force: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
415 |
if visLevels > 1: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
416 |
self.SetFoldExpanded(line, True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
417 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
418 |
self.SetFoldExpanded(line, False) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
419 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
420 |
line = self.Expand(line, doExpand, force, visLevels-1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
421 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
422 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
423 |
if doExpand and self.GetFoldExpanded(line): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
424 |
line = self.Expand(line, True, force, visLevels-1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
425 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
426 |
line = self.Expand(line, False, force, visLevels-1) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
427 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
428 |
line = line + 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
429 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
430 |
return line |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
431 |
|
637
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
432 |
def Cut(self): |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
433 |
self.ResetBuffer() |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
434 |
self.DisableEvents = True |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
435 |
self.CmdKeyExecute(wx.stc.STC_CMD_CUT) |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
436 |
self.DisableEvents = False |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
437 |
self.RefreshModel() |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
438 |
self.RefreshBuffer() |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
439 |
|
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
440 |
def Copy(self): |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
441 |
self.CmdKeyExecute(wx.stc.STC_CMD_COPY) |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
442 |
|
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
443 |
def Paste(self): |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
444 |
self.ResetBuffer() |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
445 |
self.DisableEvents = True |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
446 |
self.CmdKeyExecute(wx.stc.STC_CMD_PASTE) |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
447 |
self.DisableEvents = False |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
448 |
self.RefreshModel() |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
449 |
self.RefreshBuffer() |
c19557ec2c5a
Fixing bug preventing copy/cut/paste using shortcuts on CFileEditor text editors
laurent
parents:
630
diff
changeset
|
450 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
451 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
452 |
#------------------------------------------------------------------------------- |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
453 |
# Helper for VariablesGrid values |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
454 |
#------------------------------------------------------------------------------- |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
455 |
|
651
cbeb769b0a56
Adding support for unifying grid table control elements
laurent
parents:
637
diff
changeset
|
456 |
class VariablesTable(CustomTable): |
cbeb769b0a56
Adding support for unifying grid table control elements
laurent
parents:
637
diff
changeset
|
457 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
458 |
def GetValue(self, row, col): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
459 |
if row < self.GetNumberRows(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
460 |
if col == 0: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
461 |
return row + 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
462 |
else: |
651
cbeb769b0a56
Adding support for unifying grid table control elements
laurent
parents:
637
diff
changeset
|
463 |
return str(self.data[row].get(self.GetColLabelValue(col, False), "")) |
cbeb769b0a56
Adding support for unifying grid table control elements
laurent
parents:
637
diff
changeset
|
464 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
465 |
def _updateColAttrs(self, grid): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
466 |
""" |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
467 |
wxGrid -> update the column attributes to add the |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
468 |
appropriate renderer given the column name. |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
469 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
470 |
Otherwise default to the default renderer. |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
471 |
""" |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
472 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
473 |
typelist = None |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
474 |
accesslist = None |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
475 |
for row in range(self.GetNumberRows()): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
476 |
for col in range(self.GetNumberCols()): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
477 |
editor = None |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
478 |
renderer = None |
665
aec7aca89f3e
Fixing bug in c_ext plugin variable grid cells not editable
laurent
parents:
658
diff
changeset
|
479 |
colname = self.GetColLabelValue(col, False) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
480 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
481 |
if colname == "Name": |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
482 |
editor = wx.grid.GridCellTextEditor() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
483 |
elif colname == "Class": |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
484 |
editor = wx.grid.GridCellChoiceEditor() |
603
e1ef99c609eb
added memory location support to C file pluguin
Edouard Tisserant
parents:
587
diff
changeset
|
485 |
editor.SetParameters("input,memory,output") |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
486 |
elif colname == "Type": |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
487 |
pass |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
488 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
489 |
grid.SetReadOnly(row, col, True) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
490 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
491 |
grid.SetCellEditor(row, col, editor) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
492 |
grid.SetCellRenderer(row, col, renderer) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
493 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
494 |
grid.SetCellBackgroundColour(row, col, wx.WHITE) |
651
cbeb769b0a56
Adding support for unifying grid table control elements
laurent
parents:
637
diff
changeset
|
495 |
self.ResizeRow(grid, row) |
cbeb769b0a56
Adding support for unifying grid table control elements
laurent
parents:
637
diff
changeset
|
496 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
497 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
498 |
[ID_VARIABLESEDITOR, ID_VARIABLESEDITORVARIABLESGRID, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
499 |
ID_VARIABLESEDITORADDVARIABLEBUTTON, ID_VARIABLESEDITORDELETEVARIABLEBUTTON, |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
500 |
ID_VARIABLESEDITORUPVARIABLEBUTTON, ID_VARIABLESEDITORDOWNVARIABLEBUTTON |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
501 |
] = [wx.NewId() for _init_ctrls in range(6)] |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
502 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
503 |
class VariablesEditor(wx.Panel): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
504 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
505 |
if wx.VERSION < (2, 6, 0): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
506 |
def Bind(self, event, function, id = None): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
507 |
if id is not None: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
508 |
event(self, id, function) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
509 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
510 |
event(self, function) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
511 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
512 |
def _init_coll_MainSizer_Growables(self, parent): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
513 |
parent.AddGrowableCol(0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
514 |
parent.AddGrowableRow(0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
515 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
516 |
def _init_coll_MainSizer_Items(self, parent): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
517 |
parent.AddWindow(self.VariablesGrid, 0, border=0, flag=wx.GROW) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
518 |
parent.AddSizer(self.ButtonsSizer, 0, border=0, flag=wx.GROW) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
519 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
520 |
def _init_coll_ButtonsSizer_Growables(self, parent): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
521 |
parent.AddGrowableCol(0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
522 |
parent.AddGrowableRow(0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
523 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
524 |
def _init_coll_ButtonsSizer_Items(self, parent): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
525 |
parent.AddWindow(self.AddVariableButton, 0, border=0, flag=wx.ALIGN_RIGHT) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
526 |
parent.AddWindow(self.DeleteVariableButton, 0, border=0, flag=0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
527 |
parent.AddWindow(self.UpVariableButton, 0, border=0, flag=0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
528 |
parent.AddWindow(self.DownVariableButton, 0, border=0, flag=0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
529 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
530 |
def _init_sizers(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
531 |
self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=4) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
532 |
self.ButtonsSizer = wx.FlexGridSizer(cols=5, hgap=5, rows=1, vgap=0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
533 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
534 |
self._init_coll_MainSizer_Growables(self.MainSizer) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
535 |
self._init_coll_MainSizer_Items(self.MainSizer) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
536 |
self._init_coll_ButtonsSizer_Growables(self.ButtonsSizer) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
537 |
self._init_coll_ButtonsSizer_Items(self.ButtonsSizer) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
538 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
539 |
self.SetSizer(self.MainSizer) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
540 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
541 |
def _init_ctrls(self, prnt): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
542 |
wx.Panel.__init__(self, id=ID_VARIABLESEDITOR, name='', parent=prnt, |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
543 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
544 |
|
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
545 |
self.VariablesGrid = CustomGrid(id=ID_VARIABLESEDITORVARIABLESGRID, |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
546 |
name='VariablesGrid', parent=self, pos=wx.Point(0, 0), |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
547 |
size=wx.Size(-1, -1), style=wx.VSCROLL) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
548 |
if wx.VERSION >= (2, 5, 0): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
549 |
self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnVariablesGridCellChange) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
550 |
self.VariablesGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnVariablesGridCellLeftClick) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
551 |
self.VariablesGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN, self.OnVariablesGridEditorShown) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
552 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
553 |
wx.grid.EVT_GRID_CELL_CHANGE(self.VariablesGrid, self.OnVariablesGridCellChange) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
554 |
wx.grid.EVT_GRID_CELL_LEFT_CLICK(self.VariablesGrid, self.OnVariablesGridCellLeftClick) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
555 |
wx.grid.EVT_GRID_EDITOR_SHOWN(self.VariablesGrid, self.OnVariablesGridEditorShown) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
556 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
557 |
self.AddVariableButton = wx.Button(id=ID_VARIABLESEDITORADDVARIABLEBUTTON, label='Add Variable', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
558 |
name='AddVariableButton', parent=self, pos=wx.Point(0, 0), |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
559 |
size=wx.Size(122, 32), style=0) |
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
560 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
561 |
self.DeleteVariableButton = wx.Button(id=ID_VARIABLESEDITORDELETEVARIABLEBUTTON, label='Delete Variable', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
562 |
name='DeleteVariableButton', parent=self, pos=wx.Point(0, 0), |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
563 |
size=wx.Size(122, 32), style=0) |
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
564 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
565 |
self.UpVariableButton = wx.Button(id=ID_VARIABLESEDITORUPVARIABLEBUTTON, label='^', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
566 |
name='UpVariableButton', parent=self, pos=wx.Point(0, 0), |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
567 |
size=wx.Size(32, 32), style=0) |
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
568 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
569 |
self.DownVariableButton = wx.Button(id=ID_VARIABLESEDITORDOWNVARIABLEBUTTON, label='v', |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
570 |
name='DownVariableButton', parent=self, pos=wx.Point(0, 0), |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
571 |
size=wx.Size(32, 32), style=0) |
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
572 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
573 |
self._init_sizers() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
574 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
575 |
def __init__(self, parent, window, controler): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
576 |
self._init_ctrls(parent) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
577 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
578 |
self.ParentWindow = window |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
579 |
self.Controler = controler |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
580 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
581 |
self.VariablesDefaultValue = {"Name" : "", "Class" : "input", "Type" : ""} |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
582 |
self.Table = VariablesTable(self, [], ["#", "Name", "Class", "Type"]) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
583 |
self.ColAlignements = [wx.ALIGN_RIGHT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT] |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
584 |
self.ColSizes = [40, 200, 150, 150] |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
585 |
self.VariablesGrid.SetTable(self.Table) |
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
586 |
self.VariablesGrid.SetButtons({"Add": self.AddVariableButton, |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
587 |
"Delete": self.DeleteVariableButton, |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
588 |
"Up": self.UpVariableButton, |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
589 |
"Down": self.DownVariableButton}) |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
590 |
|
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
591 |
def _AddVariable(new_row): |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
592 |
self.Table.InsertRow(new_row, self.VariablesDefaultValue.copy()) |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
593 |
self.RefreshModel() |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
594 |
self.RefreshView() |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
595 |
return new_row |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
596 |
setattr(self.VariablesGrid, "_AddRow", _AddVariable) |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
597 |
|
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
598 |
def _DeleteVariable(row): |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
599 |
self.Table.RemoveRow(row) |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
600 |
self.RefreshModel() |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
601 |
self.RefreshView() |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
602 |
setattr(self.VariablesGrid, "_DeleteRow", _DeleteVariable) |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
603 |
|
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
604 |
def _MoveVariable(row, move): |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
605 |
new_row = self.Table.MoveRow(row, move) |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
606 |
if new_row != row: |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
607 |
self.RefreshModel() |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
608 |
self.RefreshView() |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
609 |
return new_row |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
610 |
setattr(self.VariablesGrid, "_MoveRow", _MoveVariable) |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
611 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
612 |
self.VariablesGrid.SetRowLabelSize(0) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
613 |
for col in range(self.Table.GetNumberCols()): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
614 |
attr = wx.grid.GridCellAttr() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
615 |
attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
616 |
self.VariablesGrid.SetColAttr(col, attr) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
617 |
self.VariablesGrid.SetColSize(col, self.ColSizes[col]) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
618 |
self.Table.ResetView(self.VariablesGrid) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
619 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
620 |
def RefreshModel(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
621 |
self.Controler.SetVariables(self.Table.GetData()) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
622 |
self.RefreshBuffer() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
623 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
624 |
# Buffer the last model state |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
625 |
def RefreshBuffer(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
626 |
self.Controler.BufferCFile() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
627 |
self.ParentWindow.RefreshTitle() |
587 | 628 |
self.ParentWindow.RefreshFileMenu() |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
629 |
self.ParentWindow.RefreshEditMenu() |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
630 |
self.ParentWindow.RefreshPageTitles() |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
631 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
632 |
def RefreshView(self): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
633 |
self.Table.SetData(self.Controler.GetVariables()) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
634 |
self.Table.ResetView(self.VariablesGrid) |
626
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
635 |
self.VariablesGrid.RefreshButtons() |
2b9bd5dcf8d2
Adding support for using keyboard to edit cfile interface variables displayed in Grid
laurent
parents:
610
diff
changeset
|
636 |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
637 |
def DoGetBestSize(self): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
638 |
return self.ParentWindow.GetPanelBestSize() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
639 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
640 |
def OnVariablesGridCellChange(self, event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
641 |
self.RefreshModel() |
656
c1792dfc8c7e
Fixing bug integrated plugin editors not closed when removing corresponding plugin
laurent
parents:
653
diff
changeset
|
642 |
wx.CallAfter(self.RefreshView) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
643 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
644 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
645 |
def OnVariablesGridEditorShown(self, event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
646 |
row, col = event.GetRow(), event.GetCol() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
647 |
if self.Table.GetColLabelValue(col) == "Type": |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
648 |
type_menu = wx.Menu(title='') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
649 |
base_menu = wx.Menu(title='') |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
650 |
for base_type in self.Controler.GetBaseTypes(): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
651 |
new_id = wx.NewId() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
652 |
AppendMenu(base_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=base_type) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
653 |
self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(base_type), id=new_id) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
654 |
type_menu.AppendMenu(wx.NewId(), "Base Types", base_menu) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
655 |
datatype_menu = wx.Menu(title='') |
610
00df5b1db283
Disabling definition of enumerated and structure variables for interfacing with PLC in c_ext plug-in
laurent
parents:
603
diff
changeset
|
656 |
for datatype in self.Controler.GetDataTypes(basetypes=False, only_locatables=True): |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
657 |
new_id = wx.NewId() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
658 |
AppendMenu(datatype_menu, help='', id=new_id, kind=wx.ITEM_NORMAL, text=datatype) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
659 |
self.Bind(wx.EVT_MENU, self.GetVariableTypeFunction(datatype), id=new_id) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
660 |
type_menu.AppendMenu(wx.NewId(), "User Data Types", datatype_menu) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
661 |
rect = self.VariablesGrid.BlockToDeviceRect((row, col), (row, col)) |
708 | 662 |
|
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
663 |
self.VariablesGrid.PopupMenuXY(type_menu, rect.x + rect.width, rect.y + self.VariablesGrid.GetColLabelSize()) |
708 | 664 |
type_menu.Destroy() |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
665 |
event.Veto() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
666 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
667 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
668 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
669 |
def GetVariableTypeFunction(self, base_type): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
670 |
def VariableTypeFunction(event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
671 |
row = self.VariablesGrid.GetGridCursorRow() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
672 |
self.Table.SetValueByName(row, "Type", base_type) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
673 |
self.Table.ResetView(self.VariablesGrid) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
674 |
self.RefreshModel() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
675 |
self.RefreshView() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
676 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
677 |
return VariableTypeFunction |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
678 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
679 |
def OnVariablesGridCellLeftClick(self, event): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
680 |
if event.GetCol() == 0: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
681 |
row = event.GetRow() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
682 |
num = 0 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
683 |
if self.Table.GetValueByName(row, "Class") == "input": |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
684 |
dir = "%I" |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
685 |
for i in xrange(row): |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
686 |
if self.Table.GetValueByName(i, "Class") == "input": |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
687 |
num += 1 |
603
e1ef99c609eb
added memory location support to C file pluguin
Edouard Tisserant
parents:
587
diff
changeset
|
688 |
elif self.Table.GetValueByName(row, "Class") == "memory": |
e1ef99c609eb
added memory location support to C file pluguin
Edouard Tisserant
parents:
587
diff
changeset
|
689 |
dir = "%M" |
e1ef99c609eb
added memory location support to C file pluguin
Edouard Tisserant
parents:
587
diff
changeset
|
690 |
for i in xrange(row): |
e1ef99c609eb
added memory location support to C file pluguin
Edouard Tisserant
parents:
587
diff
changeset
|
691 |
if self.Table.GetValueByName(i, "Class") == "memory": |
e1ef99c609eb
added memory location support to C file pluguin
Edouard Tisserant
parents:
587
diff
changeset
|
692 |
num += 1 |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
693 |
else: |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
694 |
dir = "%Q" |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
695 |
for i in xrange(row): |
161 | 696 |
if self.Table.GetValueByName(i, "Class") == "output": |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
697 |
num += 1 |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
698 |
data_type = self.Table.GetValueByName(row, "Type") |
401
8106a853a7c7
Adding support for displaying plugins available variable into Beremiz plugin tree
laurent
parents:
213
diff
changeset
|
699 |
var_name = self.Table.GetValueByName(row, "Name") |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
700 |
base_location = ".".join(map(lambda x:str(x), self.Controler.GetCurrentLocation())) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
701 |
location = "%s%s%s.%d"%(dir, self.Controler.GetSizeOfType(data_type), base_location, num) |
401
8106a853a7c7
Adding support for displaying plugins available variable into Beremiz plugin tree
laurent
parents:
213
diff
changeset
|
702 |
data = wx.TextDataObject(str((location, "location", data_type, var_name, ""))) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
703 |
dragSource = wx.DropSource(self.VariablesGrid) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
704 |
dragSource.SetData(data) |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
705 |
dragSource.DoDragDrop() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
706 |
event.Skip() |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
707 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
708 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
709 |
#------------------------------------------------------------------------------- |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
710 |
# SVGUIEditor Main Frame Class |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
711 |
#------------------------------------------------------------------------------- |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
712 |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
713 |
CFILE_PARTS = [ |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
714 |
("Includes", CppEditor), |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
715 |
("Variables", VariablesEditor), |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
716 |
("Globals", CppEditor), |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
717 |
("Init", CppEditor), |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
718 |
("CleanUp", CppEditor), |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
719 |
("Retrieve", CppEditor), |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
720 |
("Publish", CppEditor), |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
721 |
] |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
722 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
723 |
class FoldPanelCaption(wx.lib.buttons.GenBitmapTextToggleButton): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
724 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
725 |
def GetBackgroundBrush(self, dc): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
726 |
colBg = self.GetBackgroundColour() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
727 |
brush = wx.Brush(colBg, wx.SOLID) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
728 |
if self.style & wx.BORDER_NONE: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
729 |
myAttr = self.GetDefaultAttributes() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
730 |
parAttr = self.GetParent().GetDefaultAttributes() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
731 |
myDef = colBg == myAttr.colBg |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
732 |
parDef = self.GetParent().GetBackgroundColour() == parAttr.colBg |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
733 |
if myDef and parDef: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
734 |
if wx.Platform == "__WXMAC__": |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
735 |
brush.MacSetTheme(1) # 1 == kThemeBrushDialogBackgroundActive |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
736 |
elif wx.Platform == "__WXMSW__": |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
737 |
if self.DoEraseBackground(dc): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
738 |
brush = None |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
739 |
elif myDef and not parDef: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
740 |
colBg = self.GetParent().GetBackgroundColour() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
741 |
brush = wx.Brush(colBg, wx.SOLID) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
742 |
return brush |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
743 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
744 |
def DrawLabel(self, dc, width, height, dx=0, dy=0): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
745 |
bmp = self.bmpLabel |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
746 |
if bmp is not None: # if the bitmap is used |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
747 |
if self.bmpDisabled and not self.IsEnabled(): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
748 |
bmp = self.bmpDisabled |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
749 |
if self.bmpFocus and self.hasFocus: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
750 |
bmp = self.bmpFocus |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
751 |
if self.bmpSelected and not self.up: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
752 |
bmp = self.bmpSelected |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
753 |
bw,bh = bmp.GetWidth(), bmp.GetHeight() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
754 |
hasMask = bmp.GetMask() is not None |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
755 |
else: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
756 |
bw = bh = 0 # no bitmap -> size is zero |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
757 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
758 |
dc.SetFont(self.GetFont()) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
759 |
if self.IsEnabled(): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
760 |
dc.SetTextForeground(self.GetForegroundColour()) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
761 |
else: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
762 |
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
763 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
764 |
label = self.GetLabel() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
765 |
tw, th = dc.GetTextExtent(label) # size of text |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
766 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
767 |
if bmp is not None: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
768 |
dc.DrawBitmap(bmp, width - bw - 2, (height-bh)/2, hasMask) # draw bitmap if available |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
769 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
770 |
dc.DrawText(label, 2, (height-th)/2) # draw the text |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
771 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
772 |
dc.SetPen(wx.Pen(self.GetForegroundColour())) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
773 |
dc.SetBrush(wx.TRANSPARENT_BRUSH) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
774 |
dc.DrawRectangle(0, 0, width, height) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
775 |
|
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
776 |
[ID_CFILEEDITOR, ID_CFILEEDITORMAINSPLITTER, |
164 | 777 |
ID_CFILEEDITORCFILETREE, ID_CFILEEDITORPARTSOPENED, |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
778 |
] = [wx.NewId() for _init_ctrls in range(4)] |
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
779 |
|
738 | 780 |
class CFileEditor(ConfTreeNodeEditor): |
781 |
||
782 |
def _init_ConfNodeEditor(self, prnt): |
|
783 |
self.ConfNodeEditor = wx.Panel(id=ID_CFILEEDITOR, parent=prnt, pos=wx.Point(0, 0), |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
784 |
size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
785 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
786 |
self.Panels = {} |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
787 |
self.MainSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2 * len(CFILE_PARTS) + 1, vgap=0) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
788 |
self.MainSizer.AddGrowableCol(0) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
789 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
790 |
for idx, (name, panel_class) in enumerate(CFILE_PARTS): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
791 |
button_id = wx.NewId() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
792 |
button = FoldPanelCaption(id=button_id, name='FoldPanelCaption_%s' % name, |
734 | 793 |
label=name, bitmap=wx.Bitmap(opjimg("CollapsedIconData")), |
738 | 794 |
parent=self.ConfNodeEditor, pos=wx.Point(0, 0), |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
795 |
size=wx.Size(0, 20), style=wx.NO_BORDER|wx.ALIGN_LEFT) |
734 | 796 |
button.SetBitmapSelected(wx.Bitmap(opjimg("ExpandedIconData"))) |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
797 |
button.Bind(wx.EVT_BUTTON, self.GenPanelButtonCallback(name), id=button_id) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
798 |
self.MainSizer.AddWindow(button, 0, border=0, flag=wx.TOP|wx.GROW) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
799 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
800 |
if panel_class == VariablesEditor: |
738 | 801 |
panel = VariablesEditor(self.ConfNodeEditor, self.ParentWindow, self.Controler) |
802 |
else: |
|
803 |
panel = panel_class(self.ConfNodeEditor, name, self.ParentWindow, self.Controler) |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
804 |
self.MainSizer.AddWindow(panel, 0, border=0, flag=wx.BOTTOM|wx.GROW) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
805 |
panel.Hide() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
806 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
807 |
self.Panels[name] = {"button": button, "panel": panel, "expanded": False, "row": 2 * idx + 1} |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
808 |
|
738 | 809 |
self.Spacer = wx.Panel(self.ConfNodeEditor, -1) |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
810 |
self.SpacerExpanded = True |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
811 |
self.MainSizer.AddWindow(self.Spacer, 0, border=0, flag=wx.GROW) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
812 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
813 |
self.MainSizer.AddGrowableRow(2 * len(CFILE_PARTS)) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
814 |
|
738 | 815 |
self.ConfNodeEditor.SetSizer(self.MainSizer) |
816 |
||
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
817 |
def __init__(self, parent, controler, window): |
743 | 818 |
ConfTreeNodeEditor.__init__(self, parent, controler, window) |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
819 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
820 |
def GetBufferState(self): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
821 |
return self.Controler.GetBufferState() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
822 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
823 |
def Undo(self): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
824 |
self.Controler.LoadPrevious() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
825 |
self.RefreshView() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
826 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
827 |
def Redo(self): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
828 |
self.Controler.LoadNext() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
829 |
self.RefreshView() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
830 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
831 |
def RefreshView(self): |
751 | 832 |
ConfTreeNodeEditor.RefreshView(self) |
833 |
||
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
834 |
for infos in self.Panels.itervalues(): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
835 |
infos["panel"].RefreshView() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
836 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
837 |
def GenPanelButtonCallback(self, name): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
838 |
def PanelButtonCallback(event): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
839 |
self.TogglePanel(name) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
840 |
return PanelButtonCallback |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
841 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
842 |
def ExpandPanel(self, name): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
843 |
infos = self.Panels.get(name, None) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
844 |
if infos is not None and not infos["expanded"]: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
845 |
infos["expanded"] = True |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
846 |
infos["button"].SetToggle(True) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
847 |
infos["panel"].Show() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
848 |
self.MainSizer.AddGrowableRow(infos["row"]) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
849 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
850 |
self.RefreshSizerLayout() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
851 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
852 |
def CollapsePanel(self, name): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
853 |
infos = self.Panels.get(name, None) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
854 |
if infos is not None and infos["expanded"]: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
855 |
infos["expanded"] = False |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
856 |
infos["button"].SetToggle(False) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
857 |
infos["panel"].Hide() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
858 |
self.MainSizer.RemoveGrowableRow(infos["row"]) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
859 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
860 |
self.RefreshSizerLayout() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
861 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
862 |
def TogglePanel(self, name): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
863 |
infos = self.Panels.get(name, None) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
864 |
if infos is not None: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
865 |
infos["expanded"] = not infos["expanded"] |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
866 |
infos["button"].SetToggle(infos["expanded"]) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
867 |
if infos["expanded"]: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
868 |
infos["panel"].Show() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
869 |
self.MainSizer.AddGrowableRow(infos["row"]) |
164 | 870 |
else: |
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
871 |
infos["panel"].Hide() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
872 |
self.MainSizer.RemoveGrowableRow(infos["row"]) |
145
94855f7b08a9
Improving c_ext plugin by adding an XML file format for saving C files and an graphical interface for editing this file
lbessard
parents:
diff
changeset
|
873 |
|
630
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
874 |
self.RefreshSizerLayout() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
875 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
876 |
def RefreshSizerLayout(self): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
877 |
expand_spacer = True |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
878 |
for infos in self.Panels.itervalues(): |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
879 |
expand_spacer = expand_spacer and not infos["expanded"] |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
880 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
881 |
if self.SpacerExpanded != expand_spacer: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
882 |
self.SpacerExpanded = expand_spacer |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
883 |
if expand_spacer: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
884 |
self.Spacer.Show() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
885 |
self.MainSizer.AddGrowableRow(2 * len(CFILE_PARTS)) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
886 |
else: |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
887 |
self.Spacer.Hide() |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
888 |
self.MainSizer.RemoveGrowableRow(2 * len(CFILE_PARTS)) |
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
889 |
|
91b2ae63ea3d
Including external tools for editing plugin informations into Beremiz window
laurent
parents:
626
diff
changeset
|
890 |
self.MainSizer.Layout() |
213
d8dc1e51c3bf
Change in layout from AuiMDIParentFrame to AuiNotebook
lbessard
parents:
185
diff
changeset
|
891 |