author | laurent |
Tue, 08 Nov 2011 21:59:22 +0100 | |
changeset 586 | 9aa96a36cf33 |
parent 577 | 9dbb79722fbc |
child 604 | 5b42b4401e6b |
permissions | -rw-r--r-- |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
1 |
# -*- coding: utf-8 -*- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
2 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
3 |
#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
4 |
#based on the plcopen standard. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
5 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
6 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
7 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
8 |
#See COPYING file for copyrights details. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
9 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
10 |
#This library is free software; you can redistribute it and/or |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
11 |
#modify it under the terms of the GNU General Public |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
12 |
#License as published by the Free Software Foundation; either |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
13 |
#version 2.1 of the License, or (at your option) any later version. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
14 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
15 |
#This library is distributed in the hope that it will be useful, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
16 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
17 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
18 |
#General Public License for more details. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
19 |
# |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
20 |
#You should have received a copy of the GNU General Public |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
21 |
#License along with this library; if not, write to the Free Software |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
22 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
23 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
24 |
import wx |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
25 |
import wx.grid |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
26 |
|
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
27 |
from controls import CustomGrid |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
28 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
29 |
#------------------------------------------------------------------------------- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
30 |
# Action Block Dialog |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
31 |
#------------------------------------------------------------------------------- |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
32 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
33 |
def GetActionTableColnames(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
34 |
_ = lambda x: x |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
35 |
return [_("Qualifier"), _("Duration"), _("Type"), _("Value"), _("Indicator")] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
36 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
37 |
def GetTypeList(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
38 |
_ = lambda x: x |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
39 |
return [_("Action"), _("Variable"), _("Inline")] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
40 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
41 |
class ActionTable(wx.grid.PyGridTableBase): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
42 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
43 |
""" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
44 |
A custom wx.Grid Table using user supplied data |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
45 |
""" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
46 |
def __init__(self, parent, data, colnames): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
47 |
# The base class must be initialized *first* |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
48 |
wx.grid.PyGridTableBase.__init__(self) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
49 |
self.data = data |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
50 |
self.colnames = colnames |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
51 |
self.Parent = parent |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
52 |
# XXX |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
53 |
# we need to store the row length and collength to |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
54 |
# see if the table has changed size |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
55 |
self._rows = self.GetNumberRows() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
56 |
self._cols = self.GetNumberCols() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
57 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
58 |
def GetNumberCols(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
59 |
return len(self.colnames) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
60 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
61 |
def GetNumberRows(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
62 |
return len(self.data) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
63 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
64 |
def GetColLabelValue(self, col, translate=True): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
65 |
if col < len(self.colnames): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
66 |
colname = self.colnames[col] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
67 |
if translate: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
68 |
return _(colname) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
69 |
return colname |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
70 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
71 |
def GetRowLabelValues(self, row, translate=True): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
72 |
return row |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
73 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
74 |
def GetValue(self, row, col): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
75 |
if row < self.GetNumberRows(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
76 |
colname = self.GetColLabelValue(col, False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
77 |
name = str(self.data[row].get(colname, "")) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
78 |
if colname == "Type": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
79 |
return _(name) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
80 |
return name |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
81 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
82 |
def GetValueByName(self, row, colname): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
83 |
return self.data[row].get(colname) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
84 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
85 |
def SetValue(self, row, col, value): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
86 |
if col < len(self.colnames): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
87 |
colname = self.GetColLabelValue(col, False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
88 |
if colname == "Type": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
89 |
value = self.Parent.TranslateType[value] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
90 |
self.data[row][colname] = value |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
91 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
92 |
def ResetView(self, grid): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
93 |
""" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
94 |
(wx.Grid) -> Reset the grid view. Call this to |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
95 |
update the grid if rows and columns have been added or deleted |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
96 |
""" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
97 |
grid.BeginBatch() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
98 |
for current, new, delmsg, addmsg in [ |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
99 |
(self._rows, self.GetNumberRows(), wx.grid.GRIDTABLE_NOTIFY_ROWS_DELETED, wx.grid.GRIDTABLE_NOTIFY_ROWS_APPENDED), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
100 |
(self._cols, self.GetNumberCols(), wx.grid.GRIDTABLE_NOTIFY_COLS_DELETED, wx.grid.GRIDTABLE_NOTIFY_COLS_APPENDED), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
101 |
]: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
102 |
if new < current: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
103 |
msg = wx.grid.GridTableMessage(self,delmsg,new,current-new) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
104 |
grid.ProcessTableMessage(msg) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
105 |
elif new > current: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
106 |
msg = wx.grid.GridTableMessage(self,addmsg,new-current) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
107 |
grid.ProcessTableMessage(msg) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
108 |
self.UpdateValues(grid) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
109 |
grid.EndBatch() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
110 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
111 |
self._rows = self.GetNumberRows() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
112 |
self._cols = self.GetNumberCols() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
113 |
# update the column rendering scheme |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
114 |
self._updateColAttrs(grid) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
115 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
116 |
# update the scrollbars and the displayed part of the grid |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
117 |
grid.AdjustScrollbars() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
118 |
grid.ForceRefresh() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
119 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
120 |
def UpdateValues(self, grid): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
121 |
"""Update all displayed values""" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
122 |
# This sends an event to the grid table to update all of the values |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
123 |
msg = wx.grid.GridTableMessage(self, wx.grid.GRIDTABLE_REQUEST_VIEW_GET_VALUES) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
124 |
grid.ProcessTableMessage(msg) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
125 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
126 |
def _updateColAttrs(self, grid): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
127 |
""" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
128 |
wx.Grid -> update the column attributes to add the |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
129 |
appropriate renderer given the column name. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
130 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
131 |
Otherwise default to the default renderer. |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
132 |
""" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
133 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
134 |
for row in range(self.GetNumberRows()): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
135 |
for col in range(self.GetNumberCols()): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
136 |
editor = None |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
137 |
renderer = None |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
138 |
readonly = False |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
139 |
colname = self.GetColLabelValue(col, False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
140 |
if colname == "Qualifier": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
141 |
editor = wx.grid.GridCellChoiceEditor() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
142 |
editor.SetParameters(self.Parent.QualifierList) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
143 |
if colname == "Duration": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
144 |
editor = wx.grid.GridCellTextEditor() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
145 |
renderer = wx.grid.GridCellStringRenderer() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
146 |
if self.Parent.DurationList[self.data[row]["Qualifier"]]: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
147 |
readonly = False |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
148 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
149 |
readonly = True |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
150 |
self.data[row]["Duration"] = "" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
151 |
elif colname == "Type": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
152 |
editor = wx.grid.GridCellChoiceEditor() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
153 |
editor.SetParameters(self.Parent.TypeList) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
154 |
elif colname == "Value": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
155 |
type = self.data[row]["Type"] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
156 |
if type == "Action": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
157 |
editor = wx.grid.GridCellChoiceEditor() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
158 |
editor.SetParameters(self.Parent.ActionList) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
159 |
elif type == "Variable": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
160 |
editor = wx.grid.GridCellChoiceEditor() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
161 |
editor.SetParameters(self.Parent.VariableList) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
162 |
elif type == "Inline": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
163 |
editor = wx.grid.GridCellTextEditor() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
164 |
renderer = wx.grid.GridCellStringRenderer() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
165 |
elif colname == "Indicator": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
166 |
editor = wx.grid.GridCellChoiceEditor() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
167 |
editor.SetParameters(self.Parent.VariableList) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
168 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
169 |
grid.SetCellEditor(row, col, editor) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
170 |
grid.SetCellRenderer(row, col, renderer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
171 |
grid.SetReadOnly(row, col, readonly) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
172 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
173 |
grid.SetCellBackgroundColour(row, col, wx.WHITE) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
174 |
if wx.Platform == '__WXMSW__': |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
175 |
grid.SetRowMinimalHeight(row, 20) |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
176 |
else: |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
177 |
grid.SetRowMinimalHeight(row, 28) |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
178 |
grid.AutoSizeRow(row, False) |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
179 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
180 |
def SetData(self, data): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
181 |
self.data = data |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
182 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
183 |
def GetData(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
184 |
return self.data |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
185 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
186 |
def GetCurrentIndex(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
187 |
return self.CurrentIndex |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
188 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
189 |
def SetCurrentIndex(self, index): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
190 |
self.CurrentIndex = index |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
191 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
192 |
def AppendRow(self, row_content): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
193 |
self.data.append(row_content) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
194 |
|
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
195 |
def InsertRow(self, row_index, row_content): |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
196 |
self.data.insert(row_index, row_content) |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
197 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
198 |
def RemoveRow(self, row_index): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
199 |
self.data.pop(row_index) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
200 |
|
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
201 |
def MoveRow(self, row_index, move): |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
202 |
new_index = max(0, min(row_index + move, len(self.data) - 1)) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
203 |
if new_index != row_index: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
204 |
self.data.insert(new_index, self.data.pop(row_index)) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
205 |
return new_index |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
206 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
207 |
def Empty(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
208 |
self.data = [] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
209 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
210 |
[ID_ACTIONBLOCKDIALOG, ID_ACTIONBLOCKDIALOGVARIABLESGRID, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
211 |
ID_ACTIONBLOCKDIALOGSTATICTEXT1, ID_ACTIONBLOCKDIALOGADDBUTTON, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
212 |
ID_ACTIONBLOCKDIALOGDELETEBUTTON, ID_ACTIONBLOCKDIALOGUPBUTTON, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
213 |
ID_ACTIONBLOCKDIALOGDOWNBUTTON, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
214 |
] = [wx.NewId() for _init_ctrls in range(7)] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
215 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
216 |
class ActionBlockDialog(wx.Dialog): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
217 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
218 |
if wx.VERSION < (2, 6, 0): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
219 |
def Bind(self, event, function, id = None): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
220 |
if id is not None: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
221 |
event(self, id, function) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
222 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
223 |
event(self, function) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
224 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
225 |
def _init_coll_flexGridSizer1_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
226 |
parent.AddSizer(self.TopSizer, 0, border=20, flag=wx.GROW|wx.TOP|wx.LEFT|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
227 |
parent.AddSizer(self.GridButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.LEFT|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
228 |
parent.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT|wx.BOTTOM|wx.LEFT|wx.RIGHT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
229 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
230 |
def _init_coll_flexGridSizer1_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
231 |
parent.AddGrowableCol(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
232 |
parent.AddGrowableRow(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
233 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
234 |
def _init_coll_TopSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
235 |
parent.AddWindow(self.staticText1, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
236 |
parent.AddWindow(self.ActionsGrid, 0, border=0, flag=wx.GROW) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
237 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
238 |
def _init_coll_TopSizer_Growables(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
239 |
parent.AddGrowableCol(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
240 |
parent.AddGrowableRow(1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
241 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
242 |
def _init_coll_GridButtonSizer_Items(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
243 |
parent.AddWindow(self.AddButton, 0, border=10, flag=wx.GROW|wx.LEFT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
244 |
parent.AddWindow(self.DeleteButton, 0, border=10, flag=wx.GROW|wx.LEFT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
245 |
parent.AddWindow(self.UpButton, 0, border=10, flag=wx.GROW|wx.LEFT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
246 |
parent.AddWindow(self.DownButton, 0, border=10, flag=wx.GROW|wx.LEFT) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
247 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
248 |
def _init_sizers(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
249 |
self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
250 |
self.TopSizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=5) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
251 |
self.GridButtonSizer = wx.BoxSizer(wx.HORIZONTAL) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
252 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
253 |
self._init_coll_flexGridSizer1_Items(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
254 |
self._init_coll_flexGridSizer1_Growables(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
255 |
self._init_coll_TopSizer_Items(self.TopSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
256 |
self._init_coll_TopSizer_Growables(self.TopSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
257 |
self._init_coll_GridButtonSizer_Items(self.GridButtonSizer) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
258 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
259 |
self.SetSizer(self.flexGridSizer1) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
260 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
261 |
def _init_ctrls(self, prnt): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
262 |
wx.Dialog.__init__(self, id=ID_ACTIONBLOCKDIALOG, |
534
d506a353b3d3
Fix dialogs positions to stay on the same screen than parent frame
laurent
parents:
409
diff
changeset
|
263 |
name='ActionBlockDialog', parent=prnt, |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
264 |
size=wx.Size(500, 300), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
265 |
title=_('Edit action block properties')) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
266 |
self.SetClientSize(wx.Size(500, 300)) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
267 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
268 |
self.staticText1 = wx.StaticText(id=ID_ACTIONBLOCKDIALOGSTATICTEXT1, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
269 |
label=_('Actions:'), name='staticText1', parent=self, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
270 |
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
271 |
|
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
272 |
self.ActionsGrid = CustomGrid(id=ID_ACTIONBLOCKDIALOGVARIABLESGRID, |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
273 |
name='ActionsGrid', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
274 |
size=wx.Size(0, 0), style=wx.VSCROLL) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
275 |
self.ActionsGrid.SetFont(wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
276 |
'Sans')) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
277 |
self.ActionsGrid.SetLabelFont(wx.Font(10, 77, wx.NORMAL, wx.NORMAL, |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
278 |
False, 'Sans')) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
279 |
self.ActionsGrid.DisableDragGridSize() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
280 |
self.ActionsGrid.EnableScrolling(False, True) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
281 |
if wx.VERSION >= (2, 6, 0): |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
282 |
self.ActionsGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE, self.OnActionsGridCellChange) |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
283 |
else: |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
284 |
wx.grid.EVT_GRID_CELL_CHANGE(self.ActionsGrid, self.OnActionsGridCellChange) |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
285 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
286 |
self.AddButton = wx.Button(id=ID_ACTIONBLOCKDIALOGADDBUTTON, label=_('Add'), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
287 |
name='AddButton', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
288 |
size=wx.DefaultSize, style=0) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
289 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
290 |
self.DeleteButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDELETEBUTTON, label=_('Delete'), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
291 |
name='DeleteButton', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
292 |
size=wx.DefaultSize, style=0) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
293 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
294 |
self.UpButton = wx.Button(id=ID_ACTIONBLOCKDIALOGUPBUTTON, label='^', |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
295 |
name='UpButton', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
296 |
size=wx.Size(32, 32), style=0) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
297 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
298 |
self.DownButton = wx.Button(id=ID_ACTIONBLOCKDIALOGDOWNBUTTON, label='v', |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
299 |
name='DownButton', parent=self, pos=wx.Point(0, 0), |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
300 |
size=wx.Size(32, 32), style=0) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
301 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
302 |
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
303 |
if wx.VERSION >= (2, 5, 0): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
304 |
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
305 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
306 |
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetChildren()[0].GetSizer().GetChildren()[0].GetWindow().GetId()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
307 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
308 |
self._init_sizers() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
309 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
310 |
def __init__(self, parent): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
311 |
self._init_ctrls(parent) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
312 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
313 |
self.Table = ActionTable(self, [], GetActionTableColnames()) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
314 |
typelist = GetTypeList() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
315 |
self.TypeList = ",".join(map(_,typelist)) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
316 |
self.TranslateType = dict([(_(value), value) for value in typelist]) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
317 |
self.ColSizes = [60, 90, 80, 110, 80] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
318 |
self.ColAlignements = [wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
319 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
320 |
self.ActionsGrid.SetTable(self.Table) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
321 |
self.ActionsGrid.SetDefaultValue({"Qualifier" : "N", |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
322 |
"Duration" : "", |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
323 |
"Type" : "Action", |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
324 |
"Value" : "", |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
325 |
"Indicator" : ""}) |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
326 |
self.ActionsGrid.SetButtons({"Add": self.AddButton, |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
327 |
"Delete": self.DeleteButton, |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
328 |
"Up": self.UpButton, |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
329 |
"Down": self.DownButton}) |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
330 |
self.ActionsGrid.SetRowLabelSize(0) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
331 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
332 |
for col in range(self.Table.GetNumberCols()): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
333 |
attr = wx.grid.GridCellAttr() |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
334 |
attr.SetAlignment(self.ColAlignements[col], wx.ALIGN_CENTRE) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
335 |
self.ActionsGrid.SetColAttr(col, attr) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
336 |
self.ActionsGrid.SetColMinimalWidth(col, self.ColSizes[col]) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
337 |
self.ActionsGrid.AutoSizeColumn(col, False) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
338 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
339 |
self.Table.ResetView(self.ActionsGrid) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
340 |
self.ActionsGrid.SetFocus() |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
341 |
self.ActionsGrid.RefreshButtons() |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
342 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
343 |
def OnOK(self, event): |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
344 |
self.ActionsGrid.CloseEditControl() |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
345 |
self.EndModal(wx.ID_OK) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
346 |
|
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
347 |
def OnActionsGridCellChange(self, event): |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
348 |
wx.CallAfter(self.Table.ResetView, self.ActionsGrid) |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
349 |
event.Skip() |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
350 |
|
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
351 |
def SetQualifierList(self, list): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
352 |
self.QualifierList = "," + ",".join(list) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
353 |
self.DurationList = list |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
354 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
355 |
def SetVariableList(self, list): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
356 |
self.VariableList = "," + ",".join([variable["Name"] for variable in list]) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
357 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
358 |
def SetActionList(self, list): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
359 |
self.ActionList = "," + ",".join(list) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
360 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
361 |
def SetValues(self, actions): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
362 |
for action in actions: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
363 |
row = {"Qualifier" : action["qualifier"], "Value" : action["value"]} |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
364 |
if action["type"] == "reference": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
365 |
if action["value"] in self.ActionList: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
366 |
row["Type"] = "Action" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
367 |
elif action["value"] in self.VariableList: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
368 |
row["Type"] = "Variable" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
369 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
370 |
row["Type"] = "Inline" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
371 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
372 |
row["Type"] = "Inline" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
373 |
if "duration" in action: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
374 |
row["Duration"] = action["duration"] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
375 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
376 |
row["Duration"] = "" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
377 |
if "indicator" in action: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
378 |
row["Indicator"] = action["indicator"] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
379 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
380 |
row["Indicator"] = "" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
381 |
self.Table.AppendRow(row) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
382 |
self.Table.ResetView(self.ActionsGrid) |
577
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
383 |
if len(actions) > 0: |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
384 |
self.ActionsGrid.SetGridCursor(0, 0) |
9dbb79722fbc
Adding support for giving keyboard focus to the first control of every dialogs
laurent
parents:
534
diff
changeset
|
385 |
self.ActionsGrid.RefreshButtons() |
409
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
386 |
|
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
387 |
def GetValues(self): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
388 |
values = [] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
389 |
for data in self.Table.GetData(): |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
390 |
action = {"qualifier" : data["Qualifier"], "value" : data["Value"]} |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
391 |
if data["Type"] in ["Action", "Variable"]: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
392 |
action["type"] = "reference" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
393 |
else: |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
394 |
action["type"] = "inline" |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
395 |
if data["Duration"] != "": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
396 |
action["duration"] = data["Duration"] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
397 |
if data["Indicator"] != "": |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
398 |
action["indicator"] = data["Indicator"] |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
399 |
values.append(action) |
34c9f624c2fe
Reorganization of Dialog classes by splitting Dialogs.py into several files, one for each Dialog class
laurent
parents:
diff
changeset
|
400 |
return values |