def __init__(self, parent=None): super(TreeWidget, self).__init__(parent) self.setGeometry(QRect(0, 0, 350, 840)) self.setHeaderLabels(["", ""]) self.setMaximumWidth(450) self.setMinimumWidth(150) # self.setRootIsDecorated(True) self.setAlternatingRowColors(True) self.setColumnCount(2) self.header().resizeSection(0, 200) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.showContextMenu) self.actionDeleteObject = HelperMethods.createAction( self, "Delete Selected Object", self.deleteObject, icon="delete.png") self.deleteDone = MySignal()
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))