Beispiel #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))
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
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)
Beispiel #5
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()
Beispiel #8
0
    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()
Beispiel #9
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()
Beispiel #10
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()
Beispiel #11
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/"))
Beispiel #12
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/"))
Beispiel #13
0
 def open_url(url):
     return QDesktopServices.openUrl(QUrl(url))
Beispiel #14
0
def open_link(url: QUrl):
    if url.scheme() == "orange":
        # define custom actions within Orange here
        pass
    else:
        QDesktopServices.openUrl(url)
Beispiel #15
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"))