34 self.setupUi(self) |
36 self.setupUi(self) |
35 |
37 |
36 self.__changelistColumn = 0 |
38 self.__changelistColumn = 0 |
37 self.__statusColumn = 1 |
39 self.__statusColumn = 1 |
38 self.__propStatusColumn = 2 |
40 self.__propStatusColumn = 2 |
|
41 self.__lockedColumn = 3 |
|
42 self.__historyColumn = 4 |
|
43 self.__switchedColumn = 5 |
39 self.__lockinfoColumn = 6 |
44 self.__lockinfoColumn = 6 |
|
45 self.__upToDateColumn = 7 |
40 self.__pathColumn = 11 |
46 self.__pathColumn = 11 |
41 self.__lastColumn = self.statusList.columnCount() |
47 self.__lastColumn = self.statusList.columnCount() |
42 |
48 |
43 self.refreshButton = \ |
49 self.refreshButton = \ |
44 self.buttonBox.addButton(self.trUtf8("Refresh"), QDialogButtonBox.ActionRole) |
50 self.buttonBox.addButton(self.trUtf8("Refresh"), |
45 self.refreshButton.setToolTip(self.trUtf8("Press to refresh the status display")) |
51 QDialogButtonBox.ActionRole) |
|
52 self.refreshButton.setToolTip( |
|
53 self.trUtf8("Press to refresh the status display")) |
46 self.refreshButton.setEnabled(False) |
54 self.refreshButton.setEnabled(False) |
47 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
55 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
48 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
56 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
49 |
57 |
50 self.process = None |
58 self.process = None |
51 self.vcs = vcs |
59 self.vcs = vcs |
52 self.vcs.committed.connect(self.__committed) |
60 self.vcs.committed.connect(self.__committed) |
53 |
61 |
54 self.statusList.headerItem().setText(self.__lastColumn, "") |
62 self.statusList.headerItem().setText(self.__lastColumn, "") |
55 self.statusList.header().setSortIndicator(self.__pathColumn, Qt.AscendingOrder) |
63 self.statusList.header().setSortIndicator(self.__pathColumn, |
|
64 Qt.AscendingOrder) |
56 if self.vcs.versionStr < '1.5.0': |
65 if self.vcs.versionStr < '1.5.0': |
57 self.statusList.header().hideSection(self.__changelistColumn) |
66 self.statusList.header().hideSection(self.__changelistColumn) |
58 |
67 |
59 self.menuactions = [] |
68 self.menuactions = [] |
60 self.menu = QMenu() |
69 self.menu = QMenu() |
68 if self.vcs.versionStr >= '1.5.0': |
77 if self.vcs.versionStr >= '1.5.0': |
69 self.menu.addSeparator() |
78 self.menu.addSeparator() |
70 self.menuactions.append(self.menu.addAction( |
79 self.menuactions.append(self.menu.addAction( |
71 self.trUtf8("Add to Changelist"), self.__addToChangelist)) |
80 self.trUtf8("Add to Changelist"), self.__addToChangelist)) |
72 self.menuactions.append(self.menu.addAction( |
81 self.menuactions.append(self.menu.addAction( |
73 self.trUtf8("Remove from Changelist"), self.__removeFromChangelist)) |
82 self.trUtf8("Remove from Changelist"), |
|
83 self.__removeFromChangelist)) |
74 if self.vcs.versionStr >= '1.2.0': |
84 if self.vcs.versionStr >= '1.2.0': |
75 self.menu.addSeparator() |
85 self.menu.addSeparator() |
76 self.menuactions.append(self.menu.addAction(self.trUtf8("Lock"), |
86 self.menuactions.append(self.menu.addAction(self.trUtf8("Lock"), |
77 self.__lock)) |
87 self.__lock)) |
78 self.menuactions.append(self.menu.addAction(self.trUtf8("Unlock"), |
88 self.menuactions.append(self.menu.addAction(self.trUtf8("Unlock"), |
79 self.__unlock)) |
89 self.__unlock)) |
80 self.menuactions.append(self.menu.addAction(self.trUtf8("Break lock"), |
90 self.menuactions.append(self.menu.addAction( |
|
91 self.trUtf8("Break lock"), |
81 self.__breakLock)) |
92 self.__breakLock)) |
82 self.menuactions.append(self.menu.addAction(self.trUtf8("Steal lock"), |
93 self.menuactions.append(self.menu.addAction( |
|
94 self.trUtf8("Steal lock"), |
83 self.__stealLock)) |
95 self.__stealLock)) |
84 self.menu.addSeparator() |
96 self.menu.addSeparator() |
85 self.menuactions.append(self.menu.addAction(self.trUtf8("Adjust column sizes"), |
97 self.menuactions.append(self.menu.addAction( |
|
98 self.trUtf8("Adjust column sizes"), |
86 self.__resizeColumns)) |
99 self.__resizeColumns)) |
87 for act in self.menuactions: |
100 for act in self.menuactions: |
88 act.setEnabled(False) |
101 act.setEnabled(False) |
89 |
102 |
90 self.statusList.setContextMenuPolicy(Qt.CustomContextMenu) |
103 self.statusList.setContextMenuPolicy(Qt.CustomContextMenu) |
91 self.statusList.customContextMenuRequested.connect(self.__showContextMenu) |
104 self.statusList.customContextMenuRequested.connect( |
|
105 self.__showContextMenu) |
92 |
106 |
93 self.modifiedIndicators = [ |
107 self.modifiedIndicators = [ |
94 self.trUtf8('added'), |
108 self.trUtf8('added'), |
95 self.trUtf8('deleted'), |
109 self.trUtf8('deleted'), |
96 self.trUtf8('modified'), |
110 self.trUtf8('modified'), |
180 Private method to resize the list columns. |
195 Private method to resize the list columns. |
181 """ |
196 """ |
182 self.statusList.header().resizeSections(QHeaderView.ResizeToContents) |
197 self.statusList.header().resizeSections(QHeaderView.ResizeToContents) |
183 self.statusList.header().setStretchLastSection(True) |
198 self.statusList.header().setStretchLastSection(True) |
184 |
199 |
185 def __generateItem(self, status, propStatus, locked, history, switched, lockinfo, |
200 def __generateItem(self, status, propStatus, locked, history, switched, |
186 uptodate, revision, change, author, path): |
201 lockinfo, uptodate, revision, change, author, path): |
187 """ |
202 """ |
188 Private method to generate a status item in the status list. |
203 Private method to generate a status item in the status list. |
189 |
204 |
190 @param status status indicator (string) |
205 @param status status indicator (string) |
191 @param propStatus property status indicator (string) |
206 @param propStatus property status indicator (string) |
236 itm.setTextAlignment(8, Qt.AlignRight) |
251 itm.setTextAlignment(8, Qt.AlignRight) |
237 itm.setTextAlignment(9, Qt.AlignRight) |
252 itm.setTextAlignment(9, Qt.AlignRight) |
238 itm.setTextAlignment(10, Qt.AlignLeft) |
253 itm.setTextAlignment(10, Qt.AlignLeft) |
239 itm.setTextAlignment(11, Qt.AlignLeft) |
254 itm.setTextAlignment(11, Qt.AlignLeft) |
240 |
255 |
|
256 self.hidePropertyStatusColumn = self.hidePropertyStatusColumn and \ |
|
257 propStatus == " " |
|
258 self.hideLockColumns = self.hideLockColumns and \ |
|
259 locked == " " and lockinfo == " " |
|
260 self.hideUpToDateColumn = self.hideUpToDateColumn and uptodate == " " |
|
261 self.hideHistoryColumn = self.hideHistoryColumn and history == " " |
|
262 self.hideSwitchedColumn = self.hideSwitchedColumn and switched == " " |
|
263 |
241 def closeEvent(self, e): |
264 def closeEvent(self, e): |
242 """ |
265 """ |
243 Private slot implementing a close event handler. |
266 Private slot implementing a close event handler. |
244 |
267 |
245 @param e close event (QCloseEvent) |
268 @param e close event (QCloseEvent) |
334 self.process = None |
364 self.process = None |
335 |
365 |
336 self.statusList.doItemsLayout() |
366 self.statusList.doItemsLayout() |
337 self.__resort() |
367 self.__resort() |
338 self.__resizeColumns() |
368 self.__resizeColumns() |
339 self.statusList.setColumnHidden(self.__changelistColumn, not self.changelistFound) |
369 |
|
370 self.statusList.setColumnHidden(self.__changelistColumn, |
|
371 not self.changelistFound) |
|
372 self.statusList.setColumnHidden(self.__propStatusColumn, |
|
373 self.hidePropertyStatusColumn) |
|
374 self.statusList.setColumnHidden(self.__lockedColumn, |
|
375 self.hideLockColumns) |
|
376 self.statusList.setColumnHidden(self.__lockinfoColumn, |
|
377 self.hideLockColumns) |
|
378 self.statusList.setColumnHidden(self.__upToDateColumn, |
|
379 self.hideUpToDateColumn) |
|
380 self.statusList.setColumnHidden(self.__historyColumn, |
|
381 self.hideHistoryColumn) |
|
382 self.statusList.setColumnHidden(self.__switchedColumn, |
|
383 self.hideSwitchedColumn) |
340 |
384 |
341 def on_buttonBox_clicked(self, button): |
385 def on_buttonBox_clicked(self, button): |
342 """ |
386 """ |
343 Private slot called by a button of the button box clicked. |
387 Private slot called by a button of the button box clicked. |
344 |
388 |
379 rev = self.rx_status.cap(2) |
423 rev = self.rx_status.cap(2) |
380 change = self.rx_status.cap(3) |
424 change = self.rx_status.cap(3) |
381 author = self.rx_status.cap(4) |
425 author = self.rx_status.cap(4) |
382 path = self.rx_status.cap(5).strip() |
426 path = self.rx_status.cap(5).strip() |
383 |
427 |
384 self.__generateItem(flags[0], flags[1], flags[2], flags[3], flags[4], |
428 self.__generateItem(flags[0], flags[1], flags[2], flags[3], |
385 flags[5], flags[7], rev, change, author, path) |
429 flags[4], flags[5], flags[7], rev, |
|
430 change, author, path) |
386 elif self.rx_status2.exactMatch(s): |
431 elif self.rx_status2.exactMatch(s): |
387 flags = self.rx_status2.cap(1) |
432 flags = self.rx_status2.cap(1) |
388 path = self.rx_status2.cap(2).trimmed() |
433 path = self.rx_status2.cap(2).trimmed() |
389 |
434 |
390 self.__generateItem(flags[0], flags[1], flags[2], flags[3], flags[4], |
435 self.__generateItem(flags[0], flags[1], flags[2], flags[3], |
391 flags[5], flags[7], "", "", "", path) |
436 flags[4], flags[5], flags[7], "", "", |
|
437 "", path) |
392 elif self.rx_changelist.exactMatch(s): |
438 elif self.rx_changelist.exactMatch(s): |
393 self.currentChangelist = self.rx_changelist.cap(1) |
439 self.currentChangelist = self.rx_changelist.cap(1) |
394 self.changelistFound = True |
440 self.changelistFound = True |
395 |
441 |
396 def __readStderr(self): |
442 def __readStderr(self): |
557 |
606 |
558 def __lock(self): |
607 def __lock(self): |
559 """ |
608 """ |
560 Private slot to handle the Lock context menu entry. |
609 Private slot to handle the Lock context menu entry. |
561 """ |
610 """ |
562 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) \ |
611 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
563 for itm in self.__getLockActionItems(self.unlockedIndicators)] |
612 for itm in self.__getLockActionItems(self.unlockedIndicators)] |
564 if not names: |
613 if not names: |
565 E5MessageBox.information(self, |
614 E5MessageBox.information(self, |
566 self.trUtf8("Lock"), |
615 self.trUtf8("Lock"), |
567 self.trUtf8("""There are no unlocked files available/selected.""")) |
616 self.trUtf8("""There are no unlocked files""" |
|
617 """ available/selected.""")) |
568 return |
618 return |
569 |
619 |
570 self.vcs.svnLock(names, parent = self) |
620 self.vcs.svnLock(names, parent = self) |
571 self.on_refreshButton_clicked() |
621 self.on_refreshButton_clicked() |
572 |
622 |
573 def __unlock(self): |
623 def __unlock(self): |
574 """ |
624 """ |
575 Private slot to handle the Unlock context menu entry. |
625 Private slot to handle the Unlock context menu entry. |
576 """ |
626 """ |
577 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) \ |
627 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
578 for itm in self.__getLockActionItems(self.lockedIndicators)] |
628 for itm in self.__getLockActionItems(self.lockedIndicators)] |
579 if not names: |
629 if not names: |
580 E5MessageBox.information(self, |
630 E5MessageBox.information(self, |
581 self.trUtf8("Unlock"), |
631 self.trUtf8("Unlock"), |
582 self.trUtf8("""There are no locked files available/selected.""")) |
632 self.trUtf8("""There are no locked files""" |
|
633 """ available/selected.""")) |
583 return |
634 return |
584 |
635 |
585 self.vcs.svnUnlock(names, parent = self) |
636 self.vcs.svnUnlock(names, parent = self) |
586 self.on_refreshButton_clicked() |
637 self.on_refreshButton_clicked() |
587 |
638 |
588 def __breakLock(self): |
639 def __breakLock(self): |
589 """ |
640 """ |
590 Private slot to handle the Break Lock context menu entry. |
641 Private slot to handle the Break Lock context menu entry. |
591 """ |
642 """ |
592 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) \ |
643 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
593 for itm in self.__getLockActionItems(self.stealBreakLockIndicators)] |
644 for itm in self.__getLockActionItems( |
|
645 self.stealBreakLockIndicators)] |
594 if not names: |
646 if not names: |
595 E5MessageBox.information(self, |
647 E5MessageBox.information(self, |
596 self.trUtf8("Break Lock"), |
648 self.trUtf8("Break Lock"), |
597 self.trUtf8("""There are no locked files available/selected.""")) |
649 self.trUtf8("""There are no locked files""" |
|
650 """ available/selected.""")) |
598 return |
651 return |
599 |
652 |
600 self.vcs.svnUnlock(names, parent = self, breakIt = True) |
653 self.vcs.svnUnlock(names, parent = self, breakIt = True) |
601 self.on_refreshButton_clicked() |
654 self.on_refreshButton_clicked() |
602 |
655 |
603 def __stealLock(self): |
656 def __stealLock(self): |
604 """ |
657 """ |
605 Private slot to handle the Break Lock context menu entry. |
658 Private slot to handle the Break Lock context menu entry. |
606 """ |
659 """ |
607 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) \ |
660 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
608 for itm in self.__getLockActionItems(self.stealBreakLockIndicators)] |
661 for itm in self.__getLockActionItems( |
|
662 self.stealBreakLockIndicators)] |
609 if not names: |
663 if not names: |
610 E5MessageBox.information(self, |
664 E5MessageBox.information(self, |
611 self.trUtf8("Steal Lock"), |
665 self.trUtf8("Steal Lock"), |
612 self.trUtf8("""There are no locked files available/selected.""")) |
666 self.trUtf8("""There are no locked files""" |
|
667 """ available/selected.""")) |
613 return |
668 return |
614 |
669 |
615 self.vcs.svnLock(names, parent=self, stealIt=True) |
670 self.vcs.svnLock(names, parent=self, stealIt=True) |
616 self.on_refreshButton_clicked() |
671 self.on_refreshButton_clicked() |
617 |
672 |
618 def __addToChangelist(self): |
673 def __addToChangelist(self): |
619 """ |
674 """ |
620 Private slot to add entries to a changelist. |
675 Private slot to add entries to a changelist. |
621 """ |
676 """ |
622 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) \ |
677 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
623 for itm in self.__getNonChangelistItems()] |
678 for itm in self.__getNonChangelistItems()] |
624 if not names: |
679 if not names: |
625 E5MessageBox.information(self, |
680 E5MessageBox.information(self, |
626 self.trUtf8("Remove from Changelist"), |
681 self.trUtf8("Remove from Changelist"), |
627 self.trUtf8( |
682 self.trUtf8( |
635 |
690 |
636 def __removeFromChangelist(self): |
691 def __removeFromChangelist(self): |
637 """ |
692 """ |
638 Private slot to remove entries from their changelists. |
693 Private slot to remove entries from their changelists. |
639 """ |
694 """ |
640 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) \ |
695 names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
641 for itm in self.__getChangelistItems()] |
696 for itm in self.__getChangelistItems()] |
642 if not names: |
697 if not names: |
643 E5MessageBox.information(self, |
698 E5MessageBox.information(self, |
644 self.trUtf8("Remove from Changelist"), |
699 self.trUtf8("Remove from Changelist"), |
645 self.trUtf8( |
700 self.trUtf8( |
646 """There are no files available/selected belonging to a changelist.""" |
701 """There are no files available/selected belonging""" |
|
702 """ to a changelist.""" |
647 ) |
703 ) |
648 ) |
704 ) |
649 return |
705 return |
650 self.vcs.svnRemoveFromChangelist(names) |
706 self.vcs.svnRemoveFromChangelist(names) |
651 self.on_refreshButton_clicked() |
707 self.on_refreshButton_clicked() |