Spit and polish

This commit is contained in:
Noah 2023-01-22 12:02:21 -08:00
parent a50b22aa90
commit 0db9dd0c1b
8 changed files with 645 additions and 3 deletions

8
FyneApp.toml Normal file
View File

@ -0,0 +1,8 @@
Website = "https://www.kirsle.net/errorgen"
[Details]
Icon = "icons/radiation.png"
Name = "ErrorGen"
ID = "net.kirsle.ErrorGen"
Version = "2.0.0"
Build = 17

View File

@ -54,4 +54,30 @@ run:
# `make clean` to cleanup the repo. # `make clean` to cleanup the repo.
.PHONY: clean .PHONY: clean
clean: clean:
rm errorgen rm -rf errorgen fyne-cross
# `make release` uses fyne-cross to produce builds for Linux and Windows.
.PHONY: release
release: clean
fyne-cross windows -arch=*
fyne-cross linux -arch=*
# `make release-sudo` uses sudo commands for release in case of permission errors.
.PHONY: release-sudo
release-sudo: clean
sudo $(shell which fyne-cross) windows -arch=\*
sudo $(shell which fyne-cross) linux -arch=\*
sudo chown -R $(shell whoami) fyne-cross
# `make package` creates nice ZIP files for release after `make release`
.PHONY: package
package:
cp -r README.md README.html *.png icons fyne-cross/bin/windows-386/
cp -r README.md README.html *.png icons fyne-cross/bin/windows-amd64/
cp -r README.md README.html *.png icons fyne-cross/bin/linux-386/
cp -r README.md README.html *.png icons fyne-cross/bin/linux-amd64/
# `make pandoc` converts README.md into HTML for distribution.
.PHONY: pandoc
pandoc:
pandoc -o README.html README.md

559
README.html Normal file
View File

@ -0,0 +1,559 @@
<h1 id="error-message-generator-2.0">Error Message Generator 2.0</h1>
<p>This is a modern remake of my “Error Message Generator” that was originally written using Perl/Tk around 2006. This one is written in Go in 2023 using the <a href="https://fyne.io/">Fyne UI</a> and aims to match and surpass the features of the original Perl version.</p>
<figure>
<img src="screenshot.png" alt="Screenshot" /><figcaption aria-hidden="true">Screenshot</figcaption>
</figure>
<p>The <em>original</em> inspiration for this back in 2006 was an online web tool called “Atom Smashers Error Message Generator” which generated images of error messages. My Perl ErrorGen program included all of the Atom Smasher icons. Atom Smashers page seems offline recently, so interest has skyrocketed for my Perl ErrorGen program, so I decided to dust it off, redo it in Go and make it better than ever before.</p>
<h1 id="features">Features</h1>
<p>This program has two operating modes:</p>
<ul>
<li>MainWindow mode: by default, it will show the Main Window where you can construct and test a custom error message pop-up.</li>
<li><a href="#command-line-interface">Command Line Interface</a> (CLI): If given command-line options, it will <em>just</em> pop up the message box you specified and print the users selection to its standard output, useful for batch files or shell scripts to ask the user a question.</li>
</ul>
<p>The current features include:</p>
<ul>
<li>Choose from 72 built-in icons that all came from the original Atom Smashers Error Message Generator.</li>
<li>Custom title bar and message text.</li>
<li>Configure up to three buttons (via the MainWindow; unlimited number of buttons by command line) each with custom labels.</li>
<li>Mark some buttons disabled and not clickable.</li>
<li>Command line interface to use these error dialogs from scripts and external programs:
<ul>
<li>The program returns the selected button text on its standard output.</li>
<li>The <code>--cancel</code> value can be printed to standard out if the user Xs out of the window without selecting a button.</li>
<li>Specify which button should be the primary/default response of the Return key.</li>
<li>Specify which button should be the cancel/escape key response.</li>
</ul></li>
</ul>
<p>The roadmap of future features include:</p>
<ul>
<li>Improve the command-line interface to bring it up to par with other dialog tools such as Zenity.
<ul>
<li>e.g., add File Open/Save Dialogs, Color Picker Dialogs, and others that can be extremely useful to third-party programs.</li>
<li>The graphical Error Message Generator tool will probably not call these much - the primary GUI for this program is very much a fun toy. :)</li>
</ul></li>
<li>In the MainWindow, add a “Save” button that will turn your custom error dialog <em>into</em> a batch file or shell script that calls the ErrorGen programs command line interface.
<ul>
<li>Example: you use the ErrorGen UI to create a prank dialog box and “Save” it as a .bat file on disk.</li>
<li>Making sure that the .bat and ErrorGen.exe are in the same folder together, double-clicking on the .bat script will show your error dialog without the MainWindow coming up!</li>
</ul></li>
<li>Allow users to select a custom icon image.
<ul>
<li>The command-line interface already supports this.</li>
<li>The MainWindow should allow users to browse and select a custom icon from their computer to use in their toy error boxes.</li>
<li>Allow users to permanently extend the icon library with a folder of their own customs, so they dont have to browse and select a custom file every single time.</li>
</ul></li>
</ul>
<h1 id="command-line-interface">Command Line Interface</h1>
<p>You can call this program from batch files or shell scripts to prompt the user with a graphical dialog box and read the button they chose from this programs standard output.</p>
<p>For example, from a bash script:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co">#!/bin/bash</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="va">answer</span><span class="op">=</span><span class="kw">`</span><span class="ex">./errorgen</span> <span class="at">--alert</span> <span class="at">--title</span> <span class="st">&quot;Disk Failure&quot;</span> <span class="dt">\</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="at">--text</span> <span class="st">&quot;Failure to read from drive Z:/&quot;</span> <span class="dt">\</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> <span class="at">--icon</span> defrag <span class="at">--button</span> Abort <span class="at">--button</span> Retry <span class="at">--button</span> Fail <span class="dt">\</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="at">--default</span> 1 <span class="at">--cancel</span> Fail<span class="kw">`</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="bu">echo</span> <span class="st">&quot;You have chosen: </span><span class="va">$answer</span><span class="st">&quot;</span></span></code></pre></div>
<figure>
<img src="error.png" alt="Screenshot from the above command" /><figcaption aria-hidden="true">Screenshot from the above command</figcaption>
</figure>
<p>The full documentation is included below. Running <code>errorgen --help</code> from a text terminal will have the program print its documentation to you, but this wont work on the Windows version since a program must decide if its a graphical or a command line app and cant be both.</p>
<h1 id="built-in-icons">Built-in Icons</h1>
<p>These are all the icons that currently come with ErrorGen:</p>
<table>
<thead>
<tr class="header">
<th>Image</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><img src="icons/aim_guy.png" alt="aim_guy" /></td>
<td>aim_guy</td>
</tr>
<tr class="even">
<td><img src="icons/aol_icon.png" alt="aol_icon" /></td>
<td>aol_icon</td>
</tr>
<tr class="odd">
<td><img src="icons/attention.png" alt="attention" /></td>
<td>attention</td>
</tr>
<tr class="even">
<td><img src="icons/bomb.png" alt="bomb" /></td>
<td>bomb</td>
</tr>
<tr class="odd">
<td><img src="icons/bomb_dynamite.png" alt="bomb_dynamite" /></td>
<td>bomb_dynamite</td>
</tr>
<tr class="even">
<td><img src="icons/bomb_grenade.png" alt="bomb_grenade" /></td>
<td>bomb_grenade</td>
</tr>
<tr class="odd">
<td><img src="icons/bubble_i.png" alt="bubble_i" /></td>
<td>bubble_i</td>
</tr>
<tr class="even">
<td><img src="icons/bubble_q.png" alt="bubble_q" /></td>
<td>bubble_q</td>
</tr>
<tr class="odd">
<td><img src="icons/bulb.png" alt="bulb" /></td>
<td>bulb</td>
</tr>
<tr class="even">
<td><img src="icons/butterfly.png" alt="butterfly" /></td>
<td>butterfly</td>
</tr>
<tr class="odd">
<td><img src="icons/cake.png" alt="cake" /></td>
<td>cake</td>
</tr>
<tr class="even">
<td><img src="icons/circularsaw.png" alt="circularsaw" /></td>
<td>circularsaw</td>
</tr>
<tr class="odd">
<td><img src="icons/control_panel.png" alt="control_panel" /></td>
<td>control_panel</td>
</tr>
<tr class="even">
<td><img src="icons/cow.png" alt="cow" /></td>
<td>cow</td>
</tr>
<tr class="odd">
<td><img src="icons/defrag.png" alt="defrag" /></td>
<td>defrag</td>
</tr>
<tr class="even">
<td><img src="icons/disk_blu.png" alt="disk_blu" /></td>
<td>disk_blu</td>
</tr>
<tr class="odd">
<td><img src="icons/disk_blu_lbl.png" alt="disk_blu_lbl" /></td>
<td>disk_blu_lbl</td>
</tr>
<tr class="even">
<td><img src="icons/disk_org.png" alt="disk_org" /></td>
<td>disk_org</td>
</tr>
<tr class="odd">
<td><img src="icons/disk_red.png" alt="disk_red" /></td>
<td>disk_red</td>
</tr>
<tr class="even">
<td><img src="icons/disk_red_lbl.png" alt="disk_red_lbl" /></td>
<td>disk_red_lbl</td>
</tr>
<tr class="odd">
<td><img src="icons/disk_skull.png" alt="disk_skull" /></td>
<td>disk_skull</td>
</tr>
<tr class="even">
<td><img src="icons/disk_yel.png" alt="disk_yel" /></td>
<td>disk_yel</td>
</tr>
<tr class="odd">
<td><img src="icons/dos.png" alt="dos" /></td>
<td>dos</td>
</tr>
<tr class="even">
<td><img src="icons/e_orbit.png" alt="e_orbit" /></td>
<td>e_orbit</td>
</tr>
<tr class="odd">
<td><img src="icons/error.png" alt="error" /></td>
<td>error</td>
</tr>
<tr class="even">
<td><img src="icons/error2.png" alt="error2" /></td>
<td>error2</td>
</tr>
<tr class="odd">
<td><img src="icons/error3.png" alt="error3" /></td>
<td>error3</td>
</tr>
<tr class="even">
<td><img src="icons/error4.png" alt="error4" /></td>
<td>error4</td>
</tr>
<tr class="odd">
<td><img src="icons/file_cabinet.png" alt="file_cabinet" /></td>
<td>file_cabinet</td>
</tr>
<tr class="even">
<td><img src="icons/find.png" alt="find" /></td>
<td>find</td>
</tr>
<tr class="odd">
<td><img src="icons/fortunecookie.png" alt="fortunecookie" /></td>
<td>fortunecookie</td>
</tr>
<tr class="even">
<td><img src="icons/garbage_empty.png" alt="garbage_empty" /></td>
<td>garbage_empty</td>
</tr>
<tr class="odd">
<td><img src="icons/garbage_full.png" alt="garbage_full" /></td>
<td>garbage_full</td>
</tr>
<tr class="even">
<td><img src="icons/gun.png" alt="gun" /></td>
<td>gun</td>
</tr>
<tr class="odd">
<td><img src="icons/hammer.png" alt="hammer" /></td>
<td>hammer</td>
</tr>
<tr class="even">
<td><img src="icons/heart.png" alt="heart" /></td>
<td>heart</td>
</tr>
<tr class="odd">
<td><img src="icons/help.png" alt="help" /></td>
<td>help</td>
</tr>
<tr class="even">
<td><img src="icons/hub.png" alt="hub" /></td>
<td>hub</td>
</tr>
<tr class="odd">
<td><img src="icons/hwinfo.png" alt="hwinfo" /></td>
<td>hwinfo</td>
</tr>
<tr class="even">
<td><img src="icons/ic_a.png" alt="ic_a" /></td>
<td>ic_a</td>
</tr>
<tr class="odd">
<td><img src="icons/keys.png" alt="keys" /></td>
<td>keys</td>
</tr>
<tr class="even">
<td><img src="icons/keys2.png" alt="keys2" /></td>
<td>keys2</td>
</tr>
<tr class="odd">
<td><img src="icons/keys3.png" alt="keys3" /></td>
<td>keys3</td>
</tr>
<tr class="even">
<td><img src="icons/labtec.png" alt="labtec" /></td>
<td>labtec</td>
</tr>
<tr class="odd">
<td><img src="icons/mac.png" alt="mac" /></td>
<td>mac</td>
</tr>
<tr class="even">
<td><img src="icons/mail.png" alt="mail" /></td>
<td>mail</td>
</tr>
<tr class="odd">
<td><img src="icons/mail_deleted.png" alt="mail_deleted" /></td>
<td>mail_deleted</td>
</tr>
<tr class="even">
<td><img src="icons/mailbox.png" alt="mailbox" /></td>
<td>mailbox</td>
</tr>
<tr class="odd">
<td><img src="icons/mouth.png" alt="mouth" /></td>
<td>mouth</td>
</tr>
<tr class="even">
<td><img src="icons/mycomputer.png" alt="mycomputer" /></td>
<td>mycomputer</td>
</tr>
<tr class="odd">
<td><img src="icons/mycomputer2.png" alt="mycomputer2" /></td>
<td>mycomputer2</td>
</tr>
<tr class="even">
<td><img src="icons/mycomputer3.png" alt="mycomputer3" /></td>
<td>mycomputer3</td>
</tr>
<tr class="odd">
<td><img src="icons/newspaper.png" alt="newspaper" /></td>
<td>newspaper</td>
</tr>
<tr class="even">
<td><img src="icons/peripheral.png" alt="peripheral" /></td>
<td>peripheral</td>
</tr>
<tr class="odd">
<td><img src="icons/plant_leaf.png" alt="plant_leaf" /></td>
<td>plant_leaf</td>
</tr>
<tr class="even">
<td><img src="icons/radiation.png" alt="radiation" /></td>
<td>radiation</td>
</tr>
<tr class="odd">
<td><img src="icons/ram.png" alt="ram" /></td>
<td>ram</td>
</tr>
<tr class="even">
<td><img src="icons/recycle.png" alt="recycle" /></td>
<td>recycle</td>
</tr>
<tr class="odd">
<td><img src="icons/recycle2.png" alt="recycle2" /></td>
<td>recycle2</td>
</tr>
<tr class="even">
<td><img src="icons/scanner.png" alt="scanner" /></td>
<td>scanner</td>
</tr>
<tr class="odd">
<td><img src="icons/screw.png" alt="screw" /></td>
<td>screw</td>
</tr>
<tr class="even">
<td><img src="icons/screw2.png" alt="screw2" /></td>
<td>screw2</td>
</tr>
<tr class="odd">
<td><img src="icons/setup.png" alt="setup" /></td>
<td>setup</td>
</tr>
<tr class="even">
<td><img src="icons/sknife.png" alt="sknife" /></td>
<td>sknife</td>
</tr>
<tr class="odd">
<td><img src="icons/skull.png" alt="skull" /></td>
<td>skull</td>
</tr>
<tr class="even">
<td><img src="icons/skull2.png" alt="skull2" /></td>
<td>skull2</td>
</tr>
<tr class="odd">
<td><img src="icons/skull3.png" alt="skull3" /></td>
<td>skull3</td>
</tr>
<tr class="even">
<td><img src="icons/tux.png" alt="tux" /></td>
<td>tux</td>
</tr>
<tr class="odd">
<td><img src="icons/tux_config.png" alt="tux_config" /></td>
<td>tux_config</td>
</tr>
<tr class="even">
<td><img src="icons/ups.png" alt="ups" /></td>
<td>ups</td>
</tr>
<tr class="odd">
<td><img src="icons/zipdisk.png" alt="zipdisk" /></td>
<td>zipdisk</td>
</tr>
<tr class="even">
<td><img src="icons/zipdisks.png" alt="zipdisks" /></td>
<td>zipdisks</td>
</tr>
</tbody>
</table>
<h1 id="command-line-usage">Command Line Usage</h1>
<p>The result of <code>errorgen --help</code>:</p>
<pre><code>NAME:
errorgen - make fun and custom error messages.
USAGE:
errorgen [global options] command [command options] [arguments...]
AUTHOR:
Noah Petherbridge, https://www.kirsle.net
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--version, -v Show program version and build information and exit. (default: false)
--error, -e Make the dialog box be of type &#39;error&#39; by default.
An info box has these default attributes unless overridden by
other options:
Title: Error
Text: An error has occurred.
Icon: error
Buttons: Ok (default: false)
--alert, -a Make the dialog box be of type &#39;alert&#39; by default.
An alert box has these default attributes unless overridden by
other options:
Title: Warning
Text: Are you sure you want to proceed?
Icon: attention
Buttons: Ok (default: false)
--info, -i Make the dialog box be of type &#39;info&#39; by default.
An info box has these default attributes unless overridden by
other options:
Title: Information
Text: All updates are complete.
Icon: info
Buttons: Ok (default: false)
--question, -q Make the dialog box be of type &#39;question&#39; by default.
A question box has these default attributes unless overridden by
other options:
Title: Question
Text: Are you sure you want to proceed?
Icon: question
Buttons: Ok, Cancel (default: false)
--title value, -n value Set the title for the dialog box.
If no title is set, a default is used based on the type of dialog
box requested (which is --info by default; see also --error,
--info, --question)
--text value, -t value The text displayed inside the dialog box.
Use \n where you want line breaks.
Important: the text does NOT have automatic word wrapping applied.
Insert your own line breaks or else the dialog can be VERY wide for
longer messages!
--button value, -b value Add a button to the dialog.
Use this option as many times as you want to add multiple buttons.
The one the user chooses will be printed to standard output. If no
buttons, default is an Ok button. (accepts multiple inputs)
--default value, -m value Set the default button by its label.
The matching --button will be made the default/primary button.
--cancel value, -c value Set the &#39;cancel button&#39;.
This value should match one of your --buttons and will be the
value &#39;selected&#39; if the user closes the window or hits the
Escape key.
--disabled value, -d value, -g value Mark buttons (by index) disabled
Specify a --button number (from 0 to n) that should be disabled,
or greyed out. The user can not click on this button. (accepts multiple inputs)
--icon value, -o value Set the icon to be displayed in the dialog box.
Use either a built-in icon by name (e.g. &quot;aim_guy&quot;) or name your
own custom PNG image from disk.
Built-in icon names include the following:
aim_guy
aol_icon
attention
bomb
bomb_dynamite
bomb_grenade
bubble_i
bubble_q
bulb
butterfly
cake
circularsaw
control_panel
cow
defrag
disk_blu
disk_blu_lbl
disk_org
disk_red
disk_red_lbl
disk_skull
disk_yel
dos
e_orbit
error
error2
error3
error4
file_cabinet
find
fortunecookie
garbage_empty
garbage_full
gun
hammer
heart
help
hub
hwinfo
ic_a
keys
keys2
keys3
labtec
mac
mail
mail_deleted
mailbox
mouth
mycomputer
mycomputer2
mycomputer3
newspaper
peripheral
plant_leaf
radiation
ram
recycle
recycle2
scanner
screw
screw2
setup
sknife
skull
skull2
skull3
tux
tux_config
ups
zipdisk
zipdisks
--help, -h show help (default: false)</code></pre>
<h1 id="building">Building</h1>
<p>Requirements:</p>
<ul>
<li>Go: https://golang.org</li>
<li>Fyne dependencies: https://developer.fyne.io/started/</li>
</ul>
<p>Fedora: <code>sudo dnf install golang gcc libXcursor-devel libXrandr-devel mesa-libGL-devel libXi-devel libXinerama-devel libXxf86vm-devel</code></p>
<p>Ubuntu/Debian: <code>sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev</code></p>
<p>There is a GNU Makefile to make build commands easier to remember.</p>
<ul>
<li><code>make setup</code> installs Go dependencies for this project.</li>
<li><code>make</code> or <code>make build</code> will produce the ./errorgen binary.</li>
<li><code>make run</code> runs the Go app locally for development and testing.]</li>
<li><code>make clean</code> removes the built binary.</li>
</ul>
<p>Cross compiling: install Docker and fyne-cross and run <code>make release</code> to produce the build. To install fyne-cross:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="ex">go</span> install github.com/fyne-io/fyne-cross</span></code></pre></div>
<p>In case of permission errors (Docker often needs run as root) you can try sudo running fyne-cross directly, e.g. to produce Windows amd64 and i386 builds a command like:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode bash"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="co"># which fyne-cross to use your locally installed Go binary for the current user,</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="co"># so that root doesn&#39;t need to also install fyne-cross and have a $PATH set up.</span></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="fu">sudo</span> <span class="va">$(</span><span class="fu">which</span> fyne-cross<span class="va">)</span> windows <span class="at">-arch</span><span class="op">=</span><span class="dt">\*</span></span></code></pre></div>
<h1 id="license-author">License &amp; Author</h1>
<p>Icons from the Atom Smasher Error Message Generator.</p>
<p>Developed by Noah Petherbridge, <a href="https://www.kirsle.net/" class="uri">https://www.kirsle.net/</a></p>
<p>See my web page about this at <a href="https://www.kirsle.net/errorgen" class="uri">https://www.kirsle.net/errorgen</a></p>
<pre><code>Error Message Generator
Copyright (C) 2023 Noah Petherbridge
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</code></pre>

View File

@ -305,13 +305,50 @@ GLOBAL OPTIONS:
--help, -h show help (default: false) --help, -h show help (default: false)
``` ```
# Building
Requirements:
* Go: https://golang.org
* Fyne dependencies: https://developer.fyne.io/started/
Fedora: `sudo dnf install golang gcc libXcursor-devel libXrandr-devel mesa-libGL-devel libXi-devel libXinerama-devel libXxf86vm-devel`
Ubuntu/Debian: `sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev`
There is a GNU Makefile to make build commands easier to remember.
* `make setup` installs Go dependencies for this project.
* `make` or `make build` will produce the ./errorgen binary.
* `make run` runs the Go app locally for development and testing.]
* `make clean` removes the built binary.
Cross compiling: install Docker and fyne-cross and run `make release` to produce the build. To install fyne-cross:
```bash
go install github.com/fyne-io/fyne-cross
```
In case of permission errors (Docker often needs run as root) you can try sudo running fyne-cross directly, e.g.
to produce Windows amd64 and i386 builds a command like:
```bash
# which fyne-cross to use your locally installed Go binary for the current user,
# so that root doesn't need to also install fyne-cross and have a $PATH set up.
sudo $(which fyne-cross) windows -arch=\*
sudo $(which fyne-cross) linux -arch=\*
# Fix ownership permissions on the output folder
sudo chown -R user:user fyne-cross
```
# License & Author # License & Author
Icons from the Atom Smasher Error Message Generator. Icons from the Atom Smasher Error Message Generator.
Developed by Noah Petherbridge, https://www.kirsle.net/ Developed by Noah Petherbridge, <https://www.kirsle.net/>
See my web page about this at https://www.kirsle.net/errorgen See my web page about this at <https://www.kirsle.net/errorgen>
Error Message Generator Error Message Generator
Copyright (C) 2023 Noah Petherbridge Copyright (C) 2023 Noah Petherbridge

View File

@ -90,6 +90,7 @@ func (d Dialog) Show(app fyne.App) {
} }
w.SetIcon(d.Icon) w.SetIcon(d.Icon)
w.CenterOnScreen()
// Icon + Message row. // Icon + Message row.
icon := canvas.NewImageFromResource(d.Icon) icon := canvas.NewImageFromResource(d.Icon)

3
go.mod
View File

@ -10,11 +10,14 @@ require (
require ( require (
fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1 // indirect fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1 // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 // indirect
github.com/benoitkugler/textlayout v0.3.0 // indirect github.com/benoitkugler/textlayout v0.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fredbi/uri v0.1.0 // indirect github.com/fredbi/uri v0.1.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fyne-io/fyne-cross v1.3.0 // indirect
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect
github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect

7
go.sum
View File

@ -42,8 +42,12 @@ fyne.io/fyne/v2 v2.3.0/go.mod h1:odfJmbFnODiKn1MXdL44JR6CK+0v8lrmgdPlrUF6w0M=
fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1 h1:OiHw+bZAGEaSreHsA8dDkBOVJmSFzsNTOc/htpM+fOc= fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1 h1:OiHw+bZAGEaSreHsA8dDkBOVJmSFzsNTOc/htpM+fOc=
fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE= fyne.io/systray v1.10.1-0.20221115204952-d16a6177e6f1/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 h1:1ltqoej5GtaWF8jaiA49HwsZD459jqm9YFz9ZtMFpQA=
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
@ -86,6 +90,8 @@ github.com/fredbi/uri v0.1.0/go.mod h1:1xC40RnIOGCaQzswaOvrzvG/3M3F0hyDVb3aO/1iG
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fyne-io/fyne-cross v1.3.0 h1:pU8+B0J1+xYQJ27TNRjXiV9qsGHuHFXTDlqp0zfEyWo=
github.com/fyne-io/fyne-cross v1.3.0/go.mod h1:Kp7K91rS+2lmoa9g2kYolExO2I3BB/80no1wplc6mIw=
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe h1:A/wiwvQ0CAjPkuJytaD+SsXkPU0asQ+guQEIg1BJGX4= github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe h1:A/wiwvQ0CAjPkuJytaD+SsXkPU0asQ+guQEIg1BJGX4=
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe/go.mod h1:d4clgH0/GrRwWjRzJJQXxT/h1TyuNSfF/X64zb/3Ggg= github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe/go.mod h1:d4clgH0/GrRwWjRzJJQXxT/h1TyuNSfF/X64zb/3Ggg=
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 h1:+31CdF/okdokeFNoy9L/2PccG3JFidQT3ev64/r4pYU= github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 h1:+31CdF/okdokeFNoy9L/2PccG3JFidQT3ev64/r4pYU=
@ -470,6 +476,7 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=

View File

@ -22,6 +22,7 @@ func RunGUI() {
w.SetOnClosed(func() { w.SetOnClosed(func() {
a.Quit() a.Quit()
}) })
w.CenterOnScreen()
// Create a Dialog template that the UI components will modify. // Create a Dialog template that the UI components will modify.
var d = Dialog{ var d = Dialog{