当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QUrl方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QUrl方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QUrl方法的具体用法?Python QtCore.QUrl怎么用?Python QtCore.QUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore的用法示例。


在下文中一共展示了QtCore.QUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getTiles

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def getTiles(self, t, i=0):
        t = int(t / 600)*600
        self.getTime = t
        self.getIndex = i
        if i == 0:
            self.tileurls = []
            self.tileQimages = []
            for tt in self.tiletails:
                tileurl = "https://tilecache.rainviewer.com/v2/radar/%d/%s" \
                    % (t, tt)
                self.tileurls.append(tileurl)
        print self.myname + " " + str(self.getIndex) + " " + self.tileurls[i]
        self.tilereq = QNetworkRequest(QUrl(self.tileurls[i]))
        self.tilereply = manager.get(self.tilereq)
        QtCore.QObject.connect(self.tilereply, QtCore.SIGNAL(
                "finished()"), self.getTilesReply) 
开发者ID:n0bel,项目名称:PiClock,代码行数:18,代码来源:PyQtPiClock.py

示例2: insert

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def insert(self):

        # Get text from LineEdits and make use of QUrl's
        # parsing (e.g. add http:// if necessary)
        url = QtCore.QUrl().fromUserInput(self.urlField.text())

        text = self.textField.text()

        # HTML link (convert url back to parsed url string)
        link = "<a href=\"{}\">{}</a>".format(url.toString(),text)

        # If we need to remove the word beneath
        if self.forEditing:

            # Select the word
            self.cursor.select(QtGui.QTextCursor.WordUnderCursor)

            # Remove it
            self.cursor.removeSelectedText()
        
        # Insert this link
        self.cursor.insertHtml(link)

        # Close window after
        self.close() 
开发者ID:goldsborough,项目名称:Writer,代码行数:27,代码来源:link.py

示例3: getwx

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def getwx():
    global wxurl
    global wxreply
    print "getting current and forecast:" + time.ctime()
    wxurl = 'https://api.darksky.net/forecast/' + \
        ApiKeys.dsapi + \
        '/'
    wxurl += str(Config.location.lat) + ',' + \
        str(Config.location.lng)
    wxurl += '?units=us&lang=' + Config.Language.lower()
    wxurl += '&r=' + str(random.random())
    print wxurl
    r = QUrl(wxurl)
    r = QNetworkRequest(r)
    wxreply = manager.get(r)
    wxreply.finished.connect(wxfinished) 
开发者ID:n0bel,项目名称:PiClock,代码行数:18,代码来源:PyQtPiClock.py

示例4: cbUserData

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def cbUserData(self, data):
        self.currentUserData = data

        if self.toolbar.avatarImage is None:
            manager = QNetworkAccessManager()
            manager.finished.connect(self.returnAvatar)

            if 's3.amazonaws.com' in data['avatar_url']:
                imageUrl = QUrl(data['avatar_url'])
            else:
                imageUrl = QUrl('http:' + data['avatar_url'])

            request = QNetworkRequest(imageUrl)
            request.setRawHeader('User-Agent', 'QGIS 2.x')
            reply = manager.get(request)
            loop = QEventLoop()
            reply.finished.connect(loop.exit)
            loop.exec_()

        self.setUpUserData() 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:22,代码来源:UserData.py

示例5: cbUserData

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def cbUserData(self, data):
        if 'error' in data:
            # TODO Create image for error
            self.nameLB.setText("<html><head/><body><p><span style=\" text-decoration: underline; color:red;\">error</span></p></body></html>")
            self.error.emit(data['error'])
            return

        self.currentUserData = data
        self.settings.setValue('/CartoDBPlugin/selected', self.currentUser)
        manager = QNetworkAccessManager()
        manager.finished.connect(self.returnAvatar)

        if 's3.amazonaws.com' in data['avatar_url']:
            imageUrl = QUrl(data['avatar_url'])
        else:
            imageUrl = QUrl('http:' + data['avatar_url'])

        request = QNetworkRequest(imageUrl)
        request.setRawHeader('User-Agent', 'QGIS 2.x')
        reply = manager.get(request)
        loop = QEventLoop()
        reply.finished.connect(loop.exit)
        loop.exec_() 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:25,代码来源:CartoDBToolbar.py

示例6: getUserTables

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def getUserTables(self, page=1, per_page=20, shared='yes', returnDict=True):
        self.returnDict = returnDict
        payload = {
            'tag_name': '',
            'q': '',
            'page': page,
            'type': '',
            'exclude_shared': 'false',
            'per_page': per_page,
            'tags': '',
            'shared': shared,
            'locked': 'false',
            'only_liked': 'false',
            'order': 'name',
            'types': 'table'
        }
        url = QUrl(self.apiUrl + "viz?api_key={}&{}".format(self.apiKey, urllib.urlencode(payload)))
        request = self._getRequest(url)

        reply = self.manager.get(request)
        loop = QEventLoop()
        reply.downloadProgress.connect(self.progressCB)
        reply.error.connect(self._error)
        reply.finished.connect(loop.exit)
        loop.exec_() 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:27,代码来源:cartodbapi.py

示例7: upload

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def upload(self, filePath, returnDict=True):
        self.returnDict = returnDict
        file = QFile(filePath)
        file.open(QFile.ReadOnly)
        url = QUrl(self.apiUrl + "imports/?api_key={}".format(self.apiKey))
        files = {'file': file}
        multipart = self._createMultipart(files=files)
        request = QNetworkRequest(url)
        request.setHeader(QNetworkRequest.ContentTypeHeader, 'multipart/form-data; boundary=%s' % multipart.boundary())
        request.setRawHeader('User-Agent', 'QGISCartoDB 0.2.x')
        reply = self.manager.post(request, multipart)
        loop = QEventLoop()
        reply.uploadProgress.connect(self.progressCB)
        reply.error.connect(self._error)
        reply.finished.connect(loop.exit)
        loop.exec_() 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:18,代码来源:cartodbapi.py

示例8: createVizFromTable

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def createVizFromTable(self, table, name, description='', returnDict=True):
        self.returnDict = returnDict
        payload = {
            'type': 'derived',
            'name': name,
            'title': name,
            'description': description,
            'tags': ['QGISCartoDB'],
            "tables": [table]
        }
        url = QUrl(self.apiUrl + "viz/?api_key={}".format(self.apiKey))
        request = self._getRequest(url)

        reply = self.manager.post(request, json.dumps(payload))
        loop = QEventLoop()
        reply.downloadProgress.connect(self.progressCB)
        reply.error.connect(self._error)
        reply.finished.connect(loop.exit)
        loop.exec_() 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:21,代码来源:cartodbapi.py

示例9: geocode

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def geocode(self, location) :
		url = QtCore.QUrl("http://maps.googleapis.com/maps/api/geocode/xml")
		url.addQueryItem("address", location)
		url.addQueryItem("sensor", "false")
		"""
		url = QtCore.QUrl("http://maps.google.com/maps/geo/")
		url.addQueryItem("q", location)
		url.addQueryItem("output", "csv")
		url.addQueryItem("sensor", "false")
		"""
		request = QtNetwork.QNetworkRequest(url)
		reply = self.get(request)
		while reply.isRunning() :
			QtGui.QApplication.processEvents()

		reply.deleteLater()
		self.deleteLater()
		return self._parseResult(reply) 
开发者ID:vokimon,项目名称:python-qgmap,代码行数:20,代码来源:__init__.py

示例10: mainPyQt4Simple

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def mainPyQt4Simple():
    # 必要なモジュールのimport
    from PyQt4.QtCore import QUrl
    from PyQt4.QtGui import QApplication
    from PyQt4.QtWebKit import QWebView

    url = 'https://github.com/tody411/PyIntroduction'

    app = QApplication(sys.argv)

    # QWebViewによるWebページ表示
    browser = QWebView()
    browser.load(QUrl(url))
    browser.show()

    sys.exit(app.exec_())

## PyQt4でのWebブラウザー作成(Youtube用). 
开发者ID:tody411,项目名称:PyIntroduction,代码行数:20,代码来源:web_browser.py

示例11: mainPyQt5

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def mainPyQt5():
    # 必要なモジュールのimport
    from PyQt5.QtWidgets import QApplication
    from PyQt5.QtCore import QUrl
    from PyQt5.QtWebEngineWidgets import QWebEngineView

    url = 'https://github.com/tody411/PyIntroduction'

    app = QApplication(sys.argv)

    # QWebEngineViewによるWebページ表示
    browser = QWebEngineView()
    browser.load(QUrl(url))
    browser.show()

    sys.exit(app.exec_()) 
开发者ID:tody411,项目名称:PyIntroduction,代码行数:18,代码来源:web_browser.py

示例12: show_change_log

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def show_change_log(self, path):
        """
        Show STDM change log window if the user have never
        seen it before.
        :return: None
        :rtype: NoneType
        """
        change_log_path = '{}/html/change_log.htm'.format(path)
        change_log_url = QUrl()
        change_log_url.setPath(change_log_path)
        change_log_html = file_text(change_log_path)

        self.webView.setHtml(
            change_log_html, change_log_url
        )

        self.exec_() 
开发者ID:gltn,项目名称:stdm,代码行数:19,代码来源:change_log.py

示例13: setupUi

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def setupUi(self, ChangeLog):
        ChangeLog.setObjectName(_fromUtf8("ChangeLog"))
        ChangeLog.resize(714, 557)
        self.verticalLayout = QtGui.QVBoxLayout(ChangeLog)
        self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
        self.webView = QtWebKit.QWebView(ChangeLog)
        self.webView.setUrl(QtCore.QUrl(_fromUtf8("about:blank")))
        self.webView.setObjectName(_fromUtf8("webView"))
        self.verticalLayout.addWidget(self.webView)
        self.horizontalLayout = QtGui.QHBoxLayout()
        self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
        self.buttonBox = QtGui.QDialogButtonBox(ChangeLog)
        self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
        self.horizontalLayout.addWidget(self.buttonBox)
        spacerItem = QtGui.QSpacerItem(600000, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
        self.horizontalLayout.addItem(spacerItem)
        self.verticalLayout.addLayout(self.horizontalLayout)

        self.retranslateUi(ChangeLog)
        QtCore.QMetaObject.connectSlotsByName(ChangeLog) 
开发者ID:gltn,项目名称:stdm,代码行数:23,代码来源:ui_change_log.py

示例14: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def __init__(self, url, request_cookiejar):
        super(NikeBrowser, self).__init__()

        self.setWindowTitle('终结者浏览器')

        # 将字典转化成QNetworkCookieJar的格式
        self.cookie_jar = QtNetwork.QNetworkCookieJar()
        cookies = []
        # 直接通过cookie.name和cookie.value的方式迭代
        for cookie in request_cookiejar:
            my_cookie = QtNetwork.QNetworkCookie(QtCore.QByteArray(cookie.name), QtCore.QByteArray(cookie.value))
            my_cookie.setDomain('.nike.com')
            cookies.append(my_cookie)
        self.cookie_jar.setAllCookies(cookies)
        self.page().networkAccessManager().setCookieJar(self.cookie_jar)
        # self.cookie_jar.setCookiesFromUrl(cookies, QUrl
        # ('https://secure-store.nike.com/cn/checkout/html/cart.jsp?country=CN&l=cart&site=nikestore&returnURL=http://www.nike.com/cn/zh_cn/'))
        self.load(QtCore.QUrl(url))
        self.show() 
开发者ID:nikan1996,项目名称:nike_purchase_system,代码行数:21,代码来源:mainwindow.py

示例15: __init__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QUrl [as 别名]
def __init__(self, url, request_cookiejar):
        super(NikeBrowser, self).__init__()
        self.setWindowTitle('终结者浏览器')

        # 将字典转化成QNetworkCookieJar的格式
        self.cookie_jar = QNetworkCookieJar()
        cookies = []
        # 直接通过cookie.name和cookie.value的方式迭代
        for cookie in request_cookiejar:
            my_cookie = QNetworkCookie(QByteArray(cookie.name), QByteArray(cookie.value))
            my_cookie.setDomain('.nike.com')
            cookies.append(my_cookie)
        self.cookie_jar.setAllCookies(cookies)
        self.page().networkAccessManager().setCookieJar(self.cookie_jar)
        # self.cookie_jar.setCookiesFromUrl(cookies, QUrl('https://secure-store.nike.com/cn/checkout/html/cart.jsp?country=CN&l=cart&site=nikestore&returnURL=http://www.nike.com/cn/zh_cn/'))
        self.load(QUrl(url))
        self.show() 
开发者ID:nikan1996,项目名称:nike_purchase_system,代码行数:19,代码来源:购物车测试.py


注:本文中的PyQt4.QtCore.QUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。