20 |
from Thuban import _ |
from Thuban import _ |
21 |
from Thuban.UI.common import Color2wxColour, wxColour2Color |
from Thuban.UI.common import Color2wxColour, wxColour2Color |
22 |
|
|
23 |
|
from Thuban.Model.messages import MAP_LAYERS_REMOVED, LAYER_SHAPESTORE_REPLACED |
24 |
from Thuban.Model.range import Range |
from Thuban.Model.range import Range |
25 |
from Thuban.Model.classification import \ |
from Thuban.Model.classification import \ |
26 |
Classification, ClassGroupDefault, \ |
Classification, ClassGroupDefault, \ |
678 |
FIELDTYPE_INT: _("Integer"), |
FIELDTYPE_INT: _("Integer"), |
679 |
FIELDTYPE_DOUBLE: _("Decimal")} |
FIELDTYPE_DOUBLE: _("Decimal")} |
680 |
|
|
681 |
def __init__(self, parent, name, layer, group = None): |
def __init__(self, parent, name, map, layer, group = None): |
682 |
NonModalNonParentDialog.__init__(self, parent, name, "") |
NonModalNonParentDialog.__init__(self, parent, name, "") |
683 |
|
|
684 |
self.__SetTitle(layer.Title()) |
self.__SetTitle(layer.Title()) |
685 |
|
|
686 |
self.layer = layer |
self.layer = layer |
687 |
|
self.map = map |
688 |
|
|
689 |
|
self.map.Subscribe(MAP_LAYERS_REMOVED, self.map_layers_removed) |
690 |
|
self.layer.Subscribe(LAYER_SHAPESTORE_REPLACED, |
691 |
|
self.layer_shapestore_replaced) |
692 |
|
|
693 |
self.genDlg = None |
self.genDlg = None |
694 |
|
|
706 |
field = self.originalClass.GetField() |
field = self.originalClass.GetField() |
707 |
fieldType = self.originalClass.GetFieldType() |
fieldType = self.originalClass.GetFieldType() |
708 |
|
|
709 |
|
table = layer.ShapeStore().Table() |
710 |
# |
# |
711 |
# make field choice box |
# make field choice box |
712 |
# |
# |
713 |
self.fields = wxChoice(panel, ID_PROPERTY_SELECT,) |
self.fields = wxChoice(panel, ID_PROPERTY_SELECT,) |
714 |
|
|
715 |
self.num_cols = layer.table.NumColumns() |
self.num_cols = table.NumColumns() |
716 |
# just assume the first field in case one hasn't been |
# just assume the first field in case one hasn't been |
717 |
# specified in the file. |
# specified in the file. |
718 |
self.__cur_field = 0 |
self.__cur_field = 0 |
725 |
self.fields.SetClientData(0, None) |
self.fields.SetClientData(0, None) |
726 |
|
|
727 |
for i in range(self.num_cols): |
for i in range(self.num_cols): |
728 |
name = layer.table.Column(i).name |
name = table.Column(i).name |
729 |
self.fields.Append(name) |
self.fields.Append(name) |
730 |
|
|
731 |
if name == field: |
if name == field: |
859 |
text_title.SetFocus() |
text_title.SetFocus() |
860 |
self.haveApplied = False |
self.haveApplied = False |
861 |
|
|
862 |
|
def unsubscribe_messages(self): |
863 |
|
self.map.Unsubscribe(MAP_LAYERS_REMOVED, self.map_layers_removed) |
864 |
|
self.layer.Unsubscribe(LAYER_SHAPESTORE_REPLACED, |
865 |
|
self.layer_shapestore_replaced) |
866 |
|
|
867 |
|
def map_layers_removed(self, map): |
868 |
|
if self.layer not in self.map.Layers(): |
869 |
|
self.Close() |
870 |
|
|
871 |
|
def layer_shapestore_replaced(self, *args): |
872 |
|
self.Close() |
873 |
|
|
874 |
def EditSymbol(self, row): |
def EditSymbol(self, row): |
875 |
table = self.classGrid.GetTable() |
table = self.classGrid.GetTable() |
876 |
prop = table.GetValueAsCustom(row, COL_SYMBOL, None) |
prop = table.GetValueAsCustom(row, COL_SYMBOL, None) |
877 |
|
|
878 |
# get a new ClassGroupProperties object and copy the |
# get a new ClassGroupProperties object and copy the |
879 |
# values over to our current object |
# values over to our current object |
880 |
propDlg = SelectPropertiesDialog(NULL, prop, self.layer.ShapeType()) |
propDlg = SelectPropertiesDialog(self, prop, self.layer.ShapeType()) |
881 |
|
|
882 |
self.Enable(False) |
self.Enable(False) |
883 |
if propDlg.ShowModal() == wxID_OK: |
if propDlg.ShowModal() == wxID_OK: |
1007 |
self.Close() |
self.Close() |
1008 |
|
|
1009 |
def OnClose(self, event): |
def OnClose(self, event): |
1010 |
|
self.unsubscribe_messages() |
1011 |
NonModalNonParentDialog.OnClose(self, event) |
NonModalNonParentDialog.OnClose(self, event) |
1012 |
|
|
1013 |
def _OnCloseBtn(self, event): |
def _OnCloseBtn(self, event): |
1371 |
|
|
1372 |
wxWindow.__init__(self, parent, id, size = size, style = style) |
wxWindow.__init__(self, parent, id, size = size, style = style) |
1373 |
|
|
1374 |
|
self.parent = parent |
1375 |
|
|
1376 |
self.SetProperties(props) |
self.SetProperties(props) |
1377 |
self.SetShapeType(shapeType) |
self.SetShapeType(shapeType) |
1378 |
self.AllowEdit(True) |
self.AllowEdit(True) |
1416 |
def DoEdit(self): |
def DoEdit(self): |
1417 |
if not self.allowEdit: return |
if not self.allowEdit: return |
1418 |
|
|
1419 |
propDlg = SelectPropertiesDialog(NULL, |
propDlg = SelectPropertiesDialog(self.parent, |
1420 |
self.GetProperties(), |
self.GetProperties(), |
1421 |
self.GetShapeType()) |
self.GetShapeType()) |
1422 |
|
|