diff --git a/gui/builtinContextMenus/droneSplitStack.py b/gui/builtinContextMenus/droneSplitStack.py
index 2638433c3..d73baddc6 100644
--- a/gui/builtinContextMenus/droneSplitStack.py
+++ b/gui/builtinContextMenus/droneSplitStack.py
@@ -27,21 +27,21 @@ class DroneSplitStack(ContextMenuSingle):
return "Split {} Stack".format(itmContext)
def activate(self, callingWindow, fullContext, mainItem, i):
- dlg = DroneStackSplit(self.mainFrame, mainItem.amount)
+ with DroneStackSplit(self.mainFrame, mainItem.amount) as dlg:
- if dlg.ShowModal() == wx.ID_OK:
+ if dlg.ShowModal() == wx.ID_OK:
- if dlg.input.GetLineText(0).strip() == '':
- return
+ if dlg.input.GetLineText(0).strip() == '':
+ return
- fitID = self.mainFrame.getActiveFit()
- fit = Fit.getInstance().getFit(fitID)
- cleanInput = re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip())
+ fitID = self.mainFrame.getActiveFit()
+ fit = Fit.getInstance().getFit(fitID)
+ cleanInput = re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip())
- if mainItem in fit.drones:
- position = fit.drones.index(mainItem)
- self.mainFrame.command.Submit(cmd.GuiSplitLocalDroneStackCommand(
- fitID=fitID, position=position, amount=int(cleanInput)))
+ if mainItem in fit.drones:
+ position = fit.drones.index(mainItem)
+ self.mainFrame.command.Submit(cmd.GuiSplitLocalDroneStackCommand(
+ fitID=fitID, position=position, amount=int(cleanInput)))
DroneSplitStack.register()
@@ -50,6 +50,7 @@ DroneSplitStack.register()
class DroneStackSplit(wx.Dialog):
def __init__(self, parent, value):
+
wx.Dialog.__init__(self, parent, title="Split Drone Stack")
self.SetMinSize((346, 156))
diff --git a/gui/builtinContextMenus/fitAddBrowse.py b/gui/builtinContextMenus/fitAddBrowse.py
index 0f6eae676..8ce4ae53f 100644
--- a/gui/builtinContextMenus/fitAddBrowse.py
+++ b/gui/builtinContextMenus/fitAddBrowse.py
@@ -26,10 +26,10 @@ class AddBrowsedFits(ContextMenuUnconditional):
'graphFitList': 'Add Fits to Graph',
'graphTgtList': 'Add Targets to Graph'}
excludedFitIDs = callingWindow.getExistingFitIDs()
- dlg = FitBrowserLiteDialog(self.mainFrame, title=titles[fullContext[0]], excludedFitIDs=excludedFitIDs)
- if dlg.ShowModal() == wx.ID_OK:
- fitIDs = dlg.getFitIDsToAdd()
- callingWindow.addFitsByIDs(fitIDs)
+ with FitBrowserLiteDialog(self.mainFrame, title=titles[fullContext[0]], excludedFitIDs=excludedFitIDs) as dlg:
+ if dlg.ShowModal() == wx.ID_OK:
+ fitIDs = dlg.getFitIDsToAdd()
+ callingWindow.addFitsByIDs(fitIDs)
AddBrowsedFits.register()
diff --git a/gui/builtinContextMenus/itemAmountChange.py b/gui/builtinContextMenus/itemAmountChange.py
index 8926000ed..290faad36 100644
--- a/gui/builtinContextMenus/itemAmountChange.py
+++ b/gui/builtinContextMenus/itemAmountChange.py
@@ -43,42 +43,43 @@ class ChangeItemAmount(ContextMenuSingle):
else:
value = mainItem.amount
- dlg = AmountChanger(self.mainFrame, value, (0, 20)) if isinstance(mainItem, es_Fit) else AmountChanger(self.mainFrame, value)
- if dlg.ShowModal() == wx.ID_OK:
+ limits = (0, 20) if isinstance(mainItem, es_Fit) else None
+ with AmountChanger(self.mainFrame, value, limits) as dlg:
+ if dlg.ShowModal() == wx.ID_OK:
- if dlg.input.GetLineText(0).strip() == '':
- return
+ if dlg.input.GetLineText(0).strip() == '':
+ return
- sFit = Fit.getInstance()
- fit = sFit.getFit(fitID)
- cleanInput = int(float(re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip())))
+ sFit = Fit.getInstance()
+ fit = sFit.getFit(fitID)
+ cleanInput = int(float(re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip())))
- if isinstance(mainItem, es_Cargo):
- self.mainFrame.command.Submit(cmd.GuiChangeCargoAmountCommand(
- fitID=fitID, itemID=mainItem.itemID, amount=cleanInput))
- elif isinstance(mainItem, Drone):
- if srcContext == "projectedDrone":
- self.mainFrame.command.Submit(cmd.GuiChangeProjectedDroneAmountCommand(
+ if isinstance(mainItem, es_Cargo):
+ self.mainFrame.command.Submit(cmd.GuiChangeCargoAmountCommand(
fitID=fitID, itemID=mainItem.itemID, amount=cleanInput))
- else:
- if mainItem in fit.drones:
- position = fit.drones.index(mainItem)
- self.mainFrame.command.Submit(cmd.GuiChangeLocalDroneAmountCommand(
- fitID=fitID, position=position, amount=cleanInput))
- elif isinstance(mainItem, es_Fit):
- self.mainFrame.command.Submit(cmd.GuiChangeProjectedFitAmountCommand(
- fitID=fitID, projectedFitID=mainItem.ID, amount=cleanInput))
- elif isinstance(mainItem, es_Fighter):
- if srcContext == "projectedFighter":
- if mainItem in fit.projectedFighters:
- position = fit.projectedFighters.index(mainItem)
- self.mainFrame.command.Submit(cmd.GuiChangeProjectedFighterAmountCommand(
- fitID=fitID, position=position, amount=cleanInput))
- else:
- if mainItem in fit.fighters:
- position = fit.fighters.index(mainItem)
- self.mainFrame.command.Submit(cmd.GuiChangeLocalFighterAmountCommand(
- fitID=fitID, position=position, amount=cleanInput))
+ elif isinstance(mainItem, Drone):
+ if srcContext == "projectedDrone":
+ self.mainFrame.command.Submit(cmd.GuiChangeProjectedDroneAmountCommand(
+ fitID=fitID, itemID=mainItem.itemID, amount=cleanInput))
+ else:
+ if mainItem in fit.drones:
+ position = fit.drones.index(mainItem)
+ self.mainFrame.command.Submit(cmd.GuiChangeLocalDroneAmountCommand(
+ fitID=fitID, position=position, amount=cleanInput))
+ elif isinstance(mainItem, es_Fit):
+ self.mainFrame.command.Submit(cmd.GuiChangeProjectedFitAmountCommand(
+ fitID=fitID, projectedFitID=mainItem.ID, amount=cleanInput))
+ elif isinstance(mainItem, es_Fighter):
+ if srcContext == "projectedFighter":
+ if mainItem in fit.projectedFighters:
+ position = fit.projectedFighters.index(mainItem)
+ self.mainFrame.command.Submit(cmd.GuiChangeProjectedFighterAmountCommand(
+ fitID=fitID, position=position, amount=cleanInput))
+ else:
+ if mainItem in fit.fighters:
+ position = fit.fighters.index(mainItem)
+ self.mainFrame.command.Submit(cmd.GuiChangeLocalFighterAmountCommand(
+ fitID=fitID, position=position, amount=cleanInput))
ChangeItemAmount.register()
diff --git a/gui/builtinContextMenus/itemStats.py b/gui/builtinContextMenus/itemStats.py
index 5306ea284..3f3863771 100644
--- a/gui/builtinContextMenus/itemStats.py
+++ b/gui/builtinContextMenus/itemStats.py
@@ -55,8 +55,7 @@ class ItemStats(ContextMenuSingle):
reuse = True
if self.mainFrame.GetActiveStatsWindow() is None and reuse:
- ItemStatsDialog(stuff, fullContext)
-
+ dlg = ItemStatsDialog(stuff, fullContext)
elif reuse:
lastWnd = self.mainFrame.GetActiveStatsWindow()
pos = lastWnd.GetPosition()
@@ -66,11 +65,12 @@ class ItemStats(ContextMenuSingle):
else:
size = wx.DefaultSize
pos = wx.DefaultPosition
- ItemStatsDialog(stuff, fullContext, pos, size, maximized)
+ dlg = ItemStatsDialog(stuff, fullContext, pos, size, maximized)
lastWnd.Close()
else:
- ItemStatsDialog(stuff, fullContext)
+ dlg = ItemStatsDialog(stuff, fullContext)
+ dlg.Show()
ItemStats.register()
diff --git a/gui/builtinContextMenus/targetProfile/editor.py b/gui/builtinContextMenus/targetProfile/editor.py
index 86de122e0..c523115fd 100644
--- a/gui/builtinContextMenus/targetProfile/editor.py
+++ b/gui/builtinContextMenus/targetProfile/editor.py
@@ -25,7 +25,8 @@ class TargetProfileEditor(ContextMenuSingle):
return 'Edit Target Profile'
def activate(self, callingWindow, fullContext, mainItem, i):
- TargetProfileEditorDlg(parent=callingWindow, selected=mainItem.item)
+ with TargetProfileEditorDlg(parent=callingWindow, selected=mainItem.item) as dlg:
+ dlg.ShowModal()
TargetProfileEditor.register()
diff --git a/gui/characterEditor.py b/gui/characterEditor.py
index 17c27929d..2a462d680 100644
--- a/gui/characterEditor.py
+++ b/gui/characterEditor.py
@@ -480,13 +480,11 @@ class SkillTreeView(wx.Panel):
def onSecStatus(self, event):
sChar = Character.getInstance()
char = self.charEditor.entityEditor.getActiveEntity()
- myDlg = SecStatusDialog(self, char.secStatus or 0.0)
- res = myDlg.ShowModal()
- if res == wx.ID_OK:
- value = myDlg.floatSpin.GetValue()
- sChar.setSecStatus(char, value)
- self.btnSecStatus.SetLabel("Sec Status: {0:.2f}".format(value))
- myDlg.Destroy()
+ with SecStatusDialog(self, char.secStatus or 0.0) as dlg:
+ if dlg.ShowModal() == wx.ID_OK:
+ value = dlg.floatSpin.GetValue()
+ sChar.setSecStatus(char, value)
+ self.btnSecStatus.SetLabel("Sec Status: {0:.2f}".format(value))
def delaySearch(self, evt):
if self.searchInput.GetValue() == "" or self.searchInput.GetValue() == self.searchInput.default_text:
@@ -897,19 +895,19 @@ class APIView(wx.Panel):
class SecStatusDialog(wx.Dialog):
def __init__(self, parent, sec):
- wx.Dialog.__init__(self, parent, title="Set Security Status", size=(275, 175))
+ wx.Dialog.__init__(self, parent, title="Set Security Status", size=(300, 175))
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
bSizer1 = wx.BoxSizer(wx.VERTICAL)
self.m_staticText1 = wx.StaticText(self, wx.ID_ANY,
- "Security Status is used in some CONCORD hull calculations; you can set the characters security status here",
+ "Security Status is used in some CONCORD hull calculations",
wx.DefaultPosition, wx.DefaultSize, 0)
self.m_staticText1.Wrap(-1)
bSizer1.Add(self.m_staticText1, 1, wx.ALL | wx.EXPAND, 5)
- self.floatSpin = FloatSpin(self, value=sec, min_val=-5.0, max_val=5.0, increment=0.1, digits=2, size=(100, -1))
+ self.floatSpin = FloatSpin(self, value=sec, min_val=-5.0, max_val=5.0, increment=0.1, digits=2, size=(-1, -1))
bSizer1.Add(self.floatSpin, 0, wx.ALIGN_CENTER | wx.ALL, 5)
btnOk = wx.Button(self, wx.ID_OK)
@@ -918,4 +916,4 @@ class SecStatusDialog(wx.Dialog):
self.SetSizer(bSizer1)
self.Layout()
- self.Centre(wx.BOTH)
+ self.Center(wx.BOTH)
diff --git a/gui/devTools.py b/gui/devTools.py
index 44012128c..7e68c80e8 100644
--- a/gui/devTools.py
+++ b/gui/devTools.py
@@ -17,13 +17,15 @@
# along with pyfa. If not, see .
# =============================================================================
+import gc
+import threading
+import time
+
# noinspection PyPackageRequirements
import wx
from logbook import Logger
-import gc
-import eos
-import time
-import threading
+
+import eos.db
from gui.builtinShipBrowser.events import FitSelected
@@ -34,7 +36,7 @@ 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))
+ wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="Development Tools", size=wx.Size(400, 240))
self.mainFrame = parent
self.block = False
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
@@ -62,13 +64,15 @@ 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()
- self.Show()
- print(parent)
+
+ def OnClose(self, event):
+ self.Destroy()
def objects_by_id(self, evt):
input = self.id_get.GetValue()
diff --git a/gui/esiFittings.py b/gui/esiFittings.py
index 8f363f416..b987782b7 100644
--- a/gui/esiFittings.py
+++ b/gui/esiFittings.py
@@ -99,20 +99,13 @@ class EveFittings(wx.Frame):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
- self.closeWindow()
+ self.Close()
return
event.Skip()
def OnClose(self, event):
- self.closeWindow()
- # self.cacheTimer.Stop() # must be manually stopped, otherwise crash. See https://github.com/wxWidgets/Phoenix/issues/632
event.Skip()
- def closeWindow(self):
- self.mainFrame.Unbind(GE.EVT_SSO_LOGOUT)
- self.mainFrame.Unbind(GE.EVT_SSO_LOGIN)
- self.Destroy()
-
def getActiveCharacter(self):
selection = self.charChoice.GetCurrentSelection()
return self.charChoice.GetClientData(selection) if selection is not None else None
@@ -254,19 +247,13 @@ class ExportToEve(wx.Frame):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
- self.closeWindow()
+ self.Close()
return
event.Skip()
def OnClose(self, event):
- self.closeWindow()
event.Skip()
- def closeWindow(self):
- self.mainFrame.Unbind(GE.EVT_SSO_LOGOUT)
- self.mainFrame.Unbind(GE.EVT_SSO_LOGIN)
- self.Destroy()
-
def getActiveCharacter(self):
selection = self.charChoice.GetCurrentSelection()
return self.charChoice.GetClientData(selection) if selection is not None else None
@@ -341,6 +328,7 @@ class SsoCharacterMgmt(wx.Dialog):
self.deleteBtn.Bind(wx.EVT_BUTTON, self.delChar)
self.mainFrame.Bind(GE.EVT_SSO_LOGIN, self.ssoLogin)
+ self.Bind(wx.EVT_CLOSE, self.OnClose)
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
self.SetSizer(mainSizer)
@@ -349,20 +337,19 @@ class SsoCharacterMgmt(wx.Dialog):
self.Centre(wx.BOTH)
def ssoLogin(self, event):
- if self:
- # todo: these events don't unbind properly when window is closed (?), hence the `if`. Figure out better way of doing this.
- self.popCharList()
- event.Skip()
+ self.popCharList()
+ event.Skip()
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
- self.closeWindow()
+ self.Close()
return
event.Skip()
- def closeWindow(self):
+ def OnClose(self, event):
+ self.mainFrame.Unbind(GE.EVT_SSO_LOGIN, handler=self.ssoLogin)
self.Destroy()
def popCharList(self):
diff --git a/gui/fitBrowserLite.py b/gui/fitBrowserLite.py
index b7f863b4c..00fb311bf 100644
--- a/gui/fitBrowserLite.py
+++ b/gui/fitBrowserLite.py
@@ -62,7 +62,6 @@ class FitBrowserLiteDialog(wx.Dialog):
self.Bind(wx.EVT_TIMER, self.OnInputTimer, self.inputTimer)
self.searchBox.Bind(event=wx.EVT_TEXT, handler=self.OnSearchChanged)
-
self.SetSizer(mainSizer)
self.Layout()
self.SetSize(self.GetBestSize())
diff --git a/gui/itemStats.py b/gui/itemStats.py
index 6d3ec2679..103358426 100644
--- a/gui/itemStats.py
+++ b/gui/itemStats.py
@@ -133,8 +133,6 @@ class ItemStatsDialog(wx.Dialog):
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
- self.Show()
-
def OnActivate(self, event):
self.parentWnd.SetActiveStatsWindow(self)
diff --git a/gui/mainFrame.py b/gui/mainFrame.py
index eae23d641..4cc550354 100644
--- a/gui/mainFrame.py
+++ b/gui/mainFrame.py
@@ -237,8 +237,8 @@ class MainFrame(wx.Frame):
return Fit.getCommandProcessor(fitID)
def ShowUpdateBox(self, release, version):
- dlg = UpdateDialog(self, release, version)
- dlg.ShowModal()
+ with UpdateDialog(self, release, version) as dlg:
+ dlg.ShowModal()
def LoadPreviousOpenFits(self):
sFit = Fit.getInstance()
@@ -386,7 +386,8 @@ class MainFrame(wx.Frame):
wx.adv.AboutBox(info)
def showDevTools(self, event):
- DevTools(self)
+ dlg = DevTools(self)
+ dlg.Show()
def showCharacterEditor(self, event):
dlg = CharacterEditor(self)
@@ -397,18 +398,16 @@ class MainFrame(wx.Frame):
dlg.Show()
def showTargetProfileEditor(self, event):
- TargetProfileEditorDlg(self)
+ with TargetProfileEditorDlg(self) as dlg:
+ dlg.ShowModal()
def showDamagePatternEditor(self, event):
- dlg = DmgPatternEditorDlg(self)
- dlg.ShowModal()
- try:
- dlg.Destroy()
- except RuntimeError:
- pyfalog.error("Tried to destroy an object that doesn't exist in .")
+ with DmgPatternEditorDlg(self) as dlg:
+ dlg.ShowModal()
def showImplantSetEditor(self, event):
- ImplantSetEditorDlg(self)
+ with ImplantSetEditorDlg(self) as dlg:
+ dlg.ShowModal()
def showExportDialog(self, event):
""" Export active fit """
@@ -446,8 +445,8 @@ class MainFrame(wx.Frame):
pyfalog.error("Tried to destroy an object that doesn't exist in .")
def showPreferenceDialog(self, event):
- dlg = PreferenceDialog(self)
- dlg.ShowModal()
+ with PreferenceDialog(self) as dlg:
+ dlg.ShowModal()
@staticmethod
def goWiki(event):
diff --git a/gui/patternEditor.py b/gui/patternEditor.py
index 670971f8e..e534b6429 100644
--- a/gui/patternEditor.py
+++ b/gui/patternEditor.py
@@ -278,9 +278,6 @@ class DmgPatternEditorDlg(wx.Dialog):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
- self.closeWindow()
+ self.Close()
return
event.Skip()
-
- def closeWindow(self):
- self.Destroy()
diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py
index e4cb1c84a..6368cd0a4 100644
--- a/gui/preferenceDialog.py
+++ b/gui/preferenceDialog.py
@@ -74,7 +74,6 @@ class PreferenceDialog(wx.Dialog):
self.Layout()
- self.Bind(wx.EVT_CLOSE, self.OnClose)
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
self.btnOK.Bind(wx.EVT_BUTTON, self.OnBtnOK)
@@ -88,8 +87,3 @@ class PreferenceDialog(wx.Dialog):
self.Close()
return
event.Skip()
-
- def OnClose(self, event):
- if self.IsModal():
- self.EndModal(wx.ID_OK)
- self.Destroy()
diff --git a/gui/setEditor.py b/gui/setEditor.py
index 9557c65b8..7866465d5 100644
--- a/gui/setEditor.py
+++ b/gui/setEditor.py
@@ -175,7 +175,6 @@ class ImplantSetEditorDlg(wx.Dialog):
self.Export.Bind(wx.EVT_BUTTON, self.exportPatterns)
self.CenterOnParent()
- self.ShowModal()
def entityChanged(self, event):
if not self.entityEditor.checkEntitiesExist():
@@ -186,13 +185,10 @@ class ImplantSetEditorDlg(wx.Dialog):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
- self.closeWindow()
+ self.Close()
return
event.Skip()
- def closeWindow(self):
- self.Destroy()
-
def __del__(self):
pass
diff --git a/gui/ssoLogin.py b/gui/ssoLogin.py
index d11d84a53..5f71ba337 100644
--- a/gui/ssoLogin.py
+++ b/gui/ssoLogin.py
@@ -5,6 +5,7 @@ import gui.globalEvents as GE
class SsoLogin(wx.Dialog):
+
def __init__(self):
mainFrame = gui.mainFrame.MainFrame.getInstance()
diff --git a/gui/targetProfileEditor.py b/gui/targetProfileEditor.py
index ce02d4ae3..a72d21098 100644
--- a/gui/targetProfileEditor.py
+++ b/gui/targetProfileEditor.py
@@ -112,6 +112,7 @@ class TargetProfileEntityEditor(EntityEditor):
class TargetProfileEditorDlg(wx.Dialog):
+
DAMAGE_TYPES = OrderedDict([
("em", "EM resistance"),
("thermal", "Thermal resistance"),
@@ -243,7 +244,6 @@ class TargetProfileEditorDlg(wx.Dialog):
self.CenterOnParent()
self.Bind(wx.EVT_CHOICE, self.patternChanged)
- self.Bind(wx.EVT_CLOSE, self.onClose)
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
self.inputTimer = wx.Timer(self)
@@ -251,8 +251,6 @@ class TargetProfileEditorDlg(wx.Dialog):
self.patternChanged()
- self.ShowModal()
-
def OnFieldChanged(self, event=None):
if event is not None:
event.Skip()
@@ -366,18 +364,10 @@ class TargetProfileEditorDlg(wx.Dialog):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
- self.closeWindow()
+ self.Close()
return
event.Skip()
- def onClose(self, event):
- self.processChanges()
- event.Skip()
-
- def closeWindow(self):
- self.processChanges()
- self.Destroy()
-
def processChanges(self):
changedFitIDs = Fit.getInstance().processTargetProfileChange()
if changedFitIDs:
diff --git a/gui/updateDialog.py b/gui/updateDialog.py
index c596d553e..eb89eac71 100644
--- a/gui/updateDialog.py
+++ b/gui/updateDialog.py
@@ -46,6 +46,7 @@ hr {{ border: #000 1px solid; }}
class UpdateDialog(wx.Dialog):
+
def __init__(self, parent, release, version):
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title="pyfa Update Available", pos=wx.DefaultPosition,
size=wx.Size(550, 450), style=wx.DEFAULT_DIALOG_STYLE)
diff --git a/gui/utils/anim.py b/gui/utils/anim.py
index 0f3333dc1..8ada5491f 100644
--- a/gui/utils/anim.py
+++ b/gui/utils/anim.py
@@ -89,6 +89,7 @@ class LoadAnimation(wx.Window):
class WaitDialog(wx.Dialog):
+
def __init__(self, parent, title="Processing"):
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=title, size=(300, 30),
style=wx.NO_BORDER)
diff --git a/service/esi.py b/service/esi.py
index 301af7d53..4251c89ce 100644
--- a/service/esi.py
+++ b/service/esi.py
@@ -103,13 +103,12 @@ class Esi(EsiAccess):
def login(self):
# always start the local server if user is using client details. Otherwise, start only if they choose to do so.
if self.settings.get('ssoMode') == EsiSsoMode.CUSTOM or self.settings.get('loginMode') == EsiLoginMethod.SERVER:
- dlg = gui.ssoLogin.SsoLoginServer(6461 if self.settings.get('ssoMode') == EsiSsoMode.CUSTOM else 0)
- dlg.ShowModal()
+ with gui.ssoLogin.SsoLoginServer(6461 if self.settings.get('ssoMode') == EsiSsoMode.CUSTOM else 0) as dlg:
+ dlg.ShowModal()
else:
- dlg = gui.ssoLogin.SsoLogin()
-
- if dlg.ShowModal() == wx.ID_OK:
- self.handleLogin({'SSOInfo': [dlg.ssoInfoCtrl.Value.strip()]})
+ with gui.ssoLogin.SsoLogin() as dlg:
+ if dlg.ShowModal() == wx.ID_OK:
+ self.handleLogin({'SSOInfo': [dlg.ssoInfoCtrl.Value.strip()]})
def stopServer(self):
pyfalog.debug("Stopping Server")