|
|
|
@ -846,7 +846,7 @@ class MainFrameRes(QtGui.QWidget):
|
|
|
|
|
if self.progress_list:
|
|
|
|
|
self.progress_list[-1].hide()
|
|
|
|
|
self.message = ConfirmDialog(self, item, sid, pid)
|
|
|
|
|
self.work_layout.control.insertWidget(0, self.message)
|
|
|
|
|
self._parent.control_button.set_confirmation(self.message)
|
|
|
|
|
self.message.show()
|
|
|
|
|
|
|
|
|
|
def send_Choice(self, sid, pid, item):
|
|
|
|
@ -854,7 +854,7 @@ class MainFrameRes(QtGui.QWidget):
|
|
|
|
|
if self.progress_list:
|
|
|
|
|
self.progress_list[-1].hide()
|
|
|
|
|
self.message = ChoiceDialog(self, item, sid, pid)
|
|
|
|
|
self.work_layout.control.insertWidget(0, self.message)
|
|
|
|
|
self._parent.control_button.set_confirmation(self.message)
|
|
|
|
|
self.message.show()
|
|
|
|
|
|
|
|
|
|
def send_Message(self, sid, pid, item):
|
|
|
|
@ -890,6 +890,7 @@ class MainFrameRes(QtGui.QWidget):
|
|
|
|
|
if hasattr(self,"passwd") and self.passwd:
|
|
|
|
|
self.passwd.close()
|
|
|
|
|
self.passwd = None
|
|
|
|
|
self._parent.control_button.close_confirmation()
|
|
|
|
|
|
|
|
|
|
def closeEvent(self, event):
|
|
|
|
|
self.timer.stop()
|
|
|
|
@ -900,6 +901,7 @@ class MainFrameRes(QtGui.QWidget):
|
|
|
|
|
self.closeDialogs()
|
|
|
|
|
event.accept()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MessageDialog(QtGui.QWidget):
|
|
|
|
|
# answer to the server question
|
|
|
|
|
def __init__(self, parent, item, sid, pid, isPassword = False):
|
|
|
|
@ -978,6 +980,7 @@ class MessageDialog(QtGui.QWidget):
|
|
|
|
|
else:
|
|
|
|
|
self.send_button.setEnabled(True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ButtonDialog(QtGui.QWidget):
|
|
|
|
|
button_size = 144
|
|
|
|
|
|
|
|
|
@ -1012,11 +1015,13 @@ class ButtonDialog(QtGui.QWidget):
|
|
|
|
|
button.setShortcut(QtGui.QKeySequence(shortcut))
|
|
|
|
|
button.clicked.connect(self.send(answer, label))
|
|
|
|
|
button.setFixedWidth(self.button_size)
|
|
|
|
|
button.setFixedHeight(32)
|
|
|
|
|
self.layout.addWidget(button)
|
|
|
|
|
|
|
|
|
|
def send(self, answer, human_answer=None):
|
|
|
|
|
# Call server method
|
|
|
|
|
def wrapper():
|
|
|
|
|
self._parent._parent.control_button.close_confirmation()
|
|
|
|
|
if human_answer and self.header_label:
|
|
|
|
|
self.header_label.setText(
|
|
|
|
|
self.header_label.text() + " " +
|
|
|
|
@ -1040,13 +1045,14 @@ class ButtonDialog(QtGui.QWidget):
|
|
|
|
|
self._parent.show_result(result)
|
|
|
|
|
self.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConfirmDialog(ButtonDialog):
|
|
|
|
|
"""
|
|
|
|
|
Диалог подтверждения действия
|
|
|
|
|
"""
|
|
|
|
|
def init(self, item):
|
|
|
|
|
self.header_label = \
|
|
|
|
|
self._parent.show_message("<b>%s</b>" % item.message, space=20)
|
|
|
|
|
self._parent._parent.control_button.set_confirm_question(
|
|
|
|
|
"<b>%s</b>" % item.message)
|
|
|
|
|
self.createButton(_("Yes"), "yes", [QtCore.Qt.Key_Enter,
|
|
|
|
|
QtCore.Qt.Key_Return])
|
|
|
|
|
self.createButton(_("No"), "no", QtCore.Qt.Key_Escape)
|
|
|
|
@ -1059,8 +1065,8 @@ class ChoiceDialog(ButtonDialog):
|
|
|
|
|
def init(self, item):
|
|
|
|
|
message, answers = item.message.split('|')
|
|
|
|
|
|
|
|
|
|
self.header_label = \
|
|
|
|
|
self._parent.show_message("<b>%s</b>" % message, space=20)
|
|
|
|
|
self._parent._parent.control_button.set_confirm_question(
|
|
|
|
|
"<b>%s</b>" % message)
|
|
|
|
|
|
|
|
|
|
reAnswer = re.compile("^(.*)\((.*)\)$")
|
|
|
|
|
answers = imap_regexp(reAnswer, answers.split(','))
|
|
|
|
|