Commits

Yuya Nishihara committed ccb0f1e

fin

  • Participants
  • Parent commits fd363f1

Comments (0)

Files changed (4)

File console-per-repo.diff

-# HG changeset patch
-# Date 1372861333 -32400
-# Parent 1f958c0d2f4a1ca0fecce10c209abca72ead1a37
-docklog: assign console per repository (closes #120)
-
-This change works well in most cases. But if Mercurial command is running in
-inactive repository tab, its output is sent to wrong console. This bug will
-be fixed later by using new repository access layer.
-
-diff --git a/tortoisehg/hgqt/docklog.py b/tortoisehg/hgqt/docklog.py
---- a/tortoisehg/hgqt/docklog.py
-+++ b/tortoisehg/hgqt/docklog.py
-@@ -446,6 +446,10 @@ class ConsoleWidget(QWidget):
-         self._repo = repo
-         self._logwidget.setPrompt('%s%% ' % (repo and repo.displayname or ''))
- 
-+    def repoRootPath(self):
-+        if self._repo:
-+            return hglib.tounicode(self._repo.root)
-+
-     @property
-     def cwd(self):
-         """Return the current working directory"""
-@@ -554,19 +558,36 @@ class LogDockWidget(QDockWidget):
- 
-         self._consoles = QStackedWidget(self)
-         self.setWidget(self._consoles)
--        self._createConsole()
-+        self._createConsoleFor(None)  # TODO: is free console really necessary?
- 
-         # move focus only when console is activated by keyboard/mouse operation
-         self.toggleViewAction().triggered.connect(self._setFocusOnToggleView)
- 
-     def setRepository(self, repo):
--        self.logte.setRepository(repo)
-+        w = self._findConsoleFor(repo)
-+        if not w:
-+            w = self._createConsoleFor(repo)
-+        self._consoles.setCurrentWidget(w)
- 
--    def _createConsole(self):
-+    def _findConsoleFor(self, repo):
-+        if repo:
-+            root = hglib.tounicode(repo.root)
-+        else:
-+            root = None
-+        for i in xrange(self._consoles.count()):
-+            w = self._consoles.widget(i)
-+            if w.repoRootPath() == root:
-+                return w
-+
-+    def _createConsoleFor(self, repo):
-         w = ConsoleWidget(self)
-+        w.setRepository(repo)
-         w.closeRequested.connect(self.close)
-         w.progressReceived.connect(self.progressReceived)
-         self._consoles.addWidget(w)
-+        return w
-+
-+    # TODO: delete unused console on repositoryClosed
- 
-     # TODO: stub property should be removed later
-     @property
-diff --git a/tortoisehg/hgqt/workbench.py b/tortoisehg/hgqt/workbench.py
---- a/tortoisehg/hgqt/workbench.py
-+++ b/tortoisehg/hgqt/workbench.py
-@@ -873,6 +873,7 @@ class Workbench(QMainWindow):
-         rw = RepoWidget(repo, self, bundle=bundle)
-         rw.showMessageSignal.connect(self.showMessage)
-         rw.progress.connect(self._showRepoWidgetProgress)
-+        # TODO: send output to corresponding console instead of current one
-         rw.output.connect(self.log.output)
-         rw.makeLogVisible.connect(self.log.setShown)
-         rw.beginSuppressPrompt.connect(self.log.beginSuppressPrompt)

File console-stack.diff

-# HG changeset patch
-# Date 1372860751 -32400
-# Parent ec8fe73a009c09bfc9835b9ced703c6fa89b8883
-docklog: insert QStackedWidget as stub for per-repository console (refs #120)
-
-diff --git a/tortoisehg/hgqt/docklog.py b/tortoisehg/hgqt/docklog.py
---- a/tortoisehg/hgqt/docklog.py
-+++ b/tortoisehg/hgqt/docklog.py
-@@ -553,10 +553,9 @@ class LogDockWidget(QDockWidget):
-         #self.setWindowFlags(Qt.Drawer)
-         self.dockLocationChanged.connect(self._updateTitleBarStyle)
- 
--        self.logte = ConsoleWidget(self)
--        self.logte.closeRequested.connect(self.close)
--        self.logte.progressReceived.connect(self.progressReceived)
--        self.setWidget(self.logte)
-+        self._consoles = QStackedWidget(self)
-+        self.setWidget(self._consoles)
-+        self._createConsole()
- 
-         # move focus only when console is activated by keyboard/mouse operation
-         self.toggleViewAction().triggered.connect(self._setFocusOnToggleView)
-@@ -564,6 +563,17 @@ class LogDockWidget(QDockWidget):
-     def setRepository(self, repo):
-         self.logte.setRepository(repo)
- 
-+    def _createConsole(self):
-+        w = ConsoleWidget(self)
-+        w.closeRequested.connect(self.close)
-+        w.progressReceived.connect(self.progressReceived)
-+        self._consoles.addWidget(w)
-+
-+    # TODO: stub property should be removed later
-+    @property
-+    def logte(self):
-+        return self._consoles.currentWidget()
-+
-     @pyqtSlot()
-     def clear(self):
-         self.logte.clear()

File console-vertical.diff

-# HG changeset patch
-# Date 1372863620 -32400
-# Parent 52786d24054ea7e1f2027617ed1fbb0ebf736ae7
-docklog: move title bar to left if console is spanned horizontally
-
-It saves precious vertical space.
-
-diff --git a/tortoisehg/hgqt/docklog.py b/tortoisehg/hgqt/docklog.py
---- a/tortoisehg/hgqt/docklog.py
-+++ b/tortoisehg/hgqt/docklog.py
-@@ -551,6 +551,7 @@ class LogDockWidget(QDockWidget):
-         self.setWindowTitle(_('Output Log'))
-         # Not enabled until we have a way to make it configurable
-         #self.setWindowFlags(Qt.Drawer)
-+        self.dockLocationChanged.connect(self._updateTitleBarStyle)
- 
-         self.logte = ConsoleWidget(self)
-         self.logte.closeRequested.connect(self.close)
-@@ -589,3 +590,12 @@ class LogDockWidget(QDockWidget):
-         super(LogDockWidget, self).setVisible(visible)
-         if visible:
-             self.raise_()
-+
-+    @pyqtSlot(Qt.DockWidgetArea)
-+    def _updateTitleBarStyle(self, area):
-+        f = self.features()
-+        if area & (Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea):
-+            f |= QDockWidget.DockWidgetVerticalTitleBar  # save vertical space
-+        else:
-+            f &= ~QDockWidget.DockWidgetVerticalTitleBar
-+        self.setFeatures(f)
-console-vertical.diff
-console-stack.diff
-console-per-repo.diff
 refreshwctx-trace.diff
 wbatext-abrt.diff
 wb-openrepo-trace.diff