On 2011-08-11 00:59, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <sim...@besonet.ch>
> # Date 1313016232 -7200
> # Node ID f2e38bbbb5391830ae10ec59b96c399be4fddbed
> # 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 f2e38bbbb539 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)
> +

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 <module>
    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

Reply via email to