当前位置: 首页>>代码示例>>Python>>正文


Python Loader.save方法代码示例

本文整理汇总了Python中sas.sascalc.dataloader.loader.Loader.save方法的典型用法代码示例。如果您正苦于以下问题:Python Loader.save方法的具体用法?Python Loader.save怎么用?Python Loader.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sas.sascalc.dataloader.loader.Loader的用法示例。


在下文中一共展示了Loader.save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_click_save

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import save [as 别名]
    def on_click_save(self, event):
        """
        Save change into a file
        """
        if not self._data:
            return
        self.on_change_run(event=None)
        self.on_change_title(event=None)
        path = None
        wildcard = "CanSAS 1D files(*.xml)|*.xml"
        dlg = wx.FileDialog(self, "Choose a file",
                            self._default_save_location, "", wildcard , wx.SAVE)

        for data in self._data:
            if issubclass(data.__class__, Data2D):
                msg = "No conventional writing format for \n\n"
                msg += "Data2D at this time.\n"
                dlg = wx.MessageDialog(None, msg, 'Error Loading File',
                                             wx.OK | wx.ICON_EXCLAMATION)
                dlg.ShowModal()
            else:
                if dlg.ShowModal() == wx.ID_OK:
                    path = dlg.GetPath()
                    mypath = os.path.basename(path)
                    loader = Loader()
                    format = ".xml"
                    if os.path.splitext(mypath)[1].lower() == format:
                        loader.save(path, data, format)
                    try:
                        self._default_save_location = os.path.dirname(path)
                    except:
                        pass
                    dlg.Destroy()
        event.Skip()
开发者ID:ianhi,项目名称:sasview,代码行数:36,代码来源:data_editor.py

示例2: test_save_cansas_v1_0

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import save [as 别名]
 def test_save_cansas_v1_0(self):
     xmlreader = XMLreader(self.isis_1_0, self.schema_1_0)
     self.assertTrue(xmlreader.validate_xml())
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_0)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_0)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data(cansasreader[i])
         reader_generic.save(self.write_1_0_filename, dataloader[i], None)
         reader2 = Reader()
         self.assertTrue(os.path.isfile(self.write_1_0_filename))
         return_data = reader2.read(self.write_1_0_filename)
         written_data = return_data[0]
         xmlreader = XMLreader(self.write_1_0_filename, self.schema_1_0)
         self.assertTrue(xmlreader.validate_xml())
         self._check_data(written_data)
     if os.path.isfile(self.write_1_0_filename):
         os.remove(self.write_1_0_filename)
开发者ID:rprospero,项目名称:sasview,代码行数:22,代码来源:utest_cansas.py

示例3: test_save_cansas_v1_0

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import save [as 别名]
 def test_save_cansas_v1_0(self):
     filename = "isis_1_0_write_test.xml"
     xmlreader = XMLreader(self.isis_1_0, self.schema_1_0)
     valid = xmlreader.validate_xml()
     self.assertTrue(valid)
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_0)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_0)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data(cansasreader[i])
         reader_generic.save(filename, dataloader[i], None)
         reader2 = Reader()
         return_data = reader2.read(filename)
         written_data = return_data[0]
         xmlwrite = XMLreader(filename, self.schema_1_0)
         valid = xmlreader.validate_xml()
         self.assertTrue(valid)
         self._check_data(written_data)
开发者ID:ianhi,项目名称:sasview,代码行数:22,代码来源:utest_cansas.py

示例4: test_cansas_xml

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import save [as 别名]
 def test_cansas_xml(self):
     xmlreader = XMLreader(self.isis_1_1, self.schema_1_1)
     valid = xmlreader.validate_xml()
     xmlreader.set_processing_instructions()
     self.assertTrue(valid)
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_1)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_1)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data_1_1(dataloader[i])
         self._check_data(cansasreader[i])
         self._check_data_1_1(cansasreader[i])
         reader_generic.save(self.write_1_1_filename, dataloader[i], None)
         reader2 = Loader()
         self.assertTrue(os.path.isfile(self.write_1_1_filename))
         return_data = reader2.load(self.write_1_1_filename)
         written_data = return_data[0]
         self._check_data(written_data)
     if os.path.isfile(self.write_1_1_filename):
         os.remove(self.write_1_1_filename)
开发者ID:rprospero,项目名称:sasview,代码行数:24,代码来源:utest_cansas.py

示例5: test_cansas_xml

# 需要导入模块: from sas.sascalc.dataloader.loader import Loader [as 别名]
# 或者: from sas.sascalc.dataloader.loader.Loader import save [as 别名]
 def test_cansas_xml(self):
     filename = "isis_1_1_write_test.xml"
     xmlreader = XMLreader(self.isis_1_1, self.schema_1_1)
     valid = xmlreader.validate_xml()
     xmlreader.set_processing_instructions()
     self.assertTrue(valid)
     fo = open(self.isis_1_1)
     str = fo.read()
     reader_generic = Loader()
     dataloader = reader_generic.load(self.isis_1_1)
     reader_cansas = Reader()
     cansasreader = reader_cansas.read(self.isis_1_1)
     for i in range(len(dataloader)):
         self._check_data(dataloader[i])
         self._check_data_1_1(dataloader[i])
         self._check_data(cansasreader[i])
         self._check_data_1_1(cansasreader[i])
         reader_generic.save(filename, dataloader[i], None)
         fo = open(filename)
         str = fo.read()
         reader2 = Loader()
         return_data = reader2.load(filename)
         written_data = return_data[0]
         self._check_data(written_data)
开发者ID:ianhi,项目名称:sasview,代码行数:26,代码来源:utest_cansas.py


注:本文中的sas.sascalc.dataloader.loader.Loader.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。