16 |
wxGridTableMessage, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, \ |
wxGridTableMessage, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, \ |
17 |
wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES |
wxGRIDTABLE_NOTIFY_ROWS_DELETED, wxGRIDTABLE_REQUEST_VIEW_GET_VALUES |
18 |
|
|
19 |
|
from Thuban import _ |
20 |
|
|
21 |
# FIXME: the wx_value_type_map should be moved from tableview to a |
# FIXME: the wx_value_type_map should be moved from tableview to a |
22 |
# separate module |
# separate module |
23 |
from tableview import wx_value_type_map |
from tableview import wx_value_type_map |
31 |
def __init__(self, parent, id): |
def __init__(self, parent, id): |
32 |
wxListCtrl.__init__(self, parent, id, style = wxLC_REPORT) |
wxListCtrl.__init__(self, parent, id, style = wxLC_REPORT) |
33 |
|
|
34 |
self.InsertColumn(0, "Field") |
self.InsertColumn(0, _("Field")) |
35 |
self.SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER) |
self.SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER) |
36 |
self.InsertColumn(1, "Value") |
self.InsertColumn(1, _("Value")) |
37 |
self.SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER) |
self.SetColumnWidth(1, wxLIST_AUTOSIZE_USEHEADER) |
38 |
|
|
39 |
# vaues maps row numbers to the corresponding python values |
# vaues maps row numbers to the corresponding python values |
171 |
def SetValue(self, row, col, value): |
def SetValue(self, row, col, value): |
172 |
if row < self.num_rows: |
if row < self.num_rows: |
173 |
name = self.rows[row][0] |
name = self.rows[row][0] |
174 |
print "Set value of field %s to %s" % (name, value) |
self.record[name] = value |
175 |
|
self.table.write_record(self.record_index, {name: value}) |
176 |
|
|
177 |
# |
# |
178 |
# Some optional methods |
# Some optional methods |
180 |
|
|
181 |
# Called when the grid needs to display labels |
# Called when the grid needs to display labels |
182 |
def GetColLabelValue(self, col): |
def GetColLabelValue(self, col): |
183 |
return "Value" |
return _("Value") |
184 |
|
|
185 |
def GetRowLabelValue(self, row): |
def GetRowLabelValue(self, row): |
186 |
if row < self.num_rows: |
if row < self.num_rows: |