Beispiel #1
0
 def __enter__(self):
     self.__traceroute__ = TraceRoute()
     self.__traceroute_expected__ = TraceRoute()
     self.__expectation__ = []
     self.__recording__ = RECORDING
     self.__dependency_injection__ = DependencyInjection(double=self)
     return self
Beispiel #2
0
    def onClickDoItButton(self):
        """ Called when the 'DoIt' button is pressed.
            Reads the entered URL, validates it and initiates the trace route command
        :return: None
        """
        try:
            self.statusbar.clearMessage()
            self.statusbar.showMessage("Working...")
            self.doLookupPushButton.setEnabled(False)
            self.textOutput.clear()

            # read entered URL
            url = self.urlLineEdit.text()

            if url:
                with open("./busy.html", "r") as htmlFile:
                    html = htmlFile.read()
                self.web.setHtml(html)

                self.traceRouteThreadedHandler = TraceRoute(url)

                # set up callbacks for the trace route output
                self.traceRouteThreadedHandler.traceRouteTerminated.connect(
                    self.onTraceRouteComplete)
                self.traceRouteThreadedHandler.textOutputReady.connect(
                    self.onTraceRouteRawOutput)

                self.traceRouteThreadedHandler.start()

            else:
                self.statusbar.showMessage("URL is invalid", 5000)
                self.doLookupPushButton.setEnabled(True)

                QMessageBox.information(self, "Empty Field",
                                        "The entered URL is invalid")

        except Exception as e:
            QMessageBox.critical(self, "Critical",
                                 "Problem initiating trace route : " + str(e))