def __init__(self, controller, **kwargs): """ Initialize the Hardware:Requirement Matrix View. :param controller: the RAMSTK master data controller instance. :type controller: :py:class:`ramstk.RAMSTK.RAMSTK` """ gtk.HBox.__init__(self) ramstk.RAMSTKBaseMatrix.__init__(self, controller, **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._dtc_data_controller = None self._revision_id = None self._matrix_type = kwargs['matrix_type'] # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. self.hbx_tab_label = gtk.HBox() _label = gtk.Label() _label.set_markup("<span weight='bold'>" + _(u"Hardware\nRequirement") + "</span>") _label.set_alignment(xalign=0.5, yalign=0.5) _label.set_justify(gtk.JUSTIFY_CENTER) _label.show_all() _label.set_tooltip_text( _(u"Displays hardware/requirement matrix for the " u"selected revision.")) # self.hbx_tab_label.pack_start(_image) self.hbx_tab_label.pack_end(_label) self.hbx_tab_label.show_all() _scrolledwindow = gtk.ScrolledWindow() _scrolledwindow.add(self.matrix) self.pack_start(self._make_buttonbox(), expand=False, fill=False) self.pack_end(_scrolledwindow, expand=True, fill=True) self.show_all() pub.subscribe(self._on_select_revision, 'selectedRevision')
def __init__(self, controller, **kwargs): """ Initialize the List View. :param controller: the RAMSTK master data controller instance. :type controller: :py:class:`ramstk.RAMSTK.RAMSTK` """ gtk.HBox.__init__(self) ramstk.RAMSTKBaseMatrix.__init__(self, controller, **kwargs) # 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.hbx_tab_label = gtk.HBox()
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 __init__(self, __widget, controller): """ Initialize an instance of the Options assistant. :param gtk.Widget __widget: the gtk.Widget() that called this class. :param controller: the RAMSTK master data controller. :type controller: :class:`ramstk.RAMSTK.RAMSTK` """ gtk.Window.__init__(self) # Initialize private dictionary attributes. self._dic_icons = { 'save': controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/save.png', 'cancel': controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/cancel.png' } # Initialize private list attributes. self._lst_handler_id = [] # Initialize private scalar attributes. self._mdcRAMSTK = controller self._dtc_data_controller = controller.dic_controllers['options'] self._last_id = -1 # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. self.notebook = gtk.Notebook() self.btnSave = ramstk.RAMSTKButton(icon=self._dic_icons['save'], height=-1, width=-1) self.btnQuit = ramstk.RAMSTKButton(icon=self._dic_icons['cancel'], height=-1, width=-1) self.chkFunctions = ramstk.RAMSTKCheckButton( label=_(u"Function Module Active"), tooltip=_( u"Activates/deactivates the Function module for this program.") ) self.chkRequirements = ramstk.RAMSTKCheckButton( label=_(u"Requirements Module Active"), tooltip=_(u"Activates/deactivates the Requirements module for " u"this program.")) self.chkHardware = ramstk.RAMSTKCheckButton( label=_(u"Hardware Module Active"), tooltip=_( u"Activates/deactivates the Hardware module for this program.") ) self.chkValidation = ramstk.RAMSTKCheckButton( label=_(u"Validation Module Active"), tooltip=_( u"Activates/deactivates the Validation module for this program." )) self.chkFMEA = ramstk.RAMSTKCheckButton( label=_(u"(D)FME(C)A Module Active"), tooltip=_( u"Activates/deactivates the (D)FME(C)A module for this program." )) _n_screens = gtk.gdk.screen_get_default().get_n_monitors() _width = gtk.gdk.screen_width() / _n_screens _height = gtk.gdk.screen_height() self.set_default_size((_width / 3) - 10, (2 * _height / 7)) self.btnSave.connect('clicked', self._do_request_update) self.btnQuit.connect('clicked', self._do_quit) self._lst_handler_id.append( self.chkFunctions.connect('toggled', self._on_toggled, 0)) self._lst_handler_id.append( self.chkRequirements.connect('toggled', self._on_toggled, 1)) self._lst_handler_id.append( self.chkHardware.connect('toggled', self._on_toggled, 2)) self._lst_handler_id.append( self.chkValidation.connect('toggled', self._on_toggled, 3)) self._lst_handler_id.append( self.chkFMEA.connect('toggled', self._on_toggled, 4)) self._make_page() _vbox = gtk.HBox() _buttonbox = gtk.VButtonBox() _buttonbox.set_layout(gtk.BUTTONBOX_START) _buttonbox.pack_start(self.btnSave) _buttonbox.pack_start(self.btnQuit) _vbox.pack_start(_buttonbox, expand=False) _vbox.pack_end(self.notebook) self.add(_vbox) self._dtc_data_controller.request_do_select_all(site=False, program=True) self._load_page() self.show_all()
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 __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')
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')