Re: Improved 'extract' command

2017-10-06 Thread vitalije

>
> i.e. the name I want to use for the node, `goTo`, is on the *second* 
>> line.  Just glanced and the code and see only the first line of the 
>> selection is passed to the pattern matching 
>>
>> Looks like (?ms) in a regex will put re into multi-line dot matches all 
>> mode, I guess just (?m) would be sufficient, so I *think* passing the 
>> whole selection to extractDef() and letting people set (?m) in their 
>> patterns would be sufficient and more importantly backwards compatible? 
>>
>> I am sorry, I haven't read your whole message  (it sims like I am also in 
mode of taking only first line in account :-) )

Yes, you are right. I was trying to change as little as possible, but I'd 
love if extractDef would allow multi-line regex patterns.
Vitalije

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone know how to update Leo's pypi index?

2017-10-06 Thread Matt Wilkie
Packaging a new release for Test PyPi

 (Windows syntax)


rd /s/q dist

rd /s/q build

python setup.py bdist_wheel

twine upload --repository-url https://test.pypi.org/legacy/ dist/*

pip install --index-url https://test.pypi.org/simple/ leo



Remove broken releases (still can't re-use identical version numbers and
file names though):

https://testpypi.python.org/pypi?%3Aaction=pkg_edit&name=leo










On Fri, Oct 6, 2017 at 1:46 PM, Matt Wilkie  wrote:

> With the help of https://blog.ionelmc.ro/2014/05/25/python-packaging/ and
> https://ep2015.europython.eu/conference/talks/less-known-
> packaging-features-and-tricks I have managed to get a Leo wheel
> distribution built and uploaded to Test PyPi. It installs and works on
> Linux Mint[0] 18.2 and Windows 7 x64.
>
> Please test with
>
> pip install --index-url https://test.pypi.org/simple/ leo
>
> which should fetch "leo-5.6.post3" (I had to hardcode a test version
> number because pypi doesn't allow re-use of same number)
>
> [0] On my linux box `leo` doesn't work from command line. I had to specify
> full path `python ~/.local/lib/python2.7/site-
> packages/leo/scripts/lunchLeo.py`)
>
> Pushed to setup branch as 8616d58
> 
> .
>
> Matt
>
>
> On Thu, Oct 5, 2017 at 11:18 PM, Matt Wilkie  wrote:
>
>> I uploaded a test release to Test PyPi, but it's broken. My suspicion is
>> that not all files are present in the distribution archive. I remember
>> struggling with Manifest and related instructions last time.
>>
>> To test install:
>>
>> pip install --no-binary :all: --index-url
>> https://test.pypi.org/simple/ leo
>>
>>
>> Result:
>>
>>
>> ~~~
>>
>> B:\apps\leo-editor>leoc.exe
>>
>> reading settings in D:\Matt\Dropbox\.leo\myLeoSettings.leo
>>
>> Note: sys.stdout.encoding is not UTF-8
>> See: https://stackoverflow.com/questions/14109024
>>
>> Leo 5.6
>> Not running from a git repo
>> Python 2.7.10, PyQt version 4.8.7
>> Windows 7 AMD64 (build 6.1.7601) SP1
>> ** isPython3: False
>> ** caching enabled
>>
>> Traceback (most recent call last):
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\Scripts\leoc-script.py",
>> line 9, in 
>> load_entry_point('leo==5.6.1', 'console_scripts', 'leoc')()
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\runLeo.py",
>> line 7
>> 1, in run
>> g.app.loadManager.load(fileName, pymacs)
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
>> line 2
>> 117, in load
>> ok = lm.doPostPluginsInit()
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
>> line 2
>> 733, in doPostPluginsInit
>> c1 = lm.openEmptyWorkBook()
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
>> line 2
>> 794, in openEmptyWorkBook
>> c = lm.loadLocalFile(fn, gui=g.app.gui, old_c=None)
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
>> line 2
>> 959, in loadLocalFile
>> c = lm.openFileByName(fn, gui, old_c, previousSettings)
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
>> line 2
>> 983, in openFileByName
>> previousSettings=previousSettings)
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
>> line 1
>> 233, in newCommander
>> return leoCommands.Commands(fileName, relativeFileName, gui,
>> previousSettings)
>>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-pac
>> kages\leo\core\leoCommands.py", l
>> ine 81, in __init__
>> c.finishCreate()
>>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-pac
>> kages\leo\core\leoCommands.py", l
>> ine 388, in finishCreate
>> c.frame.finishCreate()
>>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-pac
>> kages\leo\plugins\qt_frame.py", l
>> ine 2062, in finishCreate
>> f.top = g.app.gui.frameFactory.createFrame(f)
>>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-pac
>> kages\leo\plugins\qt_frame.py", l
>> ine 4554, in createFrame
>> self.createMaster()
>>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-pac
>> kages\leo\plugins\qt_frame.py", l
>> ine 4578, in createMaster
>> g.app.gui.attachLeoIcon(mf)
>>   File 
>> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\plugins\qt_gui.py",
>> lin
>> e 825, in attachLeoIcon
>> window.setWindowIcon(self.appIcon)
>> TypeError: QWidget.setWindowIcon(QIcon): argument 1 has unexpected type
>> 'NoneType'
>>
>>
>> ~~~
>>
>>
>> matt
>>
>>
>>
>>
>> On Thu, Oct 5, 2017 at 11:13 PM, Matt Wilkie  wr

Re: Improved 'extract' command

2017-10-06 Thread vitalije
I would not expect multi-line patterns to work (at least without some 
changes in code). AFAIR function extractDef tries only first line not whole 
selected region. Perhaps it can be changed to send whole selection to 
pattern checking. 
I can't check it until some day next week.
Vitalije

On Friday, October 6, 2017 at 4:22:17 PM UTC+2, Terry Brown wrote:
>
> On Sat, 16 Sep 2017 01:50:41 -0700 (PDT) 
> vitalije > wrote: 
>
> > Done at 41ebaba . 
> > 
> > Added support for `@data extract-patterns`. 
>
> This is great.  So now I'm wondering how we can extend extract to 
> handle defs like this: 
>
>   // set viewer time to time of selected node 
>   goTo = () => { 
>   this.drifterViz.gotoTime(new 
> Date(this.drifterViz.currentNode().gpstime)) 
>   } 
>
> i.e. the name I want to use for the node, `goTo`, is on the *second* 
> line.  Just glanced and the code and see only the first line of the 
> selection is passed to the pattern matching 
>
> Looks like (?ms) in a regex will put re into multi-line dot matches all 
> mode, I guess just (?m) would be sufficient, so I *think* passing the 
> whole selection to extractDef() and letting people set (?m) in their 
> patterns would be sufficient and more importantly backwards compatible? 
>
> Thoughts? 
>
> Cheers -Terry 
>
> > This setting should contain in body regex pattern definitions, one 
> > per line, which should capture prefered headline in group(1) from the 
> > first line of extracted text. For example: 
> > 
> > line containing '\s*(?:def|class)\s+(\w+)' (without appostrophe), 
> > will match python definitions of functions/methods and classes. 
> > 
> > User defined regex patterns are prepended to default list, so even if 
> > this setting is empty, Leo will extract definitions in: python, 
> > javascript, clojure, coffeescript. 
> > 
> > Note: if you need groups in pattern, make them with (?: ) syntax 
> > so that the headline is captured in group(1). In the example above 
> > first group that matches 'def' or 'class' keyword is surrounded with 
> > '(?:' and ')'  in order to skip this group from the output groups and 
> > let the second group to be captured at index 1. 'extract` command 
> > relies on this convention that headline should be captured in group 
> > at index 1. It is also possible to write several regex patterns and 
> > avoid all other groups except the one that captures headline. For 
> > example regex from above can be written in two lines like so: 
> > \s*def\s+(\w+) 
> > \s*class\s+(\w+) 
> > 
> > Vitalije 
> > 
>

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Anyone know how to update Leo's pypi index?

2017-10-06 Thread Matt Wilkie
With the help of https://blog.ionelmc.ro/2014/05/25/python-packaging/ and
https://ep2015.europython.eu/conference/talks/less-known-packaging-features-and-tricks
I have managed to get a Leo wheel distribution built and uploaded to Test
PyPi. It installs and works on Linux Mint[0] 18.2 and Windows 7 x64.

Please test with

pip install --index-url https://test.pypi.org/simple/ leo

which should fetch "leo-5.6.post3" (I had to hardcode a test version number
because pypi doesn't allow re-use of same number)

[0] On my linux box `leo` doesn't work from command line. I had to specify
full path `python
~/.local/lib/python2.7/site-packages/leo/scripts/lunchLeo.py`)

Pushed to setup branch as 8616d58

.

Matt


On Thu, Oct 5, 2017 at 11:18 PM, Matt Wilkie  wrote:

> I uploaded a test release to Test PyPi, but it's broken. My suspicion is
> that not all files are present in the distribution archive. I remember
> struggling with Manifest and related instructions last time.
>
> To test install:
>
> pip install --no-binary :all: --index-url
> https://test.pypi.org/simple/ leo
>
>
> Result:
>
>
> ~~~
>
> B:\apps\leo-editor>leoc.exe
>
> reading settings in D:\Matt\Dropbox\.leo\myLeoSettings.leo
>
> Note: sys.stdout.encoding is not UTF-8
> See: https://stackoverflow.com/questions/14109024
>
> Leo 5.6
> Not running from a git repo
> Python 2.7.10, PyQt version 4.8.7
> Windows 7 AMD64 (build 6.1.7601) SP1
> ** isPython3: False
> ** caching enabled
>
> Traceback (most recent call last):
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\Scripts\leoc-script.py",
> line 9, in 
> load_entry_point('leo==5.6.1', 'console_scripts', 'leoc')()
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\runLeo.py",
> line 7
> 1, in run
> g.app.loadManager.load(fileName, pymacs)
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
> line 2
> 117, in load
> ok = lm.doPostPluginsInit()
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
> line 2
> 733, in doPostPluginsInit
> c1 = lm.openEmptyWorkBook()
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
> line 2
> 794, in openEmptyWorkBook
> c = lm.loadLocalFile(fn, gui=g.app.gui, old_c=None)
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
> line 2
> 959, in loadLocalFile
> c = lm.openFileByName(fn, gui, old_c, previousSettings)
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
> line 2
> 983, in openFileByName
> previousSettings=previousSettings)
>   File 
> "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-packages\leo\core\leoApp.py",
> line 1
> 233, in newCommander
> return leoCommands.Commands(fileName, relativeFileName, gui,
> previousSettings)
>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-
> packages\leo\core\leoCommands.py", l
> ine 81, in __init__
> c.finishCreate()
>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-
> packages\leo\core\leoCommands.py", l
> ine 388, in finishCreate
> c.frame.finishCreate()
>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-
> packages\leo\plugins\qt_frame.py", l
> ine 2062, in finishCreate
> f.top = g.app.gui.frameFactory.createFrame(f)
>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-
> packages\leo\plugins\qt_frame.py", l
> ine 4554, in createFrame
> self.createMaster()
>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-
> packages\leo\plugins\qt_frame.py", l
> ine 4578, in createMaster
> g.app.gui.attachLeoIcon(mf)
>   File "C:\apps\win-python-2.7-x64\python-2.7.10.amd64\lib\site-
> packages\leo\plugins\qt_gui.py", lin
> e 825, in attachLeoIcon
> window.setWindowIcon(self.appIcon)
> TypeError: QWidget.setWindowIcon(QIcon): argument 1 has unexpected type
> 'NoneType'
>
>
> ~~~
>
>
> matt
>
>
>
>
> On Thu, Oct 5, 2017 at 11:13 PM, Matt Wilkie  wrote:
>
>> As of 277e60c
>> 
>> the gui launcher works too. I had a typo in the run invocation. So now
>> `leo` is for gui mode and `leoc` is console.
>>
>> On Thu, Oct 5, 2017 at 9:29 PM, Matt Wilkie  wrote:
>>
>>> I've pushed an update to the `setup.py` branch that works with pip
>>> install in my system (PyQt and Sip need to be installed already.):
>>>
>>> pip install --editable "b:\path\to\code\leo-editor-branch"
>>>
>>> This creates 2 launch files in PYTHONHOME\Scripts folder:
>>>
>>> leoc = console Leo
>>> leow = gui mode Leo
>>>
>>> Console mode still launches the GUI, but writes log output to a console
>>> shell window.
>>>
>>> Gui mode is broken. The launcher is created, but nothing hap

Re: Improved 'extract' command

2017-10-06 Thread Terry Brown
On Sat, 16 Sep 2017 01:50:41 -0700 (PDT)
vitalije  wrote:

> Done at 41ebaba .
> 
> Added support for `@data extract-patterns`.

This is great.  So now I'm wondering how we can extend extract to
handle defs like this:

  // set viewer time to time of selected node
  goTo = () => {
  this.drifterViz.gotoTime(new Date(this.drifterViz.currentNode().gpstime))
  }

i.e. the name I want to use for the node, `goTo`, is on the *second*
line.  Just glanced and the code and see only the first line of the
selection is passed to the pattern matching 

Looks like (?ms) in a regex will put re into multi-line dot matches all
mode, I guess just (?m) would be sufficient, so I *think* passing the
whole selection to extractDef() and letting people set (?m) in their
patterns would be sufficient and more importantly backwards compatible?

Thoughts?

Cheers -Terry

> This setting should contain in body regex pattern definitions, one
> per line, which should capture prefered headline in group(1) from the
> first line of extracted text. For example:
> 
> line containing '\s*(?:def|class)\s+(\w+)' (without appostrophe),
> will match python definitions of functions/methods and classes.
> 
> User defined regex patterns are prepended to default list, so even if
> this setting is empty, Leo will extract definitions in: python,
> javascript, clojure, coffeescript.
> 
> Note: if you need groups in pattern, make them with (?: ) syntax
> so that the headline is captured in group(1). In the example above
> first group that matches 'def' or 'class' keyword is surrounded with
> '(?:' and ')'  in order to skip this group from the output groups and
> let the second group to be captured at index 1. 'extract` command
> relies on this convention that headline should be captured in group
> at index 1. It is also possible to write several regex patterns and
> avoid all other groups except the one that captures headline. For
> example regex from above can be written in two lines like so:
> \s*def\s+(\w+)
> \s*class\s+(\w+)
> 
> Vitalije
> 

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.