annotate clients/editor/scripts/gui/layerdialog.py @ 343:8e71629c4c43

Several changes to layer, camera and map dialogs: * Renamed CameraEditor and LayerEditor to CameraDialog and LayerDialog * Moved CameraDialog and LayerDialog into their own modules in scripts.gui so other components can use them. * Prettier camera dialog * Added LayerDialog to map wizard
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 25 Aug 2009 01:21:00 +0000
parents
children 8b125ec749d7
rev   line source
343
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
1 import fife
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
2 import pychan
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
3
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
4 class LayerDialog(object):
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
5 """ The B{LayerDialog} provides a gui dialog for creating and editing layers.
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
6
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
7 FIXME:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
8 - gridtypes can only be square for now
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
9 - pathing strategy
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
10 """
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
11 def __init__(self, engine, map, callback=None, onCancel=None, layer=None):
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
12 self.engine = engine
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
13 self.model = engine.getModel()
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
14 self.map = map
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
15 self.layer = layer
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
16 self.callback = callback
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
17 self.onCancel = onCancel
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
18 self._widget = pychan.loadXML('gui/layerdialog.xml')
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
19
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
20 # TODO: Add access method for adopted grid types?
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
21 self._widget.findChild(name="gridBox").items = ['square', 'hexagonal']
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
22
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
23 # TODO: Ditto for pather?
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
24 self._widget.findChild(name="pathingBox").items = ['cell_edges_only', 'cell_edges_and_diagonals', 'freeform']
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
25
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
26 if layer:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
27 cg = layer.getCellGrid()
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
28 cgtype = 0
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
29 if cg.getType() == 'hexagonal':
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
30 cgtype = 1
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
31
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
32 self._widget.distributeData({
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
33 "layerBox" : unicode(layer.getId()),
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
34 "xScaleBox" : unicode(cg.getXScale()),
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
35 "yScaleBox" : unicode(cg.getYScale()),
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
36 "rotBox" : unicode(cg.getRotation()),
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
37 "xOffsetBox" : unicode(cg.getXShift()),
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
38 "yOffsetBox" : unicode(cg.getYShift())
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
39 })
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
40
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
41 self._widget.findChild(name="pathingBox").selected = int(layer.getPathingStrategy())
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
42 self._widget.findChild(name="gridBox").selected = int(cgtype)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
43 else:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
44 self._widget.findChild(name="pathingBox").selected = 0
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
45 self._widget.findChild(name="gridBox").selected = 0
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
46
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
47 self._widget.mapEvents({
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
48 'okButton' : self._finished,
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
49 'cancelButton' : self._cancelled
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
50 })
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
51
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
52 self._widget.show()
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
53
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
54 def _cancelled(self):
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
55 """ """
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
56 if self.onCancel:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
57 self.onCancel()
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
58 self._widget.hide()
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
59
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
60 def _finished(self):
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
61 """ """
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
62 # Collect and validate data
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
63 layerId = self._widget.collectData('layerBox')
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
64 if layerId == '':
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
65 print 'Please enter a layer id.'
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
66 return
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
67
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
68 try:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
69 x_offset = float(self._widget.collectData('xOffsetBox'))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
70 y_offset = float(self._widget.collectData('yOffsetBox'))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
71 except ValueError:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
72 print 'Please enter integer or decimal values for offset.'
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
73 return
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
74
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
75 try:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
76 x_scale = float(self._widget.collectData('xScaleBox'))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
77 y_scale = float(self._widget.collectData('yScaleBox'))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
78 except ValueError:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
79 print 'Please enter integer or decimal values for scale.'
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
80 return
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
81
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
82 try:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
83 rotation = float(self._widget.collectData('rotBox'))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
84 except ValueError:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
85 print 'Please enter integer or decimal value for rotation.'
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
86 return
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
87
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
88 grid_type = int(self._widget.collectData('gridBox'))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
89 pathing = int(self._widget.collectData('pathingBox'))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
90
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
91 if grid_type == 0:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
92 grid_type = "square"
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
93 else:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
94 grid_type = "hexagonal"
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
95
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
96 # Set up layer
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
97 layer = self.layer
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
98 cellgrid = None
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
99
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
100 cellgrid = self.model.getCellGrid(grid_type)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
101 if not cellgrid:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
102 print "Invalid grid type"
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
103 return
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
104
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
105 cellgrid.setRotation(rotation)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
106 cellgrid.setXScale(x_scale)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
107 cellgrid.setYScale(y_scale)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
108 cellgrid.setXShift(x_offset)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
109 cellgrid.setYShift(y_offset)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
110
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
111 if not self.layer:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
112 try:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
113 layer = self.map.createLayer(str(layerId), cellgrid)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
114
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
115 except fife.NameClash:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
116 print 'The layer ' + str(layerId) + ' already exists!'
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
117 return
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
118 else:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
119 layer.setCellGrid(cellgrid)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
120 try:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
121 layer.setId(str(layerId))
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
122 except fife.NameClash:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
123 print 'The layer ' + str(layerId) + ' already exists!'
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
124 return
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
125
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
126 layer.setPathingStrategy(pathing)
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
127
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
128 self.engine.getView().resetRenderers()
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
129
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
130 # Hide dialog and call back
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
131 self._widget.hide()
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
132
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
133 if self.callback:
8e71629c4c43 Several changes to layer, camera and map dialogs:
cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff changeset
134 pychan.tools.applyOnlySuitable(self.callback, layer=layer)