Beispiel #1
0
    def fileNew(self):

        if not self.okToContinue():
            return

        fname = managerFile.fileNew(self.filename)

        if fname:
            HelperMethods.setEnabled(self.fileMenuActions[2:4], True)
            self.filename = fname
            self.dirty = True
            self.setTitle(fname)
            self.newSim()
Beispiel #2
0
    def loadFile(self, fname=None):

        if fname is None:
            action = self.sender()
            if isinstance(action, QAction):
                fname = action.data()
                if not self.okToContinue():
                    return
            else:
                return

        if fname:
            self.filename = None
            self.addRecentFile(fname)
            self.filename = fname
            self.dirty = False
            HelperMethods.setEnabled(self.fileMenuActions[2:4], True)
            self.setTitle(fname)
            self.openSim()
Beispiel #3
0
    def newSim(self):

        self.initSim()

        self.simulationToolBar(1)
        self.geometryToolBar(reset=True)

        HelperMethods.setEnabled(self.menuNew_Simulation_Scenario, True)
        HelperMethods.setEnabled(self.geometryMenuActions[0], True)
        HelperMethods.setEnabled(self.geometryMenuActions[4], True)

        # Show loadImage in Geometric Toolbar
        self.geometryToolBar(LoadImage=True)
        self.updateUI()
    def runEngine(self, isView=False, isReceiverPlot=False):

        self.dirty = True

        self.menuFile.menuAction().setEnabled(False)
        self.menuConfiguration.menuAction().setEnabled(False)
        self.menuPlotting_Tools.menuAction().setEnabled(False)
        self.menuTools.menuAction().setEnabled(False)
        HelperMethods.setEnabled(self.fileMenuActions, False)
        HelperMethods.setEnabled(self.geometryMenuActions, False)
        HelperMethods.setEnabled(self.inspectionMenuActions, False)
        HelperMethods.setEnabled(self.simulationMenuActions, False)

        self.statusBarWidget.startSimulation(self.SimNDT_Simulation.TimeSteps)

        if isView:
            self.statusBarWidget.viewOn()
        else:
            self.statusBarWidget.updateGeometryFrame()

        simPack = SimPack(self.SimNDT_Scenario, self.SimNDT_Materials,
                          self.SimNDT_Boundaries, self.SimNDT_Inspection,
                          self.SimNDT_Source, self.SimNDT_Transducers,
                          self.SimNDT_Signal, self.SimNDT_Simulation)

        engine = EngineController(simPack, isView, isReceiverPlot,
                                  self.statusBarWidget, self)

        state = engine.run()

        self.statusBarWidget.endSimulation()

        self.PauseSimulation = False

        if state == "Stop":
            self.StopSimulation = False
            self.status.showMessage("Stop by User!!!!!", 15000)
            message = WarningParms("Stop by User!!!")
            message.exec_()
        else:
            self.status.showMessage("Done", 15000)
            message = DoneParms()
            message.exec_()

        self.menuFile.menuAction().setEnabled(True)
        self.menuConfiguration.menuAction().setEnabled(True)
        self.menuPlotting_Tools.menuAction().setEnabled(True)
        self.menuTools.menuAction().setEnabled(True)
        HelperMethods.setEnabled(self.fileMenuActions, True)
        HelperMethods.setEnabled(self.geometryMenuActions, True)
        HelperMethods.setEnabled(self.inspectionMenuActions, True)
        HelperMethods.setEnabled(self.simulationMenuActions, True)

        self.setPlotInspectionsMenu()
        self.SimNDT_Receivers = Receivers(self.SimNDT_Inspection.Name)
        self.SimNDT_Receivers.setReceivers(engine)
Beispiel #5
0
    def updateUI(self):

        if self.SimNDT_Scenario is not None:

            try:
                self.GraphicView.imshow(self.SimNDT_Scenario.I)

            except Exception as e:
                msgBox = WarningParms(
                    "Unable to display GRAPHICS!!!. Incompatible Graphic Card, %s"
                    % e)
                if msgBox.exec_():
                    sys.exit()

            HelperMethods.setEnabled(self.menuNew_Simulation_Scenario, True)
            HelperMethods.setEnabled(self.fileMenuActions[2:5], True)
            HelperMethods.setEnabled(self.geometryMenuActions[0:], True)
            HelperMethods.setEnabled(self.configurationMenuActions[0], True)

            self.addDockWidget(Qt.LeftDockWidgetArea, self.treeDockWidget)
            self.treeDockWidget.show()

            self.geometryToolBar()
            self.simulationToolBar(2)
            self.statusBarWidget.zoomSpinBox.setVisible(True)

        if self.SimNDT_Materials is not None:
            HelperMethods.setEnabled(self.configurationMenuActions[1], True)
            self.simulationToolBar(3)

        if self.SimNDT_Boundaries is not None:

            if np.size(self.SimNDT_Scenario.Iabs) == 1:
                self.GraphicView.imshow(self.SimNDT_Scenario.I)
            else:
                self.GraphicView.imshow(self.SimNDT_Scenario.Iabs)
            HelperMethods.setEnabled(self.menuInspection_Setup, True)
            HelperMethods.setEnabled(self.inspectionMenuActions[:], True)
            self.simulationToolBar(6)

        if self.SimNDT_Inspection is not None:
            HelperMethods.setEnabled(self.simulationMenuActions[6], True)
            self.simulationToolBar(7)

        if self.SimNDT_Simulation is not None:
            HelperMethods.setEnabled(self.simulationMenuActions[7], True)
            self.simulationToolBar(8)

        if self.SimNDT_Check:
            HelperMethods.setEnabled(self.actionRun_Simulation, True)
            if not self.OpenSimFile:
                self.simulationToolBar(9)

        self.treeWidget.update(self.SimNDT_Scenario, self.SimNDT_ObjectList,
                               self.SimNDT_Materials, self.SimNDT_Boundaries,
                               self.SimNDT_Inspection, self.SimNDT_Source,
                               self.SimNDT_Transducers, self.SimNDT_Signal,
                               self.SimNDT_Simulation)
Beispiel #6
0
    def setPlotInspectionsMenu(self):

        HelperMethods.setEnabled(self.actionPlot_Receiver_Signals_SingleLaunch,
                                 False)
        HelperMethods.setEnabled(self.actionPlot_Receiver_Signals_Spectra,
                                 False)

        HelperMethods.setEnabled(self.actionPlot_Receivers_Signals_LinearScan,
                                 False)
        HelperMethods.setEnabled(self.actionPlot_Receivers_Signals_Tomography,
                                 False)

        Name = self.SimNDT_Inspection.Name
        if Name == "Transmission" or Name == "PulseEcho":
            self.menuPlotting_Tools.menuAction().setVisible(True)
            HelperMethods.setEnabled(
                self.actionPlot_Receiver_Signals_SingleLaunch, True)
        elif Name == "LinearScan":
            self.menuPlotting_Tools.menuAction().setVisible(True)
            HelperMethods.setEnabled(
                self.actionPlot_Receivers_Signals_LinearScan, True)
        elif Name == 'Tomography':
            self.menuPlotting_Tools.menuAction().setVisible(True)
            HelperMethods.setEnabled(
                self.actionPlot_Receivers_Signals_Tomography, True)
Beispiel #7
0
    def createMenus(self):

        newFileAction = HelperMethods.createAction(
            self, "&New Simulation", self.fileNew, QKeySequence.New,
            "document-new.png", self.tr("New Simulation File"))
        fileOpenAction = HelperMethods.createAction(
            self, "&Open existing Simulation", self.fileOpen,
            QKeySequence.Open, 'document-open.png',
            self.tr("Open an existing Simulation"))
        fileSaveAction = HelperMethods.createAction(
            self, "&Save Simulation", self.fileSave, QKeySequence.Save,
            "document-save.png", self.tr("Save the current Simulation"))
        fileSaveAsAction = HelperMethods.createAction(
            self,
            "Save &As",
            self.fileSaveAs,
            QKeySequence.SaveAs,
            icon="document-save-as.png",
            tip=self.tr("Save Simulation File As"))

        fileOpenAction.setIcon(self.style().standardIcon(
            QStyle.SP_DirOpenIcon))
        # fileSaveAction.setIcon(self.style().standardIcon(QStyle.SP_FileDialogNewFolder))

        fileExportMatlabAction = HelperMethods.createAction(
            self,
            "Export in .mat File",
            self.exportMatlab,
            "Ctrl+E",
            icon="exportMatlab.png",
            tip=self.tr("Export in .mat File"))

        fileResetAction = HelperMethods.createAction(self,
                                                     "Reset Settings",
                                                     self.resetSettings,
                                                     icon="reset.png")

        fileQuitAction = HelperMethods.createAction(
            self, "&Quit", self.close, "Ctrl+Q", "close",
            self.tr("Close the application"))

        self.fileMenuActions = (newFileAction, fileOpenAction, fileSaveAction,
                                fileSaveAsAction, fileExportMatlabAction, None,
                                fileResetAction, fileQuitAction)

        HelperMethods.setEnabled(self.fileMenuActions[2:5], False)
        self.connect(self.menuFile, SIGNAL("aboutToShow()"),
                     self.updateFileMenu)

        self.geometryMenuActions = (
            self.actionNew_Geometry_Model, None, self.actionAdd_Ellipse,
            self.actionAdd_Rectangle, self.actionLoad_Scenario_From_Image,
            None, self.actionPreview_Labeled_Scenario,
            self.actionRotate_The_Scenario_90_Clockwise,
            self.actionRotate_The_Scenario_90_Counter_Clockwise)

        HelperMethods.setEnabled(self.menuNew_Simulation_Scenario, False)
        HelperMethods.setEnabled(self.geometryMenuActions, False)

        self.configurationMenuActions = (self.actionMaterials_Setup,
                                         self.actionBoundaty_Conditions_Setup)
        HelperMethods.setEnabled(self.configurationMenuActions, False)

        self.inspectionMenuActions = (self.actionSingle_Launch_Inspection,
                                      self.actionLinear_Scan_Inspections,
                                      self.actionTomography_Inspections)
        inspectionGroup = QActionGroup(self)
        HelperMethods.addActions(inspectionGroup, self.inspectionMenuActions)

        HelperMethods.setEnabled(self.menuInspection_Setup, False)
        HelperMethods.setEnabled(self.actionSimulation_Setup, False)
        HelperMethods.setEnabled(self.actionCheck_Simulation_Setup, False)
        HelperMethods.setEnabled(self.actionRun_Simulation, False)

        self.actionSignal = HelperMethods.createAction(self, "&Signal Setup",
                                                       self.signalSetup,
                                                       "Ctrl+Shift+p",
                                                       "signal.png",
                                                       self.tr("Signal Setup"))

        self.simulationMenuActions = (self.actionNew_Geometry_Model,
                                      self.actionMaterials_Setup,
                                      self.actionBoundaty_Conditions_Setup,
                                      self.actionSingle_Launch_Inspection,
                                      self.actionLinear_Scan_Inspections,
                                      self.actionTomography_Inspections,
                                      self.actionSimulation_Setup,
                                      self.actionCheck_Simulation_Setup,
                                      self.actionRun_Simulation)

        self.menuPlotting_Tools.menuAction().setVisible(False)

        # self.menuAdd_Microstructure.menuAction().setVisible(False)
        # self.menuTools.menuAction().setVisible(False)

        helpAboutAction = HelperMethods.createAction(self, "&About SimNDT",
                                                     self.helpAbout)
        helpHelpAction = HelperMethods.createAction(self, self.tr("&Help"),
                                                    self.helpHelp,
                                                    QKeySequence.HelpContents)

        helpMenu = self.menubar.addMenu(self.tr("&Help"))
        HelperMethods.addActions(helpMenu, (helpAboutAction, helpHelpAction))