non-QT / command line only?

95 views
Skip to first unread message

じょいすじょん

unread,
Nov 20, 2021, 2:44:32 AM11/20/21
to leo-editor
Is it possible to run without Qt dependencies at all, command line only?

Edward K. Ream

unread,
Nov 20, 2021, 5:08:08 AM11/20/21
to leo-editor
On Sat, Nov 20, 2021 at 1:44 AM じょいすじょん <dangerwillro...@gmail.com> wrote:
Is it possible to run without Qt dependencies at all, command line only?

Yes.  Start Leo with `leo --gui console`.  Leo's console gui uses npyscreen.

Edward

dangerwillro...@gmail.com

unread,
Nov 20, 2021, 8:12:13 AM11/20/21
to leo-e...@googlegroups.com



On Nov 20, 2021, at 19:08, Edward K. Ream <edre...@gmail.com> wrote:


--

Oh wow thanks. Is it possible to install without Qt ?
That would be a convenient thing indeed. 

zhaohe wang

unread,
Nov 20, 2021, 10:45:56 PM11/20/21
to leo-editor
Perhaps it can not run. Below is output when I run it in Ubuntu2004 server.

    python launchLeo.py --gui console

***

ubuntu@VM-0-4-ubuntu:~/leo-editor$ python launchLeo.py --gui console

Can not load pyQt5 or pyQt6

setting leoID from os.getenv('USER'): 'ubuntu'
cursesGui2.py: Tk module required for clipboard handling.
Traceback (most recent call last):

  File "/home/ubuntu/leo-editor/leo/core/leoApp.py", line 920, in createCursesGui
    from leo.plugins import cursesGui2

  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 49, in <module>
    from tkinter import Tk

ModuleNotFoundError: No module named 'tkinter'

can not create curses gui.

***

If install tkinter by 

    sudo apt install python3-tk
    python launchLeo.py --gui console

***

ubuntu@VM-0-4-ubuntu:~/leo-editor$ python launchLeo.py --gui console

Can not load pyQt5 or pyQt6

setting leoID from os.getenv('USER'): 'ubuntu'
Leo 6.6b1, master branch, build 95e7dbc7c4
2021-11-11 06:35:14 -0600

Uncaught exception in Leo...
Traceback (most recent call last):
  File "launchLeo.py", line 8, in <module>
    leo.core.runLeo.run()
  File "/home/ubuntu/leo-editor/leo/core/runLeo.py", line 90, in run
    g.app.loadManager.load(fileName, pymacs)
  File "/home/ubuntu/leo-editor/leo/core/leoApp.py", line 2295, in load
    g.app.gui.runMainLoop()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1552, in runMainLoop
    self.curses_app.run()
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 44, in run
    return npyssafewrapper.wrapper(self.__remove_argument_call_main)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 47, in wrapper
    wrapper_no_fork(call_function)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 106, in wrapper_no_fork
    return_code = call_function(_SCREEN)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 37, in __remove_argument_call_main
    return self.main()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 2734, in main
    g.app.gui.run()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1566, in run
    self.top_form = self.createCursesTop()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1294, in createCursesTop
    self.createCursesStatusLine(c, form)
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1425, in createCursesStatusLine
    box = form.add(StatusLineBox, name='Status Line', max_height=3)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/fmForm.py", line 445, in add_widget
    _w = widgetClass(self,
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgboxwidget.py", line 118, in __init__
    self.make_contained_widget()
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgboxwidget.py", line 147, in make_contained_widget
    self._contained_widget(
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 3244, in __init__
    super().__init__(*args, **kwargs)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgtextbox.py", line 34, in __init__
    super(TextfieldBase, self).__init__(screen, **keywords)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgwidget.py", line 315, in __init__
    self.set_size()
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgwidget.py", line 763, in set_size
    raise NotEnoughSpaceForWidget("Not enough space for requested size")
leo.external.npyscreen.wgwidget.NotEnoughSpaceForWidget: Not enough space for requested size

***

If install pyqt5

***

ubuntu@VM-0-4-ubuntu:~/leo-editor$ python launchLeo.py --gui console

setting leoID from os.getenv('USER'): 'ubuntu'
Leo 6.6b1, master branch, build 95e7dbc7c4
2021-11-11 06:35:14 -0600

Uncaught exception in Leo...
Traceback (most recent call last):
  File "launchLeo.py", line 8, in <module>
    leo.core.runLeo.run()
  File "/home/ubuntu/leo-editor/leo/core/runLeo.py", line 90, in run
    g.app.loadManager.load(fileName, pymacs)
  File "/home/ubuntu/leo-editor/leo/core/leoApp.py", line 2295, in load
    g.app.gui.runMainLoop()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1552, in runMainLoop
    self.curses_app.run()
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 44, in run
    return npyssafewrapper.wrapper(self.__remove_argument_call_main)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 47, in wrapper
    wrapper_no_fork(call_function)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/npyssafewrapper.py", line 106, in wrapper_no_fork
    return_code = call_function(_SCREEN)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/apNPSApplication.py", line 37, in __remove_argument_call_main
    return self.main()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 2734, in main
    g.app.gui.run()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1566, in run
    self.top_form = self.createCursesTop()
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1294, in createCursesTop
    self.createCursesStatusLine(c, form)
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 1425, in createCursesStatusLine
    box = form.add(StatusLineBox, name='Status Line', max_height=3)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/fmForm.py", line 445, in add_widget
    _w = widgetClass(self,
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgboxwidget.py", line 118, in __init__
    self.make_contained_widget()
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgboxwidget.py", line 147, in make_contained_widget
    self._contained_widget(
  File "/home/ubuntu/leo-editor/leo/plugins/cursesGui2.py", line 3244, in __init__
    super().__init__(*args, **kwargs)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgtextbox.py", line 34, in __init__
    super(TextfieldBase, self).__init__(screen, **keywords)
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgwidget.py", line 315, in __init__
    self.set_size()
  File "/home/ubuntu/leo-editor/leo/external/npyscreen/wgwidget.py", line 763, in set_size
    raise NotEnoughSpaceForWidget("Not enough space for requested size")
leo.external.npyscreen.wgwidget.NotEnoughSpaceForWidget: Not enough space for requested size

dangerwillro...@gmail.com

unread,
Nov 21, 2021, 12:22:57 AM11/21/21
to leo-e...@googlegroups.com
Oh thanks for that !
At least there seem to be some dependencies that might need more changes to when and if they are required. 
Kind of surprised to see tkinter and Qt both. I would hope a CLI only version could be standard Library only. 

At least this stack trace confirms some things and gives a start of what to expect. 

I will attempt to refactor it for myself and see if it can be tidied. 


On Nov 21, 2021, at 12:45, zhaohe wang <wangz...@gmail.com> wrote:

Perhaps it can not run. Below is output when I run it in Ubuntu2004 server.
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/X7Yp2it6hZQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/dc802c42-f97f-45ea-b242-e918c6e88796n%40googlegroups.com.

Edward K. Ream

unread,
Nov 21, 2021, 12:54:33 AM11/21/21
to leo-editor
On Sat, Nov 20, 2021 at 11:22 PM <dangerwillro...@gmail.com> wrote:
Oh thanks for that !
At least there seem to be some dependencies that might need more changes to when and if they are required. 
Kind of surprised to see tkinter and Qt both. I would hope a CLI only version could be standard Library only. 

I agree. I have just created #2343 for this issue. It should be straightforward to do.

Edward

dangerwillro...@gmail.com

unread,
Nov 21, 2021, 3:14:34 AM11/21/21
to leo-e...@googlegroups.com


Thank you for that one. 
Looks like install in setup.py would need to make Qt optional. 
At run time it should be easy enough to wrap Qt imports in try except blocks that tell users they need to install dependencies if the want to us that.

On Nov 21, 2021, at 14:54, Edward K. Ream <edre...@gmail.com> wrote:


--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/X7Yp2it6hZQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.

dangerwillro...@gmail.com

unread,
Nov 21, 2021, 3:20:33 AM11/21/21
to leo-e...@googlegroups.com
The beauty of optional Qt would be light weight installation for non GUI environments. Could be very nifty on raspberry pi type things or servers. The whole package could then be usable in space restricted environments like ssh sessions in some servers.

On Nov 21, 2021, at 17:14, dangerwillro...@gmail.com wrote:



Edward K. Ream

unread,
Nov 21, 2021, 8:25:14 AM11/21/21
to leo-editor
On Sun, Nov 21, 2021 at 2:14 AM <dangerwillro...@gmail.com> wrote:

Thank you for that one. 

You're welcome.
Looks like install in setup.py would need to make Qt optional. 

Hmm.  I don't want to make setup.py less useful for the great majority of users.
At run time it should be easy enough to wrap Qt imports in try except blocks that tell users they need to install dependencies if the want to us that.

There are likely easier ways to support the console gui at startup.

Edward

Edward K. Ream

unread,
Nov 21, 2021, 8:30:28 AM11/21/21
to leo-editor
On Sun, Nov 21, 2021 at 2:20 AM <dangerwillro...@gmail.com> wrote:
The beauty of optional Qt would be light weight installation for non GUI environments. Could be very nifty on raspberry pi type things or servers. The whole package could then be usable in space restricted environments like ssh sessions in some servers.

I don't need convincing :-)

Alas, the console (and browser) guis are much less capable than the qt gui.  You could call them toys," despite the large amount of work that has gone into them. Imo, these guis need project champions who actually use them and are willing and able to fix the many rough edges.

Edward
Reply all
Reply to author
Forward
0 new messages