Leo not starting with curses gui

125 views
Skip to first unread message

lewis

unread,
Aug 10, 2017, 6:19:42 PM8/10/17
to leo-editor
launchleo.py gui=console now doesn't start with the curses gui, but starts Leo Qt with a new file named 'gui=console'

Leo Log Window
Leo 5.5, build 20170810112756, Thu Aug 10 11:27:56 CDT 2017
Git repo info: branch = master, commit = f802fd5a022f
Python 3.6.2, PyQt version 5.9.1
Windows 10 AMD64 (build 10.0.15063) SP0
isPython3: True
caching enabled

Lewis

lewis

unread,
Aug 10, 2017, 7:43:48 PM8/10/17
to leo-editor
Oops, please ignore. I left out the --
launchleo.py --gui=console works fine.



xgid

unread,
Aug 10, 2017, 7:56:45 PM8/10/17
to leo-editor
I was just going to tell you this, but first I've tried to run it myself to be sure and... woops!

C:\dev\Leo-5.4>python launchLeo.py --gui=console

reading settings in C:\dev\Leo-5.4\leo\config\leoSettings.leo
reading settings in C:\Users\sysadmin\.leo\myLeoSettings.leo
Traceback (most recent call last):
  File "launchLeo.py", line 8, in <module>
    leo.core.runLeo.run()
  File "c:\dev\Leo-5.4\leo\core\runLeo.py", line 63, in run
    g.app.loadManager.load(fileName, pymacs)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2094, in load
    lm.doPrePluginsInit(fileName, pymacs)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2158, in doPrePluginsInit
    lm.createGui(pymacs)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2329, in createGui
    lm.createSpecialGui(gui_option, pymacs, script, windowFlag)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2344, in createSpecialGui
    g.app.createDefaultGui()
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 1049, in createDefaultGui
    app.createCursesGui()
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 1026, in createCursesGui
    import leo.plugins.cursesGui2 as cursesGui2
  File "c:\dev\Leo-5.4\leo\plugins\cursesGui2.py", line 106, in <module>
    class LeoBodyTextfield (npyscreen.Textfield):
AttributeError: 'NoneType' object has no attribute 'Textfield'

I suppose that I have some python package missing (I'm sure it's in the docs!), but... would it be difficult to show a nicer error saying what is missing for novices like me?

Edward K. Ream

unread,
Aug 14, 2017, 11:09:34 AM8/14/17
to leo-editor
On Thu, Aug 10, 2017 at 6:56 PM, xgid <xgdo...@gmail.com> wrote:
I was just going to tell you this, but first I've tried to run it myself to be sure and... woops!

  File "c:\dev\Leo-5.4\leo\plugins\cursesGui2.py", line 106, in <module>
    class LeoBodyTextfield (npyscreen.Textfield):
AttributeError: 'NoneType' object has no attribute 'Textfield'

I suppose that I have some python package missing (I'm sure it's in the docs!), but... would it be difficult to show a nicer error saying what is missing for novices like me?

​The traceback clearly indicates that the missing package is npyscreen.

Rev bd1de3d in master now should issue a warning if npyscreen fails.

Edward

Xavier G. Domingo

unread,
Aug 14, 2017, 3:55:05 PM8/14/17
to leo-e...@googlegroups.com
El 14/08/2017 a las 12:09, Edward K. Ream escribió:
Rev bd1de3d in master now should issue a warning if npyscreen fails.

Edward

Thanks Edward:

I have updated to the current master and checked that effectively a clearer Warning is shown now when npyscreen is missing. But installing npyscreen did not solve the problem for me:

c:\dev\Leo-5.5>pip install npyscreen
Collecting npyscreen
  Downloading npyscreen-4.10.5.tar.gz (94kB)
    100% |████████████████████████████████| 102kB 262kB/s
Building wheels for collected packages: npyscreen
  Running setup.py bdist_wheel for npyscreen ... done
  Stored in directory: C:\Users\sysadmin\AppData\Local\pip\Cache\wheels\f4\c7\06\144fa7319cd4ec5ddd62c6e677908a23f68af8dea305ab0f8d
Successfully built npyscreen
Installing collected packages: npyscreen
Successfully installed npyscreen-4.10.5

c:\dev\Leo-5.5>python launchLeo.py --gui=console

reading settings in C:\dev\Leo-5.5\leo\config\leoSettings.leo

reading settings in C:\Users\sysadmin\.leo\myLeoSettings.leo
loading npyscreen
ModuleNotFoundError("No module named '_curses'",)
ImportError("No module named 'npyscreen'",)
ModuleNotFoundError("No module named '_curses'",)
Can not import npyscreen
Warning: 'None' failed to import 'npyscreen'

Traceback (most recent call last):
  File "launchLeo.py", line 8, in <module>
    leo.core.runLeo.run()
  File "c:\dev\Leo-5.4\leo\core\runLeo.py", line 63, in run
    g.app.loadManager.load(fileName, pymacs)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2097, in load
    lm.doPrePluginsInit(fileName, pymacs)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2161, in doPrePluginsInit
    lm.createGui(pymacs)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2332, in createGui
    lm.createSpecialGui(gui_option, pymacs, script, windowFlag)
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 2347, in createSpecialGui
    g.app.createDefaultGui()
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 1050, in createDefaultGui
    app.createCursesGui()
  File "c:\dev\Leo-5.4\leo\core\leoApp.py", line 1027, in createCursesGui
    import leo.plugins.cursesGui2 as cursesGui2

  File "c:\dev\Leo-5.4\leo\plugins\cursesGui2.py", line 106, in <module>
    class LeoBodyTextfield (npyscreen.Textfield):
AttributeError: 'NoneType' object has no attribute 'Textfield'


Is it a problem with this specific npyscreen version?

Edward K. Ream

unread,
Aug 14, 2017, 5:15:11 PM8/14/17
to leo-editor
On Mon, Aug 14, 2017 at 2:54 PM, Xavier G. Domingo <xgdo...@gmail.com> wrote:
I have updated to the current master and checked that effectively a clearer Warning is shown now when npyscreen is missing. But installing npyscreen did not solve the problem for me:
ModuleNotFoundError("No module named '_curses'",)

ImportError("No module named 'npyscreen'",)
ModuleNotFoundError("No module named '_curses'",)
Can not import npyscreen
You also need to install curses. Try this page.

Edward

lewis

unread,
Aug 14, 2017, 6:24:32 PM8/14/17
to leo-editor
Is npyscreen actually required? If I do a pip list in my site-packages folder, npyscreen is not installed, yet Leo console works fine for me with Curses 2.2 installed.

Here is proposed documentation for addition to
Leo’s Console Gui http://leoeditor.com/console-gui.html

Leo's Console minimal dependencies are:

    Python 2.6 or later, including all Python 3.x versions.
    Curses

For windows, download and install curses from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
and then install using pip
[end]

Regards
Lewis

Xavier G. Domingo

unread,
Aug 15, 2017, 1:50:21 AM8/15/17
to leo-e...@googlegroups.com

Thanks lewis, this worked! It would be great to have this mini-guide added to the docs.

I can confirm that npyscreen installation is in fact not required.

I've seen two minor details, though:

  1. Mouse clicks do not work at all to switch nodes for me (At least, not as is suggested in the docs). I'm using ConEmu, may it be due to this?
  2. Some error messages are shown regarding the backlink plugin

The first error message of the backlink plugin shows this (highlighted) line:

and then the Traceback, which I finally was able to print in another console using the hack explained at Broadcast and Listening:

   pr: Traceback (most recent call last):
   pr:   File "c:\dev\Leo-5.4\leo\core\leoPlugins.py", line 341, in callTagHandler
   pr:     result = handler(tag, keywords)
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 961, in onCreate
   pr:     backlinkController(c)
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 105, in __init__
   pr:     self.loadLinksInt()
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 454, in loadLinksInt
   pr:     self.showMessage('Link info. loaded on %d nodes' % len(idsSeen))
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 639, in showMessage
   pr:     self.ui.showMessage(msg, color=color)
   pr: AttributeError: 'backlinkController' object has no attribute 'ui'


I suppose that this is the expected behaviour, but a backlink exception is thrown everytime I move from one node to another.

Would it be possible to have the backlink plugin "simply" completely refuse to install (load) when it detects that there's no ui in the first place so no other errors are shown after that? Or do you think that the plugin could be fixed to work with the console gui?

Thanks,

Xavier

Edward K. Ream

unread,
Aug 15, 2017, 9:39:08 AM8/15/17
to leo-editor

On Mon, Aug 14, 2017 at 5:24 PM, lewis <lewi...@operamail.com> wrote:


Here is proposed documentation for addition to
Leo’s Console Gui http://leoeditor.com/console-gui.html

​Thanks.  Rev 707a7b in master adds the new words.

Edward

Edward K. Ream

unread,
Aug 15, 2017, 9:45:34 AM8/15/17
to leo-editor

On Tue, Aug 15, 2017 at 12:50 AM, Xavier G. Domingo <xgdo...@gmail.com> wrote:


   pr: Traceback (most recent call last):
   pr:   File "c:\dev\Leo-5.4\leo\core\leoPlugins.py", line 341, in callTagHandler
   pr:     result = handler(tag, keywords)
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 961, in onCreate
   pr:     backlinkController(c)
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 105, in __init__
   pr:     self.loadLinksInt()
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 454, in loadLinksInt
   pr:     self.showMessage('Link info. loaded on %d nodes' % len(idsSeen))
   pr:   File "c:\dev\Leo-5.4\leo\plugins\backlink.py", line 639, in showMessage
   pr:     self.ui.showMessage(msg, color=color)
   pr: AttributeError: 'backlinkController' object has no attribute 'ui'


I suppose that this is the expected behaviour, but a backlink exception is thrown everytime I move from one node to another.


​Fixed at af7108 by simply suppressing the message.

Edward
Reply all
Reply to author
Forward
0 new messages