Commit Graph

162 Commits

Author SHA1 Message Date
Lucio Andrés Illanes Albornoz
703aa2c388 MiRCART.py:MiRCARTPalette, MiRCARTFrame.panelPalette: replaced w/ toolbar items.
MiRCART.py:MiRCARTFrame.toolBar*: added.
MiRCART.py:MiRCARTFrame.onToolColour{Bg,Fg}(): hand off to onPaletteEvent().
MiRCART.py:MiRCARTFrame.__init__(): create & initialise toolbar.
2018-01-05 20:45:21 +01:00
Lucio Andrés Illanes Albornoz
55381cf57b MiRCART.py:MiRCARTFrame.__init__(): update File menu titles to "Export to Pasteb&in..." and "Export as PN&G...". 2018-01-05 18:28:19 +01:00
Lucio Andrés Illanes Albornoz
28ae8f04f8 MiRCART.py:MiRCARTCanvas.{parentFrame,__init__()}: added for MiRCARTFrame.onCanvasUpdate().
MiRCART.py:MiRCARTCanvas._processMapPatches(): call parentFrame.onCanvasUpdate() given updates.
MiRCART.py:MiRCARTCanvas.{re,un}do(): call parentFrame.onCanvasUpdate() given {re,un}do.
MiRCART.py:MiRCARTFrame.onCanvasUpdate(): {dis,en}able menuEdit{Re,Un}do on updates.
2018-01-05 18:21:38 +01:00
Lucio Andrés Illanes Albornoz
813d49a3f2 MiRCART.py:MiRCARTFrame.__init__(): disable (grey out) menuEdit{Redo,Undo} initially. 2018-01-05 18:12:02 +01:00
Lucio Andrés Illanes Albornoz
c7fbe5b20c MiRCART.py:MiRCARTFrame.__init__(): change default appSize to (800, 600). 2018-01-05 18:09:25 +01:00
Lucio Andrés Illanes Albornoz
8215229f84 MiRCART.py:MiRCARTFrame: complete GUI skeleton. 2018-01-05 18:08:10 +01:00
Lucio Andrés Illanes Albornoz
133c4dc240 MiRCART.py:MiRCARTCanvas.patchesUndoLevel: added to track {un,re}do queue movement in both directions.
MiRCART.py:MiRCARTCanvas._processMapPatches(): remove {un,re}do queue items 0..patchesUndoLevel when updating queue.
MiRCART.py:MiRCARTCanvas._processMapPatches(): prepend to queue instead of appending.
MiRCART.py:MiRCARTCanvas._processMapPatches(): insert {un,re}do queue items as single (list) item each.
MiRCART.py:MiRCARTCanvas.redo(): decrement patchesUndoLevel & apply redo patch, if patchesUndoLevel > 0.
MiRCART.py:MiRCARTCanvas.undo(): apply undo patch & increment patchesUndoLevel, if patchesUndo[patchesUndoLevel] != None.
MiRCART.py:MiRCARTFrame.{menuFileRedo,onFileRedo(),__init__()}: adds `&Redo' File menu item w/ wx.ID_REDO.
MiRCART.py:MiRCARTFrame.{accelRedoId,onAccelRedo(),__init__()}: binds ^Y accelerator to MiRCARTCanvas.redo().
MiRCART.py: update title.
2018-01-05 17:21:14 +01:00
Lucio Andrés Illanes Albornoz
bcf52d8dc5 IrcMiRCARTBot.py, README.md:IrcMiRCARTBot.py: update title. 2018-01-05 17:05:58 +01:00
Lucio Andrés Illanes Albornoz
31d644515a README.md:MiRCART.py: add prerequisites for Windows & title. 2018-01-05 17:04:35 +01:00
Lucio Andrés Illanes Albornoz
ba99dc1280 MiRC2png.py:MiRC2png._syncColourSpecState(): handle empty mIRC colour control code sequences. 2018-01-05 16:48:50 +01:00
Lucio Andrés Illanes Albornoz
496e4c7a4b MiRCART.py:MiRCARTToolRect.__processMapPatches(): always obtain cell state from canvasMap.
MiRCART.py:MiRCARTToolRect._draw(): always paint w/ background colour given isRightDown.
2018-01-05 03:27:57 +01:00
Lucio Andrés Illanes Albornoz
8b6d7ab445 MiRCART.py:MiRCARTFrame.accel{UndoId,Table}: added.
MiRCART.py:MiRCARTFrame.onAccelUndo(): call self.panelCanvas.undo().
MiRCART.py:MiRCARTFrame.__init__(): create self.menuFileUndo w/ wx.ID_UNDO.
MiRCART.py:MiRCARTFrame.__init__(): bind ^Z accelerator to self.onAccelUndo().
2018-01-05 01:59:04 +01:00
Lucio Andrés Illanes Albornoz
423f923b4e MiRCART.py:MiRCARTCanvas._processMapPatches(): don't process patches that don't introduce changes..
MiRCART.py:MiRCARTCanvas._processMapPatches(): append redo and undo patches to self.patchesUndo.
MiRCART.py:MiRCARTCanvas.undo(): initial implementation.
MiRCART.py:MiRCARTFrame.{menuFileUndo,onFileUndo,__init__}(): add GUI for MiRCARTCanvas.undo().
2018-01-05 01:34:57 +01:00
Lucio Andrés Illanes Albornoz
7a891d9863 MiRCART.py:MiRCARTToolRect.onMouse{Down,Motion}(): remove debugging print()s. 2018-01-05 00:57:22 +01:00
Lucio Andrés Illanes Albornoz
68ba42f244 MiRC2png.py: fix mIRC colour control code sequence counting & rendering logic. 2018-01-05 00:52:02 +01:00
Lucio Andrés Illanes Albornoz
e0300331fd MiRC2png.py:MiRC2png._parseAs{Char,ColourSpec}(): fix indentation. 2018-01-04 23:45:30 +01:00
Lucio Andrés Illanes Albornoz
325a454db7 MiRCART.py:MiRCARTCanvas._eventPointToMap[XY](): added for _onMouseEvent().
MiRCART.py:MiRCARTCanvas._onMouseEvent(): split into _processMapPatches() and _drawPatch().
MiRCART.py:MiRCARTCanvas.getCell{Height,Width}(): added for _drawPatch() and _eventPointToMap[XY]().
MiRCART.py:MiRCARTCanvas.onPaletteEvent(): only set self.mirc[FB]g.
MiRCART.py:MiRCARTCanvas.__init__(): cache canvas window size.
MiRCART.py:MiRCARTCanvas.__init__(): initialise & append canvasTools.
MiRCART.py:MiRCARTCanvas.__init__(): pre-create 16 mIRC colour brushes & pens.
MiRCART.py:MiRCARTCanvas.__init__(): initialise temporary & {un,re}do patches.
MiRCART.py:MiRCARTTool: added abstract base class for all canvas tools.
MiRCART.py:MiRCARTToolRect: initial implementation w/ cursor, limited to 1x1 rectangles.
MiRCART.py:MiRCARTFrame.__init__(): initialise MiRCARTCanvas() w/ canvasTools=[MiRCARTToolRect].
2018-01-04 23:36:37 +01:00
Lucio Andrés Illanes Albornoz
91e33f8a4a MiRCART.py:MiRCARTCanvas.canvasBitmap: added to optimise onPaint().
MiRCART.py:MiRCARTCanvas._onMouseEvent(): additionally draw to canvasBitmap via temporary wx.MemoryDC().
MiRCART.py:MiRCARTCanvas.onPaint(): reimplement using (double-buffered) wx.BufferedPaintDC() from canvasBitmap.
MiRCART.py:MiRCARTCanvas.__init__(): initialise canvasBitmap from canvas window size.
2018-01-04 20:22:15 +01:00
Lucio Andrés Illanes Albornoz
dcb4ca83bb MiRCART.py:MiRCARTCanvas.{onCharHook,__init__}(): removes wx.EVT_CHAR_HOOK event handler. 2018-01-04 20:14:38 +01:00
Lucio Andrés Illanes Albornoz
42e18ec252 MiRCART.py:MiRCARTCanvas.{_onMouseEvent,onPaint,__init__}(): switch addressing mode of self.canvasMap to [Y][X].
MiRCART.py:MiRCARTCanvas.get{Height,Map,Width}(): added for MiRCARTFrame.onFileSaveAs().
MiRCART.py:MiRCARTFrame.onFileSaveAs(): initial implementation.
2018-01-04 18:11:57 +01:00
Lucio Andrés Illanes Albornoz
427290e783 MiRCART.py:mircColours, MiRCARTCanvas.{onPaint,__init__}(): moved from MiRCARTCanvas.mircColours.
MiRCART.py:MiRCARTCanvas.get{Background,Foreground}Colour: added for MiRCARTFrame._updateStatusBar().
MiRCART.py:MiRCARTCanvas.onCharHook(): merged into MiRCARTCanvas.onPaletteEvent().
MiRCART.py:MiRCARTCanvas.onPaletteEvent(): set self.{mirc,brush,pen}{Fg,Bg} from colour choice event.
MiRCART.py:MiRCARTPalette: implements 16 colour palette panels GUI.
MiRCART.py:MiRCARTFrame._updateStatusBar(): show canvas {fore,back}ground colours in status bar.
MiRCART.py:MiRCARTFrame.onPaletteEvent(): hand off to MiRCARTCanvas.onPaletteEvent() and call _updateStatusBar().
MiRCART.py:MiRCARTFrame.__init__(): fix `&File' menu item order.
MiRCART.py:MiRCARTFrame.__init__(): create & update status bar.
2018-01-04 17:26:12 +01:00
Lucio Andrés Illanes Albornoz
1a2dd5f692 MiRC2png.py: renamed from MiRCART.py.
{IrcClient,IrcMiRCARTBot,MiRC2png}.py: update Vim modeline w/ `sw=4 ts=4'.
{IrcMiRCARTBot,MiRC2png}.py: update header legend.
IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): lower rate limit to (once per) 30 seconds.
IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): eliminate useless instance variable.
IrcMiRCARTBot.py:IrcMiRCARTBot._urlretrieveReportHook(): compare against correct limit of 1 MB (2**20.)
MiRCART.py: initial commit.
README.md: updated.
2018-01-04 16:24:06 +01:00
Lucio Andrés Illanes Albornoz
49705ad4bc IrcMiRCARTBot.py:IrcMiRCARTBot.{ContentTooLargeException,_urlretrieveReportHook()}: restrict ASCII downloads to 1 MB in size.
IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): pass (static) _urlretrieveReportHook() to urllib.request.urlretrieve().
IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): handle ContentTooLargeException, urllib.error.URLError, and ValueError exceptions.
IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): only reset clientLastMessage after successful completion.
2018-01-03 15:50:42 +01:00
Lucio Andrés Illanes Albornoz
b71ca6af89 IrcClient.py:IrcClient.{queue,unqueue}(): always CR NL-terminate messages & encode() before queuing. 2018-01-03 15:18:28 +01:00
Lucio Andrés Illanes Albornoz
9c34fe3220 IrcClient.py:IrcClient.unqueue(): handle timeout from timed select(). 2018-01-03 15:13:52 +01:00
Lucio Andrés Illanes Albornoz
97d8caaf1e IrcClient.py: add missing `# {{{'. 2018-01-03 15:12:28 +01:00
Lucio Andrés Illanes Albornoz
f2affda37e IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): catch urllib.error.HTTPError exception during download.
IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): fix typo.
2018-01-03 04:24:18 +01:00
Lucio Andrés Illanes Albornoz
95b706b4bd IrcMiRCARTBot.py:IrcMiRCARTBot._dispatchPrivmsg(): correctly instantiate MiRCART.MiRCART. 2018-01-03 04:19:13 +01:00
Lucio Andrés Illanes Albornoz
6fcf0e0a4f IrcClient.py:IrcClient.{queue,unqueue}(): split.
IrcMiRCARTBot.py:IrcMiRCARTBot._dispatch{001,Ping,Privmsg,Timer}(): replace readline() calls w/ queue() calls.
IrcMiRCARTBot.py:IrcMiRCARTBot.dispatch(): call unqueue() after processing timers and prior to calling readline().
2018-01-03 04:15:43 +01:00
Lucio Andrés Illanes Albornoz
523d91ff89 MiRCART.py:MiRCART._parseAsChar(): derive rectangle & line coordinates and outCur{X,Y} offset from outImgFontSize[{0,1}].
MiRCART.py:MiRCART.__init__(): initialise outImgFontSize and add underline area offset.
MiRCART.py:MiRCART.__init__(): derive outCurY offset from outImgFontSize[1].
2018-01-03 03:52:41 +01:00
Lucio Andrés Illanes Albornoz
e182f0ffa9 {IrcMiRCARTBot,MiRCART}.py: differentiate private class member functions. 2018-01-03 03:33:57 +01:00
Lucio Andrés Illanes Albornoz
9896108028 IrcMiRCARTBot.py:IrcMiRCARTBot: replace print() w/ _log() calls.
IrcMiRCARTBot.py:IrcMiRCARTBot._log(): log message w/ timestamp.
2018-01-03 03:28:05 +01:00
Lucio Andrés Illanes Albornoz
c32d749675 IrcClient.py: split from IrcMiRCARTBot.py.
IrcMiRCARTBot.py: renamed from pngbot.py, importing IrcClient.IrcClient.
MiRCART.py: renamed from mirc2png.py.
README.md: updated.
2018-01-03 02:33:12 +01:00
Lucio Andrés Illanes Albornoz
98eae4257c pngbot.py:IrcBot.clientNextTimeout: moved from IrcMiRCARTBot.
pngbot.py:IrcBot.connect(): close() & return False given timeout and True given success.
pngbot.py:IrcBot.readline(): honour clientNextTimeout and return "" given timer expiry.
pngbot.py:IrcBot.sendline(): ignore clientNextTimeout.
pngbot.py:IrcMiRCARTBot.connect(): honour & pass IrcBot.connect() return value.
pngbot.py:IrcMiRCARTBot.dispatch{Join,Kick,Timer}(): (re)set clientNextTimeout to time.time() + 15 seconds.
pngbot.py:IrcMiRCARTBot.dispatch(): dispatch expired timers prior to calling readline() & honour "" return value.
pngbot.py:main(): honour IrcMiRCARTBot.connect() return value & delay reconnection by 15 seconds.
2018-01-03 02:24:58 +01:00
Lucio Andrés Illanes Albornoz
3a207fc53c pngbot.py:IrcBot.connect(): set socket non-blocking, ignore BlockingIOError, and select() for writability & optionally specified timeout.
pngbot.py:IrcBot.readline(): replace settimeout()/socket.timeout-based logic w/ select() for readability & optionally specified timeout.
pngbot.py:IrcBot.sendline(): select() for writability & optionally specified timeout and send() full buffer until failure.
pngbot.py:IrcMiRCARTBot.dispatch(): dispatch expired timers prior to calling readline().
pngbot.py:main(): default (maximum) connect timeout to 15 seconds.
2018-01-03 01:43:41 +01:00
Lucio Andrés Illanes Albornoz
09a7995a50 mirc2png.py:MiRCART.parseAsChar(): implement ^V (reverse) by swapping {background,foreground} colours. 2018-01-03 01:25:46 +01:00
Lucio Andrés Illanes Albornoz
532806176c pngbot.py:IrcBot.readline(): correctly catch socket.timeout exception. 2018-01-03 00:57:55 +01:00
Lucio Andrés Illanes Albornoz
ebd2ce9393 pngbot.py:IrcMiRCARTBot.dispatch353(): skip empty nick specs. 2018-01-03 00:53:42 +01:00
Lucio Andrés Illanes Albornoz
a0db56a530 pngbot.py:IrcBot.readline(): add optional timeout parameter.
pngbot.py:IrcMiRCARTBot.clientChannelRejoin{,TimerNext}: added to support delayed rejoin-on-kick logic.
pngbot.py:IrcMiRCARTBot.dispatchJoin(): reset clientChannelRejoin{,TimerNext} on successful (re)join to clientChannel.
pngbot.py:IrcMiRCARTBot.dispatchKick(): set clientChannelRejoin{,TimerNext} on kick from clientChannel to time.time() + 15 (seconds.)
pngbot.py:IrcMiRCARTBot.dispatchTimer(): (re)join clientChannel and set clientChannelRejoin{,TimerNext} to time.time() + 15 (seconds.)
pngbot.py:IrcMiRCARTBot.dispatch(): call readline() w/ timeout delta given clientChannelRejoinTimerNext.
2018-01-03 00:49:02 +01:00
Lucio Andrés Illanes Albornoz
936bfb6c86 pngbot.py:IrcMiRCARTBot.dispatchKick(): rejoin channel on kick. 2018-01-03 00:13:02 +01:00
Lucio Andrés Illanes Albornoz
c6aa3f9ad9 pngbot.py:IrcBot.readline(): correctly parse messages w/o a prefix. 2018-01-03 00:05:46 +01:00
Lucio Andrés Illanes Albornoz
90d9d146f1 README.md: update usage information. 2018-01-02 23:45:01 +01:00
Lucio Andrés Illanes Albornoz
95c950d2ee pngbot.py:IrcMiRCARTBot.dispatch353(): fix indentation. 2018-01-02 23:39:38 +01:00
Lucio Andrés Illanes Albornoz
8f29ba4e16 pngbot.py:IrcMiRCARTBot.dispatch353(): correctly print channel name. 2018-01-02 23:38:32 +01:00
Lucio Andrés Illanes Albornoz
f4218e8ae1 pngbot.py:IrcMiRCARTBot.dispatch{001,353,MODE,None,PING,PRIVMSG}(): split from dispatch(). 2018-01-02 23:35:01 +01:00
Lucio Andrés Illanes Albornoz
28e5b9b958 pngbot.py:IrcMiRCARTBot.dispatch(): ignore `!pngbot' requests from unauthorised (non-opped) nicks.
pngbot.py:IrcMiRCARTBot.dispatch(): add status (stdout) messages.
pngbot.py:IrcMiRCARTBot.dispatch(): always use lower-case channel name in status (stdout) messages.
2018-01-02 23:23:30 +01:00
Lucio Andrés Illanes Albornoz
993e986ec0 pngbot.py:IrcMiRCARTBot.clientChannelOps: added to track nicks authorised to use `!pngbot'.
pngbot.py:IrcMiRCARTBot.dispatch(): sync clientChannelOps w/ 353 (RPL_NAMREPLY) and (channel) MODE messages.
2018-01-02 23:12:26 +01:00
Lucio Andrés Illanes Albornoz
75e8e5fdf0 pngbot.py:IrcMiRCARTBot.uploadToImgur(): split from dispatch().
pngbot.py:IrcMiRCARTBot.dispatch(): only os.remove() if target file exists.
2018-01-02 22:40:46 +01:00
Lucio Andrés Illanes Albornoz
4556f8b238 pngbot.py: set +x bit. 2018-01-02 22:25:00 +01:00
Lucio Andrés Illanes Albornoz
3b29343e15 mirc2png.py:MiRCART.__init__(): move defaults from main(). 2018-01-02 22:24:21 +01:00