main.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3. import sys
  4. from portscan import PortScan
  5. from PyQt4 import QtGui, QtCore
  6. class MainClass(QtGui.QMainWindow):
  7. def __init__(self):
  8. super(MainClass, self).__init__()
  9. self.initUI()
  10. def initUI(self):
  11. self.resize(500,300)
  12. self.center()
  13. self.setWindowTitle('FDN - VPN configuration generator')
  14. self.statusBar().showMessage('Ready')
  15. qbtn = QtGui.QPushButton('Quit', self)
  16. qbtn.clicked.connect(QtCore.QCoreApplication.instance().quit)
  17. qbtn.resize(qbtn.sizeHint())
  18. resbox = QtGui.QLabel(PortScan.portscan())
  19. hbox = QtGui.QHBoxLayout()
  20. hbox.addStretch(3)
  21. hbox.addWidget(qbtn)
  22. hbox.addWidget(resbox)
  23. vbox = QtGui.QVBoxLayout()
  24. vbox.addStretch(1)
  25. vbox.addLayout(hbox)
  26. self.setLayout(vbox)
  27. self.show()
  28. def center(self):
  29. qr = self.frameGeometry()
  30. cp = QtGui.QDesktopWidget().availableGeometry().center()
  31. qr.moveCenter(cp)
  32. self.move(qr.topLeft())
  33. def main():
  34. app = QtGui.QApplication(sys.argv)
  35. ex = MainClass()
  36. sys.exit(app.exec_())
  37. if __name__ == '__main__':
  38. main()