Skip to content

Commit

Permalink
Bug para capas que no tienen path
Browse files Browse the repository at this point in the history
  • Loading branch information
Oscar Martinez committed Apr 9, 2019
1 parent 55afc67 commit cf61f33
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 36 deletions.
39 changes: 20 additions & 19 deletions autorun.inf
Original file line number Diff line number Diff line change
@@ -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

16 changes: 12 additions & 4 deletions selectionorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
13 changes: 8 additions & 5 deletions sourceorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
9 changes: 5 additions & 4 deletions tabbedtoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
1 change: 1 addition & 0 deletions tocutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions visibilityorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit cf61f33

Please sign in to comment.