(self, path, data)
| 158 | |
| 159 | # ------------------------[ put <local file> ]------------------------ |
| 160 | def put(self, path, data): |
| 161 | path = self.basename(path) |
| 162 | pclfs = self.dirlist() |
| 163 | # re-use macro id if file name already present |
| 164 | if path in pclfs: |
| 165 | id = pclfs[path][0] |
| 166 | # find free macro id not already reserved for file |
| 167 | else: |
| 168 | id = str(item(set(c.BLOCKRANGE).difference(self.idlist()))) |
| 169 | # abort if we have used up the whole macro id space |
| 170 | if not id: |
| 171 | return output().warning("Out of macro slots.") |
| 172 | self.chitchat("Using macro id #" + id) |
| 173 | # retrieve and update superblock |
| 174 | size = str(len(data)) |
| 175 | date = str(conv().now()) |
| 176 | pclfs[path] = [id, size, date] |
| 177 | self.update_superblock(pclfs) |
| 178 | # save data as pcl macro on printer |
| 179 | self.define_macro(id, data) |
| 180 | |
| 181 | # ==================================================================== |
| 182 |
nothing calls this directly
no test coverage detected