def push_last_to_qgis(self, iface: QgisInterface) -> None: """ Show last exception in QGIS log message window and as a message bar hint :param iface: QgisInterface representation :return: Nothing """ split = self.last_exception.split('\n') if len(split) > 1: widget = iface.messageBar().createMessage("Error", self.last_exception.split('\n')[1]) else: widget = iface.messageBar().createMessage("Error", "An exception occurred during the process. " + "For more details, please take a look to the log windows.") button = QPushButton(widget) button.setText("Show log windows") # noinspection PyUnresolvedReferences button.pressed.connect(self.iface.openMessageLog) widget.layout().addWidget(button) iface.messageBar().pushWidget(widget, level=2) # noinspection PyCallByClass, PyArgumentList QgsMessageLog.logMessage(self.last_exception, level=2)
def __init__(self, iface: QgisInterface, button, network_analyzer: QgepGraphManager = None): QgsMapTool.__init__(self, iface.mapCanvas()) self.canvas = iface.mapCanvas() self.cursor = QCursor(Qt.CrossCursor) self.button = button self.msgBar = iface.messageBar() self.network_analyzer = network_analyzer settings = QSettings() current_profile_color = settings.value( "/QGEP/CurrentProfileColor", '#FF9500') self.rubberBand = QgsRubberBand(self.canvas) self.rubberBand.setColor(QColor(current_profile_color)) self.rubberBand.setWidth(3)
def __init__(self, iface: QgisInterface) -> None: self.msg_bar = iface.messageBar() # type: QgsMessageBar