Mercurial > fife-parpg
annotate clients/editor/plugins/layertool.py @ 217:68ae8f4234ca
* More compact ObjectSelector dialog
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 19 Mar 2009 01:40:51 +0000 |
parents | 2a80f7d9aede |
children | 561751c094b8 |
rev | line source |
---|---|
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 #!/usr/bin/env python |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 # coding: utf-8 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 # ################################################### |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 # Copyright (C) 2008 The Zero-Projekt team |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 # http://zero-projekt.net |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 # info@zero-projekt.net |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 # This file is part of Zero "Was vom Morgen blieb" |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 # |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 # The Zero-Projekt codebase is free software; you can redistribute it and/or modify |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 # it under the terms of the GNU General Public License as published by |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 # the Free Software Foundation; either version 2 of the License, or |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 # (at your option) any later version. |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 # |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 # This program is distributed in the hope that it will be useful, |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 # GNU General Public License for more details. |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 # |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 # You should have received a copy of the GNU General Public License |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 # along with this program; if not, write to the |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 # Free Software Foundation, Inc., |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 # ################################################### |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 """ an advanced layer tool for FIFedit """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 import fife |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 import plugin |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 import pychan |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 import pychan.widgets as widgets |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 from pychan.tools import callbackWithArguments as cbwa |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 import settings as Settings |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
35 # default should be pychan default, highlight can be choosen (format: r,g,b) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
36 _DEFAULT_BACKGROUND_COLOR = (0,0,100) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
37 _HIGHLIGHT_BACKGROUND_COLOR = (173,216,230) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
38 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
39 # the dynamicly created widgets have the name scheme prefix + layerid |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
40 _LABEL_NAME_PREFIX = "select_" |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
41 |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 class LayerTool(plugin.Plugin): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
43 """ The B{LayerTool} is an advanced method to view |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
44 and change layer informations. |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
46 While the original FIFedit tool only allows to select |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
47 layers, this one will provide the following functionality: |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
48 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
49 - toggle layer visibility |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
50 - select layer |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
51 - list layers |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
52 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
53 The plugin has to register itself in the mapeditor module |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
54 to get actual content when a new map is loaded. |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
56 def __init__(self, engine, mapedit): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
57 # Fifedit plugin data |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 self.menu_items = { 'LayerTool' : self.toggle } |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 self._mapedit = mapedit |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
60 self.data = False |
216
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
61 self.previous_active_layer = None |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
62 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
63 # "register" at mapeditor module |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
64 self._mapedit.layertool = self |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
65 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
66 self.subwrappers = [] |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
67 self.__create_gui() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
69 def __create_gui(self): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
70 """ create the basic gui container """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
71 self.container = pychan.loadXML('gui/layertool.xml') |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
72 self.wrapper = self.container.findChild(name="layers_wrapper") |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
74 def _adjust_position(self): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 """ adjusts the position of the container - we don't want to |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
76 let the window appear at the center of the screen. |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 (new default position: left, beneath the tools window) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 self.container.position = (10, 200) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 def clear(self): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 """ remove all subwrappers """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
83 if self.subwrappers is []: return |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
84 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
85 for subwrapper in self.subwrappers: |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 self.wrapper.removeChild(subwrapper) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
87 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 self.subwrappers = [] |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
90 def update(self): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
91 """ dump new layer informations into the wrapper |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 We group one ToggleButton and one Lable into a HBox, the main wrapper |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
94 itself is a VBox and we also capture both the Button and the Label to listen |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
95 for mouse actions |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
96 """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
97 layers = self._mapedit._map.getLayers() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 self.clear() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 for layer in layers: |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
102 layerid = layer.getId() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
103 subwrapper = pychan.widgets.HBox() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
105 visibility_widget = pychan.widgets.ToggleButton(up_image="icons/is_visible.png",down_image="icons/quit.png") |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
106 visibility_widget.name = "toggle_" + layerid |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 visibility_widget.capture(self.toggle_layer_visibility,"mousePressed") |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 layer_name_widget = pychan.widgets.Label() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
110 layer_name_widget.text = layerid |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
111 layer_name_widget.name = _LABEL_NAME_PREFIX + layerid |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
112 layer_name_widget.capture(self.select_active_layer,"mousePressed") |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
113 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
114 subwrapper.addChild(visibility_widget) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
115 subwrapper.addChild(layer_name_widget) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
116 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
117 self.wrapper.addChild(subwrapper) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 self.subwrappers.append(subwrapper) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
120 self.container.adaptLayout() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 self.data = True |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 def toggle(self): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
124 """ toggle visibility of the main gui container """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
125 if self.container.isVisible(): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 self.container.hide() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
127 else: |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
128 self.container.show() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
129 self._adjust_position() |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
130 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
131 def toggle_layer_visibility(self, event, widget): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 """ callback for ToggleButtons |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
133 |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
134 Toggle the chosen layer visible / invisible |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
135 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
136 NOTE: |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
137 - if a layer is set to invisible, it also shouldn't be the active layer anymore |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
138 |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
139 @type event: object |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
140 @param event: pychan mouse event |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
141 @type widget: object |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
142 @param widget: the pychan widget where the event occurs, transports the layer id in it's name |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
143 """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
144 if not self.data: return |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
145 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
146 layerid = widget.name[7:] |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
147 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
148 layer = self._mapedit._map.getLayer(layerid) |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
149 |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
150 if layer.areInstancesVisible(): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
151 layer.setInstancesVisible(False) |
216
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
152 self.select_no_layer() |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
153 # self.select_different_active_layer(layerid) |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
154 else: |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
155 layer.setInstancesVisible(True) |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
156 |
216
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
157 |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
158 def select_no_layer(self): |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
159 """ the exception approach - as soon as the user hides a layer, the mapedit module should stop to use this |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
160 one, too. |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
161 |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
162 A bunch of exceptions is the result (each click on the map will result in a exception as no layer is set etc...) |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
163 """ |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
164 self._mapedit._editLayer(None) |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
165 |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
166 def select_different_active_layer(self, layerid): |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
167 """ a helper method to pick either the previous or next layer in the layerlist |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
168 by using the given layerid as pivot element |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
169 |
216
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
170 NOTE: |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
171 - dropped for now, we set self.mapedit._layer to None if a layer gets invisible |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
172 |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
173 FIXME: |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
174 - either drop this feature or find a solution for boderline cases: |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
175 - user hides all layers (which one should be active?) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
176 - worst case would be that this algo has to check all layers recursive until it knows that all are invisible |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
177 to return with no result (no selection of an active layer, I'm not sure if FIFEdit supports that at all) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
178 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
179 @type layerid: string |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
180 @param layerid: the layerid of the pivot element |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
181 """ |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
182 layers = [layer.getId() for layer in self._mapedit._map.getLayers()] |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
183 pivot_index = layers.index(layerid) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
184 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
185 if len(layers) == 1: |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
186 return |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
187 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
188 if pivot_index == len(layers) - 1: |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
189 different_layer = layers[pivot_index - 1] |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
190 else: |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
191 different_layer = layers[pivot_index + 1] |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
192 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
193 widget = self.container.findChild(name=_LABEL_NAME_PREFIX + different_layer) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
194 self.select_active_layer(None, widget) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
195 |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
196 def select_active_layer(self, event, widget): |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
197 """ callback for Labels |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
198 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
199 We hand the layerid over to the mapeditor module to select a |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
200 new active layer |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
201 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
202 Additionally, we mark the active layer widget (changing base color) and reseting the previous one |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
203 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
204 FIXME: |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
205 - styled widgets don't accept layout changes (might be a bug in the pychan layout engine) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
206 - therefore we can only mark the active layer via text (I added a * to the label text) |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
207 |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
208 @type event: object |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
209 @param event: pychan mouse event |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
210 @type widget: object |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
211 @param widget: the pychan widget where the event occurs, transports the layer id in it's name |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
212 """ |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
213 if not self.data: return |
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
214 |
216
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
215 if self.previous_active_layer is not None: |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
216 previous_layer_id = str(self.previous_active_layer) |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
217 previous_active_widget = self.container.findChild(name="select_" + previous_layer_id) |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
218 previous_active_widget._setBackgroundColor(_DEFAULT_BACKGROUND_COLOR) |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
219 previous_active_widget._setForegroundColor(_DEFAULT_BACKGROUND_COLOR) |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
220 previous_active_widget._setBaseColor(_DEFAULT_BACKGROUND_COLOR) |
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
221 previous_active_widget.text = previous_layer_id |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
222 |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
223 layerid = widget.name[7:] |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
224 |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
225 widget._setBackgroundColor(_HIGHLIGHT_BACKGROUND_COLOR) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
226 widget._setForegroundColor(_HIGHLIGHT_BACKGROUND_COLOR) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
227 widget._setBaseColor(_HIGHLIGHT_BACKGROUND_COLOR) |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
228 widget.text = widget.text + " *" |
216
2a80f7d9aede
- changed autoselection once a layer is toggled invisible, now an exception is thrown because we also deselect the layer in the mapedit module
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
215
diff
changeset
|
229 self.previous_active_layer = layerid |
215
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
230 self.container.adaptLayout() |
5f5f8ca6db93
- added indicator for the active layer (no color indication, unfortunately pychan can't style widgets once they were stylized(), which is true for the editor application)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
182
diff
changeset
|
231 |
182
bcc93e17f978
- added new plugin to FIFedit (Layertool)
chewie@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
232 self._mapedit._editLayer(layerid) |