From 84d20a43986154cb86d8a3607a4b2b5d8c58df02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Tue, 24 Sep 2019 16:46:02 +0200 Subject: [PATCH] Adds GitHub & (hotkey) help dialogue menu items. assets/text/hotkeys.txt: updated. assets/text/TODO: updated. libtools/ToolText.py: minor cleanup. --- assets/text/TODO | 11 ++++---- assets/text/hotkeys.txt | 47 ++++++++++++++++++++----------- libroar/RoarCanvasCommandsHelp.py | 20 +++++++++++-- libroar/RoarWindowMelp.py | 33 ++++++++++++++++++++++ libtools/ToolText.py | 2 +- 5 files changed, 87 insertions(+), 26 deletions(-) create mode 100644 libroar/RoarWindowMelp.py diff --git a/assets/text/TODO b/assets/text/TODO index ebf0f0a..43e04cc 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -12,17 +12,16 @@ 12) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) 13) GUI TODO list: a) switch to Gtk - b) replace logo w/ canvas panel in About dialogue + b) replace logo w/ canvas panel in About dialogue, revisit melp? dialogue c) Settings/Settings window (e.g. autosave, hide cursor on leaving window, ...) d) replace resize buttons w/ {-,edit box,+} buttons & lock button re: ratio (ty lol3) Release roadmap: 1) {copy,cut,delete,insert from,paste}, edit asset in new canvas, import from {canvas,object} 2) BUG: a) apply tool b) move cursor c) undo d) cursor artifacts -3) add hotkeys.txt mIRC art canvas to help menu -4) operators: crop, scale, shift, slice -5) auto{load,save} & {backup,restore} -6) tools: unicode block elements -7) floating/dockable toolbar +3) operators: crop, scale, shift, slice +4) auto{load,save} & {backup,restore} +5) tools: unicode block elements +6) floating/dockable toolbar vim:ff=dos tw=0 diff --git a/assets/text/hotkeys.txt b/assets/text/hotkeys.txt index f825282..9843e47 100644 --- a/assets/text/hotkeys.txt +++ b/assets/text/hotkeys.txt @@ -1,16 +1,31 @@ - 0-9, 0-5, 6 Set foreground colour to #0-9, #10-15, transparent colour, resp. - 0-9, 0-5, 6 Set background colour to #0-9, #10-15, transparent colour, resp. - C, U, E, F, L, P, R, E, T Switch to circle, cursor, erase, fill, line, pick colour, rectangle, object, text tool - I Flip colours - N New canvas - O Open mIRC art file - S Save canvas as mIRC art file - X Exit - Y, Z Redo, undo, resp. - Break into Python debugger -(Canvas) , , , Move canvas cursor -(Canvas) , Apply current tool with foreground colour or initiate tool action (line and object tool) -(Canvas) Apply current tool with background colour -(Erase tool) Erase background colour with foreground colour -(Fill tool) , Fill entire region ignoring character cells -(Object tool) Move selection instead of cloning +Global hotkeys: + -/+ Decrease/increase brush size height and width + -/+ Decrease/increase canvas size height and width + 0-9 Set foreground colour to #0-9 + 0-5, 6 Set foreground colour to #10-15 or transparent colour, resp. + 0-9 Set background colour to #0-9 + 0-5, 6 Set background colour to #10-15 or transparent colour, resp. + C, U, E, F, L, P, R, E, T Switch to circle, cursor, erase, fill, line, pick colour, rectangle, object, text tool + I Flip colours + N New canvas + O Open mIRC art file + S Save canvas as mIRC art file + X Exit + Y, Z Redo, undo last action + Break into Python debugger + +Canvas hotkeys: +, , , Move canvas cursor +/ Apply current tool with foreground colour (with exceptions) + Apply current tool with background colour (with exceptions) + +Tool-specific hotkeys: +(Erase) Erase background colour with foreground colour +(Fill) // Fill entire region with foreground/background colour ignoring character cells +(Line, object) / Initiate line drawing/selection +(Object) Move selection instead of cloning +(Pick colour) / Pick current cell's foreground colour +(Pick colour) Pick current cell's background colour +(Text) Erase last cell and move backwards w/ wraparound +(Text) V Paste text from clipboard +(Text) Move to leftmost cell on next row w/ wraparound \ No newline at end of file diff --git a/libroar/RoarCanvasCommandsHelp.py b/libroar/RoarCanvasCommandsHelp.py index ff80f11..6c880df 100644 --- a/libroar/RoarCanvasCommandsHelp.py +++ b/libroar/RoarCanvasCommandsHelp.py @@ -4,18 +4,32 @@ # Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz # -from GuiFrame import GuiCommandDecorator +from GuiFrame import GuiCommandDecorator, NID_MENU_SEP from RoarWindowAbout import RoarWindowAbout +from RoarWindowMelp import RoarWindowMelp +import webbrowser class RoarCanvasCommandsHelp(): - @GuiCommandDecorator("About", "&About", None, None, True) + @GuiCommandDecorator("About roar", "&About roar", None, None, True) def canvasAbout(self, event): RoarWindowAbout(self.parentFrame) + @GuiCommandDecorator("View melp?", "View &melp?", None, None, True) + def canvasMelp(self, event): + RoarWindowMelp(self.parentFrame) + + @GuiCommandDecorator("Open &issue on GitHub", "Open &issue on GitHub", None, None, True) + def canvasNewIssueGitHub(self, event): + webbrowser.open("https://github.com/lalbornoz/roar/issues/new") + + @GuiCommandDecorator("Visit GitHub website", "Visit &GitHub website", None, None, True) + def canvasVisitGitHub(self, event): + webbrowser.open("https://www.github.com/lalbornoz/roar") + # # __init__(self) def __init__(self): self.accels = () - self.menus, self.toolBars = (("&Help", self.canvasAbout,),), () + self.menus, self.toolBars = (("&Help", self.canvasMelp, NID_MENU_SEP, self.canvasNewIssueGitHub, self.canvasVisitGitHub, NID_MENU_SEP, self.canvasAbout,),), () # vim:expandtab foldmethod=marker sw=4 ts=4 tw=0 diff --git a/libroar/RoarWindowMelp.py b/libroar/RoarWindowMelp.py new file mode 100644 index 0000000..a062883 --- /dev/null +++ b/libroar/RoarWindowMelp.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# +# RoarWindowMelp.py +# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz +# + +import os, wx + +class RoarWindowMelp(wx.Dialog): + def onButtonRoar(self, event): + self.Destroy() + + # + # __init__(self, parent, minSize=(320, 300), title="melp?") + def __init__(self, parent, minSize=(320, 300), title="melp?"): + super().__init__(parent, size=minSize, title=title) + self.panel, self.sizer = wx.Panel(self), wx.BoxSizer(wx.VERTICAL) + + with open(os.path.join("assets", "text", "hotkeys.txt"), "r") as fileObject: + helpLabel = "".join(fileObject.readlines()) + self.title = wx.StaticText(self.panel, label=helpLabel, style=wx.ALIGN_LEFT) + self.title.SetFont(wx.Font(8, wx.MODERN, wx.NORMAL, wx.NORMAL, underline=False)) + self.buttonRoar = wx.Button(self.panel, label="explodes.") + self.buttonRoar.Bind(wx.EVT_BUTTON, self.onButtonRoar) + self.sizer.AddMany(((self.title, 1, wx.ALL | wx.CENTER | wx.EXPAND, 4), (self.buttonRoar, 0, wx.ALL | wx.CENTER, 4),)) + self.panel.SetSizerAndFit(self.sizer) + newSize = self.sizer.ComputeFittingWindowSize(self) + self.SetSize((newSize[0] + 64, newSize[1],)); self.Center(); + self.SetTitle(title) + + self.ShowModal() + +# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 diff --git a/libtools/ToolText.py b/libtools/ToolText.py index 7abd3ab..3ddfd51 100644 --- a/libtools/ToolText.py +++ b/libtools/ToolText.py @@ -5,7 +5,7 @@ # from Tool import Tool -import re, string, time, wx +import re, string, wx class ToolText(Tool): name = "Text"