I am new to PyQgis. I made a simple calculator with PyQt4, now I am trying to run it under QGIS. I connected calculator as plugin, and tested it, its GUI works without error but it does not calculates anything. How can I get error log? Thank you.
calculator.py:
# -*- coding: utf-8 -*-from PyQt4 import QtCore, QtGuifrom calculate_ui import Ui_Dialogfrom math import *from qgis.core import *def derece(degrees): return degrees*((2*pi)/400)class Dialog(QtGui.QDialog, Ui_Dialog): def __init__(self, iface): QtGui.QDialog.__init__(self) self.iface = iface self.setupUi(self) self.ui = Ui_Dialog() self.ui.setupUi(self) # Validations tempValidator = QtGui.QDoubleValidator() tempValidator.setNotation(QtGui.QDoubleValidator.StandardNotation) self.ui.at.setValidator(tempValidator) self.ui.Rt.setValidator(tempValidator) # Signal/slot connections. self.setupConnections() def calc(self): a = float(self.ui.at.text()) R = float(self.ui.Rt.text()) T=R*tan(derece(a/2)) L=(2*pi*R*a)/400 BS=(R/cos(derece(a/2)))-R self.ui.Tt.setText(str(T)) self.ui.Lt.setText(str(L)) self.ui.BSt.setText(str(BS)) def silk(self): self.ui.at.clear() self.ui.Rt.clear() self.ui.Tt.clear() self.ui.Lt.clear() self.ui.BSt.clear() def setupConnections(self): self.connect(self.ui.hesaplak, QtCore.SIGNAL('clicked()'), self.calc) self.connect(self.ui.temizlek, QtCore.SIGNAL('clicked()'), self.silk)You can take a look at the plugin from here.
أكثر...
calculator.py:
# -*- coding: utf-8 -*-from PyQt4 import QtCore, QtGuifrom calculate_ui import Ui_Dialogfrom math import *from qgis.core import *def derece(degrees): return degrees*((2*pi)/400)class Dialog(QtGui.QDialog, Ui_Dialog): def __init__(self, iface): QtGui.QDialog.__init__(self) self.iface = iface self.setupUi(self) self.ui = Ui_Dialog() self.ui.setupUi(self) # Validations tempValidator = QtGui.QDoubleValidator() tempValidator.setNotation(QtGui.QDoubleValidator.StandardNotation) self.ui.at.setValidator(tempValidator) self.ui.Rt.setValidator(tempValidator) # Signal/slot connections. self.setupConnections() def calc(self): a = float(self.ui.at.text()) R = float(self.ui.Rt.text()) T=R*tan(derece(a/2)) L=(2*pi*R*a)/400 BS=(R/cos(derece(a/2)))-R self.ui.Tt.setText(str(T)) self.ui.Lt.setText(str(L)) self.ui.BSt.setText(str(BS)) def silk(self): self.ui.at.clear() self.ui.Rt.clear() self.ui.Tt.clear() self.ui.Lt.clear() self.ui.BSt.clear() def setupConnections(self): self.connect(self.ui.hesaplak, QtCore.SIGNAL('clicked()'), self.calc) self.connect(self.ui.temizlek, QtCore.SIGNAL('clicked()'), self.silk)You can take a look at the plugin from here.
أكثر...