Changeset 32c0841 in sasview for guiframe/utils.py
- Timestamp:
- Nov 23, 2010 11:21:20 AM (14 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:
- a54e4be
- Parents:
- 4a2b054
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/utils.py
rd955bf19 r32c0841 2 2 Contains common classes and functions 3 3 """ 4 import wx,re 4 import wx 5 import re 5 6 6 7 def format_number(value, high=False): … … 11 12 value = float(value) 12 13 except: 13 output ="NaN"14 output = "NaN" 14 15 return output.lstrip().rstrip() 15 16 16 if high: 17 output= "%-6.4g" % value 18 17 output = "%-6.4g" % value 19 18 else: 20 output = "%-5.3g" % value19 output = "%-5.3g" % value 21 20 return output.lstrip().rstrip() 22 21 … … 25 24 :param item: txtcrtl containing a value 26 25 """ 27 flag = True26 flag = True 28 27 try: 29 28 mini = float(item.GetValue()) … … 61 60 62 61 """ 63 list =[]62 list = [] 64 63 for item in mylist: 65 if re.search( separator,item)!=None:66 if n > 0:67 word = re.split(separator,item,int(n))64 if re.search(separator,item)!= None: 65 if n > 0: 66 word = re.split(separator, item, int(n)) 68 67 else: 69 word = re.split( separator,item)68 word = re.split(separator, item) 70 69 for new_item in word: 71 if new_item.lstrip().rstrip() != '':70 if new_item.lstrip().rstrip() != '': 72 71 list.append(new_item.lstrip().rstrip()) 73 72 return list … … 80 79 81 80 """ 82 list =[]83 if re.search( separator,string1)!=None:84 if n > 0:85 word = re.split(separator,string1,int(n))81 list = [] 82 if re.search(separator, string1) is not None: 83 if n > 0: 84 word = re.split(separator,string1,int(n)) 86 85 else: 87 word = re.split(separator,string1)86 word = re.split(separator,string1) 88 87 for item in word: 89 if item.lstrip().rstrip() != '':88 if item.lstrip().rstrip() != '': 90 89 list.append(item.lstrip().rstrip()) 91 90 return list … … 104 103 105 104 """ 106 begin_flag = False107 end_flag = False108 if re.search( begin,string1)!=None:109 begin_flag = True110 if end !=None:111 if re.search(end,string1) !=None:112 end_flag = True105 begin_flag = False 106 end_flag = False 107 if re.search(begin,string1) is not None: 108 begin_flag = True 109 if end is not None: 110 if re.search(end,string1) is not None: 111 end_flag = True 113 112 return begin_flag, end_flag 113
Note: See TracChangeset
for help on using the changeset viewer.