def _make_page(self): """ Make the Hardware gtk.Notebook() assessment results page. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False # Create the left side. _fixed = gtk.Fixed() self.pack1(_fixed, True, True) _x_pos, _y_pos = ramstk.make_label_group(self._lst_labels, _fixed, 5, 35) _x_pos += 50 _fixed.put(self.txtCurrentRatio, _x_pos, _y_pos[0]) _fixed.put(self.txtPowerRatio, _x_pos, _y_pos[1]) _fixed.put(self.txtVoltageRatio, _x_pos, _y_pos[2]) _fixed.put(self.chkOverstress, _x_pos, _y_pos[3]) _fixed.put(self.txtReason.scrollwindow, _x_pos, _y_pos[4]) _fixed.show_all() # Create the derating plot. _frame = ramstk.RAMSTKFrame( label=_(u"Derating Curve and Operating Point")) _frame.add(self.pltDerate.plot) _frame.show_all() self.pack2(_frame, True, True) return _return
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
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
def _make_page(self): """ Make the Option class gtk.Notebook() active modules page. :return: False if successful or True if an error is encountered. :rtype: bool """ _fixed = gtk.Fixed() _fixed.put(self.chkFunctions, 5, 5) _fixed.put(self.chkRequirements, 5, 35) _fixed.put(self.chkHardware, 5, 65) _fixed.put(self.chkValidation, 5, 95) _fixed.put(self.chkFMEA, 5, 125) _label = gtk.Label(_(u"Active RAMSTK Modules")) _label.set_tooltip_text(_(u"Select active RAMSTK modules.")) self.notebook.insert_page(_fixed, tab_label=_label, position=-1) return None
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
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
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
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
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)
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
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