def take_snapshot( cfg, callback = None, force = True ):
	logger.openlog()
	snapshots.Snapshots( cfg ).take_snapshot( callback, force )
	logger.closelog()
    KCmdLineArgs.init([sys.argv[0]], kaboutdata)
    return (KApplication(), kaboutdata)


def check_x_server():
    return 0 == os.system('xdpyinfo >/dev/null 2>&1')


if __name__ == '__main__':
    cfg = backintime.start_app(KDE4TakeSnapshotCallback())

    raise_cmd = ''
    if len(sys.argv) > 1:
        raise_cmd = '\n'.join(sys.argv[1:])

    app_instance = guiapplicationinstance.GUIApplicationInstance(
        cfg.get_app_instance_file(), raise_cmd)

    logger.openlog()
    kapp, kaboutdata = create_kapplication(cfg)

    main_window = MainWindow(cfg, app_instance, kapp, kaboutdata)

    if cfg.is_configured():
        main_window.show()
        kapp.exec_()

    logger.closelog()

    app_instance.exit_application()
		pynotify.uninit()
		
		logger.info( '[GnomeTakeSnapshotCallback.run] end loop' )


def create_gnome_app( cfg ):
	gnome_props = { gnome.PARAM_APP_DATADIR : '/usr/share' }
	return gnome.program_init( 'backintime', cfg.VERSION, properties = gnome_props )


if __name__ == '__main__':
	cfg = backintime.start_app( GnomeTakeSnapshotCallback() )

	raise_cmd = ''
	if len( sys.argv ) > 1:
		raise_cmd = '\n'.join( sys.argv[ 1 : ] )

	app_instance = guiapplicationinstance.GUIApplicationInstance( cfg.get_app_instance_file(), raise_cmd )

	create_gnome_app( cfg )

	gtk.about_dialog_set_url_hook( open_url, None )

	logger.openlog()
	main_window = MainWindow( cfg, app_instance )
	gtk.main()
	logger.closelog()

	app_instance.exit_application()

示例#4
0
def take_snapshot(cfg, callback=None, force=True):
    logger.openlog()
    snapshots.Snapshots(cfg).take_snapshot(callback, force)
    logger.closelog()