global_settings.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/usr/bin/python2.6
  2. #
  3. # The Qubes OS Project, http://www.qubes-os.org
  4. #
  5. # Copyright (C) 2012 Agnieszka Kostrzewa <agnieszka.kostrzewa@gmail.com>
  6. # Copyright (C) 2012 Marek Marczykowski <marmarek@mimuw.edu.pl>
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License
  10. # as published by the Free Software Foundation; either version 2
  11. # of the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  21. #
  22. #
  23. import sys
  24. import os
  25. from PyQt4.QtCore import *
  26. from PyQt4.QtGui import *
  27. from qubes.qubes import QubesVmCollection
  28. from qubes.qubes import QubesException
  29. from qubes.qubes import QubesDaemonPidfile
  30. from qubes.qubes import QubesHost
  31. import qubesmanager.resources_rc
  32. from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
  33. import subprocess
  34. import time
  35. import threading
  36. from operator import itemgetter
  37. from ui_globalsettingsdlg import *
  38. class GlobalSettingsWindow(Ui_GlobalSettings, QDialog):
  39. def __init__(self, parent=None):
  40. super(GlobalSettingsWindow, self).__init__(parent)
  41. self.setupUi(self)
  42. def reject(self):
  43. self.done(0)
  44. def save_and_apply(self):
  45. pass
  46. # Bases on the original code by:
  47. # Copyright (c) 2002-2007 Pascal Varet <p.varet@gmail.com>
  48. def handle_exception( exc_type, exc_value, exc_traceback ):
  49. import sys
  50. import os.path
  51. import traceback
  52. filename, line, dummy, dummy = traceback.extract_tb( exc_traceback ).pop()
  53. filename = os.path.basename( filename )
  54. error = "%s: %s" % ( exc_type.__name__, exc_value )
  55. QMessageBox.critical(None, "Houston, we have a problem...",
  56. "Whoops. A critical error has occured. This is most likely a bug "
  57. "in Qubes Global Settings application.<br><br>"
  58. "<b><i>%s</i></b>" % error +
  59. "at <b>line %d</b> of file <b>%s</b>.<br/><br/>"
  60. % ( line, filename ))
  61. def main():
  62. global qubes_host
  63. qubes_host = QubesHost()
  64. global app
  65. app = QApplication(sys.argv)
  66. app.setOrganizationName("The Qubes Project")
  67. app.setOrganizationDomain("http://qubes-os.org")
  68. app.setApplicationName("Qubes Global Settings")
  69. sys.excepthook = handle_exception
  70. qvm_collection = QubesVmCollection()
  71. qvm_collection.lock_db_for_reading()
  72. qvm_collection.load()
  73. qvm_collection.unlock_db()
  74. global global_window
  75. global_window = GlobalSetingsWindow()
  76. global_window.show()
  77. app.exec_()
  78. app.exit()
  79. if __name__ == "__main__":
  80. main()