Rework item stats from dialog into frame

This commit is contained in:
DarkPhoenix
2019-08-10 02:36:37 +03:00
parent 42d11bd3f1
commit 53f5656478
2 changed files with 27 additions and 28 deletions

View File

@@ -3,7 +3,7 @@ import wx
import gui.mainFrame
from gui.contextMenu import ContextMenuSingle
from gui.itemStats import ItemStatsDialog
from gui.itemStats import ItemStatsFrame
from service.fit import Fit
@@ -55,7 +55,7 @@ class ItemStats(ContextMenuSingle):
reuse = True
if self.mainFrame.GetActiveStatsWindow() is None and reuse:
dlg = ItemStatsDialog(stuff, fullContext)
frame = ItemStatsFrame(stuff, fullContext)
elif reuse:
lastWnd = self.mainFrame.GetActiveStatsWindow()
pos = lastWnd.GetPosition()
@@ -65,12 +65,12 @@ class ItemStats(ContextMenuSingle):
else:
size = wx.DefaultSize
pos = wx.DefaultPosition
dlg = ItemStatsDialog(stuff, fullContext, pos, size, maximized)
frame = ItemStatsFrame(stuff, fullContext, pos, size, maximized)
lastWnd.Close()
else:
dlg = ItemStatsDialog(stuff, fullContext)
dlg.Show()
frame = ItemStatsFrame(stuff, fullContext)
frame.Show()
ItemStats.register()

View File

@@ -39,26 +39,25 @@ from gui.builtinItemStatsViews.itemMutator import ItemMutatorPanel
from eos.saveddata.module import Module
class ItemStatsDialog(wx.Dialog):
class ItemStatsFrame(wx.Frame):
counter = 0
def __init__(
self,
victim,
fullContext=None,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
maximized=False
self,
victim,
fullContext=None,
pos=wx.DefaultPosition,
size=wx.DefaultSize,
maximized=False
):
wx.Dialog.__init__(
self,
gui.mainFrame.MainFrame.getInstance(),
wx.ID_ANY,
title="Item stats",
pos=pos,
size=size,
style=wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU
wx.Frame.__init__(
self,
gui.mainFrame.MainFrame.getInstance(),
wx.ID_ANY,
title="Item stats",
pos=pos,
size=size,
style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT
)
empty = getattr(victim, "isEmpty", False)
@@ -108,13 +107,13 @@ class ItemStatsDialog(wx.Dialog):
psize = self.parentWnd.GetSize()
ppos = self.parentWnd.GetPosition()
ItemStatsDialog.counter += 1
self.dlgOrder = ItemStatsDialog.counter
ItemStatsFrame.counter += 1
self.dlgOrder = ItemStatsFrame.counter
counter = ItemStatsDialog.counter
counter = ItemStatsFrame.counter
dlgStep = 30
if counter * dlgStep > ppos.x + psize.width - dlgsize.x or counter * dlgStep > ppos.y + psize.height - dlgsize.y:
ItemStatsDialog.counter = 1
ItemStatsFrame.counter = 1
dlgx = ppos.x + counter * dlgStep
dlgy = ppos.y + counter * dlgStep
@@ -146,10 +145,10 @@ class ItemStatsDialog(wx.Dialog):
def OnClose(self, event):
self.container.OnWindowClose()
if self.dlgOrder == ItemStatsDialog.counter:
ItemStatsDialog.counter -= 1
if self.dlgOrder == ItemStatsFrame.counter:
ItemStatsFrame.counter -= 1
self.parentWnd.UnregisterStatsWindow(self)
self.Destroy()
event.Skip()
class ItemStatsContainer(wx.Panel):