Beispiel #1
0
    def buttonCB_generateGraph(self):
        if (not self.transient and len(self.cellDict) == 0):
            self.stringVar_status.set("No cells have been loaded")
            return

        try:
            coords = [
                int(x.strip())
                for x in self.stringVar_entry_coords.get().split(",")
            ]
        except ValueError:
            self.stringVar_status.set("Invalid coordinate format")
            print(
                f"WARNING: Invalid coordinate string ({self.stringVar_entry_coords.get()})"
            )
            return
        self.stringVar_status.set("Searching for coordinates...")
        self.update()

        if (self.transient):
            self.graphThread = Actions.GraphThread(
                graphicalElements=self.graphicalElements,
                filename=self.filename,
                coords=coords)
        else:
            self.graphThread = Actions.GraphThread(
                graphicalElements=self.graphicalElements,
                cellDict=self.cellDict,
                coords=coords)

        # Do not wait for this thread (it disables the graph generation button until completed)
        # The thread is a daemon and will terminate when finished or when the main thread terminates
        self.graphThread.start()