예제 #1
0
def main():
    build_tool_list()
    tooldb_tools(TOOLS.keys())
    tooldb_callbacks(get_tool, put_tool, load_spindle, unload_spindle)

    try:
        tooldb_loop()  # loop forever, use callbacks
    except Exception as e:
        PLASMADB.terminate()
        if sys.stdin.isatty():
            print(("exception=", e))
        else:
            pass  # avoid messages at termination

    PLASMADB.terminate()
예제 #2
0
    def __init__(self):
        super(DataBaseManager, self).__init__()
        self.session = None

        Base.metadata.create_all(engine)

        self.session = Session()

        tools = self.session.query(Tool).all()
        tool_list = list()

        for tool in tools:
            tool_list.append(tool.tool_no)

        tooldb_tools(tool_list)
        tooldb_callbacks(self.user_get_tool, self.user_put_tool,
                         self.user_load_spindle, self.user_unload_spindle)

        self.tool_list = tool_list

        self.tools = dict()
예제 #3
0
파일: db.py 프로젝트: tyxtc/linuxcnc
    tools[key] = params.upper()  # sync to host
    if debug: sys.stderr.write("@@user_put_tool_nonran_tc: %s\n" % tools[key])
    save_tools_to_file(db_savefile)


#-----------------------------------------------------------
# begin
debug = 0  # debug var for command line testing
if (len(sys.argv) > 1 and sys.argv[1] == 'debug'): debug = 1

toolno_min = 10
toolno_max = 19
make_tools(toolno_min, toolno_max)

if random_toolchanger:
    tooldb_callbacks(user_get_tool, user_put_tool_ran_tc)
else:
    tooldb_callbacks(user_get_tool, user_put_tool_nonran_tc)

toollist = list(range(toolno_min, toolno_max + 1))
if random_toolchanger: toollist.append(0)  # T0 provision
tooldb_tools(toollist)

try:
    tooldb_loop()  # loop forever, use callbacks
except Exception as e:
    if sys.stdin.isatty():
        print(("exception=", e))
    else:
        pass  # avoid messages at termination