# HG changeset patch
# User Simon Heimberg <[email protected]>
# Date 1313274055 -7200
# Node ID 3398c460e5a7ce040537fbc57e5a967e3271775f
# Parent 038fb0c9fc09c52f95f4298e575ca697b9f55c39
hglib: fix and simplify openlocalurl
Convert str or unicode to QString before checking
The conversion would be done anyway in the qt functions.
diff -r 038fb0c9fc09 -r 3398c460e5a7 tortoisehg/hgqt/qtlib.py
--- a/tortoisehg/hgqt/qtlib.py Son Aug 21 14:59:16 2011 -0500
+++ b/tortoisehg/hgqt/qtlib.py Son Aug 14 00:20:55 2011 +0200
@@ -68,27 +68,22 @@
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'''
+ takes str, unicode or QString as argument
+ returns True if open was successfull
+ '''
if isinstance(path, str):
- path = hglib.tounicode(path)
- if os.name == 'nt' and startswith(path, '\\\\'):
+ path = QString(hglib.tounicode(path))
+ elif isinstance(path, unicode):
+ path = QString(path)
+ if os.name == 'nt' and path.startsWith('\\\\'):
# network share, special handling because of qt bug 13359
# see http://bugreports.qt.nokia.com/browse/QTBUG-13359
- qurl = QUrl().setUrl(QDir.toNativeSeparators(path))
+ qurl = QUrl()
+ qurl.setUrl(QDir.toNativeSeparators(path))
else:
qurl = QUrl.fromLocalFile(path)
return QDesktopServices.openUrl(qurl)
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop