Migrate more windows to new window control scheme
This commit is contained in:
@@ -5,7 +5,7 @@ from gui.contextMenu import ContextMenuSingle
|
||||
from gui.targetProfileEditor import TargetProfileEditor
|
||||
|
||||
|
||||
class TargetProfileEditor(ContextMenuSingle):
|
||||
class TargetProfileEditorMenu(ContextMenuSingle):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
@@ -25,7 +25,7 @@ class TargetProfileEditor(ContextMenuSingle):
|
||||
return 'Edit Target Profile'
|
||||
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
self.mainFrame.ShowTargetProfileEditor(selected=mainItem.item)
|
||||
TargetProfileEditor.openOne(parent=self.mainFrame, selected=mainItem.item)
|
||||
|
||||
|
||||
TargetProfileEditor.register()
|
||||
TargetProfileEditorMenu.register()
|
||||
|
||||
@@ -55,9 +55,9 @@ from gui.esiFittings import EveFittings, ExportToEve, SsoCharacterMgmt
|
||||
from gui.mainMenuBar import MainMenuBar
|
||||
from gui.marketBrowser import MarketBrowser
|
||||
from gui.multiSwitch import MultiSwitch
|
||||
from gui.patternEditor import DmgPatternEditorDlg
|
||||
from gui.patternEditor import DmgPatternEditor
|
||||
from gui.preferenceDialog import PreferenceDialog
|
||||
from gui.setEditor import ImplantSetEditorDlg
|
||||
from gui.setEditor import ImplantSetEditor
|
||||
from gui.shipBrowser import ShipBrowser
|
||||
from gui.statsPane import StatsPane
|
||||
from gui.targetProfileEditor import TargetProfileEditor
|
||||
@@ -397,18 +397,13 @@ class MainFrame(wx.Frame):
|
||||
AttributeEditor.openOne(parent=self)
|
||||
|
||||
def OnShowTargetProfileEditor(self, event):
|
||||
self.ShowTargetProfileEditor()
|
||||
|
||||
def ShowTargetProfileEditor(self, selected=None):
|
||||
TargetProfileEditor.openOne(parent=self, selected=selected)
|
||||
TargetProfileEditor.openOne(parent=self)
|
||||
|
||||
def OnShowDamagePatternEditor(self, event):
|
||||
with DmgPatternEditorDlg(self) as dlg:
|
||||
dlg.ShowModal()
|
||||
DmgPatternEditor.openOne(parent=self)
|
||||
|
||||
def OnShowImplantSetEditor(self, event):
|
||||
with ImplantSetEditorDlg(self) as dlg:
|
||||
dlg.ShowModal()
|
||||
ImplantSetEditor.openOne(parent=self)
|
||||
|
||||
def OnShowExportDialog(self, event):
|
||||
""" Export active fit """
|
||||
@@ -430,23 +425,13 @@ class MainFrame(wx.Frame):
|
||||
output = Port.exportXml([fit], None)
|
||||
if '.' not in os.path.basename(path):
|
||||
path += ".xml"
|
||||
with open(path, "w", encoding="utf-8") as openfile:
|
||||
openfile.write(output)
|
||||
openfile.close()
|
||||
else:
|
||||
pyfalog.warning("oops, invalid fit format %d" % format_)
|
||||
try:
|
||||
dlg.Destroy()
|
||||
except RuntimeError:
|
||||
pyfalog.error("Tried to destroy an object that doesn't exist in <showExportDialog>.")
|
||||
return
|
||||
|
||||
with open(path, "w", encoding="utf-8") as openfile:
|
||||
openfile.write(output)
|
||||
openfile.close()
|
||||
|
||||
try:
|
||||
dlg.Destroy()
|
||||
except RuntimeError:
|
||||
pyfalog.error("Tried to destroy an object that doesn't exist in <showExportDialog>.")
|
||||
|
||||
def OnShowPreferenceDialog(self, event):
|
||||
with PreferenceDialog(self) as dlg:
|
||||
dlg.ShowModal()
|
||||
@@ -834,8 +819,7 @@ class MainFrame(wx.Frame):
|
||||
"Backup fits",
|
||||
"Generating HTML file at: %s" % path,
|
||||
maximum=max_, parent=self,
|
||||
style=wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME
|
||||
)
|
||||
style=wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME)
|
||||
|
||||
exportHtml.getInstance().refreshFittingHtml(True, self.backupCallback)
|
||||
self.progressDialog.ShowModal()
|
||||
|
||||
@@ -19,13 +19,16 @@
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from logbook import Logger
|
||||
# noinspection PyPackageRequirements
|
||||
from wx.lib.intctrl import IntCtrl
|
||||
from gui.utils.clipboard import toClipboard, fromClipboard
|
||||
from gui.builtinViews.entityEditor import EntityEditor, BaseValidator
|
||||
|
||||
from gui.auxFrame import AuxiliaryFrame
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.builtinViews.entityEditor import BaseValidator, EntityEditor
|
||||
from gui.utils.clipboard import fromClipboard, toClipboard
|
||||
from service.damagePattern import DamagePattern, ImportError
|
||||
from logbook import Logger
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
@@ -85,13 +88,13 @@ class DmgPatternEntityEditor(EntityEditor):
|
||||
sDP.deletePattern(entity)
|
||||
|
||||
|
||||
class DmgPatternEditorDlg(wx.Dialog):
|
||||
class DmgPatternEditor(AuxiliaryFrame):
|
||||
|
||||
DAMAGE_TYPES = ("em", "thermal", "kinetic", "explosive")
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Dialog.__init__(
|
||||
self, parent, id=wx.ID_ANY,
|
||||
title="Damage Pattern Editor",
|
||||
super().__init__(
|
||||
parent, id=wx.ID_ANY, title="Damage Pattern Editor", style=wx.RESIZE_BORDER,
|
||||
# Dropdown list widget is scaled to its longest content line on GTK, adapt to that
|
||||
size=wx.Size(500, 240) if "wxGTK" in wx.PlatformInfo else wx.Size(400, 240))
|
||||
|
||||
@@ -185,6 +188,7 @@ class DmgPatternEditorDlg(wx.Dialog):
|
||||
self.Layout()
|
||||
bsize = self.GetBestSize()
|
||||
self.SetSize((-1, bsize.height))
|
||||
self.SetMinSize(self.GetSize())
|
||||
self.CenterOnParent()
|
||||
|
||||
self.Bind(wx.EVT_CHOICE, self.patternChanged)
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
from logbook import Logger
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from logbook import Logger
|
||||
|
||||
from service.implantSet import ImplantSets
|
||||
from gui.auxFrame import AuxiliaryFrame
|
||||
from gui.builtinViews.entityEditor import BaseValidator, EntityEditor
|
||||
from gui.builtinViews.implantEditor import BaseImplantEditorView
|
||||
from gui.utils.clipboard import toClipboard, fromClipboard
|
||||
from gui.builtinViews.entityEditor import EntityEditor, BaseValidator
|
||||
from gui.utils.clipboard import fromClipboard, toClipboard
|
||||
from service.implantSet import ImplantSets
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
@@ -83,7 +85,8 @@ class ImplantSetEntityEditor(EntityEditor):
|
||||
sIS.deleteSet(entity)
|
||||
|
||||
|
||||
class ImplantSetEditor(BaseImplantEditorView):
|
||||
class ImplantSetEditorView(BaseImplantEditorView):
|
||||
|
||||
def __init__(self, parent):
|
||||
BaseImplantEditorView.__init__(self, parent)
|
||||
if 'wxMSW' in wx.PlatformInfo:
|
||||
@@ -112,12 +115,11 @@ class ImplantSetEditor(BaseImplantEditorView):
|
||||
sIS.removeImplant(set_.ID, implant)
|
||||
|
||||
|
||||
class ImplantSetEditorDlg(wx.Dialog):
|
||||
class ImplantSetEditor(AuxiliaryFrame):
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Dialog.__init__(
|
||||
self, parent, id=wx.ID_ANY,
|
||||
title="Implant Set Editor",
|
||||
super().__init__(
|
||||
parent, id=wx.ID_ANY, title="Implant Set Editor", style=wx.RESIZE_BORDER,
|
||||
size=wx.Size(950, 500) if "wxGTK" in wx.PlatformInfo else wx.Size(850, 420))
|
||||
|
||||
self.block = False
|
||||
@@ -131,7 +133,7 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
self.sl = wx.StaticLine(self)
|
||||
mainSizer.Add(self.sl, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
||||
|
||||
self.iview = ImplantSetEditor(self)
|
||||
self.iview = ImplantSetEditorView(self)
|
||||
mainSizer.Add(self.iview, 1, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
self.slfooter = wx.StaticLine(self)
|
||||
@@ -165,7 +167,7 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
self.Layout()
|
||||
|
||||
if not self.entityEditor.checkEntitiesExist():
|
||||
self.Destroy()
|
||||
self.Close()
|
||||
return
|
||||
|
||||
self.Bind(wx.EVT_CHOICE, self.entityChanged)
|
||||
@@ -174,11 +176,12 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
self.Import.Bind(wx.EVT_BUTTON, self.importPatterns)
|
||||
self.Export.Bind(wx.EVT_BUTTON, self.exportPatterns)
|
||||
|
||||
self.SetMinSize(self.GetSize())
|
||||
self.CenterOnParent()
|
||||
|
||||
def entityChanged(self, event):
|
||||
if not self.entityEditor.checkEntitiesExist():
|
||||
self.Destroy()
|
||||
self.Close()
|
||||
return
|
||||
|
||||
def kbEvent(self, event):
|
||||
|
||||
@@ -124,7 +124,7 @@ class TargetProfileEditor(AuxiliaryFrame):
|
||||
('signatureRadius', ('Signature radius\nLeave blank for infinitely big value', 'm')),
|
||||
('radius', ('Radius', 'm'))])
|
||||
|
||||
def __init__(self, parent, selected=None):
|
||||
def __init__(self, parent):
|
||||
super().__init__(
|
||||
parent, id=wx.ID_ANY, title="Target Profile Editor", style=wx.RESIZE_BORDER,
|
||||
# Dropdown list widget is scaled to its longest content line on GTK, adapt to that
|
||||
@@ -136,7 +136,7 @@ class TargetProfileEditor(AuxiliaryFrame):
|
||||
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.entityEditor = TargetProfileEntityEditor(parent=self, selected=selected)
|
||||
self.entityEditor = TargetProfileEntityEditor(parent=self)
|
||||
mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2)
|
||||
|
||||
self.sl = wx.StaticLine(self)
|
||||
@@ -241,6 +241,7 @@ class TargetProfileEditor(AuxiliaryFrame):
|
||||
self.Layout()
|
||||
bsize = self.GetBestSize()
|
||||
self.SetSize((-1, bsize.height))
|
||||
self.SetMinSize(self.GetSize())
|
||||
self.CenterOnParent()
|
||||
|
||||
self.Bind(wx.EVT_CHOICE, self.patternChanged)
|
||||
|
||||
Reference in New Issue
Block a user