Fixes: 1065216 Alert display - Text dissapers of the edge of the screen

Fixes: 1065149 Clicking new or save disables buttons to display alert

Long words now wrap rather than dissapearing off of the edge.
When creating a new item or editing one, the text is left in the text box, the item in the list stays selected and the display buttons enabled so the user does not have to find and click on the alert they just created.
This commit is contained in:
Philip Ridout 2012-10-10 22:58:21 +01:00
parent a5b456a374
commit e55bc7f35d
2 changed files with 6 additions and 1 deletions

View File

@ -105,6 +105,7 @@ CSS = """
font-size: %spt;
color: %s;
background-color: %s;
word-wrap: break-word;
}
"""

View File

@ -80,6 +80,10 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
item_name = QtGui.QListWidgetItem(alert.text)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
self.alertListWidget.addItem(item_name)
if alert.text == unicode(self.alertTextEdit.text()):
self.item_id = alert.id
self.alertListWidget.setCurrentRow(
self.alertListWidget.row(item_name))
def onDisplayClicked(self):
self.triggerAlert(unicode(self.alertTextEdit.text()))
@ -112,7 +116,6 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
alert = AlertItem()
alert.text = unicode(self.alertTextEdit.text())
self.manager.save_object(alert)
self.alertTextEdit.setText(u'')
self.loadList()
def onSaveClick(self):
@ -125,6 +128,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.manager.save_object(alert)
self.item_id = None
self.loadList()
self.saveButton.setEnabled(False)
def onTextChanged(self):
"""