MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / __init__

Method __init__

src/astroprint/maintenancemenu.py:29–95  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

27class MaintenanceMenuManager(object):
28
29 def __init__(self):
30 self._settings = settings()
31 self._logger = logging.getLogger(__name__)
32 self.data = []
33
34 self._logger.info("Loading Maintenance Menu...")
35
36 self._maintenanceMenu = "%s/menu/utilities-menu.yaml" % self._settings.getBaseFolder('tasks')
37
38 if os.path.isfile(self._maintenanceMenu):
39 config = None
40 self._logger.info("Found maintenance menu to load.")
41 try:
42 with open(self._maintenanceMenu, "r") as f:
43 config = yaml.safe_load(f)
44 if config:
45 self.data = config
46
47 except:
48 self._logger.error("There was an error loading %s:" % self._maintenanceMenu, exc_info= True)
49
50 return
51 else:
52 self._logger.info("No Utilities menu present: A new one was loaded in memory.")
53 self.data = [
54 {
55 'id' : "movements_controls",
56 'type' : "utility",
57 'hiddenOnPrinting' : True
58 },
59 {
60 'id' : "preheat",
61 'type' : "utility"
62 },
63 {
64 'id' : "fan",
65 'type' : "utility"
66 },
67 {
68 'id' : "filament_extruder",
69 'type' : "utility",
70 'hiddenOnPrinting' : True
71 },
72 {
73 'id' : "tasks",
74 'type' : "utility",
75 'hiddenOnPrinting' : True
76 },{
77 'id' : "printing_speed",
78 'type' : "utility"
79 },
80 {
81 'id' : "printing_flow",
82 'type' : "utility"
83 },
84 {
85 'id' : "babystepping",
86 'type' : "utility"

Callers

nothing calls this directly

Calls 3

settingsFunction · 0.90
getBaseFolderMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected