so many pep8 fixes
(cherry picked from commit bee125d)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2016 Ryan Holmes
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,19 +15,19 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import logging
|
||||
import wx
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
|
||||
from service.implantSet import ImplantSets
|
||||
from gui.builtinViews.implantEditor import BaseImplantEditorView
|
||||
from gui.utils.clipboard import toClipboard, fromClipboard
|
||||
from service.implantSet import ImportError
|
||||
import logging
|
||||
from gui.builtinViews.entityEditor import EntityEditor, BaseValidator
|
||||
from service.implantSet import ImplantSets
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ImplantTextValidor(BaseValidator):
|
||||
def __init__(self):
|
||||
BaseValidator.__init__(self)
|
||||
@@ -47,7 +47,7 @@ class ImplantTextValidor(BaseValidator):
|
||||
raise ValueError("Imlplant Set name already in use, please choose another.")
|
||||
|
||||
return True
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
wx.MessageBox(u"{}".format(e), "Error")
|
||||
textCtrl.SetFocus()
|
||||
return False
|
||||
@@ -92,27 +92,27 @@ class ImplantSetEditor(BaseImplantEditorView):
|
||||
|
||||
def getImplantsFromContext(self):
|
||||
sIS = ImplantSets.getInstance()
|
||||
set = self.Parent.entityEditor.getActiveEntity()
|
||||
if set:
|
||||
return sIS.getImplants(set.ID)
|
||||
set_ = self.Parent.entityEditor.getActiveEntity()
|
||||
if set_:
|
||||
return sIS.getImplants(set_.ID)
|
||||
return []
|
||||
|
||||
def addImplantToContext(self, item):
|
||||
sIS = ImplantSets.getInstance()
|
||||
set = self.Parent.entityEditor.getActiveEntity()
|
||||
set_ = self.Parent.entityEditor.getActiveEntity()
|
||||
|
||||
sIS.addImplant(set.ID, item.ID)
|
||||
sIS.addImplant(set_.ID, item.ID)
|
||||
|
||||
def removeImplantFromContext(self, implant):
|
||||
sIS = ImplantSets.getInstance()
|
||||
set = self.Parent.entityEditor.getActiveEntity()
|
||||
set_ = self.Parent.entityEditor.getActiveEntity()
|
||||
|
||||
sIS.removeImplant(set_.ID, implant)
|
||||
|
||||
sIS.removeImplant(set.ID, implant)
|
||||
|
||||
class ImplantSetEditorDlg(wx.Dialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Dialog.__init__(self, parent, id = wx.ID_ANY, title = u"Implant Set Editor", size = wx.Size(640, 600))
|
||||
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Implant Set Editor", size=wx.Size(640, 600))
|
||||
|
||||
self.block = False
|
||||
self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
|
||||
@@ -138,8 +138,8 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
footerSizer.Add(self.stNotice, 1, wx.BOTTOM | wx.TOP | wx.LEFT, 5)
|
||||
|
||||
if "wxGTK" in wx.PlatformInfo:
|
||||
self.closeBtn = wx.Button( self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
mainSizer.Add( self.closeBtn, 0, wx.ALL|wx.ALIGN_RIGHT, 5 )
|
||||
self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0)
|
||||
mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5)
|
||||
self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent)
|
||||
|
||||
importExport = (("Import", wx.ART_FILE_OPEN, "from"),
|
||||
@@ -149,13 +149,13 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
|
||||
btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)
|
||||
|
||||
btn.SetMinSize( btn.GetSize() )
|
||||
btn.SetMaxSize( btn.GetSize() )
|
||||
btn.SetMinSize(btn.GetSize())
|
||||
btn.SetMaxSize(btn.GetSize())
|
||||
|
||||
btn.Layout()
|
||||
setattr(self, name, btn)
|
||||
btn.Enable(True)
|
||||
btn.SetToolTipString("%s implant sets %s clipboard" % (name, direction) )
|
||||
btn.SetToolTipString("%s implant sets %s clipboard" % (name, direction))
|
||||
footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT)
|
||||
|
||||
mainSizer.Add(footerSizer, 0, wx.ALL | wx.EXPAND, 5)
|
||||
@@ -183,7 +183,7 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
def closeEvent(self, event):
|
||||
self.Destroy()
|
||||
|
||||
def __del__( self ):
|
||||
def __del__(self):
|
||||
pass
|
||||
|
||||
def importPatterns(self, event):
|
||||
@@ -196,9 +196,9 @@ class ImplantSetEditorDlg(wx.Dialog):
|
||||
sIS.importSets(text)
|
||||
self.stNotice.SetLabel("Patterns successfully imported from clipboard")
|
||||
self.showInput(False)
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
self.stNotice.SetLabel(str(e))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logging.exception("Unhandled Exception")
|
||||
self.stNotice.SetLabel("Could not import from clipboard: unknown errors")
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user