Esempio n. 1
0
    def _btn_upload(self):
        """
        Blocks usage of the ui elements, and starts the upload thread with the set variables
        :return:
        """
        logging.debug("GUI: _btn_upload clicked")

        if tools.is_connected_to_irida():
            self._start_upload()
        else:
            # If no connection to irida, display a warning to the user
            msg = QtWidgets.QMessageBox()
            msg.setIcon(QtWidgets.QMessageBox.Warning)
            msg.setText("Cannot Connect to IRIDA")
            msg.setInformativeText('Please check your configuration')
            msg.setWindowTitle("Connection Error")
            # You need 2 buttons on the widget for the exit button to not be the same as the Open Config button
            # So we add an "OK" button, and then hide it
            p_config_button = msg.addButton("Open Config",
                                            QtWidgets.QMessageBox.YesRole)
            p_accept_button = msg.addButton("OK", QtWidgets.QMessageBox.NoRole)
            p_accept_button.hide()
            # Show the window, and don't let user interact with main dialog
            msg.exec()
            # allow user to go directoy to the config page
            if msg.clickedButton() == p_config_button:
                self._btn_show_config()
Esempio n. 2
0
 def _contact_irida(self):
     """
     Attempts to connect to IRIDA
     Sets the style and text of the status widget to green/red to indicate connected/error
     :return:
     """
     if tools.is_connected_to_irida():
         self._settings_status.setText("Connection OK")
         self._settings_status.setStyleSheet("background-color: {}; color: black;".format(colours.GREEN_LIGHT))
         logging.info("Successfully connected to IRIDA")
     else:
         self._settings_status.setText("ERROR!")
         self._settings_status.setStyleSheet("background-color: {}; color: black;".format(colours.RED_LIGHT))
         logging.info("Error occurred while trying to connect to IRIDA")