def NewMVContext(self, parent, name): def _Error(message): dlg = wx.MessageDialog(self._view.GetParent(), message, "Error!", wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() return None if name in [child.name for child in parent.children]: return _Error( "Can't create new many-valued context, file '{0}' already exists" .format(name)) new_path = os.path.join(parent.path, name) try: fca.write_mv_txt(fca.ManyValuedContext(), new_path) except: #TODO: Error handler return _Error( "Can't create new many-valued context, something wrong") new_item = WorkspaceItem(name, new_path, False, parent, type="Many-valued context") self.SaveWorkspace() return new_item
def NewMVContext(self, parent, name): def _Error(message): dlg = wx.MessageDialog(self._view.GetParent(), message, "Error!", wx.OK | wx.ICON_INFORMATION ) dlg.ShowModal() dlg.Destroy() return None if name in [child.name for child in parent.children]: return _Error("Can't create new many-valued context, file '{0}' already exists".format(name)) new_path = os.path.join(parent.path, name) try: fca.write_mv_txt(fca.ManyValuedContext(), new_path) except: #TODO: Error handler return _Error("Can't create new many-valued context, something wrong") new_item = WorkspaceItem(name, new_path, False, parent, type="Many-valued context") self.SaveWorkspace() return new_item
def SaveAs(self, path): fca.write_mv_txt(self.context, path) self._item = self._model.FileSaveAs(path, self._view)
def Save(self): self._model.DoSaved(self._item) fca.write_mv_txt(self.context, self.path)