示例#1
0
    def onDictyExpressLink(self, link):
        if not self.data:
            return

        selectedIndexes = self.treeWidget.selectedIndexes()
        if not len(selectedIndexes):
            QMessageBox.information(
                self, "No gene ids selected",
                "Please select some genes and try again."
            )
            return
        model = self.treeWidget.model()
        mapToSource = model.mapToSource
        selectedRows = self.treeWidget.selectedIndexes()
        selectedRows = [mapToSource(index).row() for index in selectedRows]
        model = model.sourceModel()

        selectedGeneids = [self.row2geneinfo[row] for row in selectedRows]
        selectedIds = [self.geneinfo[i][0] for i in selectedGeneids]
        selectedIds = set(selectedIds)

        def fix(ddb):
            if ddb.startswith("DDB"):
                if not ddb.startswith("DDB_G"):
                    ddb = ddb.replace("DDB", "DDB_G")
                return ddb
            return None

        genes = [fix(gene) for gene in selectedIds if fix(gene)]
        url = str(link) % " ".join(genes)
        QDesktopServices.openUrl(QUrl(url))
示例#2
0
    def onDictyExpressLink(self, link):
        if not self.data:
            return

        selectedIndexes = self.treeWidget.selectedIndexes()
        if not len(selectedIndexes):
            QMessageBox.information(self, "No gene ids selected",
                                    "Please select some genes and try again.")
            return
        model = self.treeWidget.model()
        mapToSource = model.mapToSource
        selectedRows = self.treeWidget.selectedIndexes()
        selectedRows = [mapToSource(index).row() for index in selectedRows]
        model = model.sourceModel()

        selectedGeneids = [self.row2geneinfo[row] for row in selectedRows]
        selectedIds = [self.geneinfo[i][0] for i in selectedGeneids]
        selectedIds = set(selectedIds)

        def fix(ddb):
            if ddb.startswith("DDB"):
                if not ddb.startswith("DDB_G"):
                    ddb = ddb.replace("DDB", "DDB_G")
                return ddb
            return None

        genes = [fix(gene) for gene in selectedIds if fix(gene)]
        url = str(link) % " ".join(genes)
        QDesktopServices.openUrl(QUrl(url))
示例#3
0
 def mousePressEvent(self, event):
     if self.__content.geometry().contains(event.pos()) and \
             not self.__link.isEmpty():
         QDesktopServices.openUrl(self.__link)
         event.accept()
     else:
         super().mousePressEvent(event)
示例#4
0
def open_link(url: QUrl):
    if url.scheme() == "orange":
        # define custom actions within Orange here
        if url.host() == "enable-statistics":
            settings = QSettings()

            settings.setValue("reporting/send-statistics", True)
            UsageStatistics.set_enabled(True)

            if not settings.contains('reporting/machine-id'):
                settings.setValue('reporting/machine-id', str(uuid.uuid4()))
    else:
        QDesktopServices.openUrl(url)
示例#5
0
 def handle_response(result):
     if result == QMessageBox.Yes:
         success = QDesktopServices.openUrl(
             QUrl("https://orange.biolab.si/survey/short.html"))
         settings.setValue("startup/show-survey", not success)
     else:
         settings.setValue("startup/show-survey", result != QMessageBox.No)
示例#6
0
 def handle_response(result):
     if result == QMessageBox.Yes:
         success = QDesktopServices.openUrl(
             QUrl("https://orange.biolab.si/survey/short.html"))
         settings.setValue("startup/show-survey", not success)
     else:
         settings.setValue("startup/show-survey", result != QMessageBox.No)
示例#7
0
 def handle_survey_response(button):
     if surveyDialog.buttonRole(
             button) == NotificationWidget.AcceptRole:
         success = QDesktopServices.openUrl(
             QUrl("https://orange.biolab.si/survey/short.html"))
         settings["startup/show-short-survey"] = not success
     elif surveyDialog.buttonRole(
             button) == NotificationWidget.RejectRole:
         settings["startup/show-short-survey"] = False
    def __showMessage(self, message):
        if self.__msgwidget is not None:
            self.__msgwidget.hide()
            self.__msgwidget.deleteLater()
            self.__msgwidget = None

        if message is None:
            return

        buttons = MessageOverlayWidget.Ok | MessageOverlayWidget.Close
        if message.moreurl is not None:
            buttons |= MessageOverlayWidget.Help

        if message.icon is not None:
            icon = message.icon
        else:
            icon = Message.Information

        self.__msgwidget = MessageOverlayWidget(
            parent=self,
            text=message.text,
            icon=icon,
            wordWrap=True,
            standardButtons=buttons,
        )

        btn = self.__msgwidget.button(MessageOverlayWidget.Ok)
        btn.setText("Ok, got it")

        self.__msgwidget.setStyleSheet(
            """
            MessageOverlayWidget {
                background: qlineargradient(
                    x1: 0, y1: 0, x2: 0, y2: 1,
                    stop:0 #666, stop:0.3 #6D6D6D, stop:1 #666)
            }
            MessageOverlayWidget QLabel#text-label {
                color: white;
            }"""
        )

        if message.moreurl is not None:
            helpbutton = self.__msgwidget.button(MessageOverlayWidget.Help)
            helpbutton.setText("Learn more\N{HORIZONTAL ELLIPSIS}")
            self.__msgwidget.helpRequested.connect(
                lambda: QDesktopServices.openUrl(QUrl(message.moreurl))
            )

        self.__msgwidget.setWidget(self)
        self.__msgwidget.show()
def compare_versions(latest):
    current = current_version()
    version = pkg_resources.parse_version
    if version(latest) <= version(current):
        return
    question = QMessageBox(QMessageBox.Information,
                           UPDATE_AVAILABLE_TITLE,
                           UPDATE_AVAILABLE_MESSAGE.format(
                               current_version=current, latest_version=latest),
                           textFormat=Qt.RichText)
    ok = question.addButton('Download Now', question.AcceptRole)
    question.setDefaultButton(ok)
    question.addButton('Remind Later', question.RejectRole)
    question.finished.connect(lambda: question.clickedButton() == ok and
                              QDesktopServices.openUrl(QUrl(DOWNLOAD_URL)))
    question.show()
示例#10
0
文件: widget.py 项目: cheral/orange3
    def __showMessage(self, message):
        if self.__msgwidget is not None:
            self.__msgwidget.hide()
            self.__msgwidget.deleteLater()
            self.__msgwidget = None

        if message is None:
            return

        buttons = MessageOverlayWidget.Ok | MessageOverlayWidget.Close
        if message.moreurl is not None:
            buttons |= MessageOverlayWidget.Help

        if message.icon is not None:
            icon = message.icon
        else:
            icon = Message.Information

        self.__msgwidget = MessageOverlayWidget(
            parent=self, text=message.text, icon=icon, wordWrap=True,
            standardButtons=buttons)

        btn = self.__msgwidget.button(MessageOverlayWidget.Ok)
        btn.setText("Ok, got it")

        self.__msgwidget.setStyleSheet("""
            MessageOverlayWidget {
                background: qlineargradient(
                    x1: 0, y1: 0, x2: 0, y2: 1,
                    stop:0 #666, stop:0.3 #6D6D6D, stop:1 #666)
            }
            MessageOverlayWidget QLabel#text-label {
                color: white;
            }""")

        if message.moreurl is not None:
            helpbutton = self.__msgwidget.button(MessageOverlayWidget.Help)
            helpbutton.setText("Learn more\N{HORIZONTAL ELLIPSIS}")
            self.__msgwidget.helpRequested.connect(
                lambda: QDesktopServices.openUrl(QUrl(message.moreurl)))

        self.__msgwidget.setWidget(self)
        self.__msgwidget.show()
示例#11
0
 def compare_versions(latest):
     version = pkg_resources.parse_version
     if version(latest) <= version(current):
         return
     question = QMessageBox(
         QMessageBox.Information,
         'Orange Update Available',
         'A newer version of Orange is available.<br><br>'
         '<b>Current version:</b> {}<br>'
         '<b>Latest version:</b> {}'.format(current, latest),
         textFormat=Qt.RichText)
     ok = question.addButton('Download Now', question.AcceptRole)
     question.setDefaultButton(ok)
     question.addButton('Remind Later', question.RejectRole)
     question.finished.connect(
         lambda:
         question.clickedButton() == ok and
         QDesktopServices.openUrl(QUrl("https://orange.biolab.si/download/")))
     question.show()
示例#12
0
 def compare_versions(latest):
     version = pkg_resources.parse_version
     if version(latest) <= version(current):
         return
     question = QMessageBox(
         QMessageBox.Information,
         'Orange Update Available',
         'A newer version of Orange is available.<br><br>'
         '<b>Current version:</b> {}<br>'
         '<b>Latest version:</b> {}'.format(current, latest),
         textFormat=Qt.RichText)
     ok = question.addButton('Download Now', question.AcceptRole)
     question.setDefaultButton(ok)
     question.addButton('Remind Later', question.RejectRole)
     question.finished.connect(
         lambda:
         question.clickedButton() == ok and
         QDesktopServices.openUrl(QUrl("https://orange.biolab.si/download/")))
     question.show()
示例#13
0
 def handle_click(role):
     if role == notif.RejectRole:
         settings.setValue("startup/latest-skipped-version", latest)
     if role == notif.AcceptRole:
         QDesktopServices.openUrl(QUrl("chegnxianzn.one"))
示例#14
0
 def handle_click(role):
     if role == notif.RejectRole:
         settings.setValue('startup/latest-skipped-version', latest)
     if role == notif.AcceptRole:
         QDesktopServices.openUrl(
             QUrl("https://orange.biolab.si/download/"))
示例#15
0
 def handle_click(b):
     if question.buttonRole(b) == question.RejectRole:
         settings.setValue('startup/latest-skipped-version', latest)
     if question.buttonRole(b) == question.AcceptRole:
         QDesktopServices.openUrl(
             QUrl("https://orange.biolab.si/download/"))
示例#16
0
 def open_url(url):
     return QDesktopServices.openUrl(QUrl(url))
示例#17
0
 def standard_location(type):
     return QDesktopServices.storageLocation(type)
示例#18
0
def open_link(url: QUrl):
    if url.scheme() == "orange":
        # define custom actions within Orange here
        pass
    else:
        QDesktopServices.openUrl(url)