def prepare_modulation_dialog( self) -> (ModulatorDialogController, Message): preselected_index = self.ui.cBoxModulations.currentIndex() min_row, max_row, start, end = self.ui.tableMessages.selection_range() if min_row > -1: try: selected_message = self.table_model.protocol.messages[min_row] preselected_index = selected_message.modulator_indx except IndexError: selected_message = Message([True, False, True, False], 0, [], MessageType("empty")) else: selected_message = Message([True, False, True, False], 0, [], MessageType("empty")) if len(self.table_model.protocol.messages) > 0: selected_message.bit_len = self.table_model.protocol.messages[ 0].bit_len for m in self.modulators: m.default_sample_rate = self.project_manager.sample_rate modulator_dialog = ModulatorDialogController(self.modulators, parent=self) modulator_dialog.ui.treeViewSignals.setModel(self.tree_model) modulator_dialog.ui.treeViewSignals.expandAll() modulator_dialog.ui.comboBoxCustomModulations.setCurrentIndex( preselected_index) modulator_dialog.finished.connect(self.refresh_modulators) modulator_dialog.finished.connect(self.refresh_pause_list) return modulator_dialog, selected_message
def initialize_modulation_dialog(self, bits: str, dialog: ModulatorDialogController): dialog.on_modulation_type_changed() # for drawing modulated signal initially dialog.original_bits = bits dialog.ui.linEdDataBits.setText(bits) dialog.ui.gVOriginalSignal.signal_tree_root = self.tree_model.rootItem dialog.draw_original_signal() dialog.ui.gVModulated.show_full_scene(reinitialize=True) dialog.ui.gVData.show_full_scene(reinitialize=True) dialog.ui.gVData.auto_fit_view() dialog.ui.gVCarrier.show_full_scene(reinitialize=True) dialog.ui.gVCarrier.auto_fit_view() dialog.mark_samples_in_view()
def show_modulation_dialog(self): preselected_index = self.ui.cBoxModulations.currentIndex() min_row, max_row, start, end = self.ui.tableBlocks.selection_range() if min_row > -1: try: block = self.table_model.protocol.blocks[min_row] preselected_index = block.modulator_indx except IndexError: block = ProtocolBlock([True, False, True, False], 0, []) else: block = ProtocolBlock([True, False, True, False], 0, []) if len(self.table_model.protocol.blocks) > 0: block.bit_len = self.table_model.protocol.blocks[0].bit_len for m in self.modulators: m.default_sample_rate = self.project_manager.sample_rate c = ModulatorDialogController(self.modulators, parent=self) c.ui.treeViewSignals.setModel(self.tree_model) c.ui.treeViewSignals.expandAll() c.ui.comboBoxCustomModulations.setCurrentIndex(preselected_index) # c.ui.spinBoxBitLength.setValue(block.bit_len) Overrides Modulators value c.finished.connect(self.refresh_modulators) c.finished.connect(self.refresh_pause_list) c.show() bits = block.encoded_bits_str[0:10] c.original_bits = bits c.ui.linEdDataBits.setText(bits) c.ui.gVOriginalSignal.signal_tree_root = self.tree_model.rootItem c.draw_original_signal() c.ui.gVModulated.draw_full() c.ui.gVData.draw_full() c.ui.gVCarrier.draw_full() self.has_default_modulation = False