35 |
import view |
import view |
36 |
import tree |
import tree |
37 |
import tableview, identifyview |
import tableview, identifyview |
|
from Thuban.UI.classifier import Classifier |
|
38 |
import legend |
import legend |
39 |
from menu import Menu |
from menu import Menu |
40 |
|
|
52 |
|
|
53 |
import projdialog |
import projdialog |
54 |
|
|
55 |
|
from Thuban.Lib.classmapper import ClassMapper |
56 |
|
|
57 |
|
layer_properties_dialogs = ClassMapper() |
58 |
|
|
59 |
class MainWindow(DockFrame): |
class MainWindow(DockFrame): |
60 |
|
|
351 |
""" |
""" |
352 |
self.SetStatusText(text) |
self.SetStatusText(text) |
353 |
|
|
354 |
|
def OpenOrRaiseDialog(self, name, dialog_class, *args, **kw): |
355 |
|
""" |
356 |
|
Open or raise a dialog. |
357 |
|
|
358 |
|
If a dialog with the denoted name does already exist it is |
359 |
|
raised. Otherwise a new dialog, an instance of dialog_class, |
360 |
|
is created, inserted into the main list and displayed. |
361 |
|
""" |
362 |
|
dialog = self.get_open_dialog(name) |
363 |
|
|
364 |
|
if dialog is None: |
365 |
|
dialog = dialog_class(self, name, *args, **kw) |
366 |
|
self.add_dialog(name, dialog) |
367 |
|
dialog.Show(True) |
368 |
|
else: |
369 |
|
dialog.Raise() |
370 |
|
|
371 |
def save_modified_session(self, can_veto = 1): |
def save_modified_session(self, can_veto = 1): |
372 |
"""If the current session has been modified, ask the user |
"""If the current session has been modified, ask the user |
373 |
whether to save it and do so if requested. Return the outcome of |
whether to save it and do so if requested. Return the outcome of |
724 |
self.OpenLayerProperties(layer) |
self.OpenLayerProperties(layer) |
725 |
|
|
726 |
def OpenLayerProperties(self, layer, group = None): |
def OpenLayerProperties(self, layer, group = None): |
727 |
name = "layer_properties" + str(id(layer)) |
""" |
728 |
dialog = self.get_open_dialog(name) |
Open or raise the properties dialog. |
729 |
|
|
730 |
if dialog is None: |
This method opens or raises the properties dialog for the |
731 |
dialog = Classifier(self, name, layer, group) |
currently selected layer if one is defined for this layer |
732 |
self.add_dialog(name, dialog) |
type. |
733 |
dialog.Show() |
""" |
734 |
dialog.Raise() |
dialog_class = layer_properties_dialogs.get(layer) |
735 |
|
|
736 |
|
if dialog_class is not None: |
737 |
|
name = "layer_properties" + str(id(layer)) |
738 |
|
self.OpenOrRaiseDialog(name, dialog_class, layer, group = group) |
739 |
|
|
740 |
def LayerJoinTable(self): |
def LayerJoinTable(self): |
741 |
layer = self.canvas.SelectedLayer() |
layer = self.canvas.SelectedLayer() |