def main(options=None): if options == None: options = parse_options() if options.version: print APP_NAME, "version", APP_VERSION sys.exit(0) elif os.geteuid() != 0: # root privileges are required for blivet RootTestDialog() sys.exit(0) else: if options.embeded: if options.kickstart: MainWindow = embeded_window(kickstart=True) else: MainWindow = embeded_window() MainWindow.show_all() elif options.kickstart: MainWindow = main_window(kickstart=True) MainWindow.set_position(Gtk.WindowPosition.CENTER) MainWindow.show_all() else: MainWindow = main_window() MainWindow.set_position(Gtk.WindowPosition.CENTER) MainWindow.show_all() Gtk.main()
import os import string import json import dbus from PyQt4.QtGui import * from dbus.mainloop.qt import DBusQtMainLoop from main_window import * app = QApplication(sys.argv) dbus.set_default_main_loop(dbus.mainloop.qt.DBusQtMainLoop()) the_main_window = main_window() the_main_window.show() if False == os.isatty(0): the_line = "" for line in sys.stdin: if string.rfind(line, "PSST:") == 0: the_line = line[len("PSST:"):] if len(the_line) > 0: #last line has to be most current state json.loads(the_line, object_hook=lambda x: from_json(the_main_window, x)) if the_main_window.tab_widget.count() == 0: the_main_window.add_view()