From 48ac6cb2aff6c023f765cfa0a827f914ae274b1c Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sat, 23 Mar 2019 14:01:43 +0300 Subject: [PATCH] Remove debugging prints or move them to pyfalog --- config.py | 3 --- eos/events.py | 1 - gui/bitmap_loader.py | 9 +++++---- gui/builtinMarketBrowser/itemView.py | 2 +- gui/builtinViews/fittingView.py | 20 +++++--------------- gui/graphFrame.py | 4 ++-- gui/mainFrame.py | 9 +++++---- gui/utils/exportHtml.py | 2 +- service/esi.py | 1 - service/fit.py | 2 +- 10 files changed, 20 insertions(+), 33 deletions(-) diff --git a/config.py b/config.py index 371adf8e2..6a4e2e95c 100644 --- a/config.py +++ b/config.py @@ -171,9 +171,6 @@ def defPaths(customSavePath=None): eos.config.saveddata_connectionstring = "sqlite:///" + saveDB + "?check_same_thread=False" eos.config.gamedata_connectionstring = "sqlite:///" + gameDB + "?check_same_thread=False" - print(eos.config.saveddata_connectionstring) - print(eos.config.gamedata_connectionstring) - # initialize the settings from service.settings import EOSSettings eos.config.settings = EOSSettings.getInstance().EOSSettings # this is kind of confusing, but whatever diff --git a/eos/events.py b/eos/events.py index dd4b07b79..7a8ffce18 100644 --- a/eos/events.py +++ b/eos/events.py @@ -58,7 +58,6 @@ def rel_listener(target, value, initiator): if not target or (isinstance(value, Module) and value.isEmpty): return - print("{} has had a relationship change :D".format(target)) target.modified = datetime.datetime.now() diff --git a/gui/bitmap_loader.py b/gui/bitmap_loader.py index 042a6674b..09591b32a 100644 --- a/gui/bitmap_loader.py +++ b/gui/bitmap_loader.py @@ -27,7 +27,8 @@ from logbook import Logger import config -logging = Logger(__name__) + +pyfalog = Logger(__name__) class BitmapLoader(object): @@ -38,7 +39,7 @@ class BitmapLoader(object): # logging.info("Using local image files.") # archive = None - logging.info("Using local image files.") + pyfalog.info("Using local image files.") archive = None cached_bitmaps = OrderedDict() @@ -93,7 +94,7 @@ class BitmapLoader(object): filename, img = cls.loadScaledBitmap(name, location, scale) if img is None: - print(("Missing icon file: {0}/{1}".format(location, filename))) + pyfalog.warning("Missing icon file: {0}/{1}".format(location, filename)) return None bmp: wx.Bitmap = img.ConvertToBitmap() @@ -130,7 +131,7 @@ class BitmapLoader(object): sbuf = io.StringIO(img_data) return wx.ImageFromStream(sbuf) except KeyError: - print(("Missing icon file from zip: {0}".format(path))) + pyfalog.warning("Missing icon file from zip: {0}".format(path)) else: path = os.path.join(config.pyfaPath, 'imgs' + os.sep + location + os.sep + filename) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 258c8800f..97db645d7 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -202,7 +202,7 @@ class ItemView(Display): mktgrpid = sMkt.getMarketGroupByItem(item).ID except AttributeError: mktgrpid = -1 - print(("unable to find market group for", item.name)) + pyfalog.warning("unable to find market group for {}".format(item.name)) parentname = sMkt.getParentItemByItem(item).name # Get position of market group metagrpid = sMkt.getMetaGroupIdByItem(item) diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index 97ba7d8f6..9801f4af0 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -82,7 +82,7 @@ class FitSpawner(gui.multiSwitch.TabSpawner): if not isinstance(view, FittingView): view = FittingView(self.multiSwitch) - print("###################### Created new view:" + repr(view)) + pyfalog.debug("###################### Created new view:" + repr(view)) self.multiSwitch.ReplaceActivePage(view) view.fitSelected(event) @@ -174,8 +174,8 @@ class FittingView(d.Display): self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) self.parent.Bind(EVT_NOTEBOOK_PAGE_CHANGED, self.pageChanged) - print("------------------ new fitting view -------------------") - print(self) + pyfalog.debug("------------------ new fitting view -------------------") + pyfalog.debug(self) def OnLeaveWindow(self, event): self.SetToolTip(None) @@ -224,16 +224,7 @@ class FittingView(d.Display): wx.PostEvent(self.mainFrame, FitSelected(fitID=fitID)) def Destroy(self): - # @todo: when wxPython 4.0.2 is release, https://github.com/pyfa-org/Pyfa/issues/1586#issuecomment-390074915 - # Make sure to remove the shitty checks that I have to put in place for these handlers to ignore when self is None - print("+++++ Destroy " + repr(self)) - - # print(self.parent.Unbind(EVT_NOTEBOOK_PAGE_CHANGED)) - # print(self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.fitChanged)) - # print(self.mainFrame.Unbind(EVT_FIT_RENAMED, handler=self.fitRenamed )) - # print(self.mainFrame.Unbind(EVT_FIT_REMOVED, handler=self.fitRemoved)) - # print(self.mainFrame.Unbind(ITEM_SELECTED, handler=self.appendItem)) - + pyfalog.debug("+++++ Destroy " + repr(self)) d.Display.Destroy(self) def pageChanged(self, event): @@ -296,7 +287,6 @@ class FittingView(d.Display): delete fit caused change in stats (projected) todo: move this to the notebook, not the page. We don't want the page being responsible for deleting itself """ - print('_+_+_+_+_+_ Fit Removed: {} {} activeFitID: {}, eventFitID: {}'.format(repr(self), str(bool(self)), self.activeFitID, event.fitID)) pyfalog.debug("FittingView::fitRemoved") if not self: event.Skip() @@ -331,7 +321,7 @@ class FittingView(d.Display): event.Skip() def fitSelected(self, event): - print('====== Fit Selected: ' + repr(self) + str(bool(self))) + pyfalog.debug('====== Fit Selected: ' + repr(self) + str(bool(self))) if self.parent.IsActive(self): fitID = event.fitID diff --git a/gui/graphFrame.py b/gui/graphFrame.py index a36c9c66a..1ea9b86c3 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -93,8 +93,8 @@ class GraphFrame(wx.Frame): graphFrame_enabled = True if int(mpl.__version__[0]) < 1: - print(("pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds")) - print("pyfa: Recommended minimum matplotlib version is 1.0.0") + pyfalog.warning("pyfa: Found matplotlib version {} - activating OVER9000 workarounds".format(mpl.__version__)) + pyfalog.warning("pyfa: Recommended minimum matplotlib version is 1.0.0") self.legendFix = True mplImported = True diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 3d17f9f65..78126fa80 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -73,17 +73,18 @@ from service.settings import HTMLExportSettings, SettingsProvider from service.update import Update import gui.fitCommands as cmd + +pyfalog = Logger(__name__) + disableOverrideEditor = False try: from gui.propertyEditor import AttributeEditor except ImportError as e: AttributeEditor = None - print(("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message)) + pyfalog.warning("Error loading Attribute Editor: %s.\nAccess to Attribute Editor is disabled." % e.message) disableOverrideEditor = True -pyfalog = Logger(__name__) - pyfalog.debug("Done loading mainframe imports") @@ -421,7 +422,7 @@ class MainFrame(wx.Frame): if '.' not in os.path.basename(path): path += ".xml" else: - print(("oops, invalid fit format %d" % format_)) + pyfalog.warning("oops, invalid fit format %d" % format_) try: dlg.Destroy() except RuntimeError: diff --git a/gui/utils/exportHtml.py b/gui/utils/exportHtml.py index 608b52396..ab8fa9107 100644 --- a/gui/utils/exportHtml.py +++ b/gui/utils/exportHtml.py @@ -68,7 +68,7 @@ class exportHtmlThread(threading.Thread): FILE.write(HTML) FILE.close() except IOError as ex: - print(("Failed to write to " + settings.getPath())) + pyfalog.warning("Failed to write to " + settings.getPath()) pass except Exception as ex: pass diff --git a/service/esi.py b/service/esi.py index 88b704664..301af7d53 100644 --- a/service/esi.py +++ b/service/esi.py @@ -155,7 +155,6 @@ class Esi(EsiAccess): res.json() ) cdata = res.json() - print(cdata) currentCharacter = self.getSsoCharacter(cdata['CharacterName']) diff --git a/service/fit.py b/service/fit.py index c02dd7159..d116cd4f1 100644 --- a/service/fit.py +++ b/service/fit.py @@ -50,7 +50,7 @@ class DeferRecalc: def __enter__(self): self._recalc = self.sFit.recalc - self.sFit.recalc = lambda x: print('Deferred Recalc') + self.sFit.recalc = lambda x: pyfalog.debug('Deferred Recalc') def __exit__(self, *args): self.sFit.recalc = self._recalc