Skip to content

Commit

Permalink
make combobox for device selection editable
Browse files Browse the repository at this point in the history
  • Loading branch information
jopohl committed Mar 4, 2020
1 parent 90d8246 commit 28e3452
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/ui/send_recv_device_settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ QGroupBox::indicator:checked {
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxDeviceIdentifier">
<property name="editable">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
Expand Down
6 changes: 6 additions & 0 deletions src/urh/controller/widgets/DeviceSettingsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def create_connects(self):
self.ui.comboBoxDeviceIdentifier.currentIndexChanged.connect(
self.on_combo_box_device_identifier_current_index_changed)

self.ui.comboBoxDeviceIdentifier.editTextChanged.connect(self.on_combo_box_device_identifier_edit_text_changed)

self.ui.checkBoxDCCorrection.clicked.connect(self.on_check_box_dc_correction_clicked)

def set_gain_defaults(self):
Expand Down Expand Up @@ -518,6 +520,10 @@ def on_combo_box_device_identifier_current_index_changed(self):
self.device.device_serial = self.ui.comboBoxDeviceIdentifier.currentText()
self.device.device_number = self.ui.comboBoxDeviceIdentifier.currentIndex()

@pyqtSlot(str)
def on_combo_box_device_identifier_edit_text_changed(self, new_text: str):
self.device.device_serial = new_text


if __name__ == '__main__':
from PyQt5.QtWidgets import QApplication
Expand Down
4 changes: 2 additions & 2 deletions src/urh/dev/native/PlutoSDR.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def adapt_num_read_samples_to_sample_rate(cls, sample_rate):
def setup_device(cls, ctrl_connection: Connection, device_identifier):
device_identifier = device_identifier if isinstance(device_identifier, str) else ""
try:
device_identifier = re.search("\[.*\]", device_identifier).groups(0)
device_identifier = re.search("(?<=\[).+?(?=\])", device_identifier).group(0)
except (IndexError, AttributeError):
pass

Expand All @@ -40,7 +40,7 @@ def setup_device(cls, ctrl_connection: Connection, device_identifier):
try:
device_identifier = uris[0]
except IndexError:
ctrl_connection.send("Could find a connected PlutoSDR")
ctrl_connection.send("Could not find a connected PlutoSDR")
return False

ret = plutosdr.open(device_identifier)
Expand Down
2 changes: 1 addition & 1 deletion src/urh/ui/ui_send_recv_device_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def setupUi(self, FormDeviceSettings):
self.labelGain.setObjectName("labelGain")
self.gridLayout.addWidget(self.labelGain, 10, 0, 1, 1)
self.comboBoxDeviceIdentifier = QtWidgets.QComboBox(self.frame_2)
self.comboBoxDeviceIdentifier.setEditable(False)
self.comboBoxDeviceIdentifier.setEditable(True)
self.comboBoxDeviceIdentifier.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
self.comboBoxDeviceIdentifier.setObjectName("comboBoxDeviceIdentifier")
self.gridLayout.addWidget(self.comboBoxDeviceIdentifier, 1, 1, 1, 1)
Expand Down

0 comments on commit 28e3452

Please sign in to comment.