Пример #1
0
def base_init():
    global services, json_rpc_dispatcher

    init_db_session(configuration.get('Database', 'url'), metadata, False
                    or configuration.echo_query)
    dao.set_session(session())

    json_rpc_dispatcher = HorseJsonRpc()

    make_server_json_server_dispatcher(
        json_rpc_dispatcher,
        JsonCallWrapper(ClockService(), JsonCallWrapper.CHERRYPY_MODE))

    make_server_json_server_dispatcher(
        json_rpc_dispatcher,
        JsonCallWrapper(DocumentsService(), JsonCallWrapper.CHERRYPY_MODE))

    make_server_json_server_dispatcher(
        json_rpc_dispatcher,
        JsonCallWrapper(IndicatorsService(), JsonCallWrapper.CHERRYPY_MODE))

    services = Services()
    services.register_for_server(session, Base)
Пример #2
0
def all_systems_go():
    global user_session,configuration,window, args

    mainlog.debug("all_systems_go() : init dao")
    dao.set_session(session())
    mainlog.debug("all_systems_go() : call back")
    dao.set_callback_operational_error(database_operational_error)

    mainlog.debug("all_systems_go() : building mainwindow")
    window = MainWindow(dao)
    window.setMinimumSize(1024,768)
    splash.finish(window)


    mainlog.debug("all_systems_go() : login dialog")
    if not user_session.is_active(): # the configuration may have forced a user

        # Special case for demo

        from koi.datalayer.employee_mapping import Employee
        if 'koi-mes.net' in configuration.get("DownloadSite", "base_url") or args.demo:
            user_session.open(
                dao.employee_dao.authenticate(
                    "roba", Employee.hash_password("roba")))
            d = AboutDemoDialog(None)
            d.exec_()
        else:
            d = LoginDialog(window, user_session)
            d.exec_()

        # splash.repaint()

    # zzz = QWidget()
    # splash.finish(zzz)
    # splash.show()
    # splash.update()
    # from PySide.QtGui import QSound
    # snd = QSound(os.path.join(resource_dir,'logo_sound.wav'))
    # splash.timer.start(25)
    # splash.alpha = 255
    # snd.play()

    if user_session.is_active():
        # d = LoginDialog(window, user_session)
        # d.exec_()

        window.build()
        w = StatusWidget2(window, user_session.name)
        window.statusBar().addWidget(w,100000)
        window.statusBar().setSizeGripEnabled(False)

        _koi_base.set_main_window(window)
        window.module = IndicatorsModule()
        window.module.wire( _koi_base)

        # window.showMaximized() # If I maximize what happens to multiscreens ?
        window.showMaximized()
        # splash = SplashScreen(pixmap)

        if args.screenshots:
            make_screenshot()

        app.exec_()
    else:
        # User was no authorized
        showWarningBox(_("Not authorized"),_("You are not authorized to use this program. Please check with your system administrator."))

    dao.close()
Пример #3
0
check_database = check_db_connection(configuration.database_url)

if (check_database is not True):
    showErrorBox( _("Can't connect to the database"),
                  _("<b>This program is not usable without a database and will therefore shut down now.</b> You should verify if the server is running because this situation can affect all the users of the system. It is a good idea to <b>call the system administrator now </b> because this error should not happen."))

    d = EditConfigurationDialog(None)
    d.exec_()
    # An "app must be restarted" message has been shown to the user
    sys.exit(RETURN_CODE_SUCCESS)

splash_msg( _("Loading additional data"))

mainlog.debug("Import dao")
from koi.dao import dao
dao.set_session(session())

mainlog.debug("Import query_parser")
from koi.datalayer.query_parser import initialize_customer_cache
initialize_customer_cache()

mainlog.debug("Import rest")



#from EditableTable import EditableTable
# from EmployeesEdit import EditEmployeeDialog
# from SuppliersEdit import EditSupplierDialog
# from CustomerEdit import EditCustomerDialog
from koi.delivery_slips.EditDeliverySlipDialog import handle_edit_delivery_slip
from koi.ReprintDeliverySlip import ReprintDeliverySlipDialog