Exemple #1
0
def load_projects(plist):
    backend.load_plugins()

    for p in plist:
        bp = p_open(p)
        if not bp:
            return False
        global g_proj_d
        pdir = bp.proj_dir()
        g_proj_d[pdir] = bp

    if not len(g_proj_d):
        print('No projects')
        return False

    return True
def load_projects(plist):
	backend.load_plugins()

	for p in plist:
		bp = p_open(p)
		if not bp:
			return False
		global g_proj_d
		pdir = bp.proj_dir()
		g_proj_d[pdir] = bp

	if not len(g_proj_d):
		print 'No projects'
		return False

	return True
@error(404)
def error404(code, **kwargs):
    return p(body=template('tpl/error', title='404 page not found', msg='The requested page was not found'), **kwargs)


def p(**kwargs):
    return page(config, backend, state, **kwargs)

app_dir = os.path.dirname(__file__)
if app_dir:
    os.chdir(app_dir)

import config
config = Config(config)
backend = Backend()
state = {}
(state, errors) = load_plugins(config.plugins, config)
if errors:
    for e in errors:
        sys.stderr.write(str(e))
    sys.exit(2)
session_opts = {
    'session.type': 'file',
    'session.cookie_expires': 300,
    'session.data_dir': './session_data',
    'session.auto': True
}
app = SessionMiddleware(app(), session_opts)
debug(True)
run(app=app, reloader=True, host=config.listen_host, port=config.listen_port)
Exemple #4
0
        if prj_path:
            self.proj_open(prj_path)
        #else:
        #self.proj_open_cb()
        self.file_restarted_cb()


if __name__ == "__main__":

    # pyqt version 4.5 is required
    pyqt_required_version = 0x40500
    if not QtCore.PYQT_VERSION >= pyqt_required_version:
        print('Needs pyqt version > 4.5')
        sys.exit(-1)

    # change working dir to the script dir so that we can run this script anywhere else
    app_start_dir = os.getcwd()
    app_dir = os.path.dirname(os.path.realpath(__file__))
    os.chdir(app_dir)

    # load plugins
    backend.load_plugins()
    view.load_plugins()

    # start app
    app = QApplication(sys.argv)
    ma = SeascopeApp(app_start_dir=app_start_dir)
    ma.show()
    ret = app.exec_()
    sys.exit(ret)
Exemple #5
0
                           msg='The requested page was not found'),
             **kwargs)


def p(**kwargs):
    return page(config, backend, state, **kwargs)


app_dir = os.path.dirname(__file__)
if app_dir:
    os.chdir(app_dir)

import config
config = Config(config)
backend = Backend(config)
state = {}
(state, errors) = load_plugins(config.plugins, config)
if errors:
    for e in errors:
        sys.stderr.write(str(e))
    sys.exit(2)
session_opts = {
    'session.type': 'file',
    'session.cookie_expires': 300,
    'session.data_dir': './session_data',
    'session.auto': True
}
app = SessionMiddleware(app(), session_opts)
debug(True)
#run(app=app, reloader=True, host=config.listen_host, port=config.listen_port)
				prj_path = self.recent_projects[0]
		if prj_path:
			self.proj_open(prj_path)
		#else:
			#self.proj_open_cb()
		self.file_restarted_cb()

if __name__ == "__main__":

	# pyqt version 4.5 is required
	pyqt_required_version = 0x40500 
	if not QtCore.PYQT_VERSION >= pyqt_required_version:
		print 'Needs pyqt version > 4.5'
		sys.exit(-1)

	# change working dir to the script dir so that we can run this script anywhere else
	app_start_dir = os.getcwd()
	app_dir = os.path.dirname(os.path.realpath(__file__))
	os.chdir(app_dir)
	
	# load plugins
	backend.load_plugins()
	view.load_plugins()

	# start app
	app = QApplication(sys.argv)
	ma = SeascopeApp(app_start_dir=app_start_dir)
	ma.show()
	ret = app.exec_()
	sys.exit(ret)