From 0260ef44bbcf4d2dae9309ea8ff3ac2cea70245f Mon Sep 17 00:00:00 2001 From: Jan-Paul Date: Thu, 2 Aug 2018 21:21:10 +1000 Subject: [PATCH] v0.3.1 bug fix release --- README.md | 8 ++++++++ VERSION | 2 +- gui.py | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-- sortarray.py | 15 -------------- 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f474088..6511b8c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,14 @@ PySpy connects to [CCP's ESI API](https://esi.evetech.net/ui/) and the **Current Limitations**: To avoid undue strain on zKillboard's API, PySpy will run the *Kills*, *Losses*, *Last Wk*, *Solo*, *BLOPS* and *HICs* analyses only for the first 30 characters in the list. +## Ignore Certain Entities + +PySpy allows you to specify a list of ignored characters, corporations and alliances. To add entities to that list, right click on a search result. You can remove entities from this list under _Options_->_Review Ignored Entities_ + +## Ignore all Members of your NPSI Fleet + +For anyone using PySpy in no-purple-shoot-it (NPSI) fleets, you can tell PySpy to temporarily ignore your fleet mates by first running PySpy on all characters in your fleet chat and the selecting _Options_->_Set NPSI Ignore List_. Once the fleet is over, you can clear the list under _Options_->_Clear NPSI List_. Your custom ignore list described above will not be affected by this action. + ## Installation You can download the latest release for your operating system [here](https://github.com/WhiteRusssian/PySpy/releases/latest). diff --git a/VERSION b/VERSION index 174a3d5..1e66a61 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.3 \ No newline at end of file +v0.3.1 \ No newline at end of file diff --git a/gui.py b/gui.py index 39a31e2..913c9e9 100644 --- a/gui.py +++ b/gui.py @@ -22,7 +22,7 @@ # cSpell Checker - Correct Words**************************************** # // cSpell:words wrusssian, wxpython, HRULES, VRULES, ELLIPSIZE, zkill, # // cSpell:words blops, Unregister, russsian, chkversion, posix, -# // cSpell:words Gallente, Minmatar, Amarr, Caldari, ontop, hics +# // cSpell:words Gallente, Minmatar, Amarr, Caldari, ontop, hics, npsi # ********************************************************************** Logger = logging.getLogger(__name__) # Example call: Logger.info("Something badhappened", exc_info=True) **** @@ -148,6 +148,22 @@ def __init__(self, *args, **kwds): self.review_ignore ) + self.opt_menu.AppendSeparator() + + self.ignore_all = self.opt_menu.Append(wx.ID_ANY, "&Set NPSI Ignore List\tCTRL+SHIFT+S") + self.opt_menu.Bind( + wx.EVT_MENU, + self._showNpsiDialog, + self.ignore_all + ) + + self.clear_ignore = self.opt_menu.Append(wx.ID_ANY, "&Clear NPSI Ignore List\tCTRL+SHIFT+C") + self.opt_menu.Bind( + wx.EVT_MENU, + self._clearNpsiList, + self.clear_ignore + ) + self.menubar.Append(self.opt_menu, 'Options') # Set the grid object @@ -412,9 +428,12 @@ def updateList(self, outlist, duration=None): # If updateList() gets called before outlist has been provided, do nothing if outlist is None: return + # Clean up grid if self.grid.GetNumberRows() > 0: self.grid.DeleteRows(numRows=self.grid.GetNumberRows()) self.grid.AppendRows(len(outlist)) + # Add any NPSI fleet related characters to ignored_list + npsi_list = self.options.Get("NPSIList", default=[]) ignored_list = self.options.Get("ignoredList", default=[]) hl_blops = self.options.Get("HlBlops", True) ignore_count = 0 @@ -425,6 +444,9 @@ def updateList(self, outlist, duration=None): for rec in ignored_list: if r[0] == rec[0] or r[3] == rec[0] or r[5] == rec[0]: ignore = True + for rec in npsi_list: + if r[0] == rec[0]: + ignore = True if ignore: self.grid.HideRow(rowidx) ignore_count += 1 @@ -713,6 +735,34 @@ def _openIgnoreDialog(self, evt=None): return ignoredialog.showIgnoreDialog(self) + def _showNpsiDialog(self, evt=None): + dialog = wx.MessageBox( + "Do you want to ignore all currently shown characters? " + + "You can undo this under `Options > Clear NPSI Ignore List`.", + "NPSI Ignore List", + wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION + ) + if dialog == 2: # Yes + npsi_list = [] + outlist = self.options.Get("outlist", None) + if outlist is None: + return + for r in outlist: + character_id = [r[0]] # Needs to be list to append to ignored_list + npsi_list.append(character_id) + self.options.Set("NPSIList", npsi_list) + self.updateList(outlist) + + def _clearNpsiList(self, evt=None): + dialog = wx.MessageBox( + "Would you like to clear the current NPSI fleet ignore list?", + "NPSI Ignore List", + wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION + ) + if dialog == 2: # Yes + self.options.Set("NPSIList", []) + self.updateList(self.options.Get("outlist", None)) + def _restoreColWidth(self): ''' Restores column width either to default or value stored from @@ -769,8 +819,9 @@ def OnClose(self, event=None): self.options.Set("HlNone", self.ignore_none.IsChecked()) self.options.Set("StayOnTop", self.stay_ontop.IsChecked()) self.options.Set("DarkMode", self.dark_mode.IsChecked()) - # Delete last outlist + # Delete last outlist and NPSIList self.options.Set("outlist", None) + self.options.Set("NPSIList", []) # Write pickle container to disk self.options.Save() event.Skip() if event else False diff --git a/sortarray.py b/sortarray.py index 9db9658..aae12d3 100644 --- a/sortarray.py +++ b/sortarray.py @@ -36,17 +36,6 @@ def __init__(self, prim_col, sort_array): super(SortArrayError, self).__init__(msg) -class NothingToSortError(SortArrayError): - ''' - Gets raised when there are less than two sortable objects. - ''' - def __init__(self): - msg = ( - "The unsorted input array does not contain sufficient sortable values." - ) - super(SortArrayError, self).__init__(msg) - - def _determineApproach(array, sort_col): ''' Takes an array (list of lists/tuples) and determines whether values @@ -92,10 +81,6 @@ def _determineApproach(array, sort_col): else: sort_as_str = False - # If there is nothing to sort, raise error. - if (is_num + is_str + is_none) < 2: - raise NothingToSortError - return sort_as_str