qrazercfg-applet 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env python3
  2. #
  3. # Razer device QT configuration tool
  4. #
  5. # Copyright (C) 2007-2018 Michael Buesch <m@bues.ch>
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation; either version 2
  10. # of the License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. import sys
  17. import traceback
  18. from PyQt5.QtCore import *
  19. from PyQt5.QtGui import *
  20. from PyQt5.QtWidgets import *
  21. import pyrazer
  22. from pyrazer import ui
  23. def main():
  24. try:
  25. ui.razer = pyrazer.Razer(enableNotifications=True)
  26. except pyrazer.RazerEx as e:
  27. print(e)
  28. return 1
  29. app = QApplication(sys.argv)
  30. try:
  31. # check if systray is available at freedesktop
  32. if not QSystemTrayIcon.isSystemTrayAvailable():
  33. print("No system tray available")
  34. return 1
  35. applet = ui.RazerApplet()
  36. applet.show()
  37. return app.exec_()
  38. except pyrazer.RazerEx as e:
  39. QMessageBox.critical(None,
  40. "qrazercfg-applet - Fatal exception",
  41. "qrazercfg-applet - A fatal exception occurred:\n\n"
  42. "%s\n\n"
  43. "%s" % (str(e), traceback.format_exc()))
  44. raise e
  45. if __name__ == "__main__":
  46. sys.exit(main())