# HG changeset patch
# User Simon Heimberg <[email protected]>
# 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)
+
+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
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop