- Small items
- Items related to the contributions manager
- Merged: PR #2705
- Modes and Tools can now be added, removed and updated without a restart.
- In the unlikely chance that this fails to happen without a restart (and this happens only in Windows), a restart button is displayed from which Processing restart automatically.
- The tmp folders delete much better, and in case they don’t, they are removed the next time Processing is run.
- Changes in the UI of the Contribution Managers have been implemented.
- Incorrect line coloring when filtering modes list [Merged: PR #2598]
- Merged: PR #2637
- Show installed/available version
- post last release date w/ each library in the manager and website
- fail more gracefully if no internet connection or a proxy server is in use [Merged: PR #2800]
- examples manager needed for books, courses, workshops [Merged: PR #2795]
- “starred” / “recommended” libraries [Merged: PR #2782]
- different lists for different versions of processing [Merged: PR #2746]
- Some smaller fixes to contribution manager:
- .properties file gets overwritten with contributions.txt [Merged: PR #2608]
- Incorrect mode is selected in mode menu [Merged: PR #2616]
- Update manager does not show on startup [Merged: PR #2636]
- Status messages don’t clear [Merged: PR #2667]
- Help>Environment and Help>Reference don’t work in Windows [Merged: PR #2657]
- contributions managers show specific titles (like “Mode Manager”) in the user’s preferred language [Merged: PR #2777]
- help / reference for contrib libraries [PR #2804]
- Merged: PR #2705
- And here are a few tasks I’ll be taking up post-GSOC:
- Related to the Contributions Manager:
- Prompt to install library before running a sketch if not already installed #2566
- ProgressMonitor continues to show after an exception is thrown when trying to install a contribution #2798
- Reduce scroll amount in Contributions Manager #2189
- SOCKS proxy not working 2643
A few handy resources related to this issue are:
- the current code that gets/sets the pref is in Preferences
- instead of current implementation, can we auto-detect proxy settings?
- old issue: 1476
- Info about setting up a proxy here
- Go through existing tool contributions with Elie (are there outdated tools?)
- Guidelines for modes #1656
- Auto brackets/quotes closing processing/processing-experimental#60
- REPL in console processing/processing-experimental#55 : Work underway here.
- Related to the Contributions Manager:
Here’s a quick video of a few features added to Processing:
Here, is a a detailed timeline of what I did for GSoC 2014:
18 August: Today, I made a few more changes to the code which added the references of tools/libraries to the help menu. I replaced the huge ‘if’ structure that I had added yesterday to check for references in folders of different possible names with a combination of an array and a while loop iterating over this array till it finds a file that exists, or as long as the stay has no more elements. I also shifted the reference code that was common to the Library and ToolContribution classes into a new class which extends LocalContribution: LocalContribWithReference, and made the 2 aforementioned classes extend this one in place of LocalContribution. This served the dual purpose of reducing repeated code as well as making addition of references to modes (or even examples-packages, for that matter) super simple (although I am aware that I may have broken the Object Oriented Programming paradigm of has-a, using an is-a instead). Finally, I added some documentation to the new functions introduced in this branch. Thus ends a beautiful summer.
17 August: Added several ways for references to be included in a Tool/Library. This simply involved checking out several possible paths, such as reference/index.html, documentation/index.html, etc. to see if the main file (generally index.html, but other cases like documentation.html, readme.txt, etc. were included) exists. This was done simply to offer the contributor the flexibility to add references however (s)he wants to.
16 August: Added 2 menus to the Help menu in Processing, each containing one JMenuItem for each tool/library that has references attached (both core as well as contributed). Florian and I decided that this would be better than trying to modify a static HTML file to add/remove new contributions as they come along. Here’s a screenshot of what this looks like:
15 August: Today, I improved what happens when the Contributions Manager has to handle a lack of (or an unreliable) internet connection.
I identified 2 main types of errors:
1. UnknownHostException, which happens when there is no internet connection
2. SocketTimeoutException, which happens for an unreliable connection, or a connection which gets cut in between a download
I used the following error messages for the contributions.txt:
SocketTimeout: Connection timed out while downloading the contribution list.
UnknownHost: Could not download the list of available contributions.
and for the contribution itself:
SocketTimeout: Connection timed out while downloading <contrib_name>.
UnknownHost: Error during download and install of <contrib_name>
In case the contributions.txt file doesn’t download, I added a Retry button, and disabled all install and update buttons, as shown:
14 August: Today, I pushed a commit into the compatible contributions branch so that incompatible contributions would be grayed out.
- Organized commits of and rebased the branch which highlights contributions onto master, and submitted it for PR.
- Replaced the previous “compatibleVersions” field with 2 new fields: “minRevision” and “maxRevision”, used to indicate the versions before and after which the contribution is known to break, respectively.
- Also, did some more work on French translations.
- A few tweaks relating to the visual aspects of the Examples JTree (lightening the colour of the gray rows, and reducing the top margin to make it closer to the “Add Example…” button).
- Started working on missing French translations.
- Enabled the Contributions Manager to show specific titles (like “Mode Manager”, “Library Manager”, etc.) in the local language instead of the more general “Contribution Manager”.
- A few more fixes to the “Add Examples…” button: Redesigned it; fixed a bug where it expands vertically when the Examples window is expanded.
- Prevented “old” folders, which consists of backups of deleted contributions, from displaying anywhere.
- Added background color to alternate rows of the JTree: This involved setting the JTree’s cell renderer and its UI, and a LOT of thinking out-of-the-box and experimentation. In a nutshell, so that the graphics related to the tree was not drawn over, I overrode the paintRow() function of a new BasicTreeUI object (whichi I set as the UI), and drew a semi-transparent rectangle on top of the part of the row not occupied by the label or the icon. I set the backgrounds of the label and icon by overriding the getTreeCellRendererComponent() of a new DefaultTreeCellRenderer object (which I set as the cell renderer). I had to ensure that the 2 colors matched, and they would require different RGB values, since they had different transparencies. I couldn’t set the label’s and image’s background color as having the same transparency as then, it would clash with the image ( I think). A few links I used for reference are here, here, here and here.
9 August: Made a minor change to the folder structure of the examples JTree. Also improved the visual aspects of the “Add Examples…” button as per Florian’s suggestions. Added an “Add Examples…” option to the Open icon of the Toolbar menu.
8 August: Florian pointed out that it would be better to use the fully qualified class name of the contribution rather than simply the name specified in the menu, since the menu name was likely to change over time (as had happened with PDE X changing to Java mode recently). So I worked on checking the sketch.properties to ensure that the examples-package was compatible with the current sketch before adding it to the examples JTree.
6 – 7 August: Fixed a bug in the Example Contributions feature, where I had forgotten to write the new compatibleModesList field in the .properties file of the installed contribution. Also tested out this branch extensively. Renamed the “example” type contribution to “examples-manager” type contribution. Here’s what the examples-package manager looks like:
- Compatible Contributions: Implemented support for open ranges in the “Show Only Contributions Compatible with this Revision” option, so that something like “220- ” would imply support up to the present revision. Also fixed alignment of the Processing icon by adding an EmptyBorder.
- Adding Example Contributions: Made slight UI modifications so that all the examples (those that come with the mode and installed libraries, as well as those that are installed as part of the examples package) are part of the same JTree and display in a single JScrollPane, as opposed to 2 of them.
4 August: Time to modify the look of the highlighted contributions. Removed the tiny processing icon to the left of the title/heading, as well as the accompanying indentation, etc. (well, did a revert, basically). Now added the Processing Icon to the left of the panel which describes everything about the contribution (i.e. the ContributionPanel). This was much, much simpler than the little icon on the side of the heading…
- Highlighted Contributions: Added a validation to ensure that the contribution contributor doesn’t sneakily try to add the “Starred” category into the contribution when it is not present in the original contributions.txt file. Here’s what this feature finally looks like:
- Adding Example Contributions: As per the present structure, a contribution is detected only if it contains a folder whose name is the type of the contribution (for example, a library must contain a library folder within it). Thus, the example contributions must contain an “example” folder within them. But this folder would show in the JTree which shows all the examples. Thus, I removed the DefaultMutableTreeNode representing this example folder, and added all its children (which would either be example sketches, or meaningful sub-folders) as child nodes of its parent. I also added a field in the contributions.txt and example.properties files which contains a list of modes which the example is compatible with, and ensured that the current mode is compatible with an example package before displaying it in the Examples JTree.
2 August: Contributions that are to be added now show in the Examples Manager.
31 July – 1 August: Ensured that the examples tree displays examples stored in the examples folder, which will be the destination of installed examples.
- Compatible Contributions: Ensured that the “Show Only Contributions Compatible with this Revision” option works well alongside the other filtering options.
- Highlighting contributions: On second thought, the gold in the Contributions Manager was waaay too overwhelming, as Florian pointed out. Removed the gold, and used the Processing icon instead. This involved adding the ImageIcon to a JLabel, and modifying the JPanels used, the way the existing JTextPane is displayed, etc. Also added an option whereby all contributions with “Special” in their type will be highlighted, in addition to contributions by “The Processing Foundation”. On a side note, I saw a very interesting debugging technique online. In case one’s Panels are acting up, and the alignment is out of whack, simply add coloured borders like so:
- Examples Manager: Worked on the UI of the Examples Manager.
- Ensured that the status messages clear in the Contributions Manager the next time the user performs an action (Install, Remove, close window, etc.).
28 July: Today, I started work on adding a “Show Only Contributions Compatible with this Revision” option into the Contributions Manager. I added a check-box in the GUI, as well as the relevant fields in the Contribution class. I also finished coding the checking of this field in the respective .properties files for the contribution to show up if it is compatible. To keep track of ranges, I parsed this field to fill a TreeMap, and then used the TreeMap#ceilingEntry(int) function to check if the current version is present in the contribution’s list of supported functions or not.
- Noticed that Help>Reference and Help>Environment were not working in Windows, while they worked fine in Linux. Opened an issue here.
- Fixed this issue, and submitted a PR. It seems that Desktop.getDesktop().browse(URI uri) fails to use the URI of a non-canonical file on Windows, while it does so just fine in Linux. The fix was fairly simple, and involved ensuring that the canonical file’s URI was used.
27 July: Worked on a fix whereby Help>References and Help>Environment open in a default browser in Windows as well (unlike before, when they were opening only in Linux (and Mac OS X, too, I think)).
- Reviewed several PRs that had been submitted, and that were merged or in the process of being merged, and made a few changes to the branch which dealt with displaying the date on which a contribution was last updated, its version number, etc.
- Started working on highlighting contributions created by The Processing Foundation- as a first step, worked on highlighting the contributions that had “The Processing Foundation” string as part of their authorList field.
- Started working on the examples manager: Added an EXAMPLE enum value to the ContributionType class, and the appropriate functions.
- Fixed a bug that appears when multiple modes are to be updated on restart, by adding a teensy tinsy delay before the update happens.
- Fixed a bug that affects failed updates for modes: I’d assumed that the name of the folder in which the contribution resides would be the same as the contribution name. Silly me…
- Also fixed the code segment that checks whether or not an update on start-up was successful, or needs to be done next start-up. We can’t really look at the list of all installed contributions, since, as this segment happens on start-up, there’s no guarantee that this list is even initialized yet.
Here’s what the new contributions manager feels like:
- Removed one more redundant function.
- Solved a ConcurrentModificationException that randomly pops up. This was happening because an iterator was not used in the original code, and a for-each loop was being used instead.
- A minor bug fix in the working of the Library Manager.
- Fixed a bug that appeared when the user tried to update a currently active mode, as well as one which asks the user to save an untitled, unmodified sketch…
- Removed a few redundant functions in another cleanup.
- Needed to test out all that I had done over the last 2-3 weeks or so on Linux as well. VirtualBox failed for some reason (sigh… different laptop…), and I had to resort to using a bootable pen-drive. And voila! Runs even better than on windows!For reference, here’s how to build Processing in Linux (of course, these steps might do more than required, but will provide a nice environment for build most software afterwards):
- Install Oracle JDK (not OpenJDK). Refer this very well described guide.
- Install ant: As simple as running sudo apt-get install ant in the terminal
- Install git: Again, sudo apt-get install git in the terminal
- Clone Processing: Run git clone https://github.com/processing/processing.git after changing the directory to wherever you
- ant the repo to be stored
- Build! : Change to <path_to_processing>/processing/build, and run ant run. Done!
The most difficult part, is, of course, setting up the Oracle JDK.
- Resolved a bug that prevents smooth auto-update on restart: The issue was due to an incorrect assumption that the folder in which the contribution was stored would have the same name as the contribution, and this name was previously used to check that the contribution had been installed by checking for the presence of the folder with its name. However, now, the properties file’s name parameter had to be matched with the name of the contribution to be installed to ensure that it actually had been.
- Ensured that in case the internet is not available during a restart when something has been flagged for update, the update takes place on the next restart instead (or the next, or the next, or…. whenever internet is available).
- Also started cleaning up this branch to get it ready for a PR: fixed a few stray commented out code lines, fixed indentation, etc. ; as well as changed the for-each loops to iterators.
- Added a check to ensure that all Sketches are saved before Restarting processing.
- Fixed up deletion of improper tmp folders when Installing a mode/tool: Did this by unlocking the jars, in a similar manner to which I removal of a contribution without restart was enabled. Also, ensured that all tmp folders left over are deleted on the next restart.
19 July – 20 July:
- Done with extensive GUI modifications: This primarily involved adding a feature, and ending up breaking something; fixing that and breaking something else; repeat :p . On a more serious note, here are a few images of how things now look, vs. how they were originally:
- Done with implementing a Restart Button, which enables a convenient Restart of Processing from within the Contributions Manager.
12 July – 18 July:
- Put the finishing touches (such as cleaning up, formatting, rebasing, etc.) on the branch where Update Manager shows on startup and submitted a Pull Request.
- Put the finishing touches (such as cleaning up, formatting, rebasing, etc.) on the branch where the Contribution Version number, the latest available version number and the date on which it was last updated show in the contribution manager and submitted a Pull Request.
- Almost done with auto-updating on restart, and extensive testing: Realized that a possible hitch is that if no internet is available, the contrib ends up getting deleted instead of updated, and .
- Also spent time experimenting with new looks for the contribution manager window.
- Still no laptop… Grrrrr.
7 July – 11 July: Working without a laptop is extremely tough, and my friend whose laptop I’ve been borrowing requires it now… Of all the times for my laptop to give me trouble, it chose now… And Dell’s service isn’t fantastic either. 3 visits by technicians, and 3 damaged motherboards, 1 damaged hard disk (good thing I managed to back it up 😐 ) and 1 damaged optical drive later, I’m still freakin’ waiting for spare parts… Meh. Anyways, rants aside, here’s what I’ve been up to:
- I’ve been working on an “auto-update on restart, in case the update fails without a restart (which will be thanks to the remove failing), which will work in much the same way as what now happens when remove without restart fails.
- Was in reeeeeal deep trouble when force pushing my changes on to Github. What happened was that I was working on multiple laptops (belonging to whomever had pity enough to lend me theirs :p ), with the repo in my hard disk. I finally borrowed the laptop of the friend whose lappy I used to routinely use up until a week ago, and simply pulled in all the recent changes of the branch I was working on. I then worked, amended my changes to the most recent commit, and force pushed. What I forgot was that there were other out-dated branches as well, and I had forgotten to specify the remote and the branch to which I wanted to do the force push, which meant that all branches present in the local repo got force pushed onto the origin! Ouch! Anyways, thankfully, these links helped me get back all the work I had accidentally deleted (which was a significant bit):
http://stackoverflow.com/questions/3973994/how-can-i-recover-from-an-erronous-git-push-f-origin-master In a nutshell, all that there is to do is to reset to the previous state, as recorded by reflog, and then *gulp* force push again (this time specifying the remote and branch names 😉 ).
3 July – 6 July:
- Laptop’s gone for the 3rd time now… Dell, why u do dis???
- Worked on update without restart: Updating a tool/mode without restart no longer requires a restart… Most of the time, at any rate…
- Tested out remove without restart some more, this time on a 32-bit Windows XP machine: Seems to work on Windows XP just fine, even better than on Windows 7/8… No laptop to try out Linux, though 😦
- Line endings, oooh boy: For some reason, all the line endings in a file got really messed up, and git showed the entire file (yep, every single line) as being modified. Resolving this was surprisingly tricky, and for reference, if anyone else faces this issue, here are a few links that helped me out: http://aruljohn.com/info/ctrlm/ http://adaptivepatchwork.com/2012/03/01/mind-the-end-of-your-line/
30 June-2 July:
- Removing without restart works for Tools as well now.
- Extensive testing of the Remove without restart that was undertaken on Windows shows that though remove occurs successfully most of the time, it fails on occasion. To account for this, I modified the remove without restart code so that in case remove without restart fails, i.e., if the Contribution Manager can’t delete the contribution folder, it removes the contribution on the next restart.
June 29: Removed the relevant tool from the Tools menu once removal was successful. Also managed to make Tools work when multiple editors are open. which involved iterating across all editors and closing the class loader of the Contribution and removing the appropriate tool from their contribTools, as well as removing all items from every editor’s Tool menu and rebuilding the menu. June 28:
- Found that the modes with keywords.txt file don’t remove properly. This was due to an unclosed BufferReader.
- Also managed to make Remove work for tools, provided only one editor window is open. This was extremely tricky, and involved closing the URLClassLoader of the ToolContribution to be removed from both the LocalContribution object as well as from the contribTools (since both the objects are different), as well as making the toolMenu null (possibly because the toolMenu was initialized with a ToolContribution object, though I’m not 100% sure of the exact reason).
- Made a pop-up display whenever a mode that the user is trying to update/remove is active in an open editor window.
- Remove initially worked for Tools without a restart (when there is only one tool), though a tool that was started can still be used after remove. Correcting this may be a little more difficult, since almost all tools don’t have a function to stop the running thread, and stopping them externally is not recommended. A possible solution will be to keep a track of open tools, and prevent the user from removing them.
- Found an issue where trying to change the Mode when there are unsaved changes doesn’t change the mode, but shows the mode as being changed in the modeMenu popup. Submitted a pull request resolving this issue here, where the issue was solved by selecting the correct mode explicitly in case there were unsaved changes in the sketch.
- More testing shows that Remove for Modes doesn’t work as smoothly as I had thought… For some reason, all modes with “keywords.txt” seem extremely reluctant to get removed, and the keywords.txt file is locked. Unlocking this should make mode removal run smoothly once and for all… I traced this down to a BufferedReader that had not been closed… Whew!
June 25: Today, I finished making the Update Manager display on start-up, and tested it out thoroughly to make sure everything works. June 24: Figured out the problem with update manager (why it doesn’t open on start-up): What was happening was that the previous hasUpdates() used allContributions, which was of type ArrayList<Contribution>, but actually consisted of a list of AvailableContribution objects, and AvailableContribution.isInstalled() always returns false, which means that the Update Manager would never show because it thought that there was nothing installed. To solve this, I used methods of the Base and Editor classes which accurately give all the libs/tools/modes installed. The checking for updates itself works well without any changes. I also learned that if you try something and neither get the result nor an exception, check for caught exceptions where the stack trace has not been printed! June 23: The properties file of a Contribution are no longer overwritten by the corresponding values from the contributions.txt file. The overwriting was done as a safe guard so that a wrong property didn’t mess up the Contributions Manager. However, this had the adverse effect of updating the properties file with possibly out-of-date information. The original issue is here, and the pull request, here. June 22:
- Looked through the processing.app.contrib code-base to see what all changes will be needed in order to have an update and an install without a restart. On the side, this helped me find the possible reason for this error, which is most probably this function being called.
- Since an update involves a removal followed by an install, thanks to yesterday’s changes, a restart is needed in an update only once now. Enabling the Update button, and ensuring that when it is clicked on, a removal (after, of course, unlocking the appropriate jar) happens first if it is a mode being updated, seems to work, i.e., Update with single restart works now.
- A freshly Installed mode seems to work (though a little buggy-ly).
- It seems that Tools don’t really need a restart, though the Contributions Manager says they do.
- Remove and Update in Contributions Manager: Remove now works fine, and a removed mode is now removed from the modeMenu pop-up that pops up on clicking on the mode arrow in the Editor Toolbar. Further, the method of close()-ing the (type-casted) URLClassLoader seems safe, since the only case when the ClassLoader is not instantiated with a URLClassLoader object is when there are no contributions in the first place, though there still is a fair bit of testing to be done. Remove even works when the mode that was to be removed was currently active in one of the editors. But this (being able to use a mode that has been removed) seems a little awkward, so, for now, I reverted to the original method of removal (request user to restart to remove the mode) when the mode to be removed was active in an open editor.
- Showing Last Updated Date in Contributions Manager: I just realized when testing this out that Java accepts the long as a parameter when initializing a Date object in milliseconds as opposed to seconds. So, I had to multiply the value with 1000, which solved an error that I failed to detect before: all dates show as 17 January, 1970.Here’s what the date + version number look like in Contributions Manager:
June 19-20: Ok. So I’ve started working on enabling the Update and Remove features of the Contributions Manager to work without requiring a restart. I managed to zero in on why a restart was required in the first place: the mode jars are loaded into a ClassLoader, which “locks ” the jars and prevents them from being removed. The solution is to unlock the jars. After struggling with trying to make the ClassLoader null and then calling the garbage collector (which didn’t work), I realized that the classloader could be typecasted into a URLClassLoader and then the close() method could be called. This worked, but here’s still lots left to do-
- Ensure present mode isn’t removed
- Ensure this is safe way of doing things
- Modify update as well
- Remove the removed mode from the modeMenu popup
- Test and ensure nothing unpleasant happens
- Extend this to tools as well
June 16-18: Here’s what I did these few days:
- Fixed incorrect line coloring for contribution listings: The line coloring for contribution listings would not display properly when a contribution was selected using the comboBox, or something was typed in the filterField. This was corrected by calling the updateColors() method every time one of these occurred.Here’s a quick before/after screenshot:
- Converted the lastUpdated field to have a String representing a long integer which represents Unix time, rather than a String that directly has the date in it. Also made changes to make how the Last Updated time was displayed neater.
- Tidied up my clone of Processing: A lot of changes had been done since I last pulled, and it seems that a few commits that I had puled had been rebased, which made things a little tricky. I ended up manually deleting those commits (via git rebase), and then rebasing all the commits I had made on top of an up-to-date origin (which involved a git reset –hard followed by a git rebase), and then force pushing the branch onto my online Github repository (since the repo showed that it was ahead by those 3 commits, I had to resort to a force push).
June 15: Added a lastUpdated to the Contribution object. The lastUpdated field is read from the contributions.txt file, and if present, the date when the contribution was last updated is displayed next to the version number. June 13-14: Worked on modifying the UI of the Contributions Manager so that the “New version available” message is right aligned. This was done by replacing a Box added at the South of the BorderLayout with a GridBagLayout. Here’s how things now look:
June 12: Checking out how best to modify the Contributions Manager so that the message seems more in tune with the “Update” button. (Laptop is down again. Lots of time spent on June 10-12 to set stuff up on a friend’s laptop, mostly due to slow, laggy internet… Sigh…) June 11: Contributions Manager now shows the latest version on the lib/tool/mode in its “New version available!” message. Here’s a screenshot:
June 10: Lots more adjustments to auto-save. Here’s a screenshot of how things finally look:
- Version numbers in Contribution Manager Windows: Added version numbers below each tool/mode/library in the respective Contribution Manager window.Here’s a screenshot:
- Read up some more on RSTA, ANTLR, preprocessors, etc.
- Contributions Manager: More familiarization with the Contributions Manager code base.
- AutoSave: Some adjustments to UI. Done with AutoSave.
- Compiled RSTA + Antlr4 demo, read up a little on RSTA, ANTLR, preprocessors, etc.
- Contributions Manager: Familiarization with the Contributions Manager code base.
- Present Background: Made the cursor into a hand when the color preview is moused over, and added a border to make it look nice. Done with adding Present’s background color to the Preferences Window.Here’s what the appropriate portion now looks like:
- AutoSave: Worked on the UI of the autosave. This primarily involved using a modal JDialog with a JPanel consisting of various components added to the JDialog.
June 6: The Conference: A meeting of Processing developers, mentors, and GSoCers to discuss a number of things, both related to GSoC as well as to the development of Processing in general. Unfortunately, I couldn’t see everyone via video, and the audio wasn’t clear the whole time (though everyone said they could hear me quite clearly) because though my temporary connection generally maxes out at around 512kbps , it decided to give me trouble that night, and gave me a peak speed of 150 kbps (note the small b) 😦 . MTS, this is all your fault. Ahhh, well… at least I got audio… Count your blessings 😉 June 5: Down with a fever. Thankfully didn’t last long. June 2-4:
- Present Background: Removed a pointless re-implementation of the ColorChooser class. Also added a Cancel button to this class, made some small UI changes.
- Auto-Save: Started implementing auto-save before PDE X. Auto-save involves showing the user a pop-up when they try to run an unsaved sketch telling them that their sketch is yet to be saved, and giving them an option to save t before running. Added the basic auto-save functionality, which I had already worked on before (which involved a call to (Debug)Editor.handleSave() method within the (Debug)Editor.prepareRun() method), as well as auto-save related options to the preferences.txt file.
June 1: Present Background: Changed the method of input slightly, so that the user now clicks on the color preview button to bring up a Color Selector window, and can also enter the hex color directly into the text field, which would then preview the color automatically in the color preview box as soon as a user enters a valid hex color value (of the form xxxxxx or #xxxxxx, x = 0-F). 30th May – 31st May: The background color wasn’t for the editor, but for the full-screen Present. Oops… Anyways, finished adding Present’s background color to the Preferences window. This primarily involved:
- Reading the value of run.present.bgcolor from preferences.txt and displaying the color presently selected.
- Showing the user a color chooser for him/her to choose a color.
- Writing the new color back to preferences.txt.Here are a few screenshots:
28th May – 29th May: Back in business 😀 . Worked on highlighting the current sketch- decided to go with a check mark, since making a menu item bold doesn’t work on Mac OS, probably because of its global menu structure. Here’s a screenshot:
22nd May – 27th May: Both laptop and internet connection messed up. Not. Cool. 21st May: Added editor background color to preferences.txt The background of the editor was originally part of the non-customizable theme. This property was now added into preferences.txt so that it is user customisable. The next step would be to add a color picker into the Preferences dialogue box to conveniently set the preferences from within Processing, similar to how the fonts can be set at present.
Here’s a screenshot: 20th – 21st May: Open Sketches Sub-Menu A sub-menu was added to the Sketches menu in Processing. The pull request is here. This involved:
- Finding out how Processing kept track of already open sketches: Processing does this via a List of Editor objects that automatically gets updated whenever a sketch is opened or closed.
- Populating the sub-menu: The Sketch menu required a MenuListener to be added to it so that it could be populated with whatever sketches are open at the time when a user clicks on the menu. The population can’t be done in advance because Lists don’t support adding a listener to it directly, and less direct methods, such as creating a custom ArrayList class would require too much modification of already implemented features.
- Bring to front
17th – 19th May: Completed GUI of REPL Mode (except colorization). This involved two main aspects:
- Implementing tabs for switching conveniently between the REPL Pane and the console panes. This had already been implemented in processing-experimental, and primarily involved understanding and modifying the code there.
- Implementing the REPL Pane: Involved creating a command prompt-style GUI JPanel (oxymoron-ic :p ) that could snugly replace the console pane. This required a prompt which could not be modified, and ensuring that one the user presses the Enter key, the previous lines can’t be modified. I implemented this with 2 JTextPanes, one modifiable and the other not, as well as by customizing the mouse listener and using caret and key listeners to make sure the user doesn’t sneakily modify the input that he/she provided in the previous command 😉 .
1st May: Looked through scravy’s REPL Java code base, played around with quil (especially its dynamic workflow) to get a feel of what the REPL mode should be like. Setting up quil on Windows was a little tricky, so I went about on Ubuntu: On Ubuntu:
- Use sudo apt-get install leiningen
- Type lein to ensure installation is successful
- Then, follow the instructions here
- Type lein repl, and into the REPL, enter this example
- To use quil’s dynamic workflow, follow this wiki