From 8af07b61bae021eaddf935f747ef40abb36267b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Sun, 8 Sep 2019 20:05:34 +0200 Subject: [PATCH] libgui/GuiCanvasInterface.py: soft-fail importing ImgurApiKey. assets/text/TODO: updated. --- assets/text/TODO | 23 +++++++++++------------ libgui/GuiCanvasInterface.py | 12 +++++++++--- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/assets/text/TODO b/assets/text/TODO index f987ff2..f8b3668 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -1,15 +1,14 @@ -1) General {cleanup,refactor} -2) Implement ANSI CSI CU[BDPU] sequences & italic -3) Incremental auto{load,save} & {backup,restore} -4) Implement instrumentation & unit tests, document -5) Open and toggle a reference image in the background -6) Client-Server or Peer-to-Peer realtime collaboration -7) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.) -8) Hotkey & graphical interfaces to {composed,parametrised} tools -9) GUI: a) scrollbar b) {de,in}crease cell size c) revisit About dialogue d) Settings panel e) switch from wxPython to GTK -10) Layers, layout (e.g. for comics, zines, etc.) & asset management (e.g. kade, lion, etc.) & traits w/ {inserting,merging,linking} -11) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) -12) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools: +1) Implement ANSI CSI CU[BDPU] sequences & italic +2) Incremental auto{load,save} & {backup,restore} +3) Implement instrumentation & unit tests, document +4) Open and toggle a reference image in the background +5) Client-Server or Peer-to-Peer realtime collaboration +6) Arbitrary {format,palette}s ({4,8} bit ANSI/mIRC, etc.) +7) Hotkey & graphical interfaces to {composed,parametrised} tools +8) GUI: a) scrollbar b) {de,in}crease cell size c) revisit About dialogue d) Settings panel e) switch from wxPython to GTK +9) Layers, layout (e.g. for comics, zines, etc.) & asset management (e.g. kade, lion, etc.) & traits w/ {inserting,merging,linking} +10) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) +11) Composition and parametrisation of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools; unit tools: a) geometric primitives (arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star) b) regions (crop, duplicate, erase, fill, invert, measure, pick, rotate, scale, select, shift, slice, tile, translate) c) text (edit, Unicode sets) diff --git a/libgui/GuiCanvasInterface.py b/libgui/GuiCanvasInterface.py index 42a035d..a3ae26d 100644 --- a/libgui/GuiCanvasInterface.py +++ b/libgui/GuiCanvasInterface.py @@ -4,6 +4,12 @@ # Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz # +try: + from ImgurApiKey import ImgurApiKey + haveImgurApiKey = True +except ImportError: + haveImgurApiKey = False + try: import base64, json, requests, urllib.request haveUrllib = True @@ -21,7 +27,6 @@ from ToolText import ToolText from GuiCanvasColours import Colours from GuiCanvasInterfaceAbout import GuiCanvasInterfaceAbout from GuiFrame import NID_MENU_SEP, NID_TOOLBAR_HSEP -from ImgurApiKey import ImgurApiKey import io, os, sys, wx class GuiCanvasInterface(): @@ -359,7 +364,7 @@ class GuiCanvasInterface(): return True # }}} # {{{ canvasExportImgur(self, event) - @CommandDecorator("Export to Imgur...", "Export to I&mgur...", None, None, haveUrllib) + @CommandDecorator("Export to Imgur...", "Export to I&mgur...", None, None, haveImgurApiKey and haveUrllib) def canvasExportImgur(self, event): self.parentCanvas.SetCursor(wx.Cursor(wx.CURSOR_WAIT)) rc, status, result = self.parentCanvas.canvas.exportStore.exportBitmapToImgur(self.imgurApiKey, self.parentCanvas.backend.canvasBitmap, "", "", wx.BITMAP_TYPE_PNG) @@ -530,7 +535,8 @@ class GuiCanvasInterface(): # # __init__(self, parentCanvas, parentFrame): def __init__(self, parentCanvas, parentFrame): - self.canvasPathName, self.imgurApiKey, self.lastPanelState, self.parentCanvas, self.parentFrame = None, ImgurApiKey.imgurApiKey, {}, parentCanvas, parentFrame + self.canvasPathName, self.lastPanelState, self.parentCanvas, self.parentFrame = None, {}, parentCanvas, parentFrame + self.imgurApiKey = ImgurApiKey.imgurApiKey if haveImgurApiKey else None self._initColourBitmaps() # vim:expandtab foldmethod=marker sw=4 ts=4 tw=0