I love old tech


pytextedit 0.2: pretty menus

Introducing the new and improved Menu™, now with images!

This should make it easier to find what you’re looking for just based on the icon, instead of having to read through the all menu items.

Also, you can see the new status bar in this screenshot as well. I finally got the labels to update correctly. As it turns out, this was just due to a stupid mistake; I updated on <Key> and <Button-1>, while I should have updated on <KeyRelease> and <ButtonRelease-1>.

Changes in pytextedit 0.2, Sept. 19

I’ve been sort of busy:

  • Font size can now no longer be zero or negative. This would cause a lot of inconsistencies.
  • Right-clicking on toolbar buttons now show dialogs with a short description of what the button does. Sometime in the future I’ll improve this further by using little help balloon things (I have no idea what they’re called) instead of a showinfo().
  • Middle-clicking now pastes text.
  • Fixed bug in “Goto” where clicking Cancel in the dialog would see() the line with the cursor. (This was a problem if the user had scrolled.)
  • “Goto” now uses the current line number as the default value.
  • “Select From” now uses the current cursor position as the default value.
  • Removed some unnecessary global variables.
  • askdirectory() is now imported in Python 2 as well. I have no idea why it wasn’t before.
  • askopenfilename() is now imported. It was used by “Edit Favorites”, but it wasn’t imported. Oops. I really need to stop making stupid mistakes like this…
  • “Edit Favorites” now uses ED_INIT_DIR to set the default directory.
  • “Edit Favorites” now uses the custom filetypes list.
  • Changed keybinding for “Favorites” to Ctrl+Alt+[Space]. (Ctrl+Tab will be used by the MDI later.)
  • “Recently Opened” can now be used easily without a mouse. (Added “Return” keybinding, and focus()ed on the listbox.)
  • “Favorites” can now be used easily without a mouse. (Added “Return” keybinding, and focus()ed on the listbox.)
  • “View Bookmarks” can now be used easily without a mouse. (Added “Return” keybinding, and focus()ed on the listbox.)
  • Default value for “Quick Open” is now ED_INIT_DIR.
  • Removed “Indent All” and “Unindent All”. See next improvement.
  • “Indent” and “Unindent” will now indent any selected text. This makes “Indent All” and “Unindent All” irrelevant, as all you have to do now is select all the text.
  • Added keybinding for “Add Bookmark.” (Ctrl+B) This makes it much quicker to use.
  • Added “Documents” menu. This will be used for the MDI later.
  • Added “Previous” and “Next” toolbar buttons. Again, these will be used for the MDI.
  • Re-organized toolbar. It just looked a little strange.
  • Bookmarks now cannot be added multiple times on the same line.
  • Added “Search -> Open URL in Web Browser”. Very useful for README files, in my opinion.
  • Added “Options -> Enlarge Font” and “Options -> Shrink Font”. There were no menu options for them before. Which was a bit of a problem, because without that there was no way to know the feature was there.
  • Enabling/disabling tearoff menus in Options dialog no longer requires a restart.
  • Fixed bug where tearoff menu OptionMenu in Options dialog would not default to disabled. The values didn’t match in the conditional in the if block.
  • Bookmarks are now sorted numerically. This makes it much easier to quickly find the bookmark you want.
  • Added keybinding for “View Bookmarks” (Ctrl+Shift+B).
  • Removed menu tearoff for bookmarks submenu in context menu. I have no clue why that was there, as it was completely unnecessary. Probably just another time where I was copy-pasting code and not paying much attention…
  • Revised “About” dialog.
  • Fixed bug where “Goto” would accept a line greater than the total number of lines. It seems I mass-replaced a certain string, and it matched a line in this function that I didn’t intend it to. Once again, oops.
  • Bookmarks will now no longer be shown if the line number is greater than the total number of lines. Before it would cause an error if you tried to go a bookmark on a line that didn’t exist.
  • In “Statistics” dialog added “Chars (excluding spaces)” and “Sel chars (excluding spaces)”.
  • “Statistics” dialog will now only show info on selected text if there is text selected.
  • Added feature to add extra indenting based on last character of the line. This allows for easier writing of code. Basically, it’s meant for auto-indenting blocks of code. So, if the option is set to “python”, it will add extra indent after a line that ends with “:”, and if the language is set to “c”, it will add extra indent after a line that ends with “{“. This can be turned off as well, of course.
  • Added a Cancel button to the “Options” dialog.
  • “Insert Date/Time” now use standard formatting.
  • “Undo” and “Redo” will no longer cause errors if there is nothing to do. Yay for catchall try-except blocks.
  • Moved time/date formatting options into “Misc” tab in “Options” dialog.
  • Added block indenting option to “Editing” tab in “Options” dialog.

pytextedit 0.1 fixed

This is the fixed pytextedit 0.1. I fixed opening/saving under Python 2, many thanks to Dale Everett for noticing that it didn’t work. I fixed a couple bugs I found as well:

  • Opening/saving now works with Python 2. Running it in Python 2 removes all Unicode support, however. (I’ll try to add at least some in later.)
  • Fixed bug where “Statistics” wouldn’t work if no text was selected.
  • Fixed bug where “Statistics” would report there being one less line than there actually was.
  • Line numbers now match up to the text. (Better than before, anyway. Still not perfect.)


And that’s why you test your code before you say it’s done…

Changes in pytextedit, Aug. 27

pytextedit 0.1 is almost complete, I just have to add the new Options dialog and set it up to save to the configuration files. Well, I say “just”, but it’s going to take a while…

Anyway, this is everything else I’ve done since my last post:

  • Fixed bug where “Revert to Last Save” would scroll to the bottom.
  • Fixed bug where “Revert to Last Save” would not mark the text as having no changes.
  • “Revert to Last Save” now clears the undo/redo stack.
  • Improved some of the code for loading a file from the command line. I had forgotten to update it as I did the other stuff. (Oops.)
  • Further improved comments.
  • Changed the default gbl_dlg_open_url to “http://&#8221;.
  • gbl_saved_data is now updated when the file is opened as well.
  • UI options now apply to scrollbars as well.
  • Rewrote check_modified().
  • Added function internal_text_modified() function for simplifying marking text as having changes.
  • Rewrote all functions to use internal_text_modified().
  • Simplified the code for opening from command line.
  • Rewrote file_exit() to use a Toplevel (again).