def _edit_inv(self, widget, inv): """ Open Inventory for editing. """ # checking for inventory existence in schemas file. schemas = ConfigParser() schemas.read(Path.sched_schemas) if not schemas.has_section(inv): dlg = NoScheduleDlg() dlg.run() dlg.destroy() return w = NewInventory(inv, edit_mode=True) w.show_all()
def load_inventory(self, inventory): """ Load inventory. """ inv = ConfigParser() inv.read(Path.sched_schemas) if not inv.has_section(inventory): dlg = NoScheduleDlg() dlg.run() dlg.destroy() raise NoInventory(inventory) self.invname.set_text(inventory) for item in inv.items(inventory): if item[0] == 'profile': pindx = self.profiles.index(item[1]) self.sched_name.set_active(pindx) if item[0] == 'enabled': self.invenabled.set_active(int(item[1])) if item[0] == 'command': self.loaded_command = item[1]