def _make_treeview(self): """ Set up the RAMSTKTreeView() for Failure Definitions. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING) self.treeview.set_model(_model) _cell = gtk.CellRendererText() _cell.set_property('editable', 0) _cell.set_property('wrap-width', 250) _cell.set_property('wrap-mode', pango.WRAP_WORD_CHAR) _cell.set_property('yalign', 0.1) _label = gtk.Label() _label.set_line_wrap(True) _label.set_alignment(xalign=0.5, yalign=0.5) _label.set_justify(gtk.JUSTIFY_CENTER) _label.set_markup("<span weight='bold'>Definition\nNumber</span>") _label.set_use_markup(True) _label.show_all() _column = gtk.TreeViewColumn() _column.set_widget(_label) _column.set_visible(True) _column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) _column.pack_start(_cell, True) _column.set_attributes(_cell, text=0) self.treeview.append_column(_column) _cell = gtk.CellRendererText() _cell.set_property('editable', 1) _cell.set_property('wrap-width', 450) _cell.set_property('wrap-mode', pango.WRAP_WORD_CHAR) _cell.set_property('yalign', 0.1) _cell.connect('edited', self._do_edit_cell, 1, _model) _label = gtk.Label() _label.set_line_wrap(True) _label.set_alignment(xalign=0.5, yalign=0.5) _label.set_justify(gtk.JUSTIFY_CENTER) _label.set_markup("<span weight='bold'>Failure Definition</span>") _label.set_use_markup(True) _label.show_all() _column = gtk.TreeViewColumn() _column.set_widget(_label) _column.set_visible(True) _column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) _column.pack_start(_cell, True) _column.set_attributes(_cell, text=1) self.treeview.append_column(_column) return _return
def __init__(self, controller, **kwargs): """ Initialize the List View for the Stakeholder package. :param controller: the RAMSTK master data controller instance. :type controller: :class:`ramstk.RAMSTK.RAMSTK` """ RAMSTKListView.__init__(self, controller, module='stakeholder') # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._revision_id = None self._stakeholder_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 stakeholder inputs for the selected " u"stakeholder.")) 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)) # _icon = gtk.gdk.pixbuf_new_from_file_at_size(self._dic_icons['tab'], # 22, 22) # _image = gtk.Image() # _image.set_from_pixbuf(_icon) _label = gtk.Label() _label.set_markup("<span weight='bold'>" + _(u"Stakeholder\nInputs") + "</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 stakeholder inputs for the " u"selected stakeholder.")) # 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.treeview) 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): # pylint: disable=unused-argument """ Initialize the List View for the Failure Definition package. :param controller: the RAMSTK master data controller instance. :type controller: :class:`ramstk.RAMSTK.RAMSTK` """ RAMSTKListView.__init__(self, controller, module='failure_definition') # Initialize private dictionary attributes. # Initialize private list attributes. # Initialize private scalar attributes. self._revision_id = None self._definition_id = None # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. self._make_treeview() self.treeview.set_rubber_banding(True) self.treeview.set_tooltip_text( _(u"Displays the list of failure definitions for the selected " u"revision.")) 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)) _label = gtk.Label() _label.set_markup("<span weight='bold'>" + _(u"Failure\nDefinitions") + "</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 failure definitions for the " u"selected revision.")) self.hbx_tab_label.pack_end(_label) self.hbx_tab_label.show_all() _scrolledwindow = gtk.ScrolledWindow() _scrolledwindow.add(self.treeview) 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 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 _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 _do_change_row(self, treeview): """ Handle row changes for the Usage Profile package List View. This method is called whenever a Usage Profile List View RAMSTKTreeView() row is activated or changed. :param treeview: the Usage Profile List View class RAMSTK.TreeView(). :type treeview: :class:`ramstk.gui.gtk.TreeView.RAMSTKTreeView` :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False self.treeview.handler_block(self._lst_handler_id[0]) (_model, _row) = treeview.get_selection().get_selected() try: _level = _model.get_value(_row, 11) except TypeError: _level = None _columns = treeview.get_columns() # Change the column headings depending on what is being selected. if _level == 'mission': _headings = [ _(u"Mission ID"), _(u"Description"), _(u"Units"), _(u"Start Time"), _(u"End Time"), _(u""), _(u""), _(u"") ] elif _level == 'phase': _headings = [ _(u"Phase ID"), _(u" Code\t\tDescription"), _(u"Units"), _(u"Start Time"), _(u"End Time"), _(u""), _(u""), _(u"") ] elif _level == 'environment': _headings = [ _(u"Environment ID"), _(u"Condition"), _(u"Units"), _(u"Minimum Value"), _(u"Maximum Value"), _(u"Mean Value"), _(u"Variance"), _(u"") ] else: _headings = [] i = 0 for _heading in _headings: _label = gtk.Label() _label.set_line_wrap(True) _label.set_alignment(xalign=0.5, yalign=0.5) _label.set_justify(gtk.JUSTIFY_CENTER) _label.set_markup("<span weight='bold'>" + _heading + "</span>") _label.set_use_markup(True) _label.show_all() _columns[i].set_widget(_label) i += 1 self.treeview.handler_unblock(self._lst_handler_id[0]) return _return
def __init__(self, controller, **kwargs): # pylint: disable=unused-argument """ Initialize the List View for the Usage Profile. :param controller: the RAMSTK master data controller instance. :type controller: :class:`ramstk.RAMSTK.RAMSTK` """ RAMSTKListView.__init__(self, controller, module='usage_profile') # Initialize private dictionary attributes. self._dic_icons['mission'] = \ controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/mission.png' self._dic_icons['phase'] = \ controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + '/32x32/phase.png' self._dic_icons['environment'] = \ controller.RAMSTK_CONFIGURATION.RAMSTK_ICON_DIR + \ '/32x32/environment.png' # Initialize private list attributes. # Initialize private scalar attributes. self._revision_id = None # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. self._make_treeview() self.treeview.set_rubber_banding(True) self.treeview.set_tooltip_text( _(u"Displays the list of usage profiles for the selected " u"revision.")) 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)) # _icon = gdk.pixbuf_new_from_file_at_size(self._dic_icons['tab'], # 22, 22) # _image = Image() # _image.set_from_pixbuf(_icon) _label = gtk.Label() _label.set_markup("<span weight='bold'>" + _(u"Usage\nProfiles") + "</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 usage profiles for the selected " u"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.treeview) 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 _make_page(self): """ Make the Requirement Analysis Work View page. :return: _hpaned :rtype: :class:`gtk.HPaned` """ _lst_clear = [ _(u"1. The requirement clearly states what is needed or " u"desired."), _(u"2. The requirement is unambiguous and not open to " u"interpretation."), _(u"3. All terms that can have more than one meaning are " u"qualified so that the desired meaning is readily " u"apparent."), _(u"4. Diagrams, drawings, etc. are used to increase " u"understanding of the requirement."), _(u"5. The requirement is free from spelling and " u"grammatical errors."), _(u"6. The requirement is written in non-technical " u"language using the vocabulary of the stakeholder."), _(u"7. Stakeholders understand the requirement as written."), _(u"8. The requirement is clear enough to be turned over " u"to an independent group and still be understood."), _(u"9. The requirement avoids stating how the problem is " u"to be solved or what techniques are to be used.") ] _lst_complete = [ _(u"1. Performance objectives are properly documented " u"from the user's point of view."), _(u"2. No necessary information is missing from the " u"requirement."), _(u"3. The requirement has been assigned a priority."), _(u"4. The requirement is realistic given the technology " u"that will used to implement the system."), _(u"5. The requirement is feasible to implement given the " u"defined project time frame, scope, structure and " u"budget."), _(u"6. If the requirement describes something as a " u"'standard' the specific source is cited."), _(u"7. The requirement is relevant to the problem and its " u"solution."), _(u"8. The requirement contains no implied design details."), _(u"9. The requirement contains no implied implementation " u"constraints."), _(u"10. The requirement contains no implied project " u"management constraints.") ] _lst_consistent = [ _(u"1. The requirement describes a single need or want; " u"it could not be broken into several different " u"requirements."), _(u"2. The requirement requires non-standard hardware or " u"must use software to implement."), _(u"3. The requirement can be implemented within known " u"constraints."), _(u"4. The requirement provides an adequate basis for " u"design and testing."), _(u"5. The requirement adequately supports the business " u"goal of the project."), _(u"6. The requirement does not conflict with some " u"constraint, policy or regulation."), _(u"7. The requirement does not conflict with another " u"requirement."), _(u"8. The requirement is not a duplicate of another " u"requirement."), _(u"9. The requirement is in scope for the project.") ] _lst_verifiable = [ _(u"1. The requirement is verifiable by testing, " u"demonstration, review, or analysis."), _(u"2. The requirement lacks 'weasel words' (e.g. " u"various, mostly, suitable, integrate, maybe, " u"consistent, robust, modular, user-friendly, " u"superb, good)."), _(u"3. Any performance criteria are quantified such that " u"they are testable."), _(u"4. Independent testing would be able to determine " u"whether the requirement has been satisfied."), _(u"5. The task(s) that will validate and verify the " u"final design satisfies the requirement have been " u"identified."), _(u"6. The identified V&V task(s) have been added to " u"the validation plan (e.g., DVP)") ] # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Build-up the containers for the tab. # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # _hpaned = gtk.HPaned() # Create quadrant #1 (upper left) for determining if the # requirement is clear. _vpaned = gtk.VPaned() _hpaned.pack1(_vpaned, resize=False) _scrollwindow = gtk.ScrolledWindow() _scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) _scrollwindow.add(self.tvwClear) _frame = ramstk.RAMSTKFrame(label=_(u"Clarity of Requirement")) _frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT) _frame.add(_scrollwindow) _vpaned.pack1(_frame, resize=False) # Create quadrant #3 (lower left) for determining if the # requirement is complete. _scrollwindow = gtk.ScrolledWindow() _scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) _scrollwindow.add(self.tvwComplete) _frame = ramstk.RAMSTKFrame(label=_(u"Completeness of Requirement")) _frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT) _frame.add(_scrollwindow) _vpaned.pack2(_frame, resize=False) # Create quadrant #2 (upper right) for determining if the # requirement is consistent. _vpaned = gtk.VPaned() _hpaned.pack2(_vpaned, resize=False) _scrollwindow = gtk.ScrolledWindow() _scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) _scrollwindow.add(self.tvwConsistent) _frame = ramstk.RAMSTKFrame(label=_(u"Consistency of Requirement")) _frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT) _frame.add(_scrollwindow) _vpaned.pack1(_frame, resize=False) # Create quadrant #4 (lower right) for determining if the # requirement is verifiable. _scrollwindow = gtk.ScrolledWindow() _scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) _scrollwindow.add(self.tvwVerifiable) _frame = ramstk.RAMSTKFrame(label=_(u"Verifiability of Requirement")) _frame.set_shadow_type(gtk.SHADOW_ETCHED_OUT) _frame.add(_scrollwindow) _vpaned.pack2(_frame, resize=False) # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # # Place the widgets used to display requirements analysis # # information. # # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # for _index, _treeview in enumerate([ self.tvwClear, self.tvwComplete, self.tvwConsistent, self.tvwVerifiable ]): _model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_INT) _treeview.set_model(_model) _treeview.set_headers_visible(False) _column = gtk.TreeViewColumn() _cell = gtk.CellRendererText() _cell.set_property('editable', 0) _cell.set_property('visible', 0) _column.pack_start(_cell, True) _column.set_attributes(_cell, text=0) _cell = gtk.CellRendererText() _cell.set_property('cell-background', '#E5E5E5') _cell.set_property('editable', 0) _cell.set_property('wrap-width', 650) _cell.set_property('wrap-mode', pango.WRAP_WORD_CHAR) _cell.set_property('yalign', 0.1) _column.pack_start(_cell, True) _column.set_attributes(_cell, markup=1) _cell = gtk.CellRendererToggle() _cell.set_property('activatable', 1) _cell.set_property('cell-background', '#E5E5E5') _cell.connect('toggled', self._do_edit_cell, None, None, _model, _index) _column.pack_start(_cell, True) _column.set_attributes(_cell, active=2) _column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE) _treeview.append_column(_column) _model = self.tvwClear.get_model() _model.clear() for _index, _clear in enumerate(_lst_clear): _model.append( [_index, "<span weight='bold'>" + _clear + "</span>", 0]) _model = self.tvwComplete.get_model() _model.clear() for _index, _complete in enumerate(_lst_complete): _model.append( [_index, "<span weight='bold'>" + _complete + "</span>", 0]) _model = self.tvwConsistent.get_model() _model.clear() for _index, _consistent in enumerate(_lst_consistent): _model.append( [_index, "<span weight='bold'>" + _consistent + "</span>", 0]) _model = self.tvwVerifiable.get_model() _model.clear() for _index, _verifiable in enumerate(_lst_verifiable): _model.append( [_index, "<span weight='bold'>" + _verifiable + "</span>", 0]) # Insert the tab. _label = gtk.Label() _label.set_markup("<span weight='bold'>" + _(u"Analysis") + "</span>") _label.set_alignment(xalign=0.5, yalign=0.5) _label.set_justify(gtk.JUSTIFY_CENTER) _label.set_tooltip_text(_(u"Analyzes the selected requirement.")) _label.show_all() self.hbx_tab_label.pack_start(_label) return _hpaned