From a52b9e58e97b28bcc17a1c3cb49eb1516afef002 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 18 Nov 2017 19:01:05 -0500 Subject: [PATCH] Testing some stuff out --- gui/builtinViews/fittingView.py | 2 + gui/devTools.py | 67 +++++++++++++++++++++++++++++++++ gui/graphFrame.py | 2 +- gui/mainFrame.py | 5 +++ gui/mainMenuBar.py | 3 ++ 5 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 gui/devTools.py diff --git a/gui/builtinViews/fittingView.py b/gui/builtinViews/fittingView.py index c07982886..22d06fa8d 100644 --- a/gui/builtinViews/fittingView.py +++ b/gui/builtinViews/fittingView.py @@ -166,6 +166,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) def OnLeaveWindow(self, event): self.SetToolTip(None) diff --git a/gui/devTools.py b/gui/devTools.py new file mode 100644 index 000000000..b51ce3065 --- /dev/null +++ b/gui/devTools.py @@ -0,0 +1,67 @@ +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +# ============================================================================= + +# noinspection PyPackageRequirements +import wx +from logbook import Logger +import gc + +pyfalog = Logger(__name__) + + +class DevTools(wx.Dialog): + DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive") + + def __init__(self, parent): + wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Damage Pattern Editor", size=wx.Size(400, 240)) + + self.block = False + self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) + + mainSizer = wx.BoxSizer(wx.VERTICAL) + + self.id_get = wx.TextCtrl(self, wx.ID_ANY, "", wx.DefaultPosition) + mainSizer.Add(self.id_get, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) + self.idBtn = wx.Button(self, wx.ID_ANY, "Print object", wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.idBtn, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) + + self.idBtn.Bind(wx.EVT_BUTTON, self.objects_by_id) + + self.SetSizer(mainSizer) + + self.Layout() + self.CenterOnParent() + self.Show() + + + + def objects_by_id(self, evt): + input = self.id_get.GetValue() + if input.startswith("0x"): + input = int(input, 16) + + print("Finding {} ({})".format(str(input), hex(input))) + + for obj in gc.get_objects(): + if id(obj) == input: + print(obj) + print(bool(obj)) + break + else: + print(None) diff --git a/gui/graphFrame.py b/gui/graphFrame.py index a0aa52876..a4d5fdd75 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -171,7 +171,7 @@ class GraphFrame(wx.Frame): def close(self, event): self.fitList.fitList.Unbind(wx.EVT_LEFT_DCLICK, handler=self.removeItem) - self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.draw) + print(self.mainFrame.Unbind(GE.FIT_CHANGED, handler=self.draw)) event.Skip() def getView(self): diff --git a/gui/mainFrame.py b/gui/mainFrame.py index a856c391b..cbc2dafde 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -54,6 +54,7 @@ from gui.characterSelection import CharacterSelection from gui.patternEditor import DmgPatternEditorDlg from gui.resistsEditor import ResistsEditorDlg from gui.setEditor import ImplantSetEditorDlg +from gui.devTools import DevTools from gui.preferenceDialog import PreferenceDialog from gui.graphFrame import GraphFrame from gui.copySelectDialog import CopySelectDialog @@ -386,6 +387,9 @@ class MainFrame(wx.Frame): # info.WebSite = (forumUrl, "pyfa thread at EVE Online forum") wx.adv.AboutBox(info) + def showDevTools(self, event): + DevTools(self) + def showCharacterEditor(self, event): dlg = CharacterEditor(self) dlg.Show() @@ -472,6 +476,7 @@ class MainFrame(wx.Frame): # Widgets Inspector if config.debug: self.Bind(wx.EVT_MENU, self.openWXInspectTool, id=self.widgetInspectMenuID) + self.Bind(wx.EVT_MENU, self.showDevTools, id=menuBar.devToolsId) # About self.Bind(wx.EVT_MENU, self.ShowAboutBox, id=wx.ID_ABOUT) # Char editor diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index 1cd680f63..aa85e0883 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -59,6 +59,7 @@ class MainMenuBar(wx.MenuBar): self.toggleOverridesId = wx.NewId() self.importDatabaseDefaultsId = wx.NewId() self.toggleIgnoreRestrictionID = wx.NewId() + self.devToolsId = wx.NewId() if 'wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0): wx.ID_COPY = wx.NewId() @@ -170,6 +171,8 @@ class MainMenuBar(wx.MenuBar): if config.debug: helpMenu.Append(self.mainFrame.widgetInspectMenuID, "Open Widgets Inspect tool", "Open Widgets Inspect tool") + helpMenu.Append(self.devToolsId, "Open Dev Tools", + "Dev Tools") self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)