예제 #1
0
    def setHelp(self, reply, item):
        """Change the HTML content"""
        QApplication.restoreOverrideCursor()
        if reply.error() != QNetworkReply.NoError:
            html = self.tr(
                '<h2>No detailed description available for this script</h2>')
        else:
            content = bytes(reply.readAll()).decode('utf8')
            try:
                descriptions = json.loads(content)
            except json.decoder.JSONDecodeError:
                html = self.tr(
                    '<h2>JSON Decoding Error - could not load help</h2>')
            except Exception:
                html = self.tr(
                    '<h2>Unspecified Error - could not load help</h2>')

            html = '<h2>%s</h2>' % item.name
            html += self.tr('<p><b>Description:</b> {0}</p>').format(
                getDescription(ALG_DESC, descriptions))
            html += self.tr('<p><b>Created by:</b> {0}').format(
                getDescription(ALG_CREATOR, descriptions))
            html += self.tr('<p><b>Version:</b> {0}').format(
                getDescription(ALG_VERSION, descriptions))
        reply.deleteLater()
        self.txtHelp.setHtml(html)
예제 #2
0
 def currentItemChanged(self, item, prev):
     if isinstance(item, TreeItem):
         try:
             url = self.urlBase + item.filename.replace(" ","%20") + ".help"
             helpContent = readUrl(url)
             descriptions = json.loads(helpContent)
             html = "<h2>%s</h2>" % item.name
             html+="<p><b>Description:</b> " + getDescription(ALG_DESC, descriptions)+"</p>"
             html+="<p><b>Created by:</b> " + getDescription(ALG_CREATOR, descriptions)+"</p>"
             html+="<p><b>Version:</b> " + getDescription(ALG_VERSION, descriptions)+"</p>"
         except HTTPError, e:
             html = "<h2>No detailed description available for this script</h2>"
         self.webView.setHtml(html)
예제 #3
0
 def currentItemChanged(self, item, prev):
     if isinstance(item, TreeItem):
         try:
             url = self.urlBase + item.filename.replace(' ', '%20') + '.help'
             helpContent = readUrl(url)
             descriptions = json.loads(helpContent)
             html = '<h2>%s</h2>' % item.name
             html += self.tr('<p><b>Description:</b> %s</p>') % getDescription(ALG_DESC, descriptions)
             html += self.tr('<p><b>Created by:</b> %s') % getDescription(ALG_CREATOR, descriptions)
             html += self.tr('<p><b>Version:</b> %s') % getDescription(ALG_VERSION, descriptions)
         except HTTPError, e:
             html = self.tr('<h2>No detailed description available for this script</h2>')
         self.webView.setHtml(html)
예제 #4
0
 def setHelp(self, reply, item):
     """Change the webview HTML content"""
     QApplication.restoreOverrideCursor()
     if reply.error() != QNetworkReply.NoError:
         html = self.tr('<h2>No detailed description available for this script</h2>')
     else:
         content = unicode(reply.readAll())
         descriptions = json.loads(content)
         html = '<h2>%s</h2>' % item.name
         html += self.tr('<p><b>Description:</b> %s</p>') % getDescription(ALG_DESC, descriptions)
         html += self.tr('<p><b>Created by:</b> %s') % getDescription(ALG_CREATOR, descriptions)
         html += self.tr('<p><b>Version:</b> %s') % getDescription(ALG_VERSION, descriptions)
     reply.deleteLater()
     self.webView.setHtml(html)
예제 #5
0
 def setHelp(self, reply, item):
     """Change the HTML content"""
     QApplication.restoreOverrideCursor()
     if reply.error() != QNetworkReply.NoError:
         html = self.tr('<h2>No detailed description available for this script</h2>')
     else:
         content = str(reply.readAll())
         descriptions = json.loads(content)
         html = '<h2>%s</h2>' % item.name
         html += self.tr('<p><b>Description:</b> %s</p>') % getDescription(ALG_DESC, descriptions)
         html += self.tr('<p><b>Created by:</b> %s') % getDescription(ALG_CREATOR, descriptions)
         html += self.tr('<p><b>Version:</b> %s') % getDescription(ALG_VERSION, descriptions)
     reply.deleteLater()
     self.txtHelp.setHtml(html)
예제 #6
0
 def setHelp(self, reply, item):
     """Change the HTML content"""
     QApplication.restoreOverrideCursor()
     if reply.error() != QNetworkReply.NoError:
         html = self.tr("<h2>No detailed description available for this script</h2>")
     else:
         content = bytes(reply.readAll()).decode("utf8")
         descriptions = json.loads(content)
         html = "<h2>%s</h2>" % item.name
         html += self.tr("<p><b>Description:</b> %s</p>") % getDescription(ALG_DESC, descriptions)
         html += self.tr("<p><b>Created by:</b> %s") % getDescription(ALG_CREATOR, descriptions)
         html += self.tr("<p><b>Version:</b> %s") % getDescription(ALG_VERSION, descriptions)
     reply.deleteLater()
     self.txtHelp.setHtml(html)
예제 #7
0
 def currentItemChanged(self, item, prev):
     if isinstance(item, TreeItem):
         try:
             url = self.urlBase + item.filename.replace(' ', '%20') + '.help'
             helpContent = readUrl(url)
             descriptions = json.loads(helpContent)
             html = '<h2>%s</h2>' % item.name
             html += self.tr('<p><b>Description:</b> %s</p>') % getDescription(ALG_DESC, descriptions)
             html += self.tr('<p><b>Created by:</b> %s') % getDescription(ALG_CREATOR, descriptions)
             html += self.tr('<p><b>Version:</b> %s') % getDescription(ALG_VERSION, descriptions)
         except HTTPError as e:
             html = self.tr('<h2>No detailed description available for this script</h2>')
         self.webView.setHtml(html)
     else:
         self.webView.setHtml(self.HELP_TEXT)
예제 #8
0
 def currentItemChanged(self, item, prev):
     if isinstance(item, TreeItem):
         try:
             url = self.urlBase + item.filename.replace(" ",
                                                        "%20") + ".help"
             helpContent = readUrl(url)
             descriptions = json.loads(helpContent)
             html = "<h2>%s</h2>" % item.name
             html += "<p><b>Description:</b> " + getDescription(
                 ALG_DESC, descriptions) + "</p>"
             html += "<p><b>Created by:</b> " + getDescription(
                 ALG_CREATOR, descriptions) + "</p>"
             html += "<p><b>Version:</b> " + getDescription(
                 ALG_VERSION, descriptions) + "</p>"
         except HTTPError, e:
             html = "<h2>No detailed description available for this script</h2>"
         self.webView.setHtml(html)
예제 #9
0
    def setHelp(self, reply, item):
        """Change the HTML content"""
        QApplication.restoreOverrideCursor()
        if reply.error() != QNetworkReply.NoError:
            html = self.tr('<h2>No detailed description available for this script</h2>')
        else:
            content = bytes(reply.readAll()).decode('utf8')
            try:
                descriptions = json.loads(content)
            except json.decoder.JSONDecodeError:
                html = self.tr('<h2>JSON Decoding Error - could not load help</h2>')
            except Exception:
                html = self.tr('<h2>Unspecified Error - could not load help</h2>')

            html = '<h2>%s</h2>' % item.name
            html += self.tr('<p><b>Description:</b> {0}</p>').format(getDescription(ALG_DESC, descriptions))
            html += self.tr('<p><b>Created by:</b> {0}').format(getDescription(ALG_CREATOR, descriptions))
            html += self.tr('<p><b>Version:</b> {0}').format(getDescription(ALG_VERSION, descriptions))
        reply.deleteLater()
        self.txtHelp.setHtml(html)