~qbzr-dev/qbzr/0.20

« back to all changes in this revision

Viewing changes to log.py

  • Committer: Lukáš Lalinský
  • Date: 2007-07-10 07:29:52 UTC
  • Revision ID: lalinsky@gmail.com-20070710072952-xsxskekvl62aspv8
Move QLogFormatter to top-level.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- coding: utf-8 -*-
2
2
#
3
3
# QBzr - Qt frontend to Bazaar commands
4
 
# Copyright (C) 2006 Lukáš Lalinský <lalinsky@gmail.com>
5
 
# Porions Copyright (C) 2004, 2005, 2006 by Canonical Ltd 
 
4
# Copyright (C) 2006-2007 Lukáš Lalinský <lalinsky@gmail.com>
6
5
#
7
6
# This program is free software; you can redistribute it and/or
8
7
# modify it under the terms of the GNU General Public License
21
20
import sys
22
21
import re
23
22
import Queue
24
 
from itertools import izip
25
23
from PyQt4 import QtCore, QtGui
26
24
from bzrlib import lazy_regex
27
 
from bzrlib.bzrdir import BzrDir
28
 
from bzrlib.commands import Command, register_command
29
 
from bzrlib.errors import NotVersionedError, BzrCommandError, NoSuchFile
30
25
from bzrlib.log import LogFormatter, show_log
31
26
from bzrlib.plugins.qbzr.diff import DiffWindow
32
27
from bzrlib.plugins.qbzr.util import QBzrWindow
97
92
        pass
98
93
 
99
94
 
 
95
class QLogFormatter(LogFormatter):
 
96
 
 
97
    supports_merge_revisions = True
 
98
    supports_tags = True
 
99
    supports_delta = True
 
100
 
 
101
    def __init__(self, parent):
 
102
        self.parent = parent
 
103
 
 
104
    def log_revision(self, revision):
 
105
        self.parent.log_queue.put(revision)
 
106
        self.parent.emit(QtCore.SIGNAL("log_entry_loaded()"))
 
107
 
 
108
 
100
109
class LogWindow(QBzrWindow):
101
110
 
102
111
    def __init__(self, branch, location, specific_fileid, replace=None, parent=None):
147
156
 
148
157
        #groupBox = QtGui.QGroupBox(u"Details", splitter)
149
158
 
150
 
        splitter.setStretchFactor(0, 6)
 
159
        splitter.setStretchFactor(0, 5)
151
160
        splitter.setStretchFactor(1, 1)
152
161
 
153
162
        #hbox = QtGui.QHBoxLayout(groupBox)
168
177
 
169
178
        self.message = QtGui.QTextDocument()
170
179
        self.message_browser = LogMessageBrowser(hsplitter)
171
 
        #self.message_browser.setOpenExternalLinks(True)
172
180
        self.message_browser.setDocument(self.message)
173
181
        self.connect(self.message_browser, QtCore.SIGNAL("anchorClicked(QUrl)"), self.link_clicked)
174
182
        hsplitter.addWidget(self.message_browser)
181
189
 
182
190
        splitter.addWidget(hsplitter)
183
191
 
184
 
 
185
192
        buttonbox = QtGui.QDialogButtonBox(
186
193
            QtGui.QDialogButtonBox.StandardButtons(
187
194
                QtGui.QDialogButtonBox.Close),
306
313
 
307
314
    def load_history(self):
308
315
        """Load branch history."""
309
 
 
310
 
        class QLogFormatter(LogFormatter):
311
 
 
312
 
            supports_merge_revisions = True
313
 
            supports_tags = True
314
 
            supports_delta = True
315
 
 
316
 
            def __init__(self, parent):
317
 
                self.parent = parent
318
 
 
319
 
            def log_revision(self, revision):
320
 
                self.parent.log_queue.put(revision)
321
 
                self.parent.emit(QtCore.SIGNAL("log_entry_loaded()"))
322
 
 
323
316
        formatter = QLogFormatter(self)
324
317
        show_log(self.branch, formatter, verbose=False,
325
318
                 specific_fileid=self.specific_fileid)