Ignore:
Timestamp:
03/31/13 09:33:45 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
hg-Phase:
(<MercurialRepository 1 'hg:/home/ivaradi/mlx/hg' '/'>, 'public')
Message:

Implemented the GUI logic of the bug report sending (re #190)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/gui/bugreport.py

    r483 r484  
    9797    def run(self):
    9898        """Run the checklist editor dialog."""
     99        self.set_sensitive(True)
     100        self._description.set_sensitive(True)
    99101        self._updateButtons()
    100102        self._sendButton.grab_default()
    101103        self.show_all()
    102104        response = super(BugReportDialog, self).run()
    103         self.hide()
     105
     106        print "response", response, RESPONSETYPE_ACCEPT
     107        if response==RESPONSETYPE_ACCEPT:
     108            self._send()
     109        else:
     110            self.hide()
    104111
    105112    def _summaryChanged(self, entry):
     
    110117        """Update the sensitivity of the buttoms."""
    111118        self._sendButton.set_sensitive(self._summary.get_text()!="")
     119
     120    def _send(self):
     121        """Send the bug report."""
     122        descriptionBuffer = self._description.get_buffer()
     123        description = \
     124          descriptionBuffer.get_text(descriptionBuffer.get_start_iter(),
     125                                     descriptionBuffer.get_end_iter(),
     126                                     False)
     127        self.set_sensitive(False)
     128        self._gui.sendBugReport(self._summary.get_text(),
     129                                description,
     130                                self._email.get_text(),
     131                                self._bugReportSent)
     132
     133    def _bugReportSent(self, returned, result):
     134        """Called when the bug report was sent."""
     135        self.set_sensitive(True)
     136        self._description.set_sensitive(True)
     137        if returned and result.success:
     138            self.hide()
     139            self._summary.set_text("")
     140            self._description.get_buffer().set_text("")
     141            self._email.set_text("")
     142        else:
     143            self.run()
Note: See TracChangeset for help on using the changeset viewer.