Exemple #1
0
    def _make_map_field_page(self):
        """
        Make the Import Assistant page to map fields.

        This method allows the user to map input file fields to RAMSTK
        database table fields.

        :return: _page
        :rtype: :class:`gtk.ScrolledWindow`
        """
        _page = gtk.ScrolledWindow()
        _page.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        _page.add(self._tvw_field_map)

        _model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)

        _column = gtk.TreeViewColumn()
        _label = ramstk.RAMSTKLabel(
            _(u"Import File Column"), justify=gtk.JUSTIFY_CENTER)
        _column.set_widget(_label)

        _cell = gtk.CellRendererText()
        _cell.set_property('foreground', '#000000')
        _cell.set_property('cell-background', 'light gray')
        _column.pack_start(_cell, True)
        _column.set_attributes(_cell, text=0)
        _column.set_visible(True)
        self._tvw_field_map.append_column(_column)

        _column = gtk.TreeViewColumn()
        _label = ramstk.RAMSTKLabel(
            _(u"RAMSTK Field"), justify=gtk.JUSTIFY_CENTER)
        _column.set_widget(_label)

        _cell = gtk.CellRendererCombo()
        _cellmodel = gtk.ListStore(gobject.TYPE_STRING)
        _cellmodel.append([""])
        _cell.set_property('editable', True)
        _cell.set_property('foreground', '#000000')
        _cell.set_property('has-entry', False)
        _cell.set_property('model', _cellmodel)
        _cell.set_property('text-column', 0)
        _cell.connect('edited', self._do_edit_cell, _model)
        _column.pack_start(_cell, True)
        _column.set_attributes(_cell, text=1)
        _column.set_visible(True)
        self._tvw_field_map.append_column(_column)

        self._tvw_field_map.set_model(_model)

        return _page
Exemple #2
0
    def _make_page(self):
        """
        Create the Revision Work View general data page.

        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        _fixed = gtk.Fixed()

        _scrollwindow = ramstk.RAMSTKScrolledWindow(_fixed)
        _frame = ramstk.RAMSTKFrame(label=_(u"General Information"))
        _frame.add(_scrollwindow)

        _x_pos, _y_pos = ramstk.make_label_group(self._lst_gendata_labels,
                                                 _fixed, 5, 5)
        _x_pos += 50

        _fixed.put(self.txtCode, _x_pos, _y_pos[0])
        _fixed.put(self.txtName, _x_pos, _y_pos[1])
        _fixed.put(self.txtRemarks.scrollwindow, _x_pos, _y_pos[2])

        _fixed.show_all()

        _label = ramstk.RAMSTKLabel(
            _(u"General\nData"),
            height=30,
            width=-1,
            justify=gtk.JUSTIFY_CENTER,
            tooltip=_(u"Displays general information for the selected "
                      u"revision."))
        self.hbx_tab_label.pack_start(_label)

        return _frame
Exemple #3
0
    def __init__(self, controller, **kwargs):  # pylint: disable=unused-argument
        """
        Initialize the Module View for the Hardware package.

        :param controller: the RAMSTK Master data controller instance.
        :type controller: :class:`ramstk.RAMSTK.RAMSTK`
        """
        RAMSTKModuleView.__init__(self, controller, module='hardware')

        # Initialize private dictionary attributes.
        self._dic_icons['tab'] = controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + \
            '/32x32/hardware.png'
        self._dic_icons['insert_part'] = \
            controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + \
            '/32x32/insert_part.png'

        # Initialize private list attributes.

        # Initialize private scalar attributes.
        self._hardware_id = None
        self._revision_id = None

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.

        self._make_treeview()
        self.treeview.set_tooltip_text(
            _(u"Displays the hierarchical list of "
              u"hardware items."))
        self._lst_handler_id.append(
            self.treeview.connect('cursor_changed', self._do_change_row))
        self._lst_handler_id.append(
            self.treeview.connect('button_press_event', self._on_button_press))

        self._img_tab.set_from_file(self._dic_icons['tab'])
        _label = ramstk.RAMSTKLabel(
            _(u"Hardware"),
            width=-1,
            height=-1,
            tooltip=_(u"Displays the hierarchical list of hardware items."))

        self.hbx_tab_label.pack_start(self._img_tab)
        self.hbx_tab_label.pack_end(_label)
        self.hbx_tab_label.show_all()

        _scrollwindow = gtk.ScrolledWindow()
        _scrollwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        _scrollwindow.add_with_viewport(self._make_buttonbox())
        self.pack_start(_scrollwindow, expand=False, fill=False)

        self.show_all()

        pub.subscribe(self._on_select_revision, 'selectedRevision')
        pub.subscribe(self._on_edit, 'wvwEditedHardware')
        pub.subscribe(self._on_calculate, 'calculatedAllHardware')
Exemple #4
0
    def __init__(self):
        """
        Method to initialize on instance of the Add Control or Action
        Assistant.
        """

        ramstk.RAMSTKDialog.__init__(
            self,
            _(u"RAMSTK FMEA/FMECA Design Control and "
              u"Action Addition Assistant"))

        # Initialize private dictionary attributes.

        # Initialize private list attributes.

        # Initialize private scalar attributes.

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.
        self.rdoControl = ramstk.RAMSTKOptionButton(None, _(u"Add control"))
        self.rdoAction = ramstk.RAMSTKOptionButton(self.rdoControl,
                                                   _(u"Add action"))

        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        # Build-up the containers for the dialog.                       #
        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        _fixed = gtk.Fixed()
        self.vbox.pack_start(_fixed)

        _label = ramstk.RAMSTKLabel(_(
            u"This is the RAMSTK Design Control and Action "
            u"Addition Assistant.  Enter the information "
            u"requested below and then press 'OK' to add "
            u"a new design control or action to the RAMSTK "
            u"Program database."),
                                    width=600,
                                    height=-1,
                                    wrap=True)
        _fixed.put(_label, 5, 10)
        _y_pos = _label.size_request()[1] + 50

        self.rdoControl.set_tooltip_text(
            _(u"Select to add a design control "
              u"to the selected failure cause."))
        self.rdoAction.set_tooltip_text(
            _(u"Select to add an Action to the "
              u"selected failure cause."))

        _fixed.put(self.rdoControl, 10, _y_pos)
        _fixed.put(self.rdoAction, 10, _y_pos + 35)

        _fixed.show_all()
Exemple #5
0
    def _make_goalbox(self):
        """
        Make the Allocation methods and goal-setting container.

        :return: a gtk.Frame() containing the widgets used to select the
                 allocation method and goals.
        :rtype: :class:`gtk.Frame`
        """
        # Load the method and goal comboboxes.
        self.cmbAllocationGoal.do_load_combo([[_(u"Reliability"), 0],
                                              [_(u"Hazard Rate"), 1],
                                              [_(u"MTBF"), 2]])
        self.cmbAllocationMethod.do_load_combo(
            [[_(u"Equal Apportionment"), 0], [_(u"AGREE Apportionment"), 1],
             [_(u"ARINC Apportionment"), 2],
             [_(u"Feasibility of Objectives"), 3]])

        _fixed = gtk.Fixed()

        _fixed.put(ramstk.RAMSTKLabel(_(u"Select Allocation Method")), 5, 5)
        _fixed.put(self.cmbAllocationMethod, 5, 30)
        _fixed.put(ramstk.RAMSTKLabel(_(u"Select Goal Metric")), 5, 70)
        _fixed.put(self.cmbAllocationGoal, 5, 95)
        _fixed.put(ramstk.RAMSTKLabel(_(u"R(t) Goal")), 5, 135)
        _fixed.put(self.txtReliabilityGoal, 5, 160)
        _fixed.put(ramstk.RAMSTKLabel(_(u"h(t) Goal")), 5, 200)
        _fixed.put(self.txtHazardRateGoal, 5, 225)
        _fixed.put(ramstk.RAMSTKLabel(_(u"MTBF Goal")), 5, 265)
        _fixed.put(self.txtMTBFGoal, 5, 290)

        _frame = ramstk.RAMSTKFrame(label=_(u"Allocation Goals and Method"))
        _frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        _frame.add(_fixed)

        self.txtHazardRateGoal.props.editable = 0
        self.txtHazardRateGoal.set_sensitive(0)
        self.txtMTBFGoal.props.editable = 0
        self.txtMTBFGoal.set_sensitive(0)
        self.txtReliabilityGoal.props.editable = 0
        self.txtReliabilityGoal.set_sensitive(0)

        return _frame
Exemple #6
0
    def __init__(self):
        """
        Method to initialize on instance of the Add Stress or Test Method
        Assistant.
        """

        ramstk.RAMSTKDialog.__init__(
            self,
            _(u"RAMSTK Physics of Failure Analysis Operating Stress and "
              u"Test Method Addition Assistant"))

        # Initialize private dictionary attributes.

        # Initialize private list attributes.

        # Initialize private scalar attributes.

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.
        self.rdoStress = ramstk.RAMSTKOptionButton(None, _(u"Add stress"))
        self.rdoMethod = ramstk.RAMSTKOptionButton(self.rdoStress,
                                                _(u"Add test method"))

        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        # Build-up the containers for the dialog.                       #
        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        _fixed = gtk.Fixed()
        self.vbox.pack_start(_fixed)

        _label = ramstk.RAMSTKLabel(
            _(u"This is the RAMSTK Operating Stress and Test Method "
              u"Addition Assistant.  Enter the information "
              u"requested below and then press 'OK' to add "
              u"a new design control or action to the RAMSTK "
              u"Program database."),
            width=600,
            height=-1,
            wrap=True)
        _fixed.put(_label, 5, 10)
        _y_pos = _label.size_request()[1] + 50

        self.rdoStress.set_tooltip_text(
            _(u"Select to add an operating stress to the selected operating "
              u"load."))
        self.rdoMethod.set_tooltip_text(
            _(u"Select to add a test method to the selected operating load."))

        _fixed.put(self.rdoStress, 10, _y_pos)
        _fixed.put(self.rdoMethod, 10, _y_pos + 35)

        _fixed.show_all()
Exemple #7
0
    def __init__(self, controller, **kwargs):
        """
        Initialize an instance of the Hardware assessment result view.

        :param controller: the hardware data controller instance.
        :type controller: :class:`ramstk.hardware.Controller.HardwareBoMDataController`
        :param int hardware_id: the hardware ID of the currently selected
                                hardware item.
        :param int subcategory_id: the ID of the hardware item subcategory.
        """
        gtk.Fixed.__init__(self)

        # Initialize private dictionary attributes.

        # Initialize private list attributes.
        self._lst_labels = [
            u"\u03BB<sub>b</sub>:", u"\u03C0<sub>Q</sub>:",
            u"\u03C0<sub>E</sub>:"
        ]

        # Initialize private scalar attributes.
        self._dtc_data_controller = controller
        self._hardware_id = kwargs['hardware_id']
        self._subcategory_id = kwargs['subcategory_id']

        self._lblModel = ramstk.RAMSTKLabel(
            '',
            tooltip=_(u"The assessment model used to calculate the hardware "
                      u"item failure rate."))

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.
        self.fmt = None

        self.txtLambdaB = ramstk.RAMSTKEntry(
            width=125,
            editable=False,
            bold=True,
            tooltip=_(u"The base hazard rate of the hardware item."))
        self.txtPiQ = ramstk.RAMSTKEntry(
            width=125,
            editable=False,
            bold=True,
            tooltip=_(u"The quality factor for the hardware item."))
        self.txtPiE = ramstk.RAMSTKEntry(
            width=125,
            editable=False,
            bold=True,
            tooltip=_(u"The environment factor for the hardware item."))
Exemple #8
0
    def _make_confirm_page():
        """
        Make the Import Assistant confimation page.

        :return: _page
        :rtype: :class:`gtk.Fixed`
        """
        _page = gtk.Fixed()

        _label = ramstk.RAMSTKLabel(
            _(u"RAMSTK is all set and ready to import your "
              u"data.  Press 'Apply' to import or 'Cancel' "
              u"to abort the import."),
            height=300,
            width=-1,
            wrap=True)
        _label.set_alignment(0.05, 0.05)

        _page.put(_label, 25, 5)

        return _page
Exemple #9
0
    def _make_input_file_select_page(self):
        """
        Make the Import Assistant page to select the input file.

        :return: _page
        :rtype: :class:`gtk.ScrolledWindow`
        """
        # TODO: Implement NSWC (add Design Mechanic to this list).
        self._cmb_select_module.do_load_combo(
            [[_(u"Function")], [_(u"Requirement")], [_(u"Hardware")],
             [_(u"Validation")]])

        _page = gtk.HBox()

        _fixed = gtk.Fixed()
        _label = ramstk.RAMSTKLabel(_(u"Select the RAMSTK module to import:"))
        _fixed.put(_label, 5, 5)
        _fixed.put(self._cmb_select_module, 55, 5)
        _page.pack_start(_fixed, False, False)

        _scrollwindow = gtk.ScrolledWindow()
        _file_chooser = gtk.FileChooserWidget(
            action=gtk.FILE_CHOOSER_ACTION_OPEN)
        _scrollwindow.add_with_viewport(_file_chooser)
        _page.pack_end(_scrollwindow, True, True)

        _file_filter = gtk.FileFilter()
        _file_filter.set_name(_(u"Delimited Text Files"))
        _file_filter.add_pattern('*.csv')
        _file_filter.add_pattern('*.txt')
        _file_chooser.add_filter(_file_filter)
        _file_filter = gtk.FileFilter()
        _file_filter.set_name(_(u"Excel Files"))
        _file_filter.add_pattern('*.xls*')
        _file_chooser.add_filter(_file_filter)

        _file_chooser.connect('selection_changed', self._do_select_file)

        return _page
Exemple #10
0
    def _make_methodbox(self):
        """
        Make the Similar Item analysis method container.

        :return: a gtk.Frame() containing the widgets used to select the
                 allocation method and goals.
        :rtype: :class:`gtk.Frame`
        """
        # Load the method and goal comboboxes.
        self.cmbSimilarItemMethod.do_load_combo([[_(u"Topic 633"), 0],
                                                 [_(u"User-Defined"), 1]])

        _fixed = gtk.Fixed()

        _fixed.put(ramstk.RAMSTKLabel(_(u"Select Method")), 5, 5)
        _fixed.put(self.cmbSimilarItemMethod, 5, 30)

        _frame = ramstk.RAMSTKFrame(label=_(u"Similar Item Method"))
        _frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        _frame.add(_fixed)

        return _frame
Exemple #11
0
    def _make_introduction_page():
        """
        Make the Import Assistant introduction page.

        :return: _page
        :rtype: :class:`gtk.Fixed`
        """
        _page = gtk.Fixed()

        _label = ramstk.RAMSTKLabel(
            _(u"This is the RAMSTK Import Assistant.  It "
              u"will guide you through the process of "
              u"importing RAMSTK Program module data from "
              u"an external file.  Press 'Forward' to continue "
              u"or 'Cancel' to quit."),
            height=300,
            width=-1,
            wrap=True)
        _label.set_alignment(0.05, 0.05)

        _page.put(_label, 25, 5)

        return _page
Exemple #12
0
    def _make_page(self):
        """
        Make the Requirement Work View General Data gtk.Notebook() page.

        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        # Load the requirement type gtk.ComboBox(); each _type is
        # (Code, Description, Type).
        _types = []
        for _index, _key in enumerate(
                self._mdcRAMSTK.RAMSTK_CONFIGURATION.RAMSTK_REQUIREMENT_TYPE):
            _types.append(self._mdcRAMSTK.RAMSTK_CONFIGURATION.
                          RAMSTK_REQUIREMENT_TYPE[_key])
        self.cmbRequirementType.do_load_combo(list(_types),
                                              index=1,
                                              simple=False)

        # Load the owner gtk.ComboBox(); each _owner is
        # (Description, Group Type).
        _owners = []
        for _index, _key in enumerate(
                self._mdcRAMSTK.RAMSTK_CONFIGURATION.RAMSTK_WORKGROUPS):
            _owners.append(
                self._mdcRAMSTK.RAMSTK_CONFIGURATION.RAMSTK_WORKGROUPS[_key])
        self.cmbOwner.do_load_combo(list(_owners))

        # Load the priority gtk.Combo().
        _priorities = [["1"], ["2"], ["3"], ["4"], ["5"]]
        self.cmbPriority.do_load_combo(_priorities)

        # Build the General Data page.
        _fixed = gtk.Fixed()

        _scrollwindow = ramstk.RAMSTKScrolledWindow(_fixed)
        _frame = ramstk.RAMSTKFrame(label=_(u"General Information"))
        _frame.add(_scrollwindow)

        _x_pos, _y_pos = ramstk.make_label_group(self._lst_gendata_labels,
                                                 _fixed, 5, 5)
        _x_pos += 50

        _fixed.put(self.txtCode, _x_pos, _y_pos[0])
        _fixed.put(self.txtName, _x_pos, _y_pos[1])
        _fixed.put(self.cmbRequirementType, _x_pos, _y_pos[2])
        _fixed.put(self.chkDerived, _x_pos, _y_pos[3] + 5)
        _fixed.put(self.txtSpecification, _x_pos, _y_pos[4])
        _fixed.put(self.txtPageNum, _x_pos, _y_pos[5])
        _fixed.put(self.txtFigNum, _x_pos, _y_pos[6])
        _fixed.put(self.cmbPriority, _x_pos, _y_pos[7])
        _fixed.put(self.cmbOwner, _x_pos, _y_pos[8])
        _fixed.put(self.chkValidated, _x_pos, _y_pos[9] + 5)
        _fixed.put(self.txtValidatedDate, _x_pos, _y_pos[10])
        _fixed.put(self.btnValidateDate, _x_pos + 205, _y_pos[10])

        _fixed.show_all()

        # Create the label for the gtk.Notebook() tab.
        _label = ramstk.RAMSTKLabel(
            _(u"General\nData"),
            height=30,
            width=-1,
            justify=gtk.JUSTIFY_CENTER,
            tooltip=_(u"Displays general information for the selected "
                      u"requirement."))
        self.hbx_tab_label.pack_start(_label)

        return _frame
Exemple #13
0
    def __init__(self, controller, **kwargs):  # pylint: disable=unused-argument
        """
        Initialize the Validation Module View.

        :param controller: the RAMSTK Master data controller instance.
        :type controller: :class:`ramstk.RAMSTK.RAMSTK`
        """
        RAMSTKModuleView.__init__(self, controller, module='validation')

        # Initialize private dictionary attributes.
        self._dic_icons['tab'] = controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + \
            '/32x32/validation.png'

        # Initialize private list attributes.

        # Initialize private scalar attributes.
        self._revision_id = None
        self._validation_id = None

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.

        self._make_treeview()
        self.treeview.set_tooltip_text(
            _(u"Displays the list of validation "
              u"tasks."))
        self._lst_handler_id.append(
            self.treeview.connect('cursor_changed', self._do_change_row))
        self._lst_handler_id.append(
            self.treeview.connect('button_press_event', self._on_button_press))

        i = 0
        for _column in self.treeview.get_columns():
            _cell = _column.get_cell_renderers()[0]
            try:
                if _cell.get_property('editable'):
                    _cell.connect('edited', self._do_edit_cell, i,
                                  self.treeview.get_model())
            except TypeError:
                pass
            i += 1

        self._img_tab.set_from_file(self._dic_icons['tab'])
        _label = ramstk.RAMSTKLabel(
            _(u"Validation"),
            width=-1,
            height=-1,
            tooltip=_(u"Displays the program validation tasks."))

        self.hbx_tab_label.pack_start(self._img_tab)
        self.hbx_tab_label.pack_end(_label)
        self.hbx_tab_label.show_all()

        _scrollwindow = gtk.ScrolledWindow()
        _scrollwindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        _scrollwindow.add_with_viewport(self._make_buttonbox())
        self.pack_start(_scrollwindow, expand=False, fill=False)

        self.show_all()

        pub.subscribe(self._on_select_revision, 'selectedRevision')
        pub.subscribe(self._on_edit, 'wvwEditedValidation')
Exemple #14
0
    def _make_assessment_results_page(self):
        """
        Create the gtk.Notebook() page for displaying assessment results.

        :return: False if successful or True if an error is encountered.
        :rtype: boolean
        """
        _hbox = gtk.HBox()

        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        # Build the left half of the page.                                    #
        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        _fxd_left = gtk.Fixed()

        _scrollwindow = ramstk.RAMSTKScrolledWindow(_fxd_left)
        _frame = ramstk.RAMSTKFrame(label=_(u"Reliability Results"))
        _frame.add(_scrollwindow)

        _hbox.pack_start(_frame)

        _x_pos_l, _y_pos_l = ramstk.make_label_group(
            self._lst_assess_labels[0], _fxd_left, 5, 5)
        _x_pos_l += 50

        _fxd_left.put(self.txtActiveHt, _x_pos_l, _y_pos_l[0])
        _fxd_left.put(self.txtDormantHt, _x_pos_l, _y_pos_l[1])
        _fxd_left.put(self.txtSoftwareHt, _x_pos_l, _y_pos_l[2])
        _fxd_left.put(self.txtPredictedHt, _x_pos_l, _y_pos_l[3])
        _fxd_left.put(self.txtMissionHt, _x_pos_l, _y_pos_l[4])
        _fxd_left.put(self.txtMTBF, _x_pos_l, _y_pos_l[5])
        _fxd_left.put(self.txtMissionMTBF, _x_pos_l, _y_pos_l[6])
        _fxd_left.put(self.txtReliability, _x_pos_l, _y_pos_l[7])
        _fxd_left.put(self.txtMissionRt, _x_pos_l, _y_pos_l[8])
        _fxd_left.put(self.txtPartCount, _x_pos_l, _y_pos_l[9])

        _fxd_left.show_all()

        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        # Build the right half of the page.                                   #
        # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
        _fxd_right = gtk.Fixed()

        _scrollwindow = ramstk.RAMSTKScrolledWindow(_fxd_right)
        _frame = ramstk.RAMSTKFrame(label=_(u"Maintainability Results"))
        _frame.add(_scrollwindow)

        _hbox.pack_end(_frame)

        _x_pos_r, _y_pos_r = ramstk.make_label_group(
            self._lst_assess_labels[1], _fxd_right, 5, 5)
        _x_pos_r += 55

        _fxd_right.put(self.txtMPMT, _x_pos_r, _y_pos_r[0])
        _fxd_right.put(self.txtMCMT, _x_pos_r, _y_pos_r[1])
        _fxd_right.put(self.txtMTTR, _x_pos_r, _y_pos_r[2])
        _fxd_right.put(self.txtMMT, _x_pos_r, _y_pos_r[3])
        _fxd_right.put(self.txtAvailability, _x_pos_r, _y_pos_r[4])
        _fxd_right.put(self.txtMissionAt, _x_pos_r, _y_pos_r[5])
        _fxd_right.put(self.txtTotalCost, _x_pos_r, _y_pos_r[6])
        _fxd_right.put(self.txtCostFailure, _x_pos_r, _y_pos_r[7])
        _fxd_right.put(self.txtCostHour, _x_pos_r, _y_pos_r[8])

        _fxd_right.show_all()

        _label = ramstk.RAMSTKLabel(
            _(u"Assessment\nResults"),
            height=30,
            width=-1,
            justify=gtk.JUSTIFY_CENTER,
            tooltip=_(u"Displays reliability, "
                      u"maintainability, and availability "
                      u"assessment results for the selected "
                      u"{0:s}.").format(self._module))
        self.hbx_tab_label.pack_start(_label)

        return (_hbox, _fxd_left, _fxd_right, _x_pos_l, _x_pos_r, _y_pos_l,
                _y_pos_r)
Exemple #15
0
    def _do_request_edit_function(self, __button):
        """
        Request to edit the Similar Item analysis user-defined functions.

        :param __button: the gtk.ToolButton() that called this method.
        :type __button: :class:`gtk.ToolButton`.
        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        (_model, _row) = self.treeview.get_selection().get_selected()

        _title = _(u"RAMSTK - Edit Similar Item Analysis Functions")
        _label = ramstk.RAMSTKLabel(_(u"You can define up to five functions.  "
                                      u"You can use the system failure rate, "
                                      u"selected assembly failure rate, the "
                                      u"change factor, the user float, the "
                                      u"user integer values, and results of "
                                      u"other functions.\n\n \
        System hazard rate is hr_sys\n \
        Assembly hazard rate is hr\n \
        Change factor is pi[1-8]\n \
        User float is uf[1-3]\n \
        User integer is ui[1-3]\n \
        Function result is res[1-5]"),
                                    width=600,
                                    height=-1,
                                    wrap=True)
        _label2 = ramstk.RAMSTKLabel(_(u"For example, pi1*pi2+pi3, multiplies "
                                       u"the first two change factors and "
                                       u"adds the value to the third change "
                                       u"factor."),
                                     width=600,
                                     height=-1,
                                     wrap=True)

        # Build the dialog assistant.
        _dialog = ramstk.RAMSTKDialog(_title)

        _fixed = gtk.Fixed()

        _y_pos = 10
        _fixed.put(_label, 5, _y_pos)
        _y_pos += _label.size_request()[1] + 10
        _fixed.put(_label2, 5, _y_pos)
        _y_pos += _label2.size_request()[1] + 10

        _label = ramstk.RAMSTKLabel(_(u"User function 1:"))
        _txtFunction1 = ramstk.RAMSTKEntry()
        _txtFunction1.set_text(_model.get_value(_row, 30))

        _fixed.put(_label, 5, _y_pos)
        _fixed.put(_txtFunction1, 195, _y_pos)
        _y_pos += 30

        _label = ramstk.RAMSTKLabel(_(u"User function 2:"))
        _txtFunction2 = ramstk.RAMSTKEntry()
        _txtFunction2.set_text(_model.get_value(_row, 31))
        _fixed.put(_label, 5, _y_pos)
        _fixed.put(_txtFunction2, 195, _y_pos)
        _y_pos += 30

        _label = ramstk.RAMSTKLabel(_(u"User function 3:"))
        _txtFunction3 = ramstk.RAMSTKEntry()
        _txtFunction3.set_text(_model.get_value(_row, 32))
        _fixed.put(_label, 5, _y_pos)
        _fixed.put(_txtFunction3, 195, _y_pos)
        _y_pos += 30

        _label = ramstk.RAMSTKLabel(_(u"User function 4:"))
        _txtFunction4 = ramstk.RAMSTKEntry()
        _txtFunction4.set_text(_model.get_value(_row, 33))
        _fixed.put(_label, 5, _y_pos)
        _fixed.put(_txtFunction4, 195, _y_pos)
        _y_pos += 30

        _label = ramstk.RAMSTKLabel(_(u"User function 5:"))
        _txtFunction5 = ramstk.RAMSTKEntry()
        _txtFunction5.set_text(_model.get_value(_row, 34))
        _fixed.put(_label, 5, _y_pos)
        _fixed.put(_txtFunction5, 195, _y_pos)
        _y_pos += 30

        _chkApplyAll = gtk.CheckButton(label=_(u"Apply to all assemblies."))
        _fixed.put(_chkApplyAll, 5, _y_pos)

        _fixed.show_all()

        _dialog.vbox.pack_start(_fixed)  # pylint: disable=E1101

        # Run the dialog and apply the changes if the 'OK' button is pressed.
        if _dialog.run() == gtk.RESPONSE_OK:
            if _chkApplyAll.get_active():
                _row = _model.get_iter_root()
                while _row is not None:
                    _hardware_id = _model.get_value(_row, 1)
                    _similaritem = self._dtc_data_controller.request_do_select(
                        _hardware_id)
                    _similaritem.function_1 = _txtFunction1.get_text()
                    _similaritem.function_2 = _txtFunction2.get_text()
                    _similaritem.function_3 = _txtFunction3.get_text()
                    _similaritem.function_4 = _txtFunction4.get_text()
                    _similaritem.function_5 = _txtFunction5.get_text()
                    _model.set_value(_row, 30, _similaritem.function_1)
                    _model.set_value(_row, 31, _similaritem.function_2)
                    _model.set_value(_row, 32, _similaritem.function_3)
                    _model.set_value(_row, 33, _similaritem.function_4)
                    _model.set_value(_row, 34, _similaritem.function_5)
                    self._dtc_data_controller.request_do_update(_hardware_id)
                    _row = _model.iter_next(_row)
            else:
                _similaritem = self._dtc_data_controller.request_do_select(
                    self._hardware_id)
                _similaritem.function_1 = _txtFunction1.get_text()
                _similaritem.function_2 = _txtFunction2.get_text()
                _similaritem.function_3 = _txtFunction3.get_text()
                _similaritem.function_4 = _txtFunction4.get_text()
                _similaritem.function_5 = _txtFunction5.get_text()
                _model.set_value(_row, 30, _similaritem.function_1)
                _model.set_value(_row, 31, _similaritem.function_2)
                _model.set_value(_row, 32, _similaritem.function_3)
                _model.set_value(_row, 33, _similaritem.function_4)
                _model.set_value(_row, 34, _similaritem.function_5)
                self._dtc_data_controller.request_do_update(self._hardware_id)

        _dialog.destroy()

        return False
Exemple #16
0
    def __init__(self, controller, **kwargs):  # pylint: disable=unused-argument
        """
        Initialize the Work View for the Similar Item.

        :param controller: the RAMSTK master data controller instance.
        :type controller: :class:`ramstk.RAMSTK.RAMSTK`
        """
        RAMSTKWorkView.__init__(self, controller, module='SimilarItem')

        # Initialize private dictionary attributes.
        self._dic_icons['edit'] = (
            controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR +
            '/32x32/edit.png')
        self._dic_quality = {
            'Space': 1,
            'Full Military': 2,
            'Ruggedized': 3,
            'Commercial': 4
        }
        self._dic_environment = {
            'Ground, Benign': 1,
            'Ground,Mobile': 2,
            'Naval, Sheltered': 3,
            'Airborne, Inhabited, Cargo': 4,
            'Airborne, Rotary Wing': 5,
            'Space, Flight': 6
        }

        # Initialize private list attributes.

        # Initialize private scalar attributes.
        self._revision_id = None
        self._parent_id = None
        self._hardware_id = None
        self._method_id = None
        self._dtc_hw_controller = None

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.
        _bg_color = '#FFFFFF'
        _fg_color = '#000000'
        _fmt_file = (
            controller.RAMSTK_CONFIGURATION.RAMSTK_CONF_DIR + '/layouts/' +
            controller.RAMSTK_CONFIGURATION.RAMSTK_FORMAT_FILE['similaritem'])
        _fmt_path = "/root/tree[@name='SimilarItem']/column"
        _tooltip = _(u"Displays the Similar Item Analysis for the currently "
                     u"selected Hardware item.")

        self.treeview = ramstk.RAMSTKTreeView(_fmt_path,
                                              0,
                                              _fmt_file,
                                              _bg_color,
                                              _fg_color,
                                              pixbuf=False)
        self._lst_col_order = self.treeview.order
        self.treeview.set_tooltip_text(_tooltip)

        self.cmbSimilarItemMethod = ramstk.RAMSTKComboBox(
            tooltip=_(u"Select the similar item analysis method."))

        self._lst_handler_id.append(
            self.treeview.connect('cursor_changed', self._do_change_row))
        self._lst_handler_id.append(
            self.treeview.connect('button_press_event', self._on_button_press))
        self._lst_handler_id.append(
            self.cmbSimilarItemMethod.connect('changed',
                                              self._on_combo_changed, 2))

        for _idx in self._lst_col_order[3:]:
            _cell = self.treeview.get_column(
                self._lst_col_order[_idx]).get_cell_renderers()
            try:
                _cell[0].connect('edited', self._do_edit_cell, _idx,
                                 self.treeview.get_model())
            except TypeError:
                _cell[0].connect('toggled', self._do_edit_cell, 'new text',
                                 _idx, self.treeview.get_model())

        _label = ramstk.RAMSTKLabel(
            _(u"SimilarItem"),
            height=30,
            width=-1,
            justify=gtk.JUSTIFY_CENTER,
            tooltip=_(u"Displays the Similar Item analysis for the selected "
                      u"hardware item."))
        self.hbx_tab_label.pack_start(_label)

        self.pack_start(self._make_buttonbox(), False, True)
        _hbox = gtk.HBox()
        _hbox.pack_start(self._make_methodbox(), False, True)
        _hbox.pack_end(self._make_page(), True, True)
        self.pack_end(_hbox, True, True)
        self.show_all()

        pub.subscribe(self._on_select, 'selectedHardware')
        pub.subscribe(self._do_clear_page, 'closedProgram')
Exemple #17
0
    def __init__(self, controller, **kwargs):  # pylint: disable=unused-argument
        """
        Initialize the Work View for the PoF.

        :param controller: the RAMSTK master data controller instance.
        :type controller: :class:`ramstk.RAMSTK.RAMSTK`
        """
        RAMSTKWorkView.__init__(self, controller, module='PoF')

        # Initialize private dictionary attributes.
        self._dic_icons['mode'] = controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + \
            '/32x32/mode.png'
        self._dic_icons['mechanism'] = \
            controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/mechanism.png'
        self._dic_icons['opload'] = \
            controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/load.png'
        self._dic_icons['opstress'] = \
            controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/stress.png'
        self._dic_icons['testmethod'] = \
            controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/method.png'

        # Initialize private list attributes.

        # Initialize private scalar attributes.
        self._hardware_id = None

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.
        _fmt_file = (
            controller.RAMSTK_CONFIGURATION.RAMSTK_CONF_DIR + '/layouts/' +
            controller.RAMSTK_CONFIGURATION.RAMSTK_FORMAT_FILE['pof'])
        _fmt_path = "/root/tree[@name='PoF']/column"
        _tooltip = _(u"Displays the Physics of Failure (PoF) Analysis for the "
                     u"currently selected hardware item.")

        self.treeview = ramstk.RAMSTKTreeView(
            _fmt_path,
            0,
            _fmt_file,
            '#FFFFFF',
            '#000000',
            pixbuf=True,
            indexed=True)
        self._lst_col_order = self.treeview.order
        self.treeview.set_tooltip_text(_tooltip)

        _label = ramstk.RAMSTKLabel(
            _(u"Damage\nModeling"),
            height=30,
            width=-1,
            justify=gtk.JUSTIFY_CENTER,
            tooltip=_(u"Displays the Physics of Failure (PoF) Analysis for "
                      u"the selected hardware item."))
        self.hbx_tab_label.pack_start(_label)

        self.pack_start(self._make_buttonbox(), False, True)
        self.pack_end(self._make_page(), True, True)
        self.show_all()

        pub.subscribe(self._on_select, 'selectedHardware')
        pub.subscribe(self._do_clear_page, 'closedProgram')
Exemple #18
0
    def _do_change_row(self, treeview):
        """
        Handle 'cursor-changed' event for the (D)FME(C)A RAMSTKTreeView().

        This method is called whenever a Tree View row is activated.

        :param treeview: the FMEA RAMSTKTreeView().
        :type treeview: :class:`ramstk.gui.gtk.ramstk.TreeViewRAMSTKTreeView`
        :return: False if successful or True if an error is encountered.
        :rtype: bool
        """
        _return = False
        _headings = [
            self.treeview.headings[self._lst_col_order[0]],
            self.treeview.headings[self._lst_col_order[1]],
            self.treeview.headings[self._lst_col_order[2]],
            self.treeview.headings[self._lst_col_order[3]],
            self.treeview.headings[self._lst_col_order[4]],
            self.treeview.headings[self._lst_col_order[5]],
            self.treeview.headings[self._lst_col_order[6]],
            self.treeview.headings[self._lst_col_order[7]],
            self.treeview.headings[self._lst_col_order[8]],
            self.treeview.headings[self._lst_col_order[9]],
            self.treeview.headings[self._lst_col_order[10]]
        ]

        treeview.handler_block(self._lst_handler_id[0])

        _model, _row = treeview.get_selection().get_selected()
        try:
            _node_id = _model.get_value(_row, 12)
        except (TypeError, ValueError):
            _node_id = 0

        _level = self._get_level(_node_id)

        if _level == 'mode':
            _headings[0] = self.treeview.headings[self._lst_col_order[0]]
            _headings[1] = self.treeview.headings[self._lst_col_order[1]]
            for _idx in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', False)
        elif _level == 'mechanism':
            _headings[0] = _(u"Mechanism ID")
            _headings[1] = _(u"Failure\nMechanism")
            for _idx in [1, 2, 3, 4, 5, 6, 7, 8, 9]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', False)
        elif _level == 'opload':
            _headings[0] = _(u"Operating\nLoad ID")
            _headings[1] = _(u"Damaging\nCondition")
            for _idx in [2, 3, 4, 6, 7, 8]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', False)
            for _idx in [1, 5, 9]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', True)
        elif _level == 'opstress':
            _headings[0] = _(u"Stress ID")
            _headings[1] = _(u"Operating\nStress")
            for _idx in [2, 3, 4, 5, 8, 9]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', False)
            for _idx in [1, 6, 7]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', True)
        elif _level == 'testmethod':
            _headings[0] = _(u"Test ID")
            _headings[1] = _(u"Existing or\nProposed Test")
            for _idx in [2, 3, 4, 5, 6, 7, 9]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', False)
                _cell.set_property('mode', gtk.CELL_RENDERER_MODE_INERT)
            for _idx in [1, 8]:
                _cell = self.treeview.get_column(
                    self._lst_col_order[_idx]).get_cell_renderers()[0]
                _cell.set_property('editable', True)
                _cell.set_property('mode', gtk.CELL_RENDERER_MODE_EDITABLE)

        _columns = self.treeview.get_columns()

        i = 0
        for _heading in _headings:
            _label = ramstk.RAMSTKLabel(
                _heading, height=-1, justify=gtk.JUSTIFY_CENTER, wrap=True)
            _label.show_all()
            _columns[i].set_widget(_label)
            if _heading == '':
                _columns[i].set_visible(False)
            else:
                _columns[i].set_visible(True)

            i += 1

        treeview.handler_unblock(self._lst_handler_id[0])

        return _return
Exemple #19
0
    def __init__(self, controller, **kwargs):  # pylint: disable=unused-argument
        """
        Initialize the Work View for the Allocation.

        :param controller: the RAMSTK master data controller instance.
        :type controller: :class:`ramstk.RAMSTK.RAMSTK`
        """
        RAMSTKWorkView.__init__(self, controller, module='Allocation')

        # Initialize private dictionary attributes.

        # Initialize private list attributes.

        # Initialize private scalar attributes.
        self._parent_id = None
        self._allocation_id = None

        # Initialize public dictionary attributes.

        # Initialize public list attributes.

        # Initialize public scalar attributes.
        _bg_color = '#FFFFFF'
        _fg_color = '#000000'
        _fmt_file = (
            controller.RAMSTK_CONFIGURATION.RAMSTK_CONF_DIR + '/layouts/' +
            controller.RAMSTK_CONFIGURATION.RAMSTK_FORMAT_FILE['allocation'])
        _fmt_path = "/root/tree[@name='Allocation']/column"
        _tooltip = _(u"Displays the Allocation Analysis for the "
                     u"currently selected Hardware item.")

        self.treeview = ramstk.RAMSTKTreeView(_fmt_path,
                                              0,
                                              _fmt_file,
                                              _bg_color,
                                              _fg_color,
                                              pixbuf=False)
        self._lst_col_order = self.treeview.order
        self.treeview.set_tooltip_text(_tooltip)

        self.cmbAllocationGoal = ramstk.RAMSTKComboBox(tooltip=_(
            u"Selects the goal measure for the selected hardware assembly."))
        self.cmbAllocationMethod = ramstk.RAMSTKComboBox(tooltip=_(
            u"Selects the method for allocating the reliability goal for "
            u"the selected hardware assembly."))
        self.txtHazardRateGoal = ramstk.RAMSTKEntry(
            width=125,
            tooltip=(
                u"Displays the hazard rate goal for the selected hardware "
                u"item."))
        self.txtMTBFGoal = ramstk.RAMSTKEntry(
            width=125,
            tooltip=_(
                u"Displays the MTBF goal for the selected hardware item."))
        self.txtReliabilityGoal = ramstk.RAMSTKEntry(
            width=125,
            tooltip=_(
                u"Displays the reliability goal for the selected hardware "
                u"item."))

        self._lst_handler_id.append(
            self.treeview.connect('cursor_changed', self._do_change_row))
        self._lst_handler_id.append(
            self.treeview.connect('button_press_event', self._on_button_press))
        self._lst_handler_id.append(
            self.cmbAllocationMethod.connect('changed', self._on_combo_changed,
                                             2))
        self._lst_handler_id.append(
            self.cmbAllocationGoal.connect('changed', self._on_combo_changed,
                                           3))
        self._lst_handler_id.append(
            self.txtReliabilityGoal.connect('focus_out_event',
                                            self._on_focus_out, 4))
        self._lst_handler_id.append(
            self.txtHazardRateGoal.connect('focus_out_event',
                                           self._on_focus_out, 5))
        self._lst_handler_id.append(
            self.txtMTBFGoal.connect('focus_out_event', self._on_focus_out, 6))

        for i in [
                self._lst_col_order[3], self._lst_col_order[5],
                self._lst_col_order[6], self._lst_col_order[7],
                self._lst_col_order[8], self._lst_col_order[9],
                self._lst_col_order[10], self._lst_col_order[11]
        ]:
            _cell = self.treeview.get_column(
                self._lst_col_order[i]).get_cell_renderers()
            try:
                _cell[0].connect('edited', self._do_edit_cell, i,
                                 self.treeview.get_model())
            except TypeError:
                _cell[0].connect('toggled', self._do_edit_cell, 'new text', i,
                                 self.treeview.get_model())

        _label = ramstk.RAMSTKLabel(
            _(u"Allocation"),
            height=30,
            width=-1,
            justify=gtk.JUSTIFY_CENTER,
            tooltip=_(u"Displays the Allocation analysis for the selected "
                      u"hardware item."))
        self.hbx_tab_label.pack_start(_label)

        self.pack_start(self._make_buttonbox(), False, True)
        _hbox = gtk.HBox()
        _hbox.pack_start(self._make_goalbox(), False, True)
        _hbox.pack_end(self._make_page(), True, True)
        self.pack_end(_hbox, True, True)
        self.show_all()

        pub.subscribe(self._on_select, 'selectedHardware')
        pub.subscribe(self._do_clear_page, 'closedProgram')