If called by event handle, i.e. user
(self, event=None, outlist=None, duration=None)
| 891 | self.menu.Destroy() |
| 892 | |
| 893 | def sortOutlist(self, event=None, outlist=None, duration=None): |
| 894 | ''' |
| 895 | If called by event handle, i.e. user |
| 896 | ''' |
| 897 | if event is None: |
| 898 | # Default sort by character name ascending. |
| 899 | colidx = self.options.Get("SortColumn", self.columns[3][7]) |
| 900 | sort_desc = self.options.Get("SortDesc", False) |
| 901 | else: |
| 902 | colidx = event.GetCol() |
| 903 | if self.options.Get("SortColumn", -1) == colidx: |
| 904 | sort_desc = not self.options.Get("SortDesc") |
| 905 | else: |
| 906 | sort_desc = True |
| 907 | |
| 908 | # Use unicode characters for sort indicators |
| 909 | arrow = u"\u2193" if sort_desc else u"\u2191" |
| 910 | |
| 911 | # Reset all labels |
| 912 | for col in self.columns: |
| 913 | self.grid.SetColLabelValue(col[0], col[1]) |
| 914 | |
| 915 | # Assign sort indicator to sort column |
| 916 | self.grid.SetColLabelValue( |
| 917 | colidx, |
| 918 | self.columns[colidx][1] + " " + arrow |
| 919 | ) |
| 920 | self.options.Set("SortColumn", colidx) |
| 921 | self.options.Set("SortDesc", sort_desc) |
| 922 | event = None |
| 923 | # Sort outlist. Note: outlist columns are not the same as |
| 924 | # self.grid columns!!! |
| 925 | if outlist is None: |
| 926 | outlist = self.options.Get("outlist", False) |
| 927 | |
| 928 | if outlist and colidx != 1: |
| 929 | outlist = sortarray.sort_array( |
| 930 | outlist, |
| 931 | self.columns[colidx][7], |
| 932 | sec_col=self.columns[2][7], # Secondary sort by name |
| 933 | prim_desc=sort_desc, |
| 934 | sec_desc=False, # Secondary sort by name always ascending |
| 935 | case_sensitive=False |
| 936 | ) |
| 937 | self.options.Set("outlist", outlist) |
| 938 | self.updateList(outlist, duration=duration) |
| 939 | |
| 940 | def _setTransparency(self, event=None): |
| 941 | ''' |
nothing calls this directly
no test coverage detected