Linux PyQt tray application to control OctoPrint instances
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

MainWindow.py 774B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env python3
  2. # OctoTray Linux Qt System Tray OctoPrint client
  3. #
  4. # MainWindow.py
  5. #
  6. # Used when calling application with arguments
  7. # '--windowed' or '-w' on command line,
  8. # or when no system tray is available.
  9. from PyQt5.QtWidgets import QWidget, QVBoxLayout
  10. class MainWindow(QWidget):
  11. def __init__(self, parent, *args, **kwargs):
  12. super(MainWindow, self).__init__(*args, **kwargs)
  13. self.parent = parent
  14. self.mainLayout = QVBoxLayout()
  15. self.setLayout(self.mainLayout)
  16. self.mainLayout.addWidget(self.parent.menu)
  17. self.parent.menu.aboutToHide.connect(self.aboutToHide)
  18. def aboutToHide(self):
  19. self.parent.menu.show()
  20. def closeEvent(self, event):
  21. self.parent.exit()
  22. event.accept()