do not pre-select an item in highlight dialog
This commit is contained in:
@@ -36,7 +36,7 @@ class HighlightingDialog(QDialog):
|
||||
self.btn_add.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
|
||||
self.btn_add.pressed.connect(self._add)
|
||||
|
||||
self.btn_update = QPushButton(self.tr("Update"))
|
||||
self.btn_update = QPushButton(QIcon.fromTheme("stock_edit"), self.tr("Update"))
|
||||
self.btn_update.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))
|
||||
self.btn_update.pressed.connect(self._update)
|
||||
|
||||
@@ -71,12 +71,12 @@ class HighlightingDialog(QDialog):
|
||||
|
||||
row = row + 1
|
||||
form_grid.addWidget(QLabel(self.tr("Hit Background:")), row, 0)
|
||||
self.hit_background_color = ColorButton("ff00ff")
|
||||
self.hit_background_color = ColorButton("ccb400")
|
||||
form_grid.addWidget(self.hit_background_color, row, 1)
|
||||
|
||||
row = row + 1
|
||||
form_grid.addWidget(QLabel(self.tr("Line Background:")), row, 0)
|
||||
self.line_background_color = ColorButton("ff00ff0d")
|
||||
self.line_background_color = ColorButton("fff080")
|
||||
form_grid.addWidget(self.line_background_color, row, 1)
|
||||
|
||||
row = row + 1
|
||||
@@ -86,9 +86,11 @@ class HighlightingDialog(QDialog):
|
||||
self.buttons.rejected.connect(self.close)
|
||||
form_grid.addWidget(self.buttons, row, 0, 1, 2)
|
||||
|
||||
self._load_existing_hightlighters()
|
||||
self.list.setCurrentItem(None)
|
||||
self._selection_changed()
|
||||
self.list.currentItemChanged.connect(self._item_changed)
|
||||
self.list.itemSelectionChanged.connect(self._selection_changed)
|
||||
self._load_existing_hightlighters()
|
||||
|
||||
def _add(self):
|
||||
highlighter = HighlightRegex(
|
||||
@@ -166,9 +168,7 @@ class HighlightingDialog(QDialog):
|
||||
self.btn_move_up.setDisabled(selected_index == 0)
|
||||
self.btn_move_down.setDisabled(selected_index + 1 >= self.list.count())
|
||||
|
||||
def _item_changed(self, current, _previous):
|
||||
item: PayloadItem = current
|
||||
if item:
|
||||
item: PayloadItem = self.list.item(selected_index)
|
||||
highlighter: HighlightRegex = item.payload
|
||||
self.query.setText(highlighter.query)
|
||||
self.ignore_case.setChecked(highlighter.ignore_case)
|
||||
@@ -201,5 +201,3 @@ class HighlightingDialog(QDialog):
|
||||
self.list.addItem(item)
|
||||
if not first_item:
|
||||
first_item = item
|
||||
if first_item:
|
||||
self.list.setCurrentItem(first_item)
|
||||
|
||||
Reference in New Issue
Block a user