Commits

Yuya Nishihara committed da36c70

import precommit

  • Participants
  • Parent commits 004b5b8

Comments (0)

Files changed (3)

+# HG changeset patch
+# User Yuya Nishihara <yuya@tcha.org>
+# Date 1363101665 -32400
+#      Wed Mar 13 00:21:05 2013 +0900
+# Node ID 1bc795813c22ef6abd80de2d7554cd5f40cf04db
+# Parent  b8734a9779a6b044bc7c679c73ecc63e8440c39e
+email: simplify logic to correct attachment modes
+
+diff --git a/tortoisehg/hgqt/hgemail.py b/tortoisehg/hgqt/hgemail.py
+--- a/tortoisehg/hgqt/hgemail.py
++++ b/tortoisehg/hgqt/hgemail.py
+@@ -43,13 +43,13 @@ class EmailDialog(QDialog):
+         self._initpreviewtab()
+         self._initenvelopebox()
+         self._qui.bundle_radio.toggled.connect(self._updateforms)
+-        self._qui.body_check.toggled.connect(self._body_mode_clicked)
+-        self._qui.attach_check.toggled.connect(self._attach_mode_clicked)
+-        self._qui.inline_check.toggled.connect(self._inline_mode_clicked)
++        self._qui.attach_check.toggled.connect(self._updateattachmodes)
++        self._qui.inline_check.toggled.connect(self._updateattachmodes)
+         self._initintrobox()
+         self._readhistory()
+         self._filldefaults()
+         self._updateforms()
++        self._updateattachmodes()
+         self._readsettings()
+         QShortcut(QKeySequence('CTRL+Return'), self, self.accept)
+         QShortcut(QKeySequence('Ctrl+Enter'), self, self.accept)
+@@ -247,32 +247,22 @@ class EmailDialog(QDialog):
+         if self._introrequired():
+             self._qui.writeintro_check.setChecked(True)
+ 
+-    def _body_mode_clicked(self):
+-        # Only allow a single attachment type to be active at a time
+-        sendattachment = self._qui.attach_check.isChecked() or self._qui.inline_check.isChecked()
+-        if not sendattachment:
+-            # If no attachment, ensure that the body mode is enabled
+-            self._qui.body_check.setChecked(True)
++    #@pyqtSlot()
++    def _updateattachmodes(self):
++        """Update checkboxes to select the embedding style of the patch"""
++        attachmodes = [self._qui.inline_check, self._qui.attach_check]
++        body = self._qui.body_check
+ 
+-    def _attach_mode_clicked(self):
+-        sendattachment = self._qui.attach_check.isChecked() or self._qui.inline_check.isChecked()
+-        self._qui.body_check.setDisabled(not sendattachment)
+-        if not sendattachment:
+-            self._qui.body_check.setChecked(True)
++        # --inline and --attach are exlusive
++        if self.sender() in attachmodes and self.sender().isChecked():
++            for w in attachmodes:
++                if w is not self.sender():
++                    w.setChecked(False)
+ 
+-        # Only allow a single attachment type to be active at a time
+-        if self._qui.attach_check.isChecked():
+-            self._qui.inline_check.setChecked(False)
+-
+-    def _inline_mode_clicked(self):
+-        sendattachment = self._qui.attach_check.isChecked() or self._qui.inline_check.isChecked()
+-        self._qui.body_check.setDisabled(not sendattachment)
+-        if not sendattachment:
+-            self._qui.body_check.setChecked(True)
+-
+-        # Only allow a single attachment type to be active at a time
+-        if self._qui.inline_check.isChecked():
+-            self._qui.attach_check.setChecked(False)
++        # --body is mandatory if no attach modes are specified
++        body.setEnabled(util.any(w.isChecked() for w in attachmodes))
++        if not body.isEnabled():
++            body.setChecked(True)
+ 
+     def _initenvelopebox(self):
+         for e in ('to_edit', 'from_edit'):

File graph-slots.diff

+# HG changeset patch
+# Parent 059d692e8f771fec4195ac561c93740dea959a84
+diff --git a/tortoisehg/hgqt/graph.py b/tortoisehg/hgqt/graph.py
+--- a/tortoisehg/hgqt/graph.py
++++ b/tortoisehg/hgqt/graph.py
+@@ -237,6 +237,10 @@ class GraphNode(object):
+     Simple class to encapsulate e hg node in the revision graph. Does
+     nothing but declaring attributes.
+     """
++
++    __slots__ = ('rev', 'x', 'color', 'cols', 'parents', 'bottomlines',
++                 'toplines', 'extra')
++
+     def __init__(self, rev, xposition, color, lines, parents, ncols=None,
+                  extra=None):
+         self.rev = rev
+13788.diff
+graph-slots.diff
 repof-parseerror.diff
 notestcmd.diff
 shortrepr.diff