For those new to trying out the plugin, I discovered that it didn't appear to load despite adding it to my enabled plugins. What I learned is:
1. It's in the plugin list and I needed to select the rpcalc-toggle option under the plugins menu or... 2. I see now there's an rpcalc button I didn't notice before that toggles it on and off. HTH Looking forward to using it as I prefer RPN calculators to the more standard ones. Rob... On Saturday, April 29, 2023 at 1:42:07 PM UTC-4 [email protected] wrote: > There are times while working in Leo that I have wanted to use a > calculator. Sometimes I keep a calculator program open, but this is not > always ideal because the Leo window often will obscure the calculator when > I want to look at it or use it. > > I have adapted the open-source *RPCalc* calculator to run in a tab in the > Leo log frame. This calculator is a Reverse Polish Notation (RPN) style > calculator, which IMHO is much better than the algebraic-entry type. It > is the type of calculator that Hewlett-Packard made famous. > > RPCalc is written in PyQt, so it was a good candidate to use as a starting > point. My adaptation turns it into a Leo plugin. A screenshot and a zip > file with the files are attached to this post. It's not quite ready for a > pull request yet, though it is completely functional. Still to do: add > type annotations, update the Help file, come up with a better way to copy > the results of a calculation to the clipboard, and add a setting to prevent > automatic addition of the plugin's toggle button to the icon bar. There > are also a few minor conveniences that aren't working right relating to the > Help screen. > > To "install" it, unzip the zip file - it has the rpcalc.py program and an > associated rpcalc directory. Now you can do one of two things: > > 1. Copy the file and directory into your leo/plugins directory; add a > line "rpcalc.py" to the @*enabled-plugins* node in your myLeoSettings.leo > outline; or > > 2. Copy the file and directory somewhere else, set the PYTHONPATH > environmental variable to point there, and add a line "rpcalc" (without the > ".py") to the @*enabled-plugins* node in your myLeoSettings.leo outline. > > To illustrate method 2 (on Windows; there are minor differences for > Linux), suppose you copy the plugin into *c:\temp\leo\extras*. Then > before starting Leo from a console, set the PYTHONPATH: > > set PYTHONPATH=c:\temp\leo\extras;%PYTHONPATH% > > You don't need to include the final ;%PYTHONPATH% if it has not been set > already to point somewhere else. > > Then restart Leo. There will be a new button labeled "RPCalc" on the > iconbar. Clicking on it will toggle the calculator tab on or off. The > plugin works on Windows and Linux, and with either PyQt5 or PyQt6. > > If you are not familiar with an RPN style calculator, it works by pushing > numbers onto a stack and performing operations between members of the > stack. So to add 10 and 4, you key in "10" (from the keyboard or by > clicking the number buttons), then press ENTER or click the ENT button. > This pushes the number 10 onto the stack. Then key/button-press "4", then > click/type a plus sign. The "plus" operation is executed between the 4 and > the 10, leaving the result (14) in the stack bottom (the position with the > large LCD characters). > > There are many sites on the Web that will tell you more about using an RPN > calculator. RPCalc itself has a way to enter numbers in other common bases > (eg., hex) - read the Help file to learn how. > > There is an auxiliary menu that will open either with a right-click in the > calculator main window or by pressing the ESC key. These entries open a > separate window (not in the Leo tab). One of the items opens the help > file. When the window is the one showing the registers, then the calculator > result can be copied to the clipboard with ALT-v. This is a little clumsy, > and I plan to make it easier to copy the value (there is a technical oddity > that is preventing the most obvious way from working). > > The calculator will automatically use your Leo theme's colors and fonts. > > Please test this plugin out and let us know how you like it, and if you > would like anything changed. I won't promise to make the changes, > depending on how hard they may be or if they seem too inconsistent with the > way the calculator works. But I'll try! > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/6aa354a8-38b1-4016-8193-98b3db4f21b9n%40googlegroups.com.
