This atttempt to fix issue #35 is a failure.

The gnx "time stamp" is set when the LeoBridge controller is created.
At this point, there is no .leo file.  The .leo file open occurs later
on a call to the LeoBridge controller instance.  Hence, the delay in
.leo file open fails to affect the "time stamp."
Revert "This attempt to fix issue #35 is a failure."

This reverts commit ee22510d11d9e855f0bf40245fe0d561025a84b4.
Now I will try another fix.
Fix to the two-sessions-with-equal-time-stamps problem.
The Problem

Whenever two Leo-Editor "sessions" on the same computer with same user have the same gnx "time stamp" duplicate node GNX's can occur.

I have demonstrated that this occurs when using leoBridge.  But this demonstration requires many things to happen in a one-second window.  Hence, it does not show that the "duplicate time stamp" (and hence, duplicate GNX) problem can occur when using the Leo-Editor GUI.

Now, consider what happens when local time is not monotonically increasing--and the local time is sometimes predictably and sometimes unpredictably non-monotonic.  For example, it is predictably non-monotonic every year when local time goes off daylight savings time and local time goes back a full hour.  This creates a huge window and allows Leo-Editor GUI to encounter the duplicate "time stamp" problem.

Local time is unpredictably not monotonically increasing because almost everyone sync's their computer's time with an atomic clock accessed over the Internet.  Most people do this syncing automatically in the background.  Hence, it occurs unpredictably.  The number of seconds the clock is set back is also unpredictable. It depends on how fast the computer's clock is and how long since the last sych.  When someone returns from a vacation, the correction is probably larger than usual.

I believe that both the predictable and the unpredictable "setting back" of local time could cause both leoBridge and Leo-Editor GUI to encounter the duplicate time stamp problem.  Demonstrating my claims is beyond my abilities.  I admit the likelihood of encountering the problem due to non-monotonically increasing local time is very, very small.

The Fix

The problem can be fixed by forcing the time stamp to be monotonically increasing--even when local time is not.  I implemented this with about ten lines of code in leo-editor/leo/core/LeoPyRef.leo#Code-->Core classes-->@file leoNodes.py-->class NodeIndices-->ni.setTimeStamp.  My fix communicates the last time stamp from one Leo-Editor process to the next Leo-Editor process by putting the last time stamp in the Leo-Editor "globals" cache.  I hope this is an allowed use of the cache and that I did it in a right or nearly-right way.

Demonstrating the Fix

To demonstrate that the fix really works, in setTimeStamp() set trace=False and prtF=True, then run my bug demonstration program (hrngpM2.py) till you see this console output:

$ ./hrngpM2.py
lastTimeStamp=20141008161341
newTimeStamp=20141008161511
file not found: /home/ldi/git/leo_experiments/hidden_root_tsts/test1.leo. creating new window
lastTimeStamp=20141008161511
Time in Past=20141008161511
newTimeStamp=20141008161512

** isPython3: False
Leo 4.11 final, build 20141007141947, Tue Oct  7 14:19:47 CDT 2014
Git repo info: branch = 35, commit = e0e8d22fb52a
Python 2.7.6, LeoGui: dummy version
linux2
reading settings in /home/ldi/git/leo_experiments/hidden_root_tsts/test1.leo
wrote recent file: /home/bob06/.leo/.leoRecentFiles.txt
2014-10-08 16:15:12 /home/ldi/git/leo_experiments
$

The "Time in Past" line shows that the fix code was executed.

I don't use trace to demonstrate the fix because trace does not produce any output from the hrngpS2.py process.  Could someone explain to me why this is so?

The Fix and Going off Daylight Savings Time

During the repeated hour after going off daylight savings time, each new Leo-Editor session gets a time stamp one second later than the last session's.  After the repeated hour, the time stamp becomes the true local time again.

LeoBridge Sometimes Leaves the Leo-Editor file "open"

The demonstration of this bug also demonstrates that LeoBridge Sometimes Leaves the Leo-Editor file "open".  For a simpler demonstration see Issue #?.
Added support for continuation lines.  All my tests, as do all unit tests.

Leo build: 20141009183903
Added leo/external/PythonTidy.py.  This is likely to form the basis of Leo's beautify command.

Leo build: 20141010075053
Added leo/external/PythonTidy.py to LeoPyRef.leo.

Leo build: 20141010075846
Switch from GIF to png for tree icon box

To address issues with some Qt installs not rendering the GIFs

Leo build: 20141010090626
Pushed latest PythonTidy changes and new beautify code that optionally uses tidy.
To enable, change "if 0" to "if 1" in prettyPrintNode.

Leo build: 20141010091000
Merge branch 'master' of https://github.com/leo-editor/leo-editor

Conflicts:
	leo/core/commit_timestamp.json

Leo build: 20141010091422
fix icon box colors

Apparently imagemagick doesn't preserve grey properly, only
change I made was re-converting the images with graphicsmagick
instead

Leo build: 20141010093627
tidy now retains comments :-)  Played with several preference.  Tidy has trouble with blank lines near comments.  I'm on it.

Leo build: 20141010094558
Merge

Leo build: 20141010095319
Enabled tidy by default.  It already works better than the legacy code.
To do:
- Leo options instead of hard-coded constants.
- Better handling of blank lines around comments.  There be bugs...

Leo build: 20141010095853
Tidy now supports Leo preferences:
- Added c argument (main sets it to None) to tidy_up.
- tidy_up calls set_args if c exists.
- Added the following settings to leoSettings.leo in @settings-->Command options-->Beautify command settings
    @bool tidy_add_blank_lines_around_comments =True
    @bool tidy_double_quoted_strings = False
    @bool tidy_keep_blank_lines = True
    @bool tidy_left_adjust_docstrings = False
    @int  tidy_lines_before_split_lit = 2
    @int  tidy_seps_before_split_line = 8

Leo build: 20141010103642
tidy-based beautify now handles blanks lines properly.
That it, is honors @bool tidy_add_blank_lines_around_comments and @bool tidy_keep_blank_lines

Leo build: 20141010133707
Merge pull request #71 from SegundoBob/issues/35

Issues/35 - Strictly increasing time stamp fix to Duplicate GNX bug
Updated project notes for the new beautify.

Leo build: 20141010140951
Merge branch 'master' of https://github.com/leo-editor/leo-editor
Merge the "Strictly increasing time stamp fix" into branch master.
Merge remote-tracking branch 'upstream/master'