mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-24 07:04:01 -06:00
configfile: Move config file code from klippy.py to new file
Add a klippy/configfile.py file with the code needed to read the main printer config file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
5144c5f01e
commit
f80456a698
3 changed files with 130 additions and 116 deletions
|
@ -5,9 +5,7 @@
|
|||
# Copyright (C) 2018 Janar Sööt <janar.soot@gmail.com>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import os, ConfigParser, logging
|
||||
import sys, ast, re
|
||||
import klippy
|
||||
import os, logging, sys, ast, re
|
||||
|
||||
|
||||
class error(Exception):
|
||||
|
@ -963,10 +961,9 @@ class MenuManager:
|
|||
desc=self.cmd_DO_help)
|
||||
|
||||
# Parse local config file in same directory as current module
|
||||
fileconfig = ConfigParser.RawConfigParser()
|
||||
pconfig = self.printer.lookup_object('configfile')
|
||||
localname = os.path.join(os.path.dirname(__file__), 'menu.cfg')
|
||||
fileconfig.read(localname)
|
||||
localconfig = klippy.ConfigWrapper(self.printer, fileconfig, {}, None)
|
||||
localconfig = pconfig.read_config(localname)
|
||||
|
||||
# Load items from local config
|
||||
self.load_menuitems(localconfig)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue