Changeset 316e231 in sasview for calculatorview/src
- Timestamp:
- May 3, 2012 11:23:15 AM (13 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 56acb5d
- Parents:
- 74d7b59
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/model_editor.py
r41a8cb3 r316e231 324 324 elif line.count("self.description = '%s'"): 325 325 out_f.write(line % description + "\n") 326 elif line.count("self.name = '%s'"):327 out_f.write(line % name + "\n")326 #elif line.count("self.name = '%s'"): 327 # out_f.write(line % name + "\n") 328 328 else: 329 329 out_f.write(line + "\n") … … 690 690 if has_scipy: 691 691 out_f.write("import scipy" + "\n") 692 elif line.count("name = "):693 out_f.write(line % self.name + "\n")692 #elif line.count("name = "): 693 # out_f.write(line % self.name + "\n") 694 694 elif line: 695 695 out_f.write(line + "\n") … … 777 777 from sans.models.pluginmodel import Model1DPlugin 778 778 from math import * 779 import os 780 import sys 779 781 import numpy 780 782 #import scipy? 781 783 class Model(Model1DPlugin): 782 name = " %s"784 name = "" 783 785 def __init__(self): 784 Model1DPlugin.__init__(self, name=self.name) 786 Model1DPlugin.__init__(self, name=self.name) 787 #set name same as file name 788 self.name = self.get_fname() 785 789 #self.params here 786 790 self.description = "%s" … … 827 831 """ 828 832 TEST_TEMPLATE = """ 833 def get_fname(self): 834 path = sys._getframe().f_code.co_filename 835 basename = os.path.basename(path) 836 name, _ = os.path.splitext(basename) 837 return name 829 838 ###################################################################### 830 839 ## THIS IS FOR TEST. DO NOT MODIFY THE FOLLOWING LINES!!!!!!!!!!!!!!!! … … 854 863 #P2_model: 855 864 from sans.models.%s import %s as P2 865 import os 866 import sys 856 867 857 868 class Model(Model1DPlugin): … … 863 874 ## Setting model name model description 864 875 self.description = '%s' 865 self.name = '%s'876 self.name = self.get_fname() 866 877 if self.name.rstrip().lstrip() == '': 867 878 self.name = self._get_name(p_model1.name, p_model2.name) … … 1118 1129 ( p_model1.name, p_model2.name ) 1119 1130 self.description += description 1120 1131 1132 def get_fname(self): 1133 path = sys._getframe().f_code.co_filename 1134 basename = os.path.basename(path) 1135 name, _ = os.path.splitext(basename) 1136 return name 1137 1121 1138 if __name__ == "__main__": 1122 1139 m1= Model()
Note: See TracChangeset
for help on using the changeset viewer.