Ignore:
Timestamp:
Oct 28, 2008 3:22:22 PM (16 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
92320e5
Parents:
89fef2c
Message:

added description to model

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_models/WrapperGenerator.py

    r96672c0 r9316609  
    109109         # Catch Description 
    110110        key = "[DESCRIPTION]" 
    111         find_description= False 
     111        find_description= 0 
    112112        temp="" 
    113113        for line in lines: 
    114114            if line.count(key)>0 : 
    115                 find_description= True 
     115                 
    116116                try: 
     117                    find_description= 1 
    117118                    index = line.index(key) 
    118119                    toks = line[index:].split("=",1 ) 
    119120                    temp=toks[1].lstrip().rstrip() 
    120121                    text='text' 
    121                     key2="<%s>"%text.lower 
     122                    key2="<%s>"%text.lower() 
    122123                    if re.match(key2,temp)!=None: 
    123                         index2 = line.index(key2) 
    124                         temp=line[index:] 
     124                        #index2 = line.index(key2) 
     125                        #temp = temp[index2:] 
     126                        toks2=temp.split(key2,1) 
     127                        self.description=toks2[1] 
     128                        text='text' 
     129                        key2="</%s>"%text.lower() 
     130                        if re.search(key2,toks2[1])!=None: 
     131                            temp=toks2[1].split(key2,1) 
     132                            self.description=temp[0] 
     133                            break 
     134                        #print self.description 
    125135                    else: 
    126136                        self.description=temp 
     137                        break 
    127138                except: 
    128139                     raise ValueError, "Could not parse file %s" % self.file 
    129                 if find_description: 
    130                     text='text' 
    131                     key2="</%s>"%text.lower 
    132                     if re.match(key2,temp)!=None: 
    133                         index2 = line.index(key2) 
    134                         temp=line[:index] 
    135                     temp+=line 
    136         self.description= temp 
     140            elif find_description==1: 
     141                text='text' 
     142                key2="</%s>"%text.lower() 
     143                #print "second line",line,key2,re.search(key2,line) 
     144                if re.search(key2,line)!=None: 
     145                    tok=line.split(key2,1) 
     146                    temp=tok[0].split("//",1) 
     147                    self.description+=tok[1].lstrip().rstrip() 
     148                    break 
     149                else: 
     150                    #if re.search("*",line)!=None: 
     151                    #    temp=line.split("*",1) 
     152                    #    self.description+='\n'+temp[1].lstrip().rstrip() 
     153                    if re.search("//",line)!=None: 
     154                        temp=line.split("//",1) 
     155                        self.description+='\n\t\t'+temp[1].lstrip().rstrip() 
     156                         
     157                    else: 
     158                        self.description+='\n\t\t'+line.lstrip().rstrip() 
     159                     
     160                 
    137161                 
    138162        for line in lines: 
     
    235259            newline = self.replaceToken(tmp_line,  
    236260                                        "[PYTHONCLASS]", 'C'+self.pythonClass) 
    237              
     261            #Catch model description 
     262            newline = self.replaceToken(tmp_line,  
     263                                        "[DESCRIPTION]", self.description) 
    238264            # Catch C model name 
    239265            newline = self.replaceToken(newline,  
Note: See TracChangeset for help on using the changeset viewer.