diff --git a/autorun.inf b/autorun.inf index 4b613a2..41ce384 100644 --- a/autorun.inf +++ b/autorun.inf @@ -1,19 +1,20 @@ -[script] -enable = true - -[Unit] -type = Script -name = autorun -description = -createdBy = -version = - -[Script] -main = main -Lang = python - -[properties] -autorun.group.name = gvsig-base -autorun.group.order = 1000 -autorun.order = 2900 - +[script] +enable = true + +[Unit] +type = Script +name = autorun +description = +createdBy = +version = + +[Script] +main = main +Lang = python +enable = true + +[properties] +autorun.group.name = gvsig-base +autorun.group.order = 1000 +autorun.order = 2900 + diff --git a/selectionorder.py b/selectionorder.py index d959785..7becc5a 100644 --- a/selectionorder.py +++ b/selectionorder.py @@ -51,12 +51,16 @@ from tocutils import getExpansionState from tocutils import setExpansionState +from gvsig import logger +from gvsig import LOGGER_WARN,LOGGER_INFO,LOGGER_ERROR + def setTreeAsSelectionOrder(tree, mapContext): updateAll(tree, mapContext) tree.setCellRenderer(SelectionCellRenderer(tree, mapContext)) tree.addMouseListener(SelectionMouseAdapter(tree,mapContext)) addUpdateToCListener("SelectionOrder", mapContext, UpdateListener(tree,mapContext)) - + tree.revalidate() + tree.repaint() def updateAll(tree, mapContext): exp = getExpansionState(tree) @@ -67,8 +71,9 @@ def updateAll(tree, mapContext): #tree.repaint() #expandAllNodes(tree, 0, tree.getRowCount()) setExpansionState(tree, exp) - #tree.revalidate() - #tree.repaint() + #logger("Not able to set expansion state", LOGGER_ERROR) + tree.revalidate() + tree.repaint() class UpdateListener(): def __init__(self, tree, mapContext): @@ -307,7 +312,10 @@ class DataLayer(object): def __init__(self,path,layer): self.__path = path self.__layer = layer - self.__label = os.path.basename(self.__path) + if path != None: + self.__label = os.path.basename(self.__path) + else: + self.__label = None def getName(self): return self.__label def getLayer(self): diff --git a/sourceorder.py b/sourceorder.py index 1186eab..abe6436 100644 --- a/sourceorder.py +++ b/sourceorder.py @@ -44,8 +44,8 @@ def setTreeAsSourceOrder(tree, mapContext): tree.setCellRenderer(SourceCellRenderer(tree, mapContext)) tree.addMouseListener(SourceMouseAdapter(tree,mapContext)) addUpdateToCListener("SourceOrder", mapContext, UpdateListener(tree,mapContext)) - #tree.revalidate() - #tree.repaint() + tree.revalidate() + tree.repaint() def updateAll(tree, mapContext): exp = getExpansionState(tree) @@ -56,8 +56,8 @@ def updateAll(tree, mapContext): #tree.repaint() #expandAllNodes(tree, 0, tree.getRowCount()) setExpansionState(tree, exp) - #tree.revalidate() - #tree.repaint() + tree.revalidate() + tree.repaint() class UpdateListener(): def __init__(self, tree, mapContext): @@ -245,7 +245,10 @@ class DataLayer(object): def __init__(self,path,layer): self.__path = path self.__layer = layer - self.__label = os.path.basename(self.__path) + if path != None: + self.__label = os.path.basename(self.__path) + else: + self.__label = None def getName(self): return self.__label def getLayer(self): diff --git a/tabbedtoc.py b/tabbedtoc.py index 4eaa0d3..12ad7da 100644 --- a/tabbedtoc.py +++ b/tabbedtoc.py @@ -62,14 +62,15 @@ def install(self, viewPanel): self.__mapContext = viewPanel.getMapControl().getMapContext() # TAB Source Order setTreeAsSourceOrder(self.treeSourceOrder, self.__mapContext) - self.treeSourceOrder.revalidate() - self.treeSourceOrder.repaint() # TAB Visibility setTreeAsVisibilityOrder(self.treeVisibilityOrder, self.__mapContext) - self.treeVisibilityOrder.revalidate() - self.treeVisibilityOrder.repaint() # TAB Selection setTreeAsSelectionOrder(self.treeSelectionOrder, self.__mapContext) + + self.treeSourceOrder.revalidate() + self.treeSourceOrder.repaint() + self.treeVisibilityOrder.revalidate() + self.treeVisibilityOrder.repaint() self.treeSelectionOrder.revalidate() self.treeSelectionOrder.repaint() diff --git a/tocutils.py b/tocutils.py index f193f90..985deda 100644 --- a/tocutils.py +++ b/tocutils.py @@ -221,6 +221,7 @@ class UpdateToCListener(LayerListener,LayerCollectionListener): def __init__(self, id, callable): self.callable = callable self.id = id + self.fireEvent() def getId(self): return self.id diff --git a/visibilityorder.py b/visibilityorder.py index 2b6b2af..a4785ed 100644 --- a/visibilityorder.py +++ b/visibilityorder.py @@ -66,7 +66,8 @@ def setTreeAsVisibilityOrder(tree, mapContext): vportlistener = VisibilityViewPortListener(tree, mapContext) mapContext.getViewPort().addViewPortListener(vportlistener) addUpdateToCListener("VisibilityOrder", mapContext, UpdateListener(tree,mapContext)) - + tree.revalidate() + tree.repaint() def updateAll(tree, mapContext): exp = getExpansionState(tree) @@ -75,7 +76,9 @@ def updateAll(tree, mapContext): tree.getModel().reload() #expandAllNodes(tree, 0, tree.getRowCount()) setExpansionState(tree, exp) - + tree.revalidate() + tree.repaint() + class UpdateListener(): def __init__(self, tree, mapContext): self.mapContext = mapContext @@ -95,7 +98,7 @@ def backColorChanged(self,*args): # Metodo obligatorio de ViewPortListener def extentChanged(self,*args): - updateAll(self.tree,self.mapContext) + updateAll(self.tree, self.mapContext) # Metodo obligatorio de ViewPortListener def projectionChanged(self,*args): @@ -279,7 +282,11 @@ class DataLayer(object): def __init__(self,path,layer): self.__path = path self.__layer = layer - self.__label = os.path.basename(self.__path) + if path != None: + self.__label = os.path.basename(self.__path) + else: + self.__label = None + def getName(self): return self.__label def getLayer(self):