I need to work with some layers and provide output in the form of an Excel file. I have applied a push button in my QT tool design. I have also defined function which is supposed to work after I press my push button but nothing appears in the console.
Here is an image of the button:
and here is an image of the Log panel where I want it to print.
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from qgis import processing
import sys
from operator import itemgetter
from qgis.analysis import (QgsGraphBuilder,QgsVectorLayerDirector,QgsGraphAnalyzer)
from qgis.utils import iface
class Layer(object):
def __init__(self):
print('TestDistributionCable')
class LayerUI(QtWidgets.QWidget):
def __init__(self, iface, dlg):
print('Testing')
QtWidgets.QWidget.__init__(self)
self.iface = iface
self.dlg = dlg
self.sf_lyr = None
self.ui_manager()
self.dlg.pushButton.clicked.connect(self.CMJSheetCreation)
def __del__(self):
pass
def CMJSheetCreation(self):
print("inside")
QgisAll_layers = QgsProject.instance().mapLayers().values()
path = QgsProject.instance().absolutePath()
# output = str(path) + "//fibre_cable.shp"
print("path - " + str(path))
crs = QgsProject.instance().crs()
print("CRS - " + str(crs))
for layer in QgisAll_layers:
print(layer)
if layer.name() == "Fibre Joint":
lyr_fj = polepointlayer.name()
print("layr_fj")
print(lyr_fj)
crs = QgsProject.instance().crs()
# Create the output layer
break
for chamberpointlayer in QgisAll_layers:
if chamberpointlayer.name() == "Chamber":
chamber_layer = chamberpointlayer.name()
break
for boundarieslayer in QgisAll_layers:
if boundarieslayer.name() == "Boundaries":
lyr_Boundaries = boundarieslayer.name()
break
dlg
, how/where do you open it? What isui_manager()
. These are missing. Therefore, we cannot test it.