Testing some stuff out

This commit is contained in:
blitzmann
2017-11-18 19:01:05 -05:00
parent 0d8904d59f
commit a52b9e58e9
5 changed files with 78 additions and 1 deletions

View File

@@ -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)

67
gui/devTools.py Normal file
View File

@@ -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 <http://www.gnu.org/licenses/>.
# =============================================================================
# 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)

View File

@@ -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):

View File

@@ -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

View File

@@ -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)