~ubuntu-branches/debian/sid/calibre/sid

« back to all changes in this revision

Viewing changes to src/calibre/gui2/dialogs/message_box.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-02-27 07:48:06 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: package-import@ubuntu.com-20140227074806-64wdebb3ptosxhhx
Tags: upstream-1.25.0+dfsg
ImportĀ upstreamĀ versionĀ 1.25.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
from calibre.constants import __version__, isfrozen
15
15
from calibre.gui2.dialogs.message_box_ui import Ui_Dialog
16
16
 
17
 
class MessageBox(QDialog, Ui_Dialog): # {{{
 
17
class MessageBox(QDialog, Ui_Dialog):  # {{{
18
18
 
19
19
    ERROR = 0
20
20
    WARNING = 1
79
79
 
80
80
        self.do_resize()
81
81
 
82
 
 
83
82
    def toggle_det_msg(self, *args):
84
83
        vis = unicode(self.det_msg_toggle.text()) == self.hide_det_msg
85
84
        self.det_msg_toggle.setText(self.show_det_msg if vis else
109
108
                self.bb.button(self.bb.Yes if self.default_yes else self.bb.No
110
109
                        ).setFocus(Qt.OtherFocusReason)
111
110
            except:
112
 
                pass# Buttons were changed
 
111
                pass  # Buttons were changed
113
112
        else:
114
113
            self.bb.button(self.bb.Ok).setFocus(Qt.OtherFocusReason)
115
114
        return ret
124
123
        self.do_resize()
125
124
# }}}
126
125
 
127
 
class ViewLog(QDialog): # {{{
 
126
class ViewLog(QDialog):  # {{{
128
127
 
129
128
    def __init__(self, title, html, parent=None):
130
129
        QDialog.__init__(self, parent)
156
155
 
157
156
_proceed_memory = []
158
157
 
159
 
class ProceedNotification(MessageBox): # {{{
 
158
class ProceedNotification(MessageBox):  # {{{
160
159
 
161
160
    '''
162
161
    WARNING: This class is deprecated. DO not use it as some users have
227
226
 
228
227
# }}}
229
228
 
230
 
class ErrorNotification(MessageBox): # {{{
 
229
class ErrorNotification(MessageBox):  # {{{
231
230
 
232
231
    def __init__(self, html_log, log_viewer_title, title, msg,
233
232
            det_msg='', show_copy_button=False, parent=None):
267
266
        _proceed_memory.remove(self)
268
267
# }}}
269
268
 
270
 
class JobError(QDialog): # {{{
 
269
class JobError(QDialog):  # {{{
271
270
 
272
271
    WIDTH = 600
273
272
    do_pop = pyqtSignal()
343
342
 
344
343
    def do_resize(self):
345
344
        h = self.sizeHint().height()
346
 
        self.setMinimumHeight(0) # Needed as this gets set if det_msg is shown
 
345
        self.setMinimumHeight(0)  # Needed as this gets set if det_msg is shown
347
346
        # Needed otherwise re-showing the box after showing det_msg causes the box
348
347
        # to not reduce in height
349
348
        self.setMaximumHeight(h)
360
359
        self.pop()
361
360
 
362
361
    def pop(self):
363
 
        if not self.queue or self.isVisible(): return
 
362
        if not self.queue or self.isVisible():
 
363
            return
364
364
        title, msg, det_msg = self.queue.pop(0)
365
365
        self.setWindowTitle(title)
366
366
        self.msg_label.setText(msg)