Пример #1
0
 def OnScaling(self, event):
     item = self.tree.GetSelection()
     data = self.tree.GetItemData(item).GetData()
     if isinstance(data, fca.ManyValuedContext):
         dlg = ScalingDialog(data, self.current_project.get_scales())
         if dlg.ShowModal() == wx.ID_OK:
             resulted_context = fca.scale_mvcontext(data, dlg.GetListOfScales())
             dlg.Destroy()
             self.current_project.add_element(resulted_context)
             self.tree.add_new_element("contexts", resulted_context)
             self.current_project.projectdirty = True
Пример #2
0
 def OnScaling(self, event):
     item = self.tree.GetSelection()
     data = self.tree.GetItemData(item).GetData()
     if isinstance(data, fca.ManyValuedContext):
         dlg = ScalingDialog(data, self.current_project.get_scales())
         if dlg.ShowModal() == wx.ID_OK:
             resulted_context = fca.scale_mvcontext(data,
                                                    dlg.GetListOfScales())
             dlg.Destroy()
             self.current_project.add_element(resulted_context)
             self.tree.add_new_element("contexts", resulted_context)
             self.current_project.projectdirty = True
Пример #3
0
def GetScaledContext(item, workspace):
    dialog = ScalingDialog(item, workspace)
    result = dialog.ShowModal()
    if result == wx.ID_OK:
        scales = dialog.GetListOfScales()
        mvcontext = fca.read_mv_txt(item.path)
        context = fca.scale_mvcontext(mvcontext, scales)

        default_path = item.path[:-4] + "-scaled.cxt"
        newpath = default_path
        i = 1
        while (os.path.exists(newpath)):
            newpath = default_path[:-4] + "-{0}".format(i) + newpath[-4:]
            i += 1
        fca.uwrite_cxt(context, newpath)
        newpath = [newpath]
    else:
        newpath = []

    dialog.Destroy()
    return newpath
Пример #4
0
def GetScaledContext(item, workspace):
    dialog = ScalingDialog(item, workspace) 
    result = dialog.ShowModal()
    if result == wx.ID_OK:
        scales = dialog.GetListOfScales()
        mvcontext = fca.read_mv_txt(item.path)
        context = fca.scale_mvcontext(mvcontext, scales)
        
        default_path = item.path[:-4] + "-scaled.cxt"
        newpath = default_path
        i = 1
        while (os.path.exists(newpath)):
            newpath = default_path[:-4] + "-{0}".format(i) + newpath[-4:]
            i += 1
        fca.uwrite_cxt(context, newpath)
        newpath = [newpath]
    else:
        newpath = []
        
    dialog.Destroy()
    return newpath