Skip to content

Commit

Permalink
Refactored '_input_iface_changed' and '_le_custom_text_edited' methods
Browse files Browse the repository at this point in the history
  • Loading branch information
emcek committed Dec 8, 2023
1 parent 8eb8ae0 commit 6d88b1e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dcspy/qt_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def _save_current_cell(self, currentRow: int, currentColumn: int, previousRow: i
cell_combo = self.tw_gkeys.cellWidget(currentRow, currentColumn)
self._cell_ctrl_content_changed(text=cell_combo.currentText(), widget=cell_combo, row=currentRow, col=currentColumn)

def _input_iface_changed(self, button: QRadioButton) -> None:
def _input_iface_changed(self) -> None:
"""
Triggered when new input interface is selected.
Expand All @@ -601,7 +601,10 @@ def _input_iface_changed(self, button: QRadioButton) -> None:
section = self._find_section_name(ctrl_name=current_cell_text)
key_name = self._get_key_name_from_row_col(self.current_row, self.current_col)
ctrl_key = self.ctrl_input[section][current_cell_text]
self.input_reqs[self.current_plane][key_name] = GuiPlaneInputRequest.from_control_key(ctrl_key=ctrl_key, rb_iface=button.objectName())
input_iface_name = self.bg_rb_input_iface.checkedButton().objectName()
custom_value = self.le_custom.text() if input_iface_name == 'rb_custom' else ''
self.input_reqs[self.current_plane][key_name] = GuiPlaneInputRequest.from_control_key(ctrl_key=ctrl_key, rb_iface=input_iface_name,
custom_value=custom_value)

def _le_custom_text_edited(self) -> None:
"""Triggered when text is changed and user press enter or widget lose focus."""
Expand All @@ -611,8 +614,9 @@ def _le_custom_text_edited(self) -> None:
key_name = self._get_key_name_from_row_col(self.current_row, self.current_col)
ctrl_key = self.ctrl_input[section][current_cell_text]
input_iface_name = self.bg_rb_input_iface.checkedButton().objectName()
custom_value = self.le_custom.text() if input_iface_name == 'rb_custom' else ''
self.input_reqs[self.current_plane][key_name] = GuiPlaneInputRequest.from_control_key(ctrl_key=ctrl_key, rb_iface=input_iface_name,
custom_value=self.le_custom.text())
custom_value=custom_value)

def _copy_cell_to_row(self) -> None:
"""Copy content of current cell to whole row."""
Expand Down

0 comments on commit 6d88b1e

Please sign in to comment.