Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 11:28 AM, Ville M. Vainio wrote:

>
> On Thu, Jun 18, 2009 at 7:02 PM, Edward K. Ream
> wrote:
>
> No, QString is a real unicode string. QByteArray is what qt uses for
> binary data (e.g. QString has toUtf8 that gives QByteArray).
>

If QString is, in fact, a (wrapper around) a unicode string, it should be
possible to convert to a proper Python unicode string without specifying an
encoding.  How is that done?

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: What to do about the windows installer?

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 2:07 PM, Ville M. Vainio  wrote:

>
> FWIW, I (briefly) tried setup.py bdist_wininst with bad results.
> setup.py is most useful right now for direct leo installation from
> source (setup.py install) or debian packaging.
>
> Since nobody is actively supporting any kind of windows installer, it
> might be better to just instruct windows users to run launchLeo.py
> from source distribution.


I agree.  The windows installer is causing more problems than it's worth.

Unless I hear strenuous objections, along with practical solutions to the
present installer woes, I will remove the installer stuff from the b2
distribution.  This will necessitate revisions to the installation notes and
FAQ.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: B2 - Ok to fix language definitions?

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 11:26 AM, TL  wrote:

>
> Unit tests passed.
> Trunk updated to Rev 2054


Thanks.  Got it.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: 2059 doesn't start up with qt GUI

2009-06-18 Thread znafets

ok, thanks then ... let's wait

-S

On 18 Jun., 19:00, "Ville M. Vainio"  wrote:
> On Thu, Jun 18, 2009 at 9:53 PM, znafets wrote:
> > From PyQt4 import Qsci fails with segmentation fault
>
> Obviously not leo bug then. As you saw, I forwarded this to scintilla
> mailing list, let's see if it evokes some kind of reaction...
>
> --
> Ville M. Vainiohttp://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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: What to do about the windows installer?

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 4:14 PM, Edward K. Ream wrote:

>> The modified installer also checks to make sure that it does not break
>> in various ways.
>
> I'll be happy to look at the installer script, but it's not clear that
> we will ever go back to using nsis.  I would prefer to make @button
> make work :-)

FWIW, I (briefly) tried setup.py bdist_wininst with bad results.
setup.py is most useful right now for direct leo installation from
source (setup.py install) or debian packaging.

Since nobody is actively supporting any kind of windows installer, it
might be better to just instruct windows users to run launchLeo.py
from source distribution.

py2exe would be cool, but probably very incompatible with our plugin
loading system.

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: 2059 doesn't start up with qt GUI

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 9:53 PM, znafets wrote:

> From PyQt4 import Qsci fails with segmentation fault

Obviously not leo bug then. As you saw, I forwarded this to scintilla
mailing list, let's see if it evokes some kind of reaction...

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: 2059 doesn't start up with qt GUI

2009-06-18 Thread znafets

>From PyQt4 import Qsci fails with segmentation fault
Eric start yields this:
eric
Traceback (most recent call last):
  File "/usr/share/eric/modules/eric4.py", line 43, in 
from KdeQt.KQApplication import KQApplication
  File "/usr/share/eric/modules/KdeQt/__init__.py", line 20, in

import Preferences
  File "/usr/share/eric/modules/Preferences/__init__.py", line 26, in

from PyQt4 import Qsci
RuntimeError: the sip module implements API v4.0 but the �� module
requires API v3.8

So obviously there was some change of the Python sip API, what does
that mean for leo ?

best
Stefan

On 18 Jun., 12:51, "Ville M. Vainio"  wrote:
> On Thu, Jun 18, 2009 at 3:43 PM, znafets wrote:
> > actually yes it is the same on Karmic, I have it installed (vers.
> > 2.3.2-1.1ubuntu)
>
> > Any other ideas ?
>
> Try this on plain python prompt:
>
> from PyQt4 import Qsci
>
> Does it fail, and how?
>
> Can you try installing eric4 and seeing if it works.
>
> --
> Ville M. Vainiohttp://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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: active_path question

2009-06-18 Thread Kent Tenney

On Thu, Jun 18, 2009 at 10:26 AM, Ville M. Vainio wrote:
>
> On Thu, Jun 18, 2009 at 6:19 PM, Kent Tenney wrote:
>
>> Great service!
>>
>> Traceback is gone, but dclick on folder name seems to do nothing,
>> as I understand the "About" it should be populated with the contents
>> of the folder.
>
> alt-x act-on-node

Cool, I forgot that minibuffer commands are used to ease dclick overload.

Thanks,
Kent

>
>
> --
> 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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 7:28 PM, Ville M. Vainio wrote:

> No, QSting is a real unicode string. QByteArray is what qt uses for
> binary data (e.g. QString has toUtf8 that gives QByteArray).

BTW, this is not mere speculation; I work with C++ Qt on my day job
currently, and the distinction with bytes and strings is more concrete
in that environment (like it is in python3).

I still think the aim should be to *reduce* the amount of toUnicode
calls, not increase them.

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 7:02 PM, Edward K. Ream wrote:

>> Yeah, that's why we shouldn't use g.toUnicode with QStrings (i.e. we
>> shouldn't change unicode() to g.toUnicode in qt ui).
>
> These kind of details are why there is a separate g.app.gui.toUnicode
> wrapper in the qt plugin.

Let's call it something else than toUnicode then, to avoid the
confusion. We need a version that never decodes, and use that as much
as possible.


> Thus, it appears that QString is an encoded string, **not** a unicode
> character (at least on xp).  That is, s2 is a wrapper for a utf-8 encoded

No, QSting is a real unicode string. QByteArray is what qt uses for
binary data (e.g. QString has toUtf8 that gives QByteArray).


> My hair is turning ever grayer...Maybe this will work better for Py3k??

It works better with Py3k in that it fails earlier and more often :-).
But we should be very strict about bytes/unicode distinction already.

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: B2 - Ok to fix language definitions?

2009-06-18 Thread TL

Unit tests passed.
Trunk updated to Rev 2054

--~--~-~--~~~---~--~~
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 10:24 AM, Ville M. Vainio wrote:

>
> > Once we have a QString, all our problems are solved.  A QString is
> > simply a wrapper for a unicode object.  As such, there are is no
> > decoding to be done because unicode objects have no encoding!
>
> Yeah, that's why we shouldn't use g.toUnicode with QStrings (i.e. we
> shouldn't change unicode() to g.toUnicode in qt ui).


These kind of details are why there is a separate g.app.gui.toUnicode
wrapper in the qt plugin.

But allow me to disagree with myself :-)  It appears that QString is *not* a
wrapper from unicode objects.  I ran the following script on xp:

QQQ

@first # -*- coding: utf-8 -*-

import PyQt4.QtCore as QtCore
import PyQt4.QtGui as QtGui

s0 = unicode('La Peña','utf-8')
print s0
e = s0.encode('utf-8',"strict")
print e
s2 = QtCore.QString(s0)
print s2
s3 = unicode(s2,'utf-8')
print s3

QQQ

And got this output:

La Peña
La Pe├▒a
La Pe├▒a
La Peña

Thus, it appears that QString is an encoded string, **not** a unicode
character (at least on xp).  That is, s2 is a wrapper for a utf-8 encoded
string, so we must call unicode (with the proper encoding!) to get a proper
Python unicode string.  BTW, the documentation for QString was what lead me
to write this script.

My hair is turning ever grayer...Maybe this will work better for Py3k??

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: active_path question

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 6:19 PM, Kent Tenney wrote:

> Great service!
>
> Traceback is gone, but dclick on folder name seems to do nothing,
> as I understand the "About" it should be populated with the contents
> of the folder.

alt-x act-on-node


-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 5:54 PM, Edward K. Ream wrote:

>> There are 2 separate operations:
>>
>> - Extract unicode object from QString
>
> Once we have a QString, all our problems are solved.  A QString is
> simply a wrapper for a unicode object.  As such, there are is no
> decoding to be done because unicode objects have no encoding!

Yeah, that's why we shouldn't use g.toUnicode with QStrings (i.e. we
shouldn't change unicode() to g.toUnicode in qt ui).

We should probably create g.ucode (for py3 compatibility), so that:

if python3:

g.ucode = str

else:

g.ucode = unicode


In fact, I think that should be used for most other cases as well,
failing loudly when 'ascii' encoding doesn't work. These problems get
much easier to debug if we get early warning about bugs, as opposed to
failing silently (creating ? characters on errors, etc).

Also:

http://tarekziade.wordpress.com/2008/01/08/syssetdefaultencoding-is-evil/


-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: active_path question

2009-06-18 Thread Kent Tenney

On Thu, Jun 18, 2009 at 10:06 AM, Edward K. Ream wrote:
>
>
> On Thu, Jun 18, 2009 at 9:56 AM, Edward K. Ream  wrote:
>>
>>
>> On Thu, Jun 18, 2009 at 9:42 AM, Kent Tenney  wrote:
>>>
>>> dclicking one of these nodes results in
>>>
>>> [snip]
>>
>>
>>>
>>>  File "/home/ktenney/src/leo-editor/leo/core/leoCommands.py", line
>>> 6393, in outerUpdate
>>>    g.trace('','tree.drag_p',c.frame.tree.drag_p)
>>> AttributeError: leoQtTree instance has no attribute 'drag_p'
>>
>> Thanks for this.  I'll fix it immediately.
>
> Done on the trunk at rev  2053.  All unit tests pass.

Great service!

Traceback is gone, but dclick on folder name seems to do nothing,
as I understand the "About" it should be populated with the contents
of the folder.

Thanks,
Kent

>
> 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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Startup problem

2009-06-18 Thread Edward K. Ream
On Sun, Jun 14, 2009 at 9:56 PM, Steve Zatz  wrote:

>
> If I create an empty .leo file in my home directory, this problem goes
> away.


Thanks for this.  This is one of those install problems that should be fixed
before b2.  I'll look at it asap.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: segmentation fault ?

2009-06-18 Thread Edward K. Ream
On Sun, Jun 14, 2009 at 9:20 AM, znafets  wrote:

>
>  File "/usr/lib/python2.6/xml/sax/handler.py", line 38, in fatalError
>raise exception
>
> SAXParseException: :12:1: not well-formed (invalid token)
>
> reading settings in /usr/local/home/.leo/myLeoSettings.leo
> Using menus from myLeoSettings.leo
> reading /usr/local/home/.leo/.leoRecentFiles.txt
> Segmentation fault
>
>
> tk gui at least starts the app


There may be multiple problems here.  Certainly, Leo/Python/Qt should never
segfault, but of course that is cold comfort :-)

In any case, I would remove the invalid token at line 12, character 1 of the
file and try again.  Continue until sax is happy. If there is still a
segfault we know the problem is unrelated to sax.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Debian package available

2009-06-18 Thread Edward K. Ream
On Wed, Jun 17, 2009 at 4:22 PM, Ville M. Vainio  wrote:

>
> You can grab a proper beta2 package when it's done, but this is something
> to try anyway.


Many thanks for this.  I know b2 is getting close because we are starting to
discuss installation issues.  I'd like to release b3, b4 etc weekly.  Maybe
by b8 we'll have all the issues resolved :-)

This really is progress.  Installation issues, including unicode issues, can
easily get swept under the run between releases...

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: active_path question

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 9:56 AM, Edward K. Ream  wrote:

>
>
> On Thu, Jun 18, 2009 at 9:42 AM, Kent Tenney  wrote:
>
>>
>> dclicking one of these nodes results in
>>
>> [snip]
>
>
>
>>
>>  File "/home/ktenney/src/leo-editor/leo/core/leoCommands.py", line
>> 6393, in outerUpdate
>>g.trace('','tree.drag_p',c.frame.tree.drag_p)
>> AttributeError: leoQtTree instance has no attribute 'drag_p'
>
>
> Thanks for this.  I'll fix it immediately.
>

Done on the trunk at rev  2053.  All unit tests pass.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: active_path question

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 9:42 AM, Kent Tenney  wrote:

>
> dclicking one of these nodes results in
>
> [snip]



>
>  File "/home/ktenney/src/leo-editor/leo/core/leoCommands.py", line
> 6393, in outerUpdate
>g.trace('','tree.drag_p',c.frame.tree.drag_p)
> AttributeError: leoQtTree instance has no attribute 'drag_p'


Thanks for this.  I'll fix it immediately.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Edward K. Ream

On Jun 18, 9:39 am, "Ville M. Vainio"  wrote:
> On Thu, Jun 18, 2009 at 5:18 PM, Edward K. Ream wrote:
> > P.S.  The reason I keep going on about g.toUnicode is that it is the
> > foundation of Leo3k.  In particular, the 'unicode' function does not exist
> > in Py3k, and so it must be wrapped.
>
> But then it should be just aliased to str.

That's what happens.  Take a look.

BTW, I have a half memory that the reason g.toUnicode has the fairly
bizarre coding style is to avoid Python errors.  Even so, pylint
complains that 'byte' doesn't exist, at least when pylint is run with
Python 2.x. I should probably have added a note to myself...

> There are 2 separate operations:
>
> - Extract unicode object from QString

Once we have a QString, all our problems are solved.  A QString is
simply a wrapper for a unicode object.  As such, there are is no
decoding to be done because unicode objects have no encoding!

> - Read file, producing unicode

The process of reading the file, passing .leo files to sax, and
getting objects (vnodes, etc) containing unicode is a bit
complicated.  For example, we have to clean characters that would
cause sax to choke before sending those characters to sax.  These
problems are likely unavoidable, but I believe the Leo3k code will
work pretty much as is.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



active_path question

2009-06-18 Thread Kent Tenney

current trunk

node headline
@path path/to/folder

re-opening Leo populates the node with file and folder names.

dclicking one of these nodes results in

raceback (most recent call last):
  File "/home/ktenney/src/leo-editor/leo/core/leoGlobals.py", line
3567, in doHook
return f(tag,keywords)
  File "/home/ktenney/src/leo-editor/leo/core/leoPlugins.py", line
298, in doPlugins
return doHandlersForTag(tag,keywords)
  File "/home/ktenney/src/leo-editor/leo/core/leoPlugins.py", line
273, in doHandlersForTag
val = callTagHandler(bunch,tag,keywords)
  File "/home/ktenney/src/leo-editor/leo/core/leoPlugins.py", line
252, in callTagHandler
result = handler(tag,keywords)
  File "/home/ktenney/src/leo-editor/leo/plugins/active_path.py", line
465, in 
leoPlugins.registerHandler(event, lambda t,k: onSelect(t,k))
  File "/home/ktenney/src/leo-editor/leo/plugins/active_path.py", line
99, in onSelect
c.redraw()
  File "/home/ktenney/src/leo-editor/leo/core/leoCommands.py", line
6446, in redraw
c.selectPosition(p)
  File "/home/ktenney/src/leo-editor/leo/core/leoCommands.py", line
7508, in selectPosition
c.frame.tree.select(p)
  File "/home/ktenney/src/leo-editor/leo/core/leoFrame.py", line 2655, in select
c.frame.tree.afterSelectHint(p,old_p)
  File "/home/ktenney/src/leo-editor/leo/plugins/baseNativeTree.py",
line 794, in afterSelectHint
c.outerUpdate() # Bring the tree up to date.
  File "/home/ktenney/src/leo-editor/leo/core/leoCommands.py", line
6393, in outerUpdate
g.trace('','tree.drag_p',c.frame.tree.drag_p)
AttributeError: leoQtTree instance has no attribute 'drag_p'

--~--~-~--~~~---~--~~
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 5:18 PM, Edward K. Ream wrote:

> P.S.  The reason I keep going on about g.toUnicode is that it is the
> foundation of Leo3k.  In particular, the 'unicode' function does not exist
> in Py3k, and so it must be wrapped.

But then it should be just aliased to str. It definitely shouldn't do
any encoding - because if we "fall back" to encoding, we are hiding
bugs. There are 2 separate operations:

- Extract unicode object from QString
- Read file, producing unicode

These are unrelated, apart from the fact that the return value is
unicode object.

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 9:00 AM, Ville M. Vainio  wrote:

>
> > I think this can, and should, be done.  g.app.gui.toUnicode will
> > simply do:
> >
> >return g.toUnicode(s,g.app.gui.defaultQtEncoding)
> >
> > where defaultQtEncoding is utf-8 by default, and can be set by @string
> > default_qt_encoding setting.
>
> I still think this is wrong (my understanding of unicode), but it's
> even more wrong to have it as setting. If anything, it should be
> hardcoded to utf-8.


Well, that is, in essence, what we get by calling g.toUnicode!

In my experience, a setting that *can* match the Python's default encoding
may be worthwhile.  It was with tk.  Furthermore, having that setting
default to utf-8 can hardly be worse than the present situation.  If people
find the setting useful, fine.  If not, nothing has been lost.

Edward

P.S.  The reason I keep going on about g.toUnicode is that it is the
foundation of Leo3k.  In particular, the 'unicode' function does not exist
in Py3k, and so it must be wrapped.

BTW, the present version of g.toUnicode goes overboard in trying to
eliminate duplicate code.  It would be much clearer to accept the
duplication, and have two completely separate versions of the code--one for
Python 2.x and one for Python 3.x.  I'll fix this early in the b3 cycle.

EKR

--~--~-~--~~~---~--~~
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 4:57 PM, Edward K. Ream wrote:

>> we may have to add a
>> setting that will tell the qt gui which encoding to assume by default.  We
>> will then pass that as a the encoding param to g.toUnicode, for example.
>
> I think this can, and should, be done.  g.app.gui.toUnicode will
> simply do:
>
>    return g.toUnicode(s,g.app.gui.defaultQtEncoding)
>
> where defaultQtEncoding is utf-8 by default, and can be set by @string
> default_qt_encoding setting.

I still think this is wrong (my understanding of unicode), but it's
even more wrong to have it as setting. If anything, it should be
hardcoded to utf-8.

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 4:50 PM, Edward K. Ream wrote:

>> We should use setMimeData of QClipboard to set binary data:
>>
>> http://doc.trolltech.com/4.5/qclipboard.html#setMimeData
>
> When do we ever want to put binary data to the clipboard?  Are you calling
> utf-8 encoded strings binary data?

Yes, utf-8 encoded strings are binary data ('bytes' on Python 3).
Treating it as "text" is wrong, and we are (correctly) getting an
exception for that.  Utf-8 can be converted to text (unicode) by
decoding it.

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Edward K. Ream

On Jun 18, 8:50 am, "Edward K. Ream"  wrote:
> we may have to add a
> setting that will tell the qt gui which encoding to assume by default.  We
> will then pass that as a the encoding param to g.toUnicode, for example.

I think this can, and should, be done.  g.app.gui.toUnicode will
simply do:

return g.toUnicode(s,g.app.gui.defaultQtEncoding)

where defaultQtEncoding is utf-8 by default, and can be set by @string
default_qt_encoding setting.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: Copy/paste bug in Qt GUI?

2009-06-18 Thread Edward K. Ream
On Wed, Jun 17, 2009 at 9:46 AM, Ville M. Vainio  wrote:

>
> Our current clipboard approach has a fundamental problem: we are
> treating clipboard as text (unicode), but the xml data (outline
> structure) is not text. It's 8 bit binary data (that happens to be in
> utf8).


This may be a bug, but I wouldn't get excited and call it a fundamental
problem.

Leo assumes that all data it deals with internally is unicode.  This, and
nothing else, is fundamental.  To make this work, Leo converts from
so-called encoded formats to unicode when reading data, and converts back to
encoded formats when writing data.

g.toUnicode is the basis of this approach.  There may be, as you suggest,
instances where g.toUnicode isn't the easiest, or even correct, way to
convert data to unicode.  If so, we can deal with it, and use comments to
explain why g.toUnicode won't work.

I'm sure you understand this, but I want to say it anyway to emphasize what
is, and isn't, fundamentally important.

As you your recent change to g.app.gui.toUnicode::

g.trace('Warning - toUnicode does encoding (bugs possible)')
return unicode(s,encoding,errors='replace')

This is, in essence, exactly what g.toUnicode does.  Yes, errors are
possible if the encoding specified does not match the encoding used to
created the encoded text.  g.toUnicode will convert "bad" characters to '?'
characters.

By the way, neither unicode nor g.toUnicode *does* encoding (that's the
reverse process).  Instead, these functions *assume* an encoding.  If there
is, in fact, a "fundamental" problem, it is that it is not possible, in
general, given an encoded string, to deduce the encoding.  But we aren't
going to change that.

Please note that g.app.gui.toUnicode is called only from the qt gui plugin.
Whatever encoding problems arise apply only to the gui plugin.  In essence,
the "general/fundamental" problem is simply stated:  how do we know what
encoding to pass to g.app.gui.toUnicode?

The tk gui handles this by using various settings to specify encodings.  All
will be well if those settings match the user's installation.

In short, there is a general/fundamental problem with calling unicode, or
equivalently, g.toUnicode, namely to avoid data loss (converting characters
to '?' characters, for instance) the encoding specified must match the
actual encoding of the encoded data.  There is no way around this problem,
and it has nothing specifically to do with Leo.

In *some* cases, we may be able to know for sure what the encoding is.
That's always good :-)

I suspect, but do not know for sure, that many of these problems will
disappear if people will specify utf-8 for Python's default encoding in
sitecustomize.py.  Certainly, I have no problems with non-ascii characters
on my machines.  If that isn't convenient for people, we may have to add a
setting that will tell the qt gui which encoding to assume by default.  We
will then pass that as a the encoding param to g.toUnicode, for example.

Separate method should be used to put binary data to clipboard (in tk,
> it's probably always binary data?).
>
> We should use setMimeData of QClipboard to set binary data:
>
> http://doc.trolltech.com/4.5/qclipboard.html#setMimeData


When do we ever want to put binary data to the clipboard?  Are you calling
utf-8 encoded strings binary data?

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: What to do about the windows installer?

2009-06-18 Thread Edward K. Ream



On Jun 17, 9:04 pm, David Szent-Györgyi  wrote:

> I gather that the installers for Leo 4.5 and Leo 4.6 are written in
> Python instead, and that they use the Python-standard tools.

See the code in @button make in dist.leo.

It's python, but does not use distutils.

> I gather
> that one of the goals of the switch to the Python-based installer was
> to install Leo as a package. I expect that it ought to be possible to
> use NSIS to drive that intelligently, too.

The advantage of the @button make approach is that it uses the .zip
file produced by bzr.  This eliminates the need for manifests, which
always seem to become out of date.  Ideally, an automatic NSIS
installer would use the bzr .ignore spec to include or exclude files.
I have no idea whether that is feasible.

> The modified installer also checks to make sure that it does not break
> in various ways.

I'll be happy to look at the installer script, but it's not clear that
we will ever go back to using nsis.  I would prefer to make @button
make work :-)

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: B2 - Ok to fix language definitions?

2009-06-18 Thread Edward K. Ream
On Thu, Jun 18, 2009 at 7:14 AM, TL  wrote:

>
> Edward,
> The "rst" and "rest" language definitions have invalid comment
> definitions in the leoApp.py file.  They should be changed from ".."
> to ".._" (making use of the REM hack).  Is it ok for me to check in
> the fix today?  Also, I would like to add an entry for the "vim"
> language to enable support for the development of Vim plugins using
> Leo.


Please go ahead.  As always, make sure all unit tests pass before committing
any changes.

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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: 2059 doesn't start up with qt GUI

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 3:43 PM, znafets wrote:

> actually yes it is the same on Karmic, I have it installed (vers.
> 2.3.2-1.1ubuntu)
>
> Any other ideas ?

Try this on plain python prompt:

from PyQt4 import Qsci

Does it fail, and how?

Can you try installing eric4 and seeing if it works.

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: 2059 doesn't start up with qt GUI

2009-06-18 Thread znafets

Hi Ville,

actually yes it is the same on Karmic, I have it installed (vers.
2.3.2-1.1ubuntu)

Any other ideas ?

best
Stefan

On 18 Jun., 10:55, "Ville M. Vainio"  wrote:
> On Thu, Jun 18, 2009 at 12:59 PM, znafets wrote:
> > since I am working on Ubuntu Karmic leo can't load the qt gui anymore.
> > Did I mess up something or is it because of other pyqt4 stuff ?
>
> Have you installed scintilla? On Jaunty, it's package 'python-qscintilla2'
>
> --
> Ville M. Vainiohttp://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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



B2 - Ok to fix language definitions?

2009-06-18 Thread TL

Edward,
The "rst" and "rest" language definitions have invalid comment
definitions in the leoApp.py file.  They should be changed from ".."
to ".._" (making use of the REM hack).  Is it ok for me to check in
the fix today?  Also, I would like to add an entry for the "vim"
language to enable support for the development of Vim plugins using
Leo.

Regards,
TL
--~--~-~--~~~---~--~~
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: 2059 doesn't start up with qt GUI

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 1:55 PM, Ville M. Vainio wrote:

> Have you installed scintilla? On Jaunty, it's package 'python-qscintilla2'

Note to self - it's probably best to make that dependency optional (by
cathing the exception in import), because scintilla is not currently
enabled and it's a "non-obvious" dependency.


-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



Re: 2059 doesn't start up with qt GUI

2009-06-18 Thread Ville M. Vainio

On Thu, Jun 18, 2009 at 12:59 PM, znafets wrote:

> since I am working on Ubuntu Karmic leo can't load the qt gui anymore.
> Did I mess up something or is it because of other pyqt4 stuff ?

Have you installed scintilla? On Jaunty, it's package 'python-qscintilla2'

-- 
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---



2059 doesn't start up with qt GUI

2009-06-18 Thread znafets

Hi,

since I am working on Ubuntu Karmic leo can't load the qt gui anymore.
Did I mess up something or is it because of other pyqt4 stuff ?
Btw. when I delete the leoRecentfiles.txt the start of leo ends with
"segmentation fault"


./launchLeo.py --gui=qt
reading settings in /usr/local/src/PYTHON/leo-bzr/trunk/leo/config/
leoSettings.leo
Using menus from leoSettings.leo
reading settings in /usr/local/home/.leo/myLeoSettings.leo
Using menus from myLeoSettings.leo
reading /usr/local/home/.leo/.leoRecentFiles.txt
unexpected exception in g.importFromPath(qtGui)
Traceback (most recent call last):

  File "/usr/local/src/PYTHON/leo-bzr/trunk/leo/core/leoGlobals.py",
line 6638, in importFromPath
module = imp.load_module(moduleName,theFile,pathname,description)

  File "/usr/local/src/PYTHON/leo-bzr/trunk/leo/plugins/qtGui.py",
line 54, in 
from PyQt4 import Qsci

unexpected Exception in g.pr
make sure your sitecustomize.py contains::
sys.setdefaultencoding("utf-8")
Traceback (most recent call last):

  File "/usr/local/src/PYTHON/leo-bzr/trunk/leo/core/leoGlobals.py",
line 3848, in pr
sys.stdout.write(s+'\n')

UnicodeEncodeError: 'ascii' codec can't encode characters in position
57-65: ordinal not in range(128)

pr:
,run,doPrePluginsInit,createSpecialGui,createQtGui,loadOnePlugin,importFromPath,es_exception
Can not import qtGui from plugin qtGui
can not load enabled plugin: qtGui
loaded plugin: tkGui
image.py: can not import ImageTk
opening default_leo_file: /Users/sz93814/.leo/workbook.leo
@enabled-plugins found in myLeoSettings.leo
can not load enabled plugin: image

best
Stefan
--~--~-~--~~~---~--~~
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 
leo-editor+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~--~~~~--~~--~--~---