Re: qt-plugin branched merged with the trunk

2008-11-25 Thread leo_hag

Are these problems caused by the fact that  positions used by
scintilla refer to an index into the bye encoded string?

eg if  £5 (british pound is inserted into a scintilla widget the index
of the £ will be 0 and the index of the five will be 2 not 1 as
expected.

This applies to all positions with this widget (at least with the wx
version maybe the qt version is different.)

On Nov 24, 7:42 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 OK. Thanks.

 Vicent

 On Nov 24, 5:36 pm, Edward K. Ream [EMAIL PROTECTED] wrote:

  On Nov 24, 10:22 am, Edward K. Ream [EMAIL PROTECTED] wrote:

   On Fri, Nov 21, 2008 at 12:48 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] 
   wrote:
- accents are not working in the qt plugin when scintilla is used. If
qt-use-scintilla=False I can write this:

àáä (the same for the rest of vowels)

but if qt-use-scintilla=True when I enter the same sequence in the
keyboard I get:

`aaa (the same for the rest of vowels)

- the problem with the ñ character (reported previously too) is only
present in the qt plugin (both with and without scintilla)

   Thanks for this report.  I'll put it on the to-do list.

  I don't see any problems with accented characters with QTextEdit on
  either XP or Ubuntu.  I'm willing to believe that there are problems
  with QScintilla, but that widget isn't ready yet.  I'll let you know
  when it is time to report problems with QScintilla.

  Edward
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



demo of alternative tree widget for qt

2008-11-25 Thread leo_hag

Hi,

I was playing around with gtkOutlineDemo.py trying to get a handle on
both leo and qt.

So I converted it to qt which was easy, and finished off the lines and
edit widget that were missing from the original, not much more
difficult.

Slightly more difficult was wiring it into the qt plugin !

I have made a branch

lp:~leo-hag/leo-editor/hag-qt-plugin

with the modified qt plugin so you can test it out and see if it might
be a more suitable and flexible alternative than the current tree
widget.

It is based on an older version of the qt plugin but it is only for
demo purposes. Obviously it should be run with gui=qt. Also it is only
tested on windows and I haven't tried any unit test stuff yet.

If you don't like it, or prefer your own version, then nothing is
lost, it was a great learning experience and I enjoyed it!

I would also like to suggest that qt leo moves to using dockable
widgets for the layout instead of splitters. In addition, I would like
the minibuffer widget put in a toolbar so it can be moved around and
share space with other widgets.

I would very much like to contribute to this very exciting project. I
was thinking of doing my own gui calling it qtCub (pronounced cute
cub :) but it would probably be better if I helped with the official
version.  Perhaps you could suggest where I might best fit into your
project?

hag
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: demo of alternative tree widget for qt

2008-11-25 Thread Ville M. Vainio

On Tue, Nov 25, 2008 at 1:46 PM, leo_hag [EMAIL PROTECTED] wrote:

 I would also like to suggest that qt leo moves to using dockable
 widgets for the layout instead of splitters. In addition, I would like

That can already be done - leo loads the .ui file dynamically.

-- 
Ville M. Vainio
http://tinyurl.com/vainio

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: demo of alternative tree widget for qt

2008-11-25 Thread Edward K. Ream

On Tue, Nov 25, 2008 at 5:46 AM, leo_hag [EMAIL PROTECTED] wrote:

 I was playing around with gtkOutlineDemo.py trying to get a handle on
 both leo and qt.

 So I converted it to qt which was easy, and finished off the lines and
 edit widget that were missing from the original, not much more
 difficult.

Thanks for this work.  I'll look at it later this week.  I'm about to
leave for the airport now.

It would be simpler to base any new version on the present code:
otherwise you risk trying to keep pace with what I have just done.

There is only one aspect of the tree widget that I am considering
improving.  Rather than redrawing the entire tree, the widget should
redraw only needed sections.

Just a couple of days ago I saw how to do so cleanly.  The essential
part of the redrawing algorithm is drawing a list of siblings.  If the
to-be-drawn siblings match the existing sibs, do nothing.  Otherwise,
the algorithm can try to be clever by detecting inserted, deleted or
moved siblings, or the algorithm can simply redraw all the siblings,
along with their *entire* subtrees.

This scheme is simple, and will be *much* more efficient than the
present scheme.  Furthermore, no redraw will ever be needed when a
tree item is expanded.

 I would also like to suggest that qt leo moves to using dockable
widgets for the layout instead of splitters.

I'd like to see a demo of that.

 I would like the minibuffer widget put in a toolbar so it can be moved around 
 and
share space with other widgets.

I don't see the utility of that, but again, a demo would be good.

 Perhaps you could suggest where I might best fit into your project?

Base any demo on the existing plugin.

Edward

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Trying QT gui

2008-11-25 Thread tfer

The work around is obvious enough, just position and drag the borders
to get a maximum sized window for the non-maximized window, then the
effects of moving around in the tree go unnoticed.

Tom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Demo qt gui using docking widgets instead of splitters

2008-11-25 Thread leo_hag

Hi

I have put a quick and dirty demo of a qt leo using docking widgets
instead of splitters as the layout components.  I used this as a test
bed to help me understand leo and qt before I started hacking about
with the real thing.

This demo is availiable in the  lp:~leo-hag/leo-editor/hag-qt-plugin
 branch.

The code is in leo\test\qtOutlineDemo.py.  It is not a real leo just a
demo which uses leoBridge to get the data.

Initially the layout is the same as standard leo, but try dragging the
log pane and outline pane arround near the various edges of the window
to see the various docking features availiable in qt.

Any number of predefined layouts could be set for the user to choose
from and perhaps the user could be allowed to define his own standard
layouts.

The tree widget can be seen in real use by running the leo from this
branch whith --gui=qt. Note again this is for demo purposes and not
for merging.


hag
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Demo qt gui using docking widgets instead of splitters

2008-11-25 Thread Ville M. Vainio

On Tue, Nov 25, 2008 at 9:03 PM, leo_hag [EMAIL PROTECTED] wrote:

 This demo is availiable in the  lp:~leo-hag/leo-editor/hag-qt-plugin
  branch.

This can be betrayingly simple (that's how qt ui started, i.e. in qleolite).

You can do this in real leo by just opening qt_main.ui in ui designer,
and changing the widgets to be docked instead of being split by a
splitters. That kind of implementation is also directly usable by the
real leo.

I'm afraid using a custom tree widget would not be technically viable
- you immediately lose the ability to benefit from any enhancements
tree widget will receive (as implemented by the qt developers) in the
future, and it will most likely be slower as well.

-- 
Ville M. Vainio
http://tinyurl.com/vainio

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Getting stdout out of IPython console

2008-11-25 Thread Ville M. Vainio

On Tue, Nov 25, 2008 at 8:54 PM, tfer [EMAIL PROTECTED] wrote:

 No, but since that is how I got this branch of Leo, I'll go ahead and
 download this when I get home.

Great. If that still doesn't work:

- Ensure that you are not using old version of ipy_leo (left over from
old ipython installation).
- Paste the block that doesn't work.

-- 
Ville M. Vainio
http://tinyurl.com/vainio

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Is the trunk busted?

2008-11-25 Thread leo_hag

The nav_buttons plugin will not load and the qt.gui barely works at
all!

In addition, when I ran leo on a new computer before setting up an id,
leo crashed before it even started.

C:\hag\leo\repos\leo-editorlaunchLeo
Traceback (most recent call last):
  File C:\hag\leo\repos\leo-editor\launchLeo.py, line 8, in module
leo.core.runLeo.run()
  File C:\hag\leo\repos\leo-editor\leo\core\runLeo.py, line 88, in
run
initApp(verbose)
  File C:\hag\leo\repos\leo-editor\leo\core\runLeo.py, line 269, in
initApp
g.app.setLeoID(verbose=verbose)
  File C:\hag\leo\repos\leo-editor\leo\core\leoApp.py, line 545, in
setLeoID
g.app.createTkGui(startup)
  File C:\hag\leo\repos\leo-editor\leo\core\leoApp.py, line 306, in
createTkGui
leoPlugins.loadOnePlugin ('tkGui',verbose=True)
  File C:\hag\leo\repos\leo-editor\leo\core\leoPlugins.py, line 386,
in loadOnePlugin
warn_on_failure = g.app.config.getBool
(c=None,setting='warn_when_plugins_fail_to_load')
AttributeError: 'NoneType' object has no attribute 'getBool'

hag
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Demo qt gui using docking widgets instead of splitters

2008-11-25 Thread leo_hag

 This can be betrayingly simple (that's how qt ui started, i.e. in qleolite).

Tell me about it! I only played at conveting the gtk demo because it
seemed easy and I wanted an excercise to help me learn qt, now I'm
hooked and passionate.


 I'm afraid using a custom tree widget would not be technically viable
 - you immediately lose the ability to benefit from any enhancements
 tree widget will receive (as implemented by the qt developers) in the
 future, and it will most likely be slower as well.

Have you tested it yet? It does loads of things the current widget can
not do and it seems pretty fast to me.

Try doing expand all nodes and then collapse all nodes.

If you decide the current widget is better fine.  But you will have to
show me a working widget before
I am convinced. At the moment the custom widget out performs the
native widget by miles. And it doesn't need any nasty hacks!

By the way I have already included the tree widget in the qt plugin in
the hag branch, run leo with gui=qt in this branch and you will see it
working. Not technically feasable indeed :-) I'm glad no one told
Edward that when he started leo!

Hag
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Demo qt gui using docking widgets instead of splitters

2008-11-25 Thread Ville M. Vainio

On Tue, Nov 25, 2008 at 9:44 PM, leo_hag [EMAIL PROTECTED] wrote:

 Try doing expand all nodes and then collapse all nodes.

That was immediate on qleolite as well, when it was still using
leoBridge. The core imposes requires some things to be done, and
that's what takes the time.

 I am convinced. At the moment the custom widget out performs the
 native widget by miles. And it doesn't need any nasty hacks!

Again, the same was with qleolite...

 By the way I have already included the tree widget in the qt plugin in
 the hag branch, run leo with gui=qt in this branch and you will see it
 working. Not technically feasable indeed :-) I'm glad no one told
 Edward that when he started leo!

I don't say it isn't doable - just that it would be a bad idea IMHO
(but that's just MHO), in that it's better to put the work into making
a normal tree widget work well.

Of course code does speak louder than words, and you seem to be doing
great, but just out of curiosity - what does your tree widget do that
QTreeWidget doesn't?

Also, attach screeshots for those who can't test it right now ;-)

-- 
Ville M. Vainio
http://tinyurl.com/vainio

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Demo qt gui using docking widgets instead of splitters

2008-11-25 Thread jkn



On Nov 25, 7:03 pm, leo_hag [EMAIL PROTECTED] wrote:

 The code is in leo\test\qtOutlineDemo.py.  It is not a real leo just a
 demo which uses leoBridge to get the data.

I think you mean leo\plugins\qtOutlineDemo.py?  # s/\\/\/ to suit...

Thanks for the docking demo. I for one think I prefer the minibuffer
at the top, as has already been discussed somewhat.

J^n
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



curses GUI and OPML

2008-11-25 Thread Berend

hi all,

i put:

leoOPML

in a node with headline: @enabled-plugins, in file ~/myLeoSettings.leo
but i cant seem to find the OPML read/write command in a menu?
Where should i look it this is working? (used '.py' suffix too)

I was also interested in using the curses GUI but i gathered that is
only used to develop a Py3k branch?


Berend

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Previous and next similar word completer

2008-11-25 Thread vitalije

Hello everyone.
In editors that I have used before discovering Leo there were commands
for completing a word with similar word either before or after
insertion point. I could not find those commands in Leo so I have
written them. In case that anybody would like to use them here are
copies of those two nodes.
CUT FROM HERE
?xml version=1.0 encoding=utf-8?
?xml-stylesheet ekr_test?
leo_file
leo_header file_format=2/
vnodes
v t=vitalije.20081125152732.3vh@command complete-previous/vh
v t=vitalije.20081125152732.4vhWordCompleter/vh
v t=vitalije.20081125152732.5 a=Evhcomplete_word/vh
v t=vitalije.20081125152732.6vhlt;lt;backward searchgt;gt;/
vh
v t=vitalije.20081125154636.1vhlt;lt;counter checkgt;gt;/
vh/v
v t=vitalije.20081125152732.7vhlt;lt;clean up and
exitgt;gt;/vh/v
/v
v t=vitalije.20081125152732.8 a=Evhlt;lt;forward
searchgt;gt;/vh
v t=vitalije.20081125154636.1/v
v t=vitalije.20081125152732.7/v
/v
/v
v t=vitalije.20081125152732.9vhacceptable_word/vh/v
v t=vitalije.20081125152732.10vhundo_replacement/vh/v
v t=vitalije.20081125152732.11vhredo_replacement/vh/v
v t=vitalije.20081125152732.12vhexit/vh/v
v t=vitalije.20081125152732.13vhrun/vh/v
v t=vitalije.20081125152732.14vhadjust/vh/v
/v
v t=vitalije.20081125152732.15vhgetCurrentWord/vh/v
/v
/vnodes
tnodes
t tx=vitalije.20081125152732.3wordsep = u'., -+\n\r[]{}lt;gt;=-
+*amp;[EMAIL PROTECTED]\'?/\\|^()~`:;'
word_completer_key = 'back_word_completer'
@others
completer = g.app.config.get(c,word_completer_key,'WordCompleter')
if completer is None:
completer = WordCompleter(p,c,back=True)
g.app.config.set(c,word_completer_key,'WordCompleter',completer)
completer.run()
else:
completer.adjust(p, c.frame.body.getInsertPoint())
completer.complete_word()
/t
t tx=vitalije.20081125152732.4class WordCompleter:
def __init__(self, p, c, back=True):
self.p = p.copy()
self.c = c
self.back = back
self.pos = -1
@others
/t
t tx=vitalije.20081125152732.5def complete_word(self):
txt = self.chunk
word = self.word
try:
if self.back:
lt;lt;backward searchgt;gt;
else:
lt;lt;forward searchgt;gt;
except:
self.exit()
g.es_exception()/t
t tx=vitalije.20081125152732.6p = self.search_pos
start = -1
counter = 0
while p:
lt;lt;counter checkgt;gt;
i = txt.rfind(word, 0, start)
if i == -1:
p.moveToThreadBack()
if p:self.chunk = txt = p.bodyString()
start = -1
else:
if self.acceptable_word(i, txt, word):
self.chunk = txt[:i+len(word)-1]
return
start = i+len(word)-1
lt;lt;clean up and exitgt;gt;/t
t tx=vitalije.20081125152732.7if len(self.tried) gt; 1:
# there was some tries so we need to restore
self.c.setBodyString(self.p, self.before+self.word+self.after)
self.c.frame.body.setInsertPoint(self.pos)
return self.exit()/t
t tx=vitalije.20081125152732.8p = self.search_pos
start = 0
counter = 0
while p:
lt;lt;counter checkgt;gt;
i = txt.find(word, start)
if i == -1:
p.moveToThreadNext()
if p:self.chunk = txt = p.bodyString()
start = 0
else:
if self.acceptable_word(i, txt, word):
self.chunk = txt[i+1:]
return
start = i+1
lt;lt;clean up and exitgt;gt;/t
t tx=vitalije.20081125152732.9@ if found word for the first time
then try it
@c
def acceptable_word(self, i, txt, word):
if i == 0 or wordsep.find(txt[i-1]) != -1:
j = i+len(word)
while j lt; len(txt) and wordsep.find(txt[j]) lt; 0:
j += 1
nword = txt[i:j]
if nword not in self.tried:
self.tried[nword] = 1
u = self.c.undoer
bunch = u.createCommonBunch(p)
bunch.oldBody = p.bodyString()
bunch.insertPos = self.pos
# Set the type amp; helpers.
bunch.kind = 'node'
bunch.undoType = 'complete word'
bunch.undoHelper = self.undo_replacement
bunch.redoHelper = self.redo_replacement
bunch.newBody = newBody = self.before+nword+self.after

self.c.setBodyString(self.p, newBody)
self.c.frame.body.setInsertPoint(self.pos)

bunch.dirtyVnodeList = [p.v]
bunch.newChanged = u.c.isChanged()
bunch.newDirty = p.isDirty()
bunch.newMarked = p.isMarked()

u.pushBead(bunch)

return True
return False
/t
t tx=vitalije.20081125152732.10def undo_replacement(self):
u = self.c.undoer; c=self.c; p=u.p
bunch = u.getBead(u.bead)
c.setBodyString(p, bunch.oldBody)
c.frame.body.setInsertPoint(bunch.insertPos)/t
t tx=vitalije.20081125152732.11def redo_replacement(self):
c = self.c; u=c.undoer; bunch=u.getBead(u.bead+1)
c.setBodyString(bunch.p, bunch.newBody)
c.frame.body.setInsertPoint(bunch.insertPos)/t
t tx=vitalije.20081125152732.12def exit(self):
# this was used during