MainWnd.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from PyQt5.QtGui import *
  2. from PyQt5.QtWidgets import *
  3. from CustomFrame import *
  4. import os
  5. import datetime
  6. class MainWindow(QMainWindow):
  7. """docstring for Mainwindow"""
  8. def __init__(self, parent = None):
  9. super(MainWindow,self).__init__(parent)
  10. self.basic()
  11. self.Controller = ControlFrame()
  12. self.viewerFrame = ViewerFrame(self.Controller.OnAction)
  13. splitter= self.split_()
  14. self.setCentralWidget(splitter)
  15. def basic(self):
  16. #设置标题,大小,图标
  17. self.setWindowTitle("RPC3DView")
  18. self.resize(490*2+300, 370*2)
  19. #self.setWindowIcon(QIcon("./image/Gt.png"))
  20. #居中显示
  21. screen = QDesktopWidget().geometry()
  22. self_size = self.geometry()
  23. self.move(int((screen.width() - self_size.width())/2),int((screen.height() - self_size.height())/2))
  24. def closeEvent(self, QCloseEvent):
  25. self.Controller.close()
  26. self.viewerFrame.close()
  27. #分割窗口
  28. def split_(self):
  29. splitter = QSplitter(Qt.Horizontal)
  30. splitter.addWidget(self.viewerFrame)
  31. splitter.addWidget(self.Controller)
  32. splitter.setStretchFactor(0,11)
  33. splitter.setStretchFactor(1,4)
  34. return splitter
  35. def OnCloudHandle(self,clouds:pb.clouds):
  36. self.viewerFrame.DisplayCloud(clouds)
  37. def OnErrorHandle(self,info:str):
  38. self.Controller.DisplayErrorInfo(info)