Re: [thg-dev] [PATCH 1 of 1] qtlib: new method openlocalurl for opening a local url

2011-08-22 Thread Simon Heimberg
Am Donnerstag, den 11.08.2011, 11:31 +0200 schrieb Adrian Buehlmann:
> On 2011-08-11 00:59, Simon Heimberg wrote:
> > # HG changeset patch
> > # User Simon Heimberg 
> > # Date 1313016232 -7200
> > # Node ID f2e385391830ae10ec59b96c399be4fddbed
> > # Parent  0da8ec901d80482621d42f0df1e111c86fed1201
> > qtlib: new method openlocalurl for opening a local url
> > 
> > It allows to explore something located on a network share.
> > Additionally the path is converted to unicode if necessary.
> > 
snip
> >  
> > +def startswith(strQstring, startstr):
> > +'''calls startsWith of QString or startswith for others
> > +
> > +takes st, unicode or QString as strQstring'''
> > +
> > + if isinstance(strQstring, QString):
> > +return strQstring.startsWith(startstr)
> > +else:
> > +return strQstring.startswith(startstr)
> > +
> 
> Did you test this? (see below)

At least I tried to. Excuse me.
It is not easy because I do not have a source distribution with qt
installed. With python and pylint this would be seen. The space must
have slipped in later.
This time I tested the changes with a hg extension on a windows machine
and doublechecked the patch before sending. I hope it helps.

> 
snip
> subprocess.CalledProcessError: Command 'C:\Python26\python.exe setup.py 
> py2exe -b3' returned non-zero exit status 1
> 
> I've pushed a fix with 620eff4aee7a
Thanks.

Greetings,
Simon

--
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
___
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop


Re: [thg-dev] [PATCH 1 of 1] qtlib: new method openlocalurl for opening a local url

2011-08-11 Thread Adrian Buehlmann
On 2011-08-11 00:59, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg 
> # Date 1313016232 -7200
> # Node ID f2e385391830ae10ec59b96c399be4fddbed
> # Parent  0da8ec901d80482621d42f0df1e111c86fed1201
> qtlib: new method openlocalurl for opening a local url
> 
> It allows to explore something located on a network share.
> Additionally the path is converted to unicode if necessary.
> 
> diff -r 0da8ec901d80 -r f2e38539 tortoisehg/hgqt/qtlib.py
> --- a/tortoisehg/hgqt/qtlib.pyDon Aug 11 00:43:52 2011 +0200
> +++ b/tortoisehg/hgqt/qtlib.pyDon Aug 11 00:43:52 2011 +0200
> @@ -64,10 +64,35 @@
>  chm = os.path.join(paths.bin_path, 'doc', 'TortoiseHg.chm')
>  if os.path.exists(chm):
>  fullurl = (r'mk:@MSITStore:%s::/' % chm) + url
> -QDesktopServices.openUrl(QUrl.fromLocalFile(fullurl))
> +openlocalurl(fullurl)
>  return
>  QDesktopServices.openUrl(QUrl(fullurl))
>  
> +def startswith(strQstring, startstr):
> +'''calls startsWith of QString or startswith for others
> +
> +takes st, unicode or QString as strQstring'''
> +
> + if isinstance(strQstring, QString):
> +return strQstring.startsWith(startstr)
> +else:
> +return strQstring.startswith(startstr)
> +

Did you test this? (see below)

> +def openlocalurl(path):
> +'''open the given path with the default application
> +
> +takes str, unicode or QString as argument'''
> +
> +if isinstance(path, str):
> +path = hglib.tounicode(path)
> +if os.name == 'nt' and startswith(path, ''):
> +# network share, special handling because of qt bug 13359
> +# see http://bugreports.qt.nokia.com/browse/QTBUG-13359
> +qurl = QUrl().setUrl(QDir.toNativeSeparators(path))
> +else:
> +qurl = QUrl.fromLocalFile(path)
> +return QDesktopServices.openUrl(qurl)
> +
>  def editfiles(repo, files, lineno=None, search=None, parent=None):
>  if len(files) == 1:
>  path = repo.wjoin(files[0])

error: compiling 'build\lib\tortoisehg\hgqt\qtlib.py' failed
IndentationError: unexpected indent (qtlib.py, line 76)
Traceback (most recent call last):
  File "setup.py", line 867, in 
build_thg_installer(packagename, productid, arch)
  File "setup.py", line 450, in build_thg_installer
run_python(r'setup.py py2exe -b3', 'build/thg', env=get_pruned_env(arch))
  File "setup.py", line 154, in run_python
run(cmd, cwd, hide, env)
  File "setup.py", line 145, in run
subprocess.check_call(cmd, shell=True, cwd=cwd, env=env)
  File "C:\Python26\lib\subprocess.py", line 488, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'C:\Python26\python.exe setup.py py2exe 
-b3' returned non-zero exit status 1

I've pushed a fix with 620eff4aee7a


--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
___
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop


[thg-dev] [PATCH 1 of 1] qtlib: new method openlocalurl for opening a local url

2011-08-10 Thread Simon Heimberg
# HG changeset patch
# User Simon Heimberg 
# Date 1313016232 -7200
# Node ID f2e385391830ae10ec59b96c399be4fddbed
# Parent  0da8ec901d80482621d42f0df1e111c86fed1201
qtlib: new method openlocalurl for opening a local url

It allows to explore something located on a network share.
Additionally the path is converted to unicode if necessary.

diff -r 0da8ec901d80 -r f2e38539 tortoisehg/hgqt/qtlib.py
--- a/tortoisehg/hgqt/qtlib.py  Don Aug 11 00:43:52 2011 +0200
+++ b/tortoisehg/hgqt/qtlib.py  Don Aug 11 00:43:52 2011 +0200
@@ -64,10 +64,35 @@
 chm = os.path.join(paths.bin_path, 'doc', 'TortoiseHg.chm')
 if os.path.exists(chm):
 fullurl = (r'mk:@MSITStore:%s::/' % chm) + url
-QDesktopServices.openUrl(QUrl.fromLocalFile(fullurl))
+openlocalurl(fullurl)
 return
 QDesktopServices.openUrl(QUrl(fullurl))
 
+def startswith(strQstring, startstr):
+'''calls startsWith of QString or startswith for others
+
+takes st, unicode or QString as strQstring'''
+
+ if isinstance(strQstring, QString):
+return strQstring.startsWith(startstr)
+else:
+return strQstring.startswith(startstr)
+
+def openlocalurl(path):
+'''open the given path with the default application
+
+takes str, unicode or QString as argument'''
+
+if isinstance(path, str):
+path = hglib.tounicode(path)
+if os.name == 'nt' and startswith(path, ''):
+# network share, special handling because of qt bug 13359
+# see http://bugreports.qt.nokia.com/browse/QTBUG-13359
+qurl = QUrl().setUrl(QDir.toNativeSeparators(path))
+else:
+qurl = QUrl.fromLocalFile(path)
+return QDesktopServices.openUrl(qurl)
+
 def editfiles(repo, files, lineno=None, search=None, parent=None):
 if len(files) == 1:
 path = repo.wjoin(files[0])

--
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. 
http://p.sf.net/sfu/wandisco-dev2dev
___
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop