MiRCARTFrame.py:MiRCARTFrame.canvas{Export{AsPng,Imgur,Pastebin},New,Open,Save}(): add wx.CURSOR_WAIT guards.

This commit is contained in:
Lucio Andrés Illanes Albornoz 2018-01-07 23:55:26 +01:00
parent 39babc71a4
commit 6a4356568b

View File

@ -172,15 +172,19 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
return False return False
else: else:
outPathName = dialog.GetPath() outPathName = dialog.GetPath()
self.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
self.panelCanvas.canvasStore.exportBitmapToPngFile( \ self.panelCanvas.canvasStore.exportBitmapToPngFile( \
self.panelCanvas.canvasBitmap, outPathName, \ self.panelCanvas.canvasBitmap, outPathName, \
wx.BITMAP_TYPE_PNG) wx.BITMAP_TYPE_PNG)
self.SetCursor(wx.Cursor(wx.NullCursor))
return True return True
# }}} # }}}
# {{{ canvasExportImgur(self): XXX # {{{ canvasExportImgur(self): XXX
def canvasExportImgur(self): def canvasExportImgur(self):
self.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
imgurResult = self.panelCanvas.canvasStore.exportBitmapToImgur( \ imgurResult = self.panelCanvas.canvasStore.exportBitmapToImgur( \
"c9a6efb3d7932fd", self.panelCanvas.canvasBitmap, "", "", wx.BITMAP_TYPE_PNG) "c9a6efb3d7932fd", self.panelCanvas.canvasBitmap, "", "", wx.BITMAP_TYPE_PNG)
self.SetCursor(wx.Cursor(wx.NullCursor))
if imgurResult[0] == 200: if imgurResult[0] == 200:
if not wx.TheClipboard.IsOpened(): if not wx.TheClipboard.IsOpened():
wx.TheClipboard.Open() wx.TheClipboard.Open()
@ -194,11 +198,13 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
# }}} # }}}
# {{{ canvasExportPastebin(self): XXX # {{{ canvasExportPastebin(self): XXX
def canvasExportPastebin(self): def canvasExportPastebin(self):
self.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
pasteStatus, pasteResult = \ pasteStatus, pasteResult = \
self.panelCanvas.canvasStore.exportPastebin( \ self.panelCanvas.canvasStore.exportPastebin( \
"", \ "", \
self.panelCanvas.canvasMap, \ self.panelCanvas.canvasMap, \
self.panelCanvas.canvasSize) self.panelCanvas.canvasSize)
self.SetCursor(wx.Cursor(wx.NullCursor))
if pasteStatus: if pasteStatus:
if not wx.TheClipboard.IsOpened(): if not wx.TheClipboard.IsOpened():
wx.TheClipboard.Open() wx.TheClipboard.Open()
@ -220,10 +226,12 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
pass pass
elif saveChanges == wx.ID_YES: elif saveChanges == wx.ID_YES:
self.canvasSave() self.canvasSave()
self.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
if newCanvasSize == None: if newCanvasSize == None:
newCanvasSize = (100, 30) newCanvasSize = (100, 30)
self.panelCanvas.canvasStore.importNew(newCanvasSize) self.panelCanvas.canvasStore.importNew(newCanvasSize)
self.canvasPathName = None self.canvasPathName = None
self.SetCursor(wx.Cursor(wx.NullCursor))
self._updateStatusBar(); self.onCanvasUpdate(); self._updateStatusBar(); self.onCanvasUpdate();
# }}} # }}}
# {{{ canvasOpen(self): XXX # {{{ canvasOpen(self): XXX
@ -242,8 +250,10 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
return False return False
else: else:
self.canvasPathName = dialog.GetPath() self.canvasPathName = dialog.GetPath()
self.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
self.panelCanvas.canvasStore.importTextFile(self.canvasPathName) self.panelCanvas.canvasStore.importTextFile(self.canvasPathName)
self.panelCanvas.canvasStore.importIntoPanel() self.panelCanvas.canvasStore.importIntoPanel()
self.SetCursor(wx.Cursor(wx.NullCursor))
self._updateStatusBar(); self.onCanvasUpdate(); self._updateStatusBar(); self.onCanvasUpdate();
return True return True
# }}} # }}}
@ -254,9 +264,11 @@ class MiRCARTFrame(MiRCARTGeneralFrame):
return return
try: try:
with open(self.canvasPathName, "w") as outFile: with open(self.canvasPathName, "w") as outFile:
self.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
self.panelCanvas.canvasStore.exportTextFile( \ self.panelCanvas.canvasStore.exportTextFile( \
self.panelCanvas.canvasMap, \ self.panelCanvas.canvasMap, \
self.panelCanvas.canvasSize, outFile) self.panelCanvas.canvasSize, outFile)
self.SetCursor(wx.Cursor(wx.NullCursor))
return True return True
except IOError as error: except IOError as error:
return False return False