Changeset db08737 in sasview for sansview/perspectives/fitting
- Timestamp:
- Sep 23, 2010 2:40:48 PM (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:
- 20905a0
- Parents:
- a1b2471
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
r3c44c66 rdb08737 2070 2070 self.disp_list=self.model.getDispParamList() 2071 2071 2072 keys.sort() 2072 def custom_compare(a,b): 2073 """ 2074 Custom compare to order, first by alphabets then second by number. 2075 """ 2076 a_last = a[len(a)-1] 2077 b_last = b[len(b)-1] 2078 2079 num_a = None 2080 num_b = None 2081 # check if it contains a int number(<10) 2082 try: 2083 num_a = int(a_last) 2084 except: pass 2085 try: 2086 num_b = int(b_last) 2087 except: pass 2088 # both have a number 2089 if num_a != None and num_b != None: 2090 if num_a > num_b: return 1 2091 elif num_a == num_b: 2092 return cmp(a.lower(), b.lower()) 2093 else: return -1 2094 # one of them has a number 2095 elif num_a == None: return -1 2096 elif num_b == None: return 1 2097 # no nuumbers 2098 else: 2099 return cmp(a.lower(), b.lower()) 2100 2101 keys.sort(custom_compare) 2073 2102 2074 2103 iy = 0
Note: See TracChangeset
for help on using the changeset viewer.