本文整理汇总了Python中Tree.resetTree方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.resetTree方法的具体用法?Python Tree.resetTree怎么用?Python Tree.resetTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.resetTree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeList
# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import resetTree [as 别名]
#.........这里部分代码省略.........
self.message="selected"
self.progressBar=ProgressBarWindow(True,True)# apro la progress bar con due barre
self.progressBar.setMaximumOverall(4)
self.ui_tree=MainWindowAlbero(iface,self.tree)
#self.tree
def testExport(self,L):
f=open("/home/giuseppe/Scrivania/treeNodes.json","w")
#self.t.childrenAdder(self.t.getProvincia(), self.t.getComune())
#f.write("var treeNodes={text:'root','expanded':true,'children'"+":[") #file js
f.write('{"text":"root","expanded":"true","children"'+":[")
l=L[0:1]#prendo un sottoinsieme di regioni
#l.export(f)
for p in l:
p.exportJson(f)
f.write("]}")
def exportDb(self,L):
dbfile='root'+":"+'mmasgisDB'+'@'+'localhost'+":"+'3306'
engine = create_engine('mysql://root:[email protected]/mmasgisDB?charset=utf8&use_unicode=0', pool_recycle=3600)
connection =MySQLdb.connect(user='root',passwd='vilu7240',db='mmasgisDB',host='localhost')# engine.connect()
cur=connection.cursor()
metadata = MetaData(bind=engine)
Session = sessionmaker(bind=engine)
session=Session()
c=0
for p in L:
print " nodo ",c
c+=1
p.exportDb(session,-1)
session.commit()
def treeMaker(self):
self.tree.resetTree()
layersmap=QgsMapLayerRegistry.instance().mapLayers()
curLayer = self.iface.mapCanvas().currentLayer()
mc=self.iface.mapCanvas()
#self.log("nLayers test.py 194",self.nLayers)
# rimuovo il layer aggiunto dal plugin openLayers
#non posso cambiare il dict mentre sono in un ciclo
#quindi creo un dict con i soli layers che mi interessano
dummymap={}
for key in layersmap.iterkeys():
if (self.search(str(key),"_g"))or(self.match(str(key),'Cap')):
dummymap[key]=layersmap[key]
#self.log("dummymap={0}".format(dummymap),"203 test.py")
#self.log("layersmap={0}".format(layersmap),"204 test.py")
#self.log("lunghezza dummy={0}".format(len(dummymap)),"lunghezza original={0}".format(len(layersmap)))
n=0
for key in dummymap.iterkeys():
self.progressBar.setValueOverall(n)
# self.log("esamino layers {0}".format(key),"test.py 212")
# self.log("type(key {0}".format(type(key))," ###")
curLayer=layersmap[key]
chiave=str(key[0:3])
#aggiungo il layer che verra' usato per selezionare le features sulla mappa
self.ui_tree.addLayer(str(key)[0:3], curLayer)
self.analizeLayers(curLayer,chiave.lower(),str(key))
n+=1
lista_nodi=self.tree.treeBuilder()
#self.testExport(lista_nodi)
#self.exportDb(lista_nodi)
#creo il file javascript per l'albero