def __init__(self, controller, **kwargs): """ Initialize an instance of the Switch assessment input view. :param controller: the hardware data controller instance. :type controller: :class:`ramstk.hardware.Controller.HardwareBoMDataController` """ AssessmentInputs.__init__(self, controller, **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. self._lst_labels.append(_(u"Application:")) self._lst_labels.append(_(u"Construction:")) self._lst_labels.append(_(u"Contact Form:")) self._lst_labels.append(_(u"Number of Cycles/Hour:")) self._lst_labels.append(_(u"Number of Active Contacts:")) # Initialize private scalar attributes. # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. self.cmbApplication = ramstk.RAMSTKComboBox( index=0, simple=True, tooltip=_(u"The application of the switch.")) self.cmbConstruction = ramstk.RAMSTKComboBox( index=0, simple=False, tooltip=_(u"The construction method for " u"the switch.")) self.cmbContactForm = ramstk.RAMSTKComboBox( index=0, simple=True, tooltip=_(u"The contact form and quantity of the switch.")) self.txtNCycles = ramstk.RAMSTKEntry( width=125, tooltip=_(u"The number of cycles per hour of the switch.")) self.txtNElements = ramstk.RAMSTKEntry( width=125, tooltip=_(u"The number of active contacts in the switch.")) self._make_page() self.show_all() self._lst_handler_id.append( self.cmbQuality.connect('changed', self._on_combo_changed, 0)) self._lst_handler_id.append( self.cmbApplication.connect('changed', self._on_combo_changed, 1)) self._lst_handler_id.append( self.cmbConstruction.connect('changed', self._on_combo_changed, 2)) self._lst_handler_id.append( self.cmbContactForm.connect('changed', self._on_combo_changed, 3)) self._lst_handler_id.append( self.txtNCycles.connect('changed', self._on_focus_out, 4)) self._lst_handler_id.append( self.txtNElements.connect('changed', self._on_focus_out, 5))
def __init__(self, controller, **kwargs): """ Initialize an instance of the Miscellaneous assessment input view. :param controller: the hardware data controller instance. :type controller: :class:`ramstk.hardware.Controller.HardwareBoMDataController` """ AssessmentInputs.__init__(self, controller, **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. self._lst_labels.append(_(u"Application:")) self._lst_labels.append(_(u"Type:")) self._lst_labels.append(_(u"Operating Frequency:")) self._lst_labels.append(_(u"Utilization:")) # Initialize private scalar attributes. # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. self.cmbApplication = ramstk.RAMSTKComboBox( index=0, simple=True, tooltip=_(u"The application of the lamp.")) self.cmbType = ramstk.RAMSTKComboBox( index=0, simple=True, tooltip=_(u"The type of electronic filter.")) self.txtFrequency = ramstk.RAMSTKEntry( width=125, tooltip=_(u"The operating frequency of the crystal.")) self.txtUtilization = ramstk.RAMSTKEntry( width=125, tooltip=_(u"The utilization factor (illuminate hours / equipment " u"operate hours) of the lamp.")) self._make_page() self.show_all() self._lst_handler_id.append( self.cmbQuality.connect('changed', self._on_combo_changed, 0)) self._lst_handler_id.append( self.cmbApplication.connect('changed', self._on_combo_changed, 1)) self._lst_handler_id.append( self.cmbType.connect('changed', self._on_combo_changed, 2)) self._lst_handler_id.append( self.txtFrequency.connect('changed', self._on_focus_out, 3)) self._lst_handler_id.append( self.txtUtilization.connect('changed', self._on_focus_out, 4))
def _make_page(self): """ Make the integrated circuit class gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ self._do_load_comboboxes(subcategory_id=self._subcategory_id) self._do_set_sensitive() # Build the container for inductors. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.cmbPackage, _x_pos, _y_pos[1]) self.put(self.txtArea, _x_pos, _y_pos[2]) self.put(self.txtNElements, _x_pos, _y_pos[3]) self.put(self.txtThetaJC, _x_pos, _y_pos[4]) self.put(self.txtNActivePins, _x_pos, _y_pos[5]) self.put(self.cmbTechnology, _x_pos, _y_pos[6]) self.put(self.txtYearsInProduction, _x_pos, _y_pos[7]) self.put(self.cmbConstruction, _x_pos, _y_pos[8]) self.put(self.txtNCycles, _x_pos, _y_pos[9]) self.put(self.txtOperatingLife, _x_pos, _y_pos[10]) self.put(self.cmbECC, _x_pos, _y_pos[11]) self.put(self.cmbApplication, _x_pos, _y_pos[12]) self.put(self.cmbType, _x_pos, _y_pos[13]) self.put(self.txtFeatureSize, _x_pos, _y_pos[14]) self.put(self.cmbManufacturing, _x_pos, _y_pos[15]) self.put(self.txtVoltageESD, _x_pos, _y_pos[16]) return None
def _do_load_page(self, **kwargs): """ Load the Miscellaneous assesment input widgets. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) if self._subcategory_id == 4: # Lamp self.cmbApplication.handler_block(self._lst_handler_id[1]) self.cmbApplication.set_active(_attributes['application_id']) self.cmbApplication.handler_unblock(self._lst_handler_id[1]) elif self._subcategory_id == 2: # Filter self.cmbType.handler_block(self._lst_handler_id[2]) self.cmbType.set_active(_attributes['type_id']) self.cmbType.handler_unblock(self._lst_handler_id[2]) if _attributes['hazard_rate_method_id'] == 2: if self._subcategory_id == 1: # Crystal self.txtFrequency.handler_block(self._lst_handler_id[3]) self.txtFrequency.set_text( str(self.fmt.format(_attributes['frequency_operating']))) self.txtFrequency.handler_unblock(self._lst_handler_id[3]) elif self._subcategory_id == 4: # Lamp self.txtUtilization.handler_block(self._lst_handler_id[4]) self.txtUtilization.set_text( str(self.fmt.format(_attributes['duty_cycle']))) self.txtUtilization.handler_unblock(self._lst_handler_id[4]) return _return
def _make_page(self): """ Make the Connection class gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ # Load the gtk.ComboBox() widgets. self._do_load_comboboxes(subcategory_id=self._subcategory_id) self._do_set_sensitive() # Build the container for connections. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.cmbType, _x_pos, _y_pos[1]) self.put(self.cmbSpecification, _x_pos, _y_pos[2]) self.put(self.cmbInsert, _x_pos, _y_pos[3]) self.put(self.txtContactGauge, _x_pos, _y_pos[4]) self.put(self.txtActivePins, _x_pos, _y_pos[5]) self.put(self.txtAmpsContact, _x_pos, _y_pos[6]) self.put(self.txtMating, _x_pos, _y_pos[7]) self.put(self.txtNWave, _x_pos, _y_pos[8]) self.put(self.txtNHand, _x_pos, _y_pos[9]) self.put(self.txtNPlanes, _x_pos, _y_pos[10]) return None
def _do_load_page(self, **kwargs): """ Load the Switch assesment input widgets. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) if _attributes['hazard_rate_method_id'] == 2: self.cmbApplication.handler_block(self._lst_handler_id[1]) self.cmbApplication.set_active(_attributes['application_id']) self.cmbApplication.handler_unblock(self._lst_handler_id[1]) self.cmbConstruction.handler_block(self._lst_handler_id[2]) self.cmbConstruction.set_active(_attributes['construction_id']) self.cmbConstruction.handler_unblock(self._lst_handler_id[2]) self.cmbContactForm.handler_block(self._lst_handler_id[3]) self.cmbContactForm.set_active(_attributes['contact_form_id']) self.cmbContactForm.handler_unblock(self._lst_handler_id[3]) self.txtNCycles.handler_block(self._lst_handler_id[4]) self.txtNCycles.set_text( str(self.fmt.format(_attributes['n_cycles']))) self.txtNCycles.handler_unblock(self._lst_handler_id[4]) self.txtNElements.handler_block(self._lst_handler_id[5]) self.txtNElements.set_text( str(self.fmt.format(_attributes['n_elements']))) self.txtNElements.handler_unblock(self._lst_handler_id[5]) return _return
def _do_load_comboboxes(self, **kwargs): """ Load the Inductor RKTComboBox()s. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_comboboxes(self, **kwargs) # Load the quality level RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: _data = [[_(u"Established Reliability")], ["MIL-SPEC"], [_(u"Lower")]] else: try: _data = self._dic_quality[self._subcategory_id] except KeyError: _data = [] self.cmbQuality.do_load_combo(_data) # Load the specification RAMSTKComboBox(). try: _data = self._dic_specifications[self._subcategory_id] except KeyError: _data = [] self.cmbSpecification.do_load_combo(_data) # Load the insulation class RAMSTKComboBox(). try: _data = self._dic_insulation[self._subcategory_id] except KeyError: _data = [] self.cmbInsulation.do_load_combo(_data) # Load the transformer family RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: if self._subcategory_id == 1: _data = [ [_(u"Low Power Pulse Transformer")], [_(u"Audio Transformer")], [_(u"High Power Pulse and Power Transformer, Filter")], [_(u"RF Transformer")] ] else: _data = [[_(u"RF Coils, Fixed or Molded")], [_(u"RF Coils, Variable")]] else: _data = [[_(u"Pulse Transformer")], [_("Audio Transformer")], [_(u"Power Transformer or Filter")], [_(u"RF Transformer")]] self.cmbFamily.do_load_combo(_data) # load the coil construction RAMSTKComboBox(). self.cmbConstruction.do_load_combo([[_(u"Fixed")], [_(u"Variable")]]) return _return
def _on_combo_changed(self, combo, index): """ Retrieve RAMSTKCombo() changes and assign to Integrated Circuit attribute. This method is called by: * gtk.Combo() 'changed' signal :param combo: the RAMSTKCombo() that called this method. :type combo: :class:`ramstk.gui.gtk.ramstk.RAMSTKCombo` :param int index: the position in the signal handler list associated with the calling RAMSTKComboBox(). Indices are: +-------+------------------+-------+------------------+ | Index | Widget | Index | Widget | +=======+==================+=======+==================+ | 1 | cmbApplication | 5 | cmbPackage | +-------+------------------+-------+------------------+ | 2 | cmbConstruction | 6 | cmbTechnology | +-------+------------------+-------+------------------+ | 3 | cmbECC | 7 | cmbType | +-------+------------------+-------+------------------+ | 4 | cmbManufacturing | | | +-------+------------------+-------+------------------+ :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False combo.handler_block(self._lst_handler_id[index]) _attributes = AssessmentInputs.on_combo_changed(self, combo, index) if _attributes: if index == 1: _attributes['application_id'] = int(combo.get_active()) elif index == 2: _attributes['construction_id'] = int(combo.get_active()) elif index == 3: _attributes['type_id'] = int(combo.get_active()) elif index == 4: _attributes['manufacturing_id'] = int(combo.get_active()) elif index == 5: _attributes['package_id'] = int(combo.get_active()) elif index == 6: _attributes['technology_id'] = int(combo.get_active()) elif index == 7: _attributes['type_id'] = int(combo.get_active()) self._dtc_data_controller.request_set_attributes( self._hardware_id, _attributes) combo.handler_unblock(self._lst_handler_id[index]) return _return
def _do_load_page(self, **kwargs): """ Load the Relay assesment input widgets. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) self.cmbType.handler_block(self._lst_handler_id[1]) self.cmbType.set_active(_attributes['type_id']) self.cmbType.handler_unblock(self._lst_handler_id[1]) if _attributes['hazard_rate_method_id'] == 2: self.cmbLoadType.handler_block(self._lst_handler_id[2]) self.cmbLoadType.set_active(_attributes['technology_id']) self.cmbLoadType.handler_unblock(self._lst_handler_id[2]) self.cmbContactForm.handler_block(self._lst_handler_id[3]) self.cmbContactForm.set_active(_attributes['contact_form_id']) self.cmbContactForm.handler_unblock(self._lst_handler_id[3]) self.cmbContactRating.handler_block(self._lst_handler_id[4]) self.cmbContactRating.set_active(_attributes['contact_rating_id']) # Load the application RAMSTKComboBox(). try: _data = self._dic_application[_attributes['contact_rating_id']] except KeyError: _data = [] self.cmbApplication.do_load_combo(_data) self.cmbContactRating.handler_unblock(self._lst_handler_id[4]) self.cmbApplication.handler_block(self._lst_handler_id[5]) self.cmbApplication.set_active(_attributes['application_id']) # Load the construction RAMSTKComboBox(). try: _data = self._dic_construction[_attributes[ 'contact_rating_id']][_attributes['application_id']] except KeyError: _data = [] self.cmbConstruction.do_load_combo(_data) self.cmbApplication.handler_unblock(self._lst_handler_id[5]) self.cmbConstruction.handler_block(self._lst_handler_id[6]) self.cmbConstruction.set_active(_attributes['construction_id']) self.cmbConstruction.handler_unblock(self._lst_handler_id[6]) self.txtCycles.handler_block(self._lst_handler_id[7]) self.txtCycles.set_text( str(self.fmt.format(_attributes['n_cycles']))) self.txtCycles.handler_unblock(self._lst_handler_id[7]) return _return
def _do_load_comboboxes(self, **kwargs): """ Load the Resisotr RKTComboBox()s. :param int subcategory_id: the newly selected resistor subcategory ID. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_comboboxes(self, **kwargs) # Load the quality level RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: _data = ["S", "R", "P", "M", ["MIL-SPEC"], [_(u"Lower")]] else: try: _data = self._dic_quality[self._subcategory_id] except KeyError: _data = [] self.cmbQuality.do_load_combo(_data) # Load the specification RAMSTKComboBox(). try: _data = self._dic_specifications[self._subcategory_id] except KeyError: _data = [] self.cmbSpecification.do_load_combo(_data) # Load the type RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: try: _data = self._dic_types[self._subcategory_id] except KeyError: _data = [] else: _data = [[_(u"Bead")], [_(u"Disk")], [_(u"Rod")]] self.cmbType.do_load_combo(_data) # Load the style RAMSTKComboBox(). try: _data = self._dic_styles[_attributes['subcategory_id']][ _attributes['specification_id']] except (KeyError, IndexError): _data = [] self.cmbStyle.do_load_combo(_data) # Load the construction RAMSTKComboBox(). try: _data = self._dic_construction[self._subcategory_id] except KeyError: _data = [] self.cmbConstruction.do_load_combo(_data) return _return
def __init__(self, controller, **kwargs): """ Initialize an instance of the Meter assessment input view. :param controller: the meter data controller instance. :type controller: :class:`ramstk.meter.Controller.MeterBoMDataController` :param int hardware_id: the hardware ID of the currently selected meter. :param int subcategory_id: the ID of the meter subcategory. """ AssessmentInputs.__init__(self, controller, **kwargs) # Initialize private dictionary attributes. # Initialize private list attributes. self._lst_labels.append(_(u"Meter Type:")) self._lst_labels.append(_(u"Meter Function:")) # Initialize private scalar attributes. # Initialize public dictionary attributes. # Initialize public list attributes. # Initialize public scalar attributes. self.cmbApplication = ramstk.RAMSTKComboBox( index=0, simple=True, tooltip=_(u"The appliction of the panel meter.")) self.cmbType = ramstk.RAMSTKComboBox(index=0, simple=False, tooltip=_(u"The type of meter.")) self._make_page() self.show_all() self._lst_handler_id.append( self.cmbQuality.connect('changed', self._on_combo_changed, 0)) self._lst_handler_id.append( self.cmbApplication.connect('changed', self._on_combo_changed, 1)) self._lst_handler_id.append( self.cmbType.connect('changed', self._on_combo_changed, 2))
def _do_load_page(self, **kwargs): """ Load the Semiconductor assesment input widgets. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) if _attributes['hazard_rate_method_id'] == 2: self.cmbApplication.handler_block(self._lst_handler_id[1]) self.cmbApplication.set_active(_attributes['application_id']) self.cmbApplication.handler_unblock(self._lst_handler_id[1]) self.cmbConstruction.handler_block(self._lst_handler_id[2]) self.cmbConstruction.set_active(_attributes['construction_id']) self.cmbConstruction.handler_unblock(self._lst_handler_id[2]) self.cmbMatching.handler_block(self._lst_handler_id[3]) self.cmbMatching.set_active(_attributes['matching_id']) self.cmbMatching.handler_unblock(self._lst_handler_id[3]) self.cmbPackage.handler_block(self._lst_handler_id[4]) self.cmbPackage.set_active(_attributes['package_id']) self.cmbPackage.handler_unblock(self._lst_handler_id[4]) self.cmbType.handler_block(self._lst_handler_id[5]) self.cmbType.set_active(_attributes['type_id']) self.cmbType.handler_unblock(self._lst_handler_id[5]) self.txtFrequencyOperating.handler_block(self._lst_handler_id[6]) self.txtFrequencyOperating.set_text( str(self.fmt.format(_attributes['frequency_operating']))) self.txtFrequencyOperating.handler_unblock(self._lst_handler_id[6]) self.txtNElements.handler_block(self._lst_handler_id[7]) self.txtNElements.set_text( str(self.fmt.format(_attributes['n_elements']))) self.txtNElements.handler_unblock(self._lst_handler_id[7]) self.txtThetaJC.handler_block(self._lst_handler_id[8]) self.txtThetaJC.set_text( str(self.fmt.format(_attributes['theta_jc']))) self.txtThetaJC.handler_unblock(self._lst_handler_id[8]) return _return
def _make_page(self): """ Make the Meter class gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ self._do_load_comboboxes(subcategory_id=self._subcategory_id) self._do_set_sensitive() # Build the container for inductors. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.cmbType, _x_pos, _y_pos[1]) self.put(self.cmbApplication, _x_pos, _y_pos[2]) return None
def _on_combo_changed(self, combo, index): """ Retrieve RAMSTKCombo() changes and assign to Inductor attribute. This method is called by: * gtk.Combo() 'changed' signal :param combo: the RAMSTKCombo() that called this method. :type combo: :class:`ramstk.gui.gtk.ramstk.RAMSTKCombo` :param int index: the position in the signal handler list associated with the calling RAMSTKComboBox(). Indices are: +---------+------------------+---------+------------------+ | Index | Widget | Index | Widget | +=========+==================+=========+==================+ | 1 | cmbSpecification | 3 | cmbFamily | +---------+------------------+---------+------------------+ | 2 | cmbInsulation | 4 | cmbConstruction | +---------+------------------+---------+------------------+ :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False combo.handler_block(self._lst_handler_id[index]) _attributes = AssessmentInputs.on_combo_changed(self, combo, index) if _attributes: if index == 1: _attributes['specification_id'] = int(combo.get_active()) elif index == 2: _attributes['insulation_id'] = int(combo.get_active()) elif index == 3: _attributes['family_id'] = int(combo.get_active()) elif index == 4: _attributes['construction_id'] = int(combo.get_active()) self._dtc_data_controller.request_set_attributes( self._hardware_id, _attributes) combo.handler_unblock(self._lst_handler_id[index]) return _return
def _do_load_comboboxes(self, **kwargs): """ Load the relay RKTComboBox()s. This method is used to load the specification RAMSTKComboBox() whenever the relay subcategory is changed. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_comboboxes(self, **kwargs) # Load the quality level RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: _data = [[_(u"Established Reliability")], ["MIL-SPEC"], [_(u"Lower")]] else: try: _data = self._dic_quality[self._subcategory_id] except KeyError: _data = [] self.cmbQuality.do_load_combo(_data) # Load the relay type RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: _data = self._dic_pc_types[self._subcategory_id] else: try: _data = self._dic_types[self._subcategory_id] except KeyError: _data = [] self.cmbType.do_load_combo(_data) # Load the load type RAMSTKComboBox(). self.cmbLoadType.do_load_combo(self._lst_technology) # Load the contact form RAMSTKComboBox(). self.cmbContactForm.do_load_combo(self._lst_contact_form) # Load the contact rating RAMSTKComboBox(). self.cmbContactRating.do_load_combo(self._lst_contact_rating) return _return
def _do_load_comboboxes(self, **kwargs): """ Load the switch RKTComboBox(). This method is used to load the specification RAMSTKComboBox() whenever the switch subcategory is changed. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_comboboxes(self, **kwargs) # Load the quality level RAMSTKComboBox(). self.cmbQuality.do_load_combo([["MIL-SPEC"], [_(u"Lower")]]) # Load the application RAMSTKCOmboBOx(). try: _data = self._dic_applications[self._subcategory_id] except KeyError: _data = [] self.cmbApplication.do_load_combo(_data) # Load the construction RAMSTKComboBox(). try: if _attributes['hazard_rate_method_id'] == 1: _data = [[_(u"Thermal")], [_(u"Magnetic")]] else: _data = self._dic_constructions[self._subcategory_id] except KeyError: _data = [] self.cmbConstruction.do_load_combo(_data) # Load the contact form RAMSTKComboBox(). try: _data = self._dic_contact_forms[self._subcategory_id] except KeyError: _data = [] self.cmbContactForm.do_load_combo(_data) return _return
def _do_load_comboboxes(self, **kwargs): """ Load the specification RKTComboBox(). This method is used to load the specification RAMSTKComboBox() whenever the capacitor subcategory is changed. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_comboboxes(self, **kwargs) # Load the quality level RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: _data = ["S", "R", "P", "M", "L", ["MIL-SPEC"], [_(u"Lower")]] else: try: _data = self._dic_quality[self._subcategory_id] except KeyError: _data = [] self.cmbQuality.do_load_combo(_data) # Load the specification RAMSTKComboBox(). try: _data = self._dic_specifications[self._subcategory_id] except KeyError: _data = [] self.cmbSpecification.do_load_combo(_data) self.cmbConstruction.do_load_combo([[_(u"Slug, All Tantalum")], [ _(u"Foil, Hermetic") ], [_(u"Slug, Hermetic")], [_(u"Foil, Non-Hermetic")], [_(u"Slug, Non-Hermetic")]]) self.cmbConfiguration.do_load_combo([[_(u"Fixed")], [_(u"Variable")]]) _model = self.cmbStyle.get_model() _model.clear() return _return
def _do_load_page(self, **kwargs): """ Load the Meter assesment input widgets. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) self.cmbApplication.handler_block(self._lst_handler_id[1]) self.cmbApplication.set_active(_attributes['application_id']) self.cmbApplication.handler_unblock(self._lst_handler_id[1]) self.cmbType.handler_block(self._lst_handler_id[2]) self.cmbType.set_active(_attributes['type_id']) self.cmbType.handler_unblock(self._lst_handler_id[2]) return _return
def _make_page(self): """ Make the Switch class gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ self._do_load_comboboxes(subcategory_id=self._subcategory_id) # Build the container for inductors. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.cmbApplication, _x_pos, _y_pos[1]) self.put(self.cmbConstruction, _x_pos, _y_pos[2]) self.put(self.cmbContactForm, _x_pos, _y_pos[3]) self.put(self.txtNCycles, _x_pos, _y_pos[4]) self.put(self.txtNElements, _x_pos, _y_pos[5]) self.show_all() return None
def _do_load_page(self, **kwargs): """ Load the Capacitor Assessment Inputs page. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) # We don't block the callback signal otherwise the style # RAMSTKComboBox() will not be loaded and set. self.cmbSpecification.set_active(_attributes['specification_id']) if (_attributes['hazard_rate_method_id'] != 1 and self._subcategory_id == 1): self.cmbStyle.handler_block(self._lst_handler_id[2]) self.cmbStyle.set_active(_attributes['type_id']) self.cmbStyle.handler_unblock(self._lst_handler_id[2]) self.cmbConfiguration.handler_block(self._lst_handler_id[3]) self.cmbConfiguration.set_active(_attributes['configuration_id']) self.cmbConfiguration.handler_unblock(self._lst_handler_id[3]) self.cmbConstruction.handler_block(self._lst_handler_id[4]) self.cmbConstruction.set_active(_attributes['construction_id']) self.cmbConstruction.handler_unblock(self._lst_handler_id[4]) self.txtCapacitance.handler_block(self._lst_handler_id[5]) self.txtCapacitance.set_text( str(self.fmt.format(_attributes['capacitance']))) self.txtCapacitance.handler_unblock(self._lst_handler_id[5]) self.txtESR.handler_block(self._lst_handler_id[6]) self.txtESR.set_text( str(self.fmt.format(_attributes['resistance']))) self.txtESR.handler_unblock(self._lst_handler_id[6]) return _return
def _make_page(self): """ Make the Capacitor class gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ # Load the gtk.ComboBox() widgets. self._do_load_comboboxes(subcategory_id=self._subcategory_id) self._do_set_sensitive() # Build the container for capacitors. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.txtCapacitance, _x_pos, _y_pos[1]) self.put(self.cmbSpecification, _x_pos, _y_pos[2]) self.put(self.cmbStyle, _x_pos, _y_pos[3]) self.put(self.cmbConfiguration, _x_pos, _y_pos[4]) self.put(self.cmbConstruction, _x_pos, _y_pos[5]) self.put(self.txtESR, _x_pos, _y_pos[6]) return None
def _make_page(self): """ Make the Inductor gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ # Load the gtk.ComboBox() widgets. self._do_load_comboboxes(subcategory_id=self._subcategory_id) self._do_set_sensitive() # Build the container for inductors. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.cmbSpecification, _x_pos, _y_pos[1]) self.put(self.cmbInsulation, _x_pos, _y_pos[2]) self.put(self.txtArea, _x_pos, _y_pos[3]) self.put(self.txtWeight, _x_pos, _y_pos[4]) self.put(self.cmbFamily, _x_pos, _y_pos[5]) self.put(self.cmbConstruction, _x_pos, _y_pos[6]) return None
def _do_load_comboboxes(self, **kwargs): """ Load the connection RKTComboBox()s. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_comboboxes(self, **kwargs) # Load the quality level RAMSTKComboBox(). _attributes = self._dtc_data_controller.request_get_attributes( self._hardware_id) if _attributes['hazard_rate_method_id'] == 1: _data = [["MIL-SPEC"], [_(u"Lower")]] else: try: _data = self._dic_quality[self._subcategory_id] except KeyError: _data = [] self.cmbQuality.do_load_combo(_data) # Load the connector type RAMSTKComboBox(). try: _data = self._dic_type[self._subcategory_id] except KeyError: _data = [] self.cmbType.do_load_combo(_data) # Clear the remaining ramstk.ComboBox()s. These are loaded dynamically # based on the selection made in other ramstk.ComboBox()s. _model = self.cmbSpecification.get_model() _model.clear() _model = self.cmbInsert.get_model() _model.clear() return _return
def _do_load_comboboxes(self, **kwargs): """ Load the meter RKTComboBox()s. This method is used to load the specification RAMSTKComboBox() whenever the meter subcategory is changed. :param int subcategory_id: the newly selected meter subcategory ID. :return: False if successful or True if an error is encountered. :rtype: bool """ _subcategory_id = kwargs['subcategory_id'] _return = False _attributes = AssessmentInputs.do_load_comboboxes( self, subcategory_id=_subcategory_id) # Load the quality level RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: _data = [["MIL-SPEC"], [_(u"Lower")]] else: try: _data = self._dic_quality[self._subcategory_id] except KeyError: _data = [] self.cmbQuality.do_load_combo(_data) # Load the meter appliction RAMSTKComboBox(). self.cmbApplication.do_load_combo([[_(u"Ammeter")], [_(u"Voltmeter")], [_(u"Other")]]) # Load the meter type RAMSTKComboBox(). try: _data = self._dic_types[self._subcategory_id] except KeyError: _data = [] self.cmbType.do_load_combo(_data) return _return
def _do_load_page(self, **kwargs): """ Load the Resistor assesment input widgets. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) self.cmbType.handler_block(self._lst_handler_id[2]) self.cmbType.set_active(_attributes['type_id']) self.cmbType.handler_unblock(self._lst_handler_id[2]) if _attributes['hazard_rate_method_id'] == 2: self.cmbSpecification.handler_block(self._lst_handler_id[1]) self.cmbSpecification.set_active(_attributes['specification_id']) self.cmbSpecification.handler_unblock(self._lst_handler_id[1]) self.cmbStyle.handler_block(self._lst_handler_id[3]) self.cmbStyle.set_active(_attributes['family_id']) self.cmbStyle.handler_unblock(self._lst_handler_id[3]) self.cmbConstruction.handler_block(self._lst_handler_id[4]) self.cmbConstruction.set_active(_attributes['construction_id']) self.cmbConstruction.handler_unblock(self._lst_handler_id[4]) self.txtResistance.handler_block(self._lst_handler_id[5]) self.txtResistance.set_text( str(self.fmt.format(_attributes['resistance']))) self.txtResistance.handler_unblock(self._lst_handler_id[5]) self.txtNElements.handler_block(self._lst_handler_id[6]) self.txtNElements.set_text( str(self.fmt.format(_attributes['n_elements']))) self.txtNElements.handler_unblock(self._lst_handler_id[6]) return _return
def _do_load_page(self, **kwargs): """ Load the Inductor assesment input widgets. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_page(self, **kwargs) self.cmbFamily.handler_block(self._lst_handler_id[3]) self.cmbFamily.set_active(_attributes['family_id']) self.cmbFamily.handler_unblock(self._lst_handler_id[3]) if _attributes['hazard_rate_method_id'] == 2: self.cmbSpecification.handler_block(self._lst_handler_id[1]) self.cmbSpecification.set_active(_attributes['specification_id']) self.cmbSpecification.handler_unblock(self._lst_handler_id[1]) self.cmbInsulation.handler_block(self._lst_handler_id[2]) self.cmbInsulation.set_active(_attributes['insulation_id']) self.cmbInsulation.handler_unblock(self._lst_handler_id[2]) self.cmbConstruction.handler_block(self._lst_handler_id[4]) self.cmbConstruction.set_active(_attributes['construction_id']) self.cmbConstruction.handler_unblock(self._lst_handler_id[4]) self.txtArea.handler_block(self._lst_handler_id[5]) self.txtArea.set_text(str(self.fmt.format(_attributes['area']))) self.txtArea.handler_unblock(self._lst_handler_id[5]) self.txtWeight.handler_block(self._lst_handler_id[6]) self.txtWeight.set_text(str(self.fmt.format( _attributes['weight']))) self.txtWeight.handler_unblock(self._lst_handler_id[6]) return _return
def _make_page(self): """ Make the semiconductor gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ self._do_load_comboboxes(subcategory_id=self._subcategory_id) self._do_set_sensitive() # Build the container for inductors. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.cmbPackage, _x_pos, _y_pos[1]) self.put(self.cmbType, _x_pos, _y_pos[2]) self.put(self.cmbApplication, _x_pos, _y_pos[3]) self.put(self.cmbConstruction, _x_pos, _y_pos[4]) self.put(self.cmbMatching, _x_pos, _y_pos[5]) self.put(self.txtFrequencyOperating, _x_pos, _y_pos[6]) self.put(self.txtNElements, _x_pos, _y_pos[7]) self.put(self.txtThetaJC, _x_pos, _y_pos[8]) return None
def _make_page(self): """ Make the Hardware class gtk.Notebook() assessment input page. :return: False if successful or True if an error is encountered. :rtype: bool """ self._do_load_comboboxes(subcategory_id=self._subcategory_id) self._do_set_sensitive() # Build the container for inductors. _x_pos, _y_pos = AssessmentInputs.make_page(self) self.put(self.txtResistance, _x_pos, _y_pos[1]) self.put(self.cmbSpecification, _x_pos, _y_pos[2]) self.put(self.cmbType, _x_pos, _y_pos[3]) self.put(self.cmbStyle, _x_pos, _y_pos[4]) self.put(self.cmbConstruction, _x_pos, _y_pos[5]) self.put(self.txtNElements, _x_pos, _y_pos[6]) self.show_all() return None
def _do_load_comboboxes(self, **kwargs): # pylint: disable=unused-argument """ Load the miscellaneous RKTComboBox()s. This method is used to load the specification RAMSTKComboBox() whenever the miscellaneous subcategory is changed. :param int subcategory_id: the newly selected miscellaneous hardware item subcategory ID. :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False _attributes = AssessmentInputs.do_load_comboboxes(self, **kwargs) # Load the quality level RAMSTKComboBox(). self.cmbQuality.do_load_combo([["MIL-SPEC"], [_(u"Lower")]]) # Load the application RAMSTKComboBox(). self.cmbApplication.do_load_combo([[_(u"Incandescent, AC")], [_(u"Incandescent, DC")]]) # Load the type RAMSTKComboBox(). if _attributes['hazard_rate_method_id'] == 1: self.cmbType.do_load_combo( [[_(u"Ceramic-Ferrite")], [_(u"Discrete LC Components")], [_(u"Discrete LC and Crystal Components")]]) elif _attributes['hazard_rate_method_id'] == 2: self.cmbType.do_load_combo( [[_(u"MIL-F-15733 Ceramic-Ferrite")], [ _(u"MIL-F-15733 Discrete LC Components") ], [_(u"MIL-F-18327 Discrete LC Components")], [_(u"MIL-F-18327 Discrete LC and Crystal Components")]]) return _return
def _on_combo_changed(self, combo, index): """ Retrieve RAMSTKCombo() changes and assign to Capacitor attribute. This method is called by: * gtk.Combo() 'changed' signal :param combo: the RAMSTKCombo() that called this method. :type combo: :class:`ramstk.gui.gtk.ramstk.RAMSTKCombo` :param int index: the position in the signal handler list associated with the calling RAMSTKComboBox(). Indices are: +---------+------------------+---------+------------------+ | Index | Widget | Index | Widget | +=========+==================+=========+==================+ | 1 | cmbSpecification | 3 | cmbConfiguration | +---------+------------------+---------+------------------+ | 2 | cmbStyle | 4 | cmbConstruction | +---------+------------------+---------+------------------+ :return: False if successful or True if an error is encountered. :rtype: bool """ _return = False combo.handler_block(self._lst_handler_id[index]) _attributes = AssessmentInputs.on_combo_changed(self, combo, index) if _attributes: if index == 1: _attributes['specification_id'] = int(combo.get_active()) # Load the capacitor style RAMSTKComboBox(). _index = _attributes['specification_id'] - 1 if self._subcategory_id in [1, 3, 4, 7, 9, 10, 11, 13]: try: _data = self._dic_styles[self._subcategory_id][_index] except KeyError: _data = [] else: try: _data = self._dic_styles[self._subcategory_id] except KeyError: _data = [] self.cmbStyle.do_load_combo(_data) elif index == 2: _attributes['type_id'] = int(combo.get_active()) elif index == 3: _attributes['configuration_id'] = int(combo.get_active()) elif index == 4: _attributes['construction_id'] = int(combo.get_active()) self._dtc_data_controller.request_set_attributes( self._hardware_id, _attributes) combo.handler_unblock(self._lst_handler_id[index]) return _return