Skip to content

Commit

Permalink
replace QComboBox with ListWidget because the ComboBox crashed when a…
Browse files Browse the repository at this point in the history
…dding items after a clear
  • Loading branch information
redvox committed Apr 3, 2024
1 parent 907b22c commit f9c1a85
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/gui/key_rotation_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QDialog, QLabel, QApplication, QHBoxLayout, QVBoxLayout, \
QPushButton, QComboBox
QPushButton, QListWidget

if TYPE_CHECKING:
from gui.gui import Gui
Expand All @@ -19,7 +19,7 @@ def __init__(self, parent=None):

self.resize(self.width, self.height)

self.access_key_selection = QComboBox()
self.access_key_selection = QListWidget()

self.text = QLabel("This will create a new key and delete the old one!", self)
self.text.setStyleSheet('color: rgb(255, 0, 0);')
Expand All @@ -43,7 +43,7 @@ def __init__(self, parent=None):
self.installEventFilter(self)

def ok(self):
selected_key = self.access_key_selection.currentText()
selected_key = self.access_key_selection.currentItem().text()
self.gui.rotate_access_key(key_name=selected_key)
self.hide()

Expand All @@ -63,9 +63,7 @@ def keyPressEvent(self, event):
self.cancel()

def show_dialog(self, access_key_list: List[str]):
self.access_key_selection.blockSignals(True)
self.access_key_selection.clear()
self.access_key_selection.blockSignals(False)
for access_key in access_key_list:
self.access_key_selection.addItem(access_key)
self.show()
Expand Down

0 comments on commit f9c1a85

Please sign in to comment.