July 2, 2013
#12 Keyboard Shortcuts Underpinnings on Main Menu
This one is easy to implement, and can be done with no issues whatsoever.
PatchIt! still does not have a GUI, despite all my talk about one and the large features implemented in the last few versions, and continues to be a command-line style application. However, the lack of a GUI cannot stop me from adding GUI characteristics. Today, I watched a video of a program written in C++ and that used the Qt5 GUI library, and was very impressed by the overall quality of the program, but also by the shortcut keys to the various functions. I thought to myself
Why can’t I add these same shortcuts into PatchIt!?
Thus Dev-log #12 was born.
I can add these them, even though I don’t have a GUI written. All I have to do is set up the Tkinter root window, but hide it from view so it will still be present. Then I just have to do is bind the keyboard shortcuts to their respective commands:
<Control> - <n> for Create a PatchIt! Patch,
<Control> - <o> for Install a PatchIt! Patch,
<Control> - <q> for Quit,
<Alt> - <s> for PatchIt! Settings (perhaps, still thinking about this one), and
<F12> for the About PatchIt! box.
With these shortcuts, I can add GUI-like functionality but still have the command-line style for a bit longer. While these would only be present on the main menu (I would have a lot of clean up to do later on if I added this code everywhere), it is still a good feature to add, and helps the transition from an CLI interface to GUI a bit easier. 🙂
Soon after this Dev-log was written, I began adding the functionally discussed into PatchIt!. Turns out, the entire concept was flawed. It is impossible to hide the root Tkinter window, have the console window the active window, and expect the keyboard shortcuts to work. So while the feature outlined in this Dev-log is broken, and will not ever happen in it’s current form, I am still posting this for a complete record archive.