def encode_uri(ds_uri, schema_name, project_name=None):
    u = QUrl()
    urlQuery = QUrlQuery()

    u.setScheme("postgresql")
    u.setHost(ds_uri.host())
    if ds_uri.port() != '':
        u.setPort(int(ds_uri.port()))
    if ds_uri.username() != '':
        u.setUserName(ds_uri.username())
    if ds_uri.password() != '':
        u.setPassword(ds_uri.password())

    if ds_uri.service() != '':
        urlQuery.addQueryItem("service", ds_uri.service())
    if ds_uri.authConfigId() != '':
        urlQuery.addQueryItem("authcfg", ds_uri.authConfigId())
    if ds_uri.sslMode() != QgsDataSourceUri.SslPrefer:
        urlQuery.addQueryItem("sslmode", QgsDataSourceUri.encodeSslMode(ds_uri.sslMode()))

    urlQuery.addQueryItem("dbname", ds_uri.database())

    urlQuery.addQueryItem("schema", schema_name)
    if project_name:
        urlQuery.addQueryItem("project", project_name)

    u.setQuery(urlQuery)
    return str(u.toEncoded(), 'utf-8')
Exemple #2
0
def encode_uri(ds_uri, schema_name, project_name=None):
    u = QUrl()
    urlQuery = QUrlQuery()

    u.setScheme("postgresql")
    u.setHost(ds_uri.host())
    if ds_uri.port() != '':
        u.setPort(int(ds_uri.port()))
    if ds_uri.username() != '':
        u.setUserName(ds_uri.username())
    if ds_uri.password() != '':
        u.setPassword(ds_uri.password())

    if ds_uri.service() != '':
        urlQuery.addQueryItem("service", ds_uri.service())
    if ds_uri.authConfigId() != '':
        urlQuery.addQueryItem("authcfg", ds_uri.authConfigId())
    if ds_uri.sslMode() != QgsDataSourceUri.SslPrefer:
        urlQuery.addQueryItem("sslmode", QgsDataSourceUri.encodeSslMode(ds_uri.sslMode()))

    urlQuery.addQueryItem("dbname", ds_uri.database())

    urlQuery.addQueryItem("schema", schema_name)
    if project_name:
        urlQuery.addQueryItem("project", project_name)

    u.setQuery(urlQuery)
    return str(u.toEncoded(), 'utf-8')
Exemple #3
0
    def processfile(self, i):
        print("processfile_start " +
              str(self.filecount - self.ui.listWidget.count()))
        if self.ui.listWidget.count() == 0:
            return

        file = str(self.ui.listWidget.item(i).text())
        image = QImage(file)

        if self.ui.radio_noscale.isChecked():
            pass
        elif self.ui.radio_both.isChecked():
            image = image.scaled(self.ui.spin_width.value(),
                                 self.ui.spin_height.value(),
                                 Qt.IgnoreAspectRatio, Qt.SmoothTransformation)
        elif self.ui.radio_width.isChecked():
            w = self.ui.spin_width.value()
            image = image.scaledToWidth(w, Qt.KeepAspectRatio,
                                        Qt.SmoothTransformation)
        elif self.ui.radio_height.isChecked():
            h = self.ui.spin_height.value()
            image = image.scaledToHeight(h, Qt.KeepAspectRatio,
                                         Qt.SmoothTransformation)

        self.f = QTemporaryFile()
        self.f.open()
        image.save(self.f, 'JPG')
        self.f.seek(0)

        url = QUrl("ftp://" + self.ui.line_host.text() + "/" +
                   self.ui.line_dir.text() + "/" + self.ui.line_prefix.text() +
                   str(self.ui.spin_start_num.value()) +
                   self.ui.line_suffix.text())
        url.setUserName(self.ui.line_user.text())
        url.setPassword(self.ui.line_pass.text())
        url.setPort(self.ui.spin_port.value())

        try:
            self.ui.listWidget.takeItem(0)
            self.ui.spin_start_num.setValue(self.ui.spin_start_num.value() + 1)
            self.nam = QNetworkAccessManager()
            self.rep = self.nam.put(QNetworkRequest(url), self.f)
            self.rep.finished.connect(self.isfinished)
            self.rep.error.connect(self.getError)
            if self.filecount != 0:
                self.progress = int(
                    (self.filecount - self.ui.listWidget.count()) /
                    (0.01 * self.filecount))
            self.ui.progressBar.setValue(self.progress)
        except Exception as e:
            print("Exception " + str(e))
        print("end")
Exemple #4
0
 def addHistoryEntry(self, url):
     """
     Public method to add a history entry.
     
     @param url URL to be added (string)
     """
     cleanurl = QUrl(url)
     if cleanurl.scheme() not in ["eric", "about"]:
         if cleanurl.password():
             # don't save the password in the history
             cleanurl.setPassword("")
         if cleanurl.host():
             cleanurl.setHost(cleanurl.host().lower())
         itm = HistoryEntry(cleanurl.toString(), QDateTime.currentDateTime())
         self._addHistoryEntry(itm)
Exemple #5
0
 def addHistoryEntry(self, url):
     """
     Public method to add a history entry.
     
     @param url URL to be added (string)
     """
     cleanurl = QUrl(url)
     if cleanurl.scheme() not in ["eric", "about"]:
         if cleanurl.password():
             # don't save the password in the history
             cleanurl.setPassword("")
         if cleanurl.host():
             cleanurl.setHost(cleanurl.host().lower())
         itm = HistoryEntry(cleanurl.toString(),
                            QDateTime.currentDateTime())
         self._addHistoryEntry(itm)
Exemple #6
0
        #data = subprocess.check_output(['objdump', '-d',path]).decode("utf-8")
        data = profile.loadBinaryDesass(path, func)
        return data
    else:
        abort(404)


if args.webkit == 0:
    app.run(host="localhost", port=port, threaded=True)
else:
    #from https://mrl33h.de/post/23

    #select a port
    port = randint(1025, 65535)

    #start server
    thread = threading.Thread(target=app.run, args=['localhost', port])
    thread.daemon = True
    thread.start()

    qt_app = QApplication([])
    w = QWebView()
    url = QUrl('http://localhost:' + str(port))
    url.setUserName(webkitUser)
    url.setPassword(webkitPasswd)
    w.load(url)
    w.show()
    w.showMaximized()
    qt_app.exec_()
    os.remove(authFile)