Пример #1
0
 def updateColumnVisibility(self):
     is_running = mmapi.is_solver_running()
     if is_running is True:
         return
     show_state = lib_state.get_display_attribute_state_state()
     show_min_max = lib_state.get_display_attribute_min_max_state()
     self.displayStateColumnChanged(show_state)
     self.displayMinMaxColumnChanged(show_min_max)
     return
Пример #2
0
    def addMenuBarContents(self, menubar):
        # File Menu
        file_menu = QtWidgets.QMenu('File', menubar)

        # New Collection
        label = 'New Collection'
        tooltip = 'Create a new Collection node.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.createNewCollectionNodeCB))
        file_menu.addAction(action)

        # Rename Collection
        label = 'Rename Collection'
        tooltip = 'Rename a Collection node.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.renameCollectionNodeCB))
        file_menu.addAction(action)

        file_menu.addSeparator()

        # Remove Collection
        label = 'Remove Collection'
        tooltip = 'Remove a Collection node.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.removeCollectionNodeCB))
        file_menu.addAction(action)

        file_menu.addSeparator()

        # Close Window
        label = 'Close Window'
        tooltip = 'Close the mmSolver window.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.close))
        file_menu.addAction(action)

        menubar.addMenu(file_menu)

        # Edit Menu
        edit_menu = QtWidgets.QMenu('Edit', menubar)
        edit_menu.setTearOffEnabled(True)

        if Qt.IsPySide2 or Qt.IsPyQt5:
            edit_menu.addSection('Undo / Redo')

        # Undo
        label = 'Undo (without UI update)'
        tooltip = ('Undo the Maya scene state, '
                   'without updating the viewport or solver UI')
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(self.undoTriggeredCB)
        edit_menu.addAction(action)

        # Redo
        label = 'Redo (without UI update)'
        tooltip = ('Redo the Maya scene state, '
                   'without updating the viewport or solver UI')
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(self.redoTriggeredCB)
        edit_menu.addAction(action)

        if Qt.IsPySide2 or Qt.IsPyQt5:
            edit_menu.addSection('Window Update')

        # Auto Update Solver Validation
        label = 'Auto-Update Solver Validation'
        tooltip = 'Auto-update details of the solver parameter/error numbers.'
        value = lib_state.get_auto_update_solver_validation_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.solver_settings.autoUpdateSolverValidationChanged)
        edit_menu.addAction(action)

        if Qt.IsPySide2 or Qt.IsPyQt5:
            edit_menu.addSection('Solver Execution')

        # Pre-Solve Force Evaluation
        label = 'Pre-Solve Force Evaluation'
        tooltip = ('Before starting a solve, '
                   'update the scene to force an evaluation.')
        pre_solve_force_eval = lib_state.get_pre_solve_force_eval_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(pre_solve_force_eval)
        action.toggled.connect(type(self).preSolveForceEvalActionToggledCB)
        edit_menu.addAction(action)

        # Refresh Viewport During Solve
        label = 'Refresh Viewport'
        tooltip = 'Refresh the viewport while Solving.'
        refresh_value = lib_state.get_refresh_viewport_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(refresh_value)
        action.toggled.connect(type(self).refreshActionToggledCB)
        edit_menu.addAction(action)

        # Force DG evaluation.
        label = 'Force DG Update'
        tooltip = 'Force Maya DG Evaluation while solving.'
        force_dg_update_value = lib_state.get_force_dg_update_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(force_dg_update_value)
        action.toggled.connect(type(self).forceDgUpdateActionToggledCB)
        edit_menu.addAction(action)

        menubar.addMenu(edit_menu)

        # View Menu
        view_menu = QtWidgets.QMenu('View', menubar)
        view_menu.setTearOffEnabled(True)

        if Qt.IsPySide2 or Qt.IsPyQt5:
            view_menu.addSection('Input Object Display')

        # Display Object Weight
        label = 'Weight Column'
        tooltip = 'Display Object weight column'
        value = lib_state.get_display_object_weight_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.object_browser.displayWeightColumnChanged)
        view_menu.addAction(action)

        # Display Object Frame Deviation
        label = 'Frame Deviation'
        tooltip = 'Display per-frame deviation for each Marker/Camera.'
        value = lib_state.get_display_object_frame_deviation_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.object_browser.displayFrameDeviationColumnChanged)
        view_menu.addAction(action)

        # Display Object Average Deviation
        label = 'Average Deviation'
        tooltip = 'Display average  deviation column'
        value = lib_state.get_display_object_average_deviation_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.object_browser.displayAverageDeviationColumnChanged)
        view_menu.addAction(action)

        # Display Object Maximum Deviation
        label = 'Maximum Deviation'
        tooltip = 'Display maximum deviation column'
        value = lib_state.get_display_object_maximum_deviation_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.object_browser.displayMaximumDeviationColumnChanged)
        view_menu.addAction(action)

        if Qt.IsPySide2 or Qt.IsPyQt5:
            view_menu.addSection('Output Attribute Display')

        # Display Attribute State
        label = 'Display Attribute State'
        tooltip = 'Display Attribute State column'
        value = lib_state.get_display_attribute_state_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.attribute_browser.displayStateColumnChanged)
        view_menu.addAction(action)

        # Display Attribute Min/Max
        label = 'Display Attribute Min/Max'
        tooltip = 'Display Attribute Minimum and Maximum columns'
        value = lib_state.get_display_attribute_min_max_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.attribute_browser.displayMinMaxColumnChanged)
        view_menu.addAction(action)

        if Qt.IsPySide2 or Qt.IsPyQt5:
            view_menu.addSection('During Solve')

        # Display the Image Planes while solving.
        #
        # TODO: Add other object types to show/hide while solving,
        #  such as camera, nurbsCurves, nurbsSurfaces, and locators.
        label = 'Display Image Planes'
        tooltip = 'Display Image Planes while solving.'
        value = lib_state.get_display_image_plane_while_solving_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            type(self).displayImagePlaneWhileSolvingActionToggledCB)
        view_menu.addAction(action)

        # Display the Meshes while solving.
        label = 'Display Meshes'
        tooltip = 'Display Meshes while solving.'
        value = lib_state.get_display_meshes_while_solving_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            type(self).displayMeshesWhileSolvingActionToggledCB)
        view_menu.addAction(action)

        # Isolate Objects while solving
        label = 'Isolate Objects'
        tooltip = 'Isolate visibility of all Markers and Bundles while solving.'
        isolate_value = lib_state.get_isolate_object_while_solving_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(isolate_value)
        action.toggled.connect(
            type(self).isolateObjectWhileSolvingActionToggledCB)
        view_menu.addAction(action)

        menubar.addMenu(view_menu)

        # Log Menu
        # This menu depicts a radio button allowing the user to choose
        # how much information is returned to the console (the logging
        # level).
        log_menu = QtWidgets.QMenu('Log', menubar)

        # Errors
        label = 'Errors'
        tooltip = 'Send Errors to the log.'
        logErrorAction = QtWidgets.QAction(label, log_menu)
        logErrorAction.setStatusTip(tooltip)
        logErrorAction.setCheckable(True)
        logErrorAction.triggered.connect(partial(self.logErrorCB))
        log_menu.addAction(logErrorAction)

        # Warnings
        label = 'Warnings'
        tooltip = 'Send Warnings to the log.'
        logWarningAction = QtWidgets.QAction(label, log_menu)
        logWarningAction.setStatusTip(tooltip)
        logWarningAction.setCheckable(True)
        logWarningAction.triggered.connect(partial(self.logWarningCB))
        log_menu.addAction(logWarningAction)

        # Information
        label = 'Info'
        tooltip = 'Send Information to the log.'
        logInfoAction = QtWidgets.QAction(label, log_menu)
        logInfoAction.setStatusTip(tooltip)
        logInfoAction.setCheckable(True)
        logInfoAction.triggered.connect(partial(self.logInfoCB))
        log_menu.addAction(logInfoAction)

        # Verbose
        label = 'Verbose'
        tooltip = 'Send Verboses to the log.'
        logVerboseAction = QtWidgets.QAction(label, log_menu)
        logVerboseAction.setStatusTip(tooltip)
        logVerboseAction.setCheckable(True)
        logVerboseAction.triggered.connect(partial(self.logVerboseCB))
        log_menu.addAction(logVerboseAction)

        # Debug
        label = 'Debug'
        tooltip = 'Send Debug messages to the log.'
        logDebugAction = QtWidgets.QAction(label, log_menu)
        logDebugAction.setStatusTip(tooltip)
        logDebugAction.setCheckable(True)
        logDebugAction.triggered.connect(partial(self.logDebugCB))
        log_menu.addAction(logDebugAction)

        # 'Radio' button for logging levels
        log_actionGroup = QtWidgets.QActionGroup(log_menu)
        log_actionGroup.addAction(logErrorAction)
        log_actionGroup.addAction(logWarningAction)
        log_actionGroup.addAction(logInfoAction)
        log_actionGroup.addAction(logVerboseAction)
        log_actionGroup.addAction(logDebugAction)

        log_level = lib_state.get_log_level()
        if log_level == const.LOG_LEVEL_ERROR:
            logErrorAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_WARNING:
            logWarningAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_INFO:
            logInfoAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_VERBOSE:
            logVerboseAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_DEBUG:
            logDebugAction.setChecked(True)
        else:
            LOG.warning('Invalid log level given: %r' % log_level)

        menubar.addMenu(log_menu)

        # Help Menu
        help_menu = QtWidgets.QMenu('Help', menubar)

        # Launch Help
        label = 'Help...'
        tooltip = 'Show help.'
        action = QtWidgets.QAction(label, help_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.launchHelpCB))
        help_menu.addAction(action)

        # Launch System Info window.
        label = 'System Information...'
        tooltip = 'Display detailed information about software and hardware.'
        action = QtWidgets.QAction(label, help_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.launchSysInfoCB))
        help_menu.addAction(action)

        # Launch About
        label = 'About mmSolver...'
        tooltip = 'About this software.'
        action = QtWidgets.QAction(label, help_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.launchAboutCB))
        help_menu.addAction(action)

        menubar.addMenu(help_menu)
        return
Пример #3
0
    def addMenuBarContents(self, menubar):
        # File Menu
        file_menu = QtWidgets.QMenu('File', menubar)

        # New Collection
        label = 'New Collection'
        tooltip = 'Create a new Collection node.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.createNewCollectionNodeCB))
        file_menu.addAction(action)

        # Rename Collection
        label = 'Rename Collection'
        tooltip = 'Rename a Collection node.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.renameCollectionNodeCB))
        file_menu.addAction(action)

        file_menu.addSeparator()

        # Remove Collection
        label = 'Remove Collection'
        tooltip = 'Remove a Collection node.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.removeCollectionNodeCB))
        file_menu.addAction(action)

        file_menu.addSeparator()

        # Close Window
        label = 'Close Window'
        tooltip = 'Close the mmSolver window.'
        action = QtWidgets.QAction(label, file_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.close))
        file_menu.addAction(action)

        menubar.addMenu(file_menu)

        # Edit Menu
        edit_menu = QtWidgets.QMenu('Edit', menubar)

        # Refresh Viewport During Solve
        label = 'Refresh Viewport'
        tooltip = 'Refresh the viewport while Solving.'
        refresh_value = lib_state.get_refresh_viewport_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(refresh_value)
        action.toggled.connect(type(self).refreshActionToggledCB)
        edit_menu.addAction(action)

        # Force DG evaluation.
        label = 'Force DG Update'
        tooltip = 'Force Maya DG Evaluation while solving.'
        force_dg_update_value = lib_state.get_force_dg_update_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(force_dg_update_value)
        action.toggled.connect(type(self).forceDgUpdateActionToggledCB)
        edit_menu.addAction(action)

        menubar.addMenu(edit_menu)

        # View Menu
        view_menu = QtWidgets.QMenu('View', menubar)

        # Display Object Weight
        label = 'Display Object Weight Column'
        tooltip = 'Display Object weight column'
        value = lib_state.get_display_object_weight_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(self.subForm.displayObjectWeightColumnChanged)
        view_menu.addAction(action)

        # Display Object Deviation
        label = 'Display Object Frame Deviation'
        tooltip = 'Display per-frame deviation for each Marker/Camera.'
        value = lib_state.get_display_object_frame_deviation_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.displayObjectFrameDeviationColumnChanged)
        view_menu.addAction(action)

        # Display Object Deviation
        label = 'Display Object Average Deviation'
        tooltip = 'Display deviation column'
        value = lib_state.get_display_object_average_deviation_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.displayObjectAverageDeviationColumnChanged)
        view_menu.addAction(action)

        # Display Object Deviation
        label = 'Display Object Maximum Deviation'
        tooltip = 'Display deviation column'
        value = lib_state.get_display_object_maximum_deviation_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.displayObjectMaximumDeviationColumnChanged)
        view_menu.addAction(action)

        view_menu.addSeparator()

        # Display Attribute State
        label = 'Display Attribute State'
        tooltip = 'Display Attribute State column'
        value = lib_state.get_display_attribute_state_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(self.subForm.displayAttributeStateColumnChanged)
        view_menu.addAction(action)

        # Display Attribute Min/Max
        label = 'Display Attribute Min/Max'
        tooltip = 'Display Attribute Minimum and Maximum columns'
        value = lib_state.get_display_attribute_min_max_state()
        action = QtWidgets.QAction(label, view_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            self.subForm.displayAttributeMinMaxColumnChanged)
        view_menu.addAction(action)

        view_menu.addSeparator()

        # Display the Image Planes while solving.
        label = 'Display Image Planes (while solving)'
        tooltip = 'Display Image Planes while solving.'
        value = lib_state.get_display_image_plane_while_solving_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            type(self).displayImagePlaneWhileSolvingActionToggledCB)
        view_menu.addAction(action)

        # Isolate Objects while solving
        label = 'Isolate Objects (while solving)'
        tooltip = 'Isolate visibility of all Markers and Bundles while solving.'
        value = lib_state.get_display_image_plane_while_solving_state()
        action = QtWidgets.QAction(label, edit_menu)
        action.setStatusTip(tooltip)
        action.setCheckable(True)
        action.setChecked(value)
        action.toggled.connect(
            type(self).isolateObjectWhileSolvingActionToggledCB)
        view_menu.addAction(action)

        menubar.addMenu(view_menu)

        # Tools Menu
        tools_menu = QtWidgets.QMenu('Tools', menubar)

        # Create Marker
        label = 'Create Marker'
        tooltip = 'Create Markers on the selected camera.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.createMarkerCB))
        tools_menu.addAction(action)

        # Convert to Marker
        label = 'Convert to Marker'
        tooltip = 'Convert the selection to Markers.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.convertToMarkerCB))
        tools_menu.addAction(action)

        # Load Markers
        label = 'Load Markers...'
        tooltip = 'Load Markers from a file.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.loadMarkerCB))
        tools_menu.addAction(action)

        tools_menu.addSeparator()

        # Create Bundle
        label = 'Create Bundle'
        tooltip = 'Create a default Bundle node.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.createBundleCB))
        tools_menu.addAction(action)

        tools_menu.addSeparator()

        # Link Marker + Bundle
        label = 'Link Marker + Bundle'
        tooltip = 'Link the selected Marker and Bundle together.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.linkMarkerBundleCB))
        tools_menu.addAction(action)

        # Unlink Marker from all Bundles
        label = 'Unlink Marker from all Bundles'
        tooltip = 'Unlink all selected Markers from their Bundle.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.unlinkMarkerBundleCB))
        tools_menu.addAction(action)

        tools_menu.addSeparator()

        # Toogle Marker / Bundle selection
        label = 'Toggle Marker / Bundle'
        tooltip = 'Select connected Markers, or Bundles.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.toggleMarkerBundleSelectionCB))
        tools_menu.addAction(action)

        # Select Marker / Bundle
        label = 'Select Marker + Bundle'
        tooltip = 'Select the connected Markers and Bundles.'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.selectBothMarkersAndBundlesCB))
        tools_menu.addAction(action)

        # Rename Marker + Bundle
        label = 'Rename Markers + Bundles'
        tooltip = 'Rename the selected Markers and Bundles;'
        action = QtWidgets.QAction(label, tools_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.renameMarkerBundleCB))
        tools_menu.addAction(action)

        menubar.addMenu(tools_menu)

        # Log Menu
        # This menu depicts a radio button allowing the user to choose
        # how much information is returned to the console (the logging
        # level).
        log_menu = QtWidgets.QMenu('Log', menubar)

        # Errors
        label = 'Errors'
        tooltip = 'Send Errors to the log.'
        logErrorAction = QtWidgets.QAction(label, log_menu)
        logErrorAction.setStatusTip(tooltip)
        logErrorAction.setCheckable(True)
        logErrorAction.triggered.connect(partial(self.logErrorCB))
        log_menu.addAction(logErrorAction)

        # Warnings
        label = 'Warnings'
        tooltip = 'Send Warnings to the log.'
        logWarningAction = QtWidgets.QAction(label, log_menu)
        logWarningAction.setStatusTip(tooltip)
        logWarningAction.setCheckable(True)
        logWarningAction.triggered.connect(partial(self.logWarningCB))
        log_menu.addAction(logWarningAction)

        # Information
        label = 'Info'
        tooltip = 'Send Information to the log.'
        logInfoAction = QtWidgets.QAction(label, log_menu)
        logInfoAction.setStatusTip(tooltip)
        logInfoAction.setCheckable(True)
        logInfoAction.triggered.connect(partial(self.logInfoCB))
        log_menu.addAction(logInfoAction)

        # Verbose
        label = 'Verbose'
        tooltip = 'Send Verboses to the log.'
        logVerboseAction = QtWidgets.QAction(label, log_menu)
        logVerboseAction.setStatusTip(tooltip)
        logVerboseAction.setCheckable(True)
        logVerboseAction.triggered.connect(partial(self.logVerboseCB))
        log_menu.addAction(logVerboseAction)

        # Debug
        label = 'Debug'
        tooltip = 'Send Debug messages to the log.'
        logDebugAction = QtWidgets.QAction(label, log_menu)
        logDebugAction.setStatusTip(tooltip)
        logDebugAction.setCheckable(True)
        logDebugAction.triggered.connect(partial(self.logDebugCB))
        log_menu.addAction(logDebugAction)

        # 'Radio' button for logging levels
        log_actionGroup = QtWidgets.QActionGroup(log_menu)
        log_actionGroup.addAction(logErrorAction)
        log_actionGroup.addAction(logWarningAction)
        log_actionGroup.addAction(logInfoAction)
        log_actionGroup.addAction(logVerboseAction)
        log_actionGroup.addAction(logDebugAction)

        log_level = lib_state.get_log_level()
        if log_level == const.LOG_LEVEL_ERROR:
            logErrorAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_WARNING:
            logWarningAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_INFO:
            logInfoAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_VERBOSE:
            logVerboseAction.setChecked(True)
        elif log_level == const.LOG_LEVEL_DEBUG:
            logDebugAction.setChecked(True)
        else:
            LOG.warning('Invalid log level given: %r' % log_level)

        menubar.addMenu(log_menu)

        # Help Menu
        help_menu = QtWidgets.QMenu('Help', menubar)

        # Launch Help
        label = 'Help...'
        tooltip = 'Show help.'
        action = QtWidgets.QAction(label, help_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.launchHelpCB))
        help_menu.addAction(action)

        # Launch System Info window.
        label = 'System Information...'
        tooltip = 'Display detailed information about software and hardware.'
        action = QtWidgets.QAction(label, help_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.launchSysInfoCB))
        help_menu.addAction(action)

        # Launch About
        label = 'About mmSolver...'
        tooltip = 'About this software.'
        action = QtWidgets.QAction(label, help_menu)
        action.setStatusTip(tooltip)
        action.triggered.connect(partial(self.launchAboutCB))
        help_menu.addAction(action)

        menubar.addMenu(help_menu)
        return
Пример #4
0
 def updateAttributeColumnVisibility(self):
     show_state = lib_state.get_display_attribute_state_state()
     show_min_max = lib_state.get_display_attribute_min_max_state()
     self.displayAttributeStateColumnChanged(show_state)
     self.displayAttributeMinMaxColumnChanged(show_min_max)
     return