This commit is contained in:
jeffy-g
2017-04-03 02:00:10 +09:00
parent 4d8c3eadbc
commit 8fd424814a
2 changed files with 12 additions and 13 deletions

View File

@@ -880,8 +880,9 @@ class MainFrame(wx.Frame, IPortUser):
def onPortProcessStart(self):
# flag for progress dialog.
self.__progress_flag = True
# 2017/03/29 NOTE: implementation like interface
def onPortProcessing(self, action, data=None):
# 2017/03/29 NOTE: implementation like interface
wx.CallAfter(
self._onPortProcessing, action, data
)
@@ -909,8 +910,8 @@ class MainFrame(wx.Frame, IPortUser):
dlg = wx.MessageDialog(self,
"The following error was generated\n\n%s\n\nBe aware that already processed fits were not saved" % data,
_message, wx.OK | wx.ICON_ERROR)
# if dlg.ShowModal() == wx.ID_OK:
# return
# if dlg.ShowModal() == wx.ID_OK:
# return
dlg.ShowModal()
return

View File

@@ -145,13 +145,13 @@ class IPortUser:
__metaclass__ = ABCMeta
ID_PULSE = 1
ID_PULSE = 1
# Pulse the progress bar
ID_UPDATE = ID_PULSE << 1
# Replace message with data: update messate
ID_DONE = ID_PULSE << 2
ID_DONE = ID_PULSE << 2
# open fits: import process done
ID_ERROR = ID_PULSE << 3
ID_ERROR = ID_PULSE << 3
# display error: raise some error
PROCESS_IMPORT = ID_PULSE << 4
@@ -236,7 +236,7 @@ class Port(object):
msg = "Processing file:\n%s" % path
pyfalog.debug(msg)
PortProcessing.notify(iportuser, IPortUser.PROCESS_IMPORT | IPortUser.ID_UPDATE, msg)
#wx.CallAfter(callback, 1, msg)
# wx.CallAfter(callback, 1, msg)
file_ = open(path, "r")
srcString = file_.read()
@@ -327,7 +327,6 @@ class Port(object):
return True, fit_list
@staticmethod
def importFitFromBuffer(bufferStr, activeFit=None):
sFit = svcFit.getInstance()
@@ -471,10 +470,10 @@ class Port(object):
@staticmethod
def importCrest(str_):
sMkt = Market.getInstance()
sMkt = Market.getInstance()
fitobj = Fit()
refobj = json.loads(str_)
items = refobj['items']
items = refobj['items']
fitobj.name = refobj['name']
# 2017/03/29: read description
# "<" and ">" is replace to "&lt;", "&gt;" by EVE client
@@ -989,7 +988,7 @@ class Port(object):
description = ""
elif len(description):
# convert <br> to "\n" and remove html tags.
description = sequential_rep(description, r"<(br|BR)>", "\n",r"<[^<>]+>", "")
description = sequential_rep(description, r"<(br|BR)>", "\n", r"<[^<>]+>", "")
# description = re.sub(r"<(br|BR)>", "\n", description)
# description = re.sub(r"<[^<>]+>", "", description)
fitobj.notes = description
@@ -1275,7 +1274,7 @@ class Port(object):
hardware.setAttribute("type", name)
fitting.appendChild(hardware)
except Exception as e:
# print("Failed on fitID: %d" % fit.ID)
# print("Failed on fitID: %d" % fit.ID)
pyfalog.error("Failed on fitID: %d, message: %s" % e.message)
continue
finally:
@@ -1365,4 +1364,3 @@ class PortProcessing(object):
def notify(iportuser, flag, data):
if not iportuser.onPortProcessing(flag, data):
raise UserCancelException