示例#1
0
def save():
  s = open(config_path(), 'w')
  config.save(s)
  s.close()
示例#2
0
import traceback
from config import Config
try:
  from hal_configurator.lib.workspace_manager import Workspace
except:
  pass

__author__ = 'Costa Halicea'
from hal_configurator.lib import config_path
config = None
try:
  config = Config(open(config_path(), 'r'))
except:
  traceback.print_exc()
  print 'ConfigPath %s' % config_path()
  print 'Cannot Locate the Configuration file'

def add_config_to_history(path):
  ch = get_config_history()
  if path in ch:
    ch.append(ch.pop(ch.index(path)))
  elif len(config.config_history) == len(ch):
    ch.append("'"+path+"'")
    ch.pop(0)
  else:
    ch.append("'"+path+"'")
  for i in range(0, len(ch)):
    config.config_history[i].path = ch[i]
  save()

def get_config_history():
#!/Users/halicea/envs/hal_automator/bin/python
import sys
import os
from hal_configurator.lib.app_config import config
from hal_configurator.lib import config_path
from hal_configurator.lib.plugin_loader import load_plugins_from_directory_list
if config:
    plugin_dirs = []
    cp = config_path()
    j = os.path.join
    dn = os.path.dirname
    abp = os.path.abspath
    for p_dir in config.plugin_dirs:
        if os.path.isabs(p_dir):
            plugin_dirs.append(p_dir)
        else:
            abs_dir = abp(j(dn(cp), p_dir))
            plugin_dirs.append(abs_dir)
    load_plugins_from_directory_list(plugin_dirs)
else:
    print 'No Configuration Loadeed, Continuing...'

sys.path.append(os.path.abspath(__file__))
try:
    import hal_configurator.lib.configurator_console as console
except:
    print 'Not configured for executor, only web server mode is possible'

print "Running in", os.path.abspath(__file__)
ui_enabled = True
try:
示例#4
0
def save():
  config.save(config_path())
示例#5
0
def save():
    config.save(config_path())
示例#6
0
    pass
from hal_configurator.lib.dict2obj import DynamicObject
from hal_configurator.lib import config_path

__author__ = 'Costa Halicea'


class Config(DynamicObject):
    def __init__(self, d):
        j = json.loads(d)
        DynamicObject.__init__(self, j)


config = None
try:
    config = Config(open(config_path(), 'r').read())
except:
    traceback.print_exc()
    print 'ConfigPath %s' % config_path()
    print 'Cannot Locate the Configuration file'


def add_config_to_history(path):
    ch = get_config_history()
    if path in ch:
        ch.append(ch.pop(ch.index(path)))

    ch.append(path)
    if len(config.config_history) >= 10:
        ch.pop(0)
    save()