Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. from PyQt4 import QtCore, QtGui
  4. from calculate_ui import Ui_Dialog
  5. from math import *
  6. from qgis.core import *
  7. class Dialog(QtGui.QDialog, Ui_Dialog):
  8. def __init__(self, iface):
  9. QtGui.QDialog.__init__(self)
  10. self.iface = iface
  11. self.setupUi(self)
  12. self.ui = Ui_Dialog()
  13. self.ui.setupUi(self)
  14. # Validations
  15. tempValidator = QtGui.QDoubleValidator()
  16. tempValidator.setNotation(QtGui.QDoubleValidator.StandardNotation)
  17. self.ui.at.setValidator(tempValidator)
  18. self.ui.Rt.setValidator(tempValidator)
  19. self.ui.hesaplak.clicked.connect(self.calc)
  20. self.ui.temizlek.clicked.connect(self.silk)
  21. def derece(degrees):
  22. return degrees*((2*pi)/400)
  23. def calc(self):
  24. a = float(self.ui.at.text())
  25. R = float(self.ui.Rt.text())
  26. T=R*tan(derece(a/2))
  27. L=(2*pi*R*a)/400
  28. BS=(R/cos(derece(a/2)))-R
  29. self.ui.Tt.setText(str(T))
  30. self.ui.Lt.setText(str(L))
  31. self.ui.BSt.setText(str(BS))
  32. def silk(self):
  33. self.ui.at.clear()
  34. self.ui.Rt.clear()
  35. self.ui.Tt.clear()
  36. self.ui.Lt.clear()
  37. self.ui.BSt.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement