Rework dev tools window from frame into dialog

This commit is contained in:
DarkPhoenix
2019-08-10 11:02:25 +03:00
parent 2160cc4aaa
commit ea7f122030
2 changed files with 18 additions and 11 deletions

View File

@@ -32,11 +32,15 @@ from gui.builtinShipBrowser.events import FitSelected
pyfalog = Logger(__name__)
class DevTools(wx.Dialog):
class DevTools(wx.Frame):
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
def __init__(self, parent):
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Development Tools", size=wx.Size(400, 240))
wx.Frame.__init__(
self, parent, id=wx.ID_ANY, title="Development Tools",
style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT,
size=wx.Size(400, 320) if "wxGTK" in wx.PlatformInfo else wx.Size(400, 240))
self.mainFrame = parent
self.block = False
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
@@ -64,16 +68,12 @@ class DevTools(wx.Dialog):
mainSizer.Add(self.cmdPrint, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
self.cmdPrint.Bind(wx.EVT_BUTTON, self.cmd_print)
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.SetSizer(mainSizer)
self.Layout()
self.CenterOnParent()
def OnClose(self, event):
self.Destroy()
def objects_by_id(self, evt):
input = self.id_get.GetValue()
if input.startswith("0x"):

View File

@@ -214,6 +214,7 @@ class MainFrame(wx.Frame):
# Internal vars to keep track of other windows (graphing/stats)
self.graphFrame = None
self.tgtProfileEditor = None
self.devTools = None
self.statsWnds = []
self.activeStatsWnd = None
@@ -387,16 +388,15 @@ class MainFrame(wx.Frame):
wx.adv.AboutBox(info)
def OnShowDevTools(self, event):
dlg = DevTools(self)
dlg.Show()
self.bringUpWindow('devTools', DevTools)
def OnShowCharacterEditor(self, event):
dlg = CharacterEditor(self)
dlg.Show()
def OnShowAttrEditor(self, event):
dlg = AttributeEditor(self)
dlg.Show()
frame = AttributeEditor(self)
frame.Show()
def OnShowTargetProfileEditor(self, event):
self.ShowTargetProfileEditor()
@@ -965,7 +965,6 @@ class MainFrame(wx.Frame):
def OnShowGraphFrame(self, event):
if not self.graphFrame:
self.graphFrame = GraphFrame(self)
if graphFrame.graphFrame_enabled:
self.graphFrame.Show()
elif graphFrame.graphFrame_enabled:
@@ -981,3 +980,11 @@ class MainFrame(wx.Frame):
if not wnd:
wnd = self
InspectionTool().Show(wnd, True)
def bringUpWindow(self, attrName, windowClass):
if not getattr(self, attrName):
frame = windowClass(self)
setattr(self, attrName, frame)
frame.Show()
else:
getattr(self, attrName).Raise()