~nmb/bzr-colo/qcolo

« back to all changes in this revision

Viewing changes to qcommands.py

  • Committer: Neil Martinsen-Burrell
  • Date: 2011-05-11 03:18:08 UTC
  • Revision ID: nmb@wartburg.edu-20110511031808-wwnwm6g3mrw0vrmw
get branches and log multiple branches

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from colocated import ColocatedWorkspace
27
27
from PyQt4 import QtCore, QtGui
28
28
 
 
29
from bzrlib.plugins.qbzr.lib.branch import QBzrBranchWindow
29
30
from bzrlib.plugins.qbzr.lib.commands import QBzrCommand
30
31
from bzrlib.plugins.qbzr.lib.diffview import SidebySideDiffView
 
32
from bzrlib.plugins.qbzr.lib.log import LogWindow
 
33
from bzrlib.plugins.qbzr.lib.subprocess import run_subprocess_command
 
34
from bzrlib.plugins.qbzr.lib.switch import QBzrSwitchWindow
 
35
from bzrlib.plugins.qbzr.lib.trace import reports_exception
 
36
from bzrlib.plugins.qbzr.lib.uifactory import ui_current_widget
31
37
from bzrlib.plugins.qbzr.lib.util import (BTN_CLOSE,
32
38
                                          QBzrWindow,
33
39
                                          ThrobberWidget,
34
40
                                          runs_in_loading_queue,
35
41
                                         )
36
 
from bzrlib.plugins.qbzr.lib.uifactory import ui_current_widget
37
 
from bzrlib.plugins.qbzr.lib.switch import QBzrSwitchWindow
38
 
from bzrlib.plugins.qbzr.lib.trace import reports_exception
39
 
from bzrlib.plugins.qbzr.lib.subprocess import run_subprocess_command
40
42
 
41
43
 
42
44
class ColocatedBranchesList(QtGui.QListWidget):
245
247
        super(ColoWindow, self).__init__(**kwargs)
246
248
 
247
249
        self.branches_list.setSelectionMode(
248
 
            QtGui.QAbstractItemView.SingleSelection)
 
250
            QtGui.QAbstractItemView.ExtendedSelection)
249
251
        self.source_branch = None
250
252
 
251
253
        self.restoreSize("colomerge", (600, 400))
292
294
                               QtCore.SIGNAL('itemSelectionChanged()'),
293
295
                               self.source_changed
294
296
                              )
 
297
        QtCore.QObject.connect(self.get_button,
 
298
                               QtCore.SIGNAL('clicked(bool)'),
 
299
                               self.click_get
 
300
                              )
 
301
        QtCore.QObject.connect(self.log_button,
 
302
                               QtCore.SIGNAL('clicked(bool)'),
 
303
                               self.click_log
 
304
                              )
 
305
        QtCore.QObject.connect(self.merge_button,
 
306
                               QtCore.SIGNAL('clicked(bool)'),
 
307
                               self.click_merge
 
308
                              )
295
309
 
296
310
        self.column_box.addLayout(list_column)
297
311
 
307
321
    def source_changed(self):
308
322
        """Selected source branch has changed."""
309
323
        print "source branch changed"
310
 
        try:
311
 
            self.source_branch = str(
312
 
                self.branches_list.selectedItems()[0].text())
313
 
        except IndexError:
 
324
        selection = self.branches_list.selectedItems()
 
325
        if len(selection) == 0:
314
326
            self.source_branch = None
315
 
        if self.source_branch is not None:
 
327
        elif len(selection) == 1:
 
328
            self.source_branch = str(selection[0].text())
316
329
            self.load_diff()
 
330
        elif len(selection) > 1:
 
331
            self.source_branch = None
317
332
 
318
333
    def click_refresh(self):
319
 
        print 'refreshing'
320
334
        self.current_label.setText(self.workspace.current_branch_name())
321
335
        self.branches_list.refresh_branches()
322
336
        self.load_diff()
326
340
                               ui_mode=True)
327
341
        win.exec_()
328
342
        self.click_refresh()
 
343
 
 
344
    def click_merge(self):
 
345
        pass
 
346
 
 
347
    def click_log(self):
 
348
        """Log the selected branches only"""
 
349
        locations = ['colo:'+str(s.text()) for s in
 
350
                     self.branches_list.selectedItems()]        
 
351
        win = LogWindow(locations=locations)
 
352
        win.show()
 
353
 
 
354
    def click_get(self):
 
355
        dialog = QBzrBranchWindow(None, ui_mode=True)
 
356
        dialog.exec_()
 
357
        self.click_refresh()
329
358
        
330
359
    def _load_diff(self, op):
331
360
        (old_tree, new_tree, 
355
384
 
356
385
    def load_diff(self):
357
386
        if self.source_branch is not None:
 
387
            print "loading diff"
358
388
            op = cleanup.OperationWithCleanups(self._load_diff)
359
389
            self.throbber.show()
360
390
            op.add_cleanup(self.throbber.hide)