eric6/Plugins/VcsPlugins/vcsMercurial/HisteditExtension/HgHisteditPlanEditor.py

Tue, 10 Sep 2019 19:30:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 10 Sep 2019 19:30:07 +0200
changeset 7229
53054eb5b15a
parent 6942
2602857055c5
child 7360
9190402e4505
permissions
-rw-r--r--

Removed obsolete "from __future__ import ..." statements.

5283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
3 # Copyright (c) 2016 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
5283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to edit the history modification plan.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
5291
e93d14b48c34 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5283
diff changeset
10
5283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt5.QtCore import pyqtSlot, QCoreApplication
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QComboBox
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from E5Gui import E5MessageBox
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 from Ui_HgHisteditPlanEditor import Ui_HgHisteditPlanEditor
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import UI.PixmapCache
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 class HgHisteditPlanActionComboBox(QComboBox):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 Class implementing a combo box to select the action in the plan tree.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 def __init__(self, item, column):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 Constructor
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param item reference to the item
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type QTreeWidgetItem
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param column column number inside the tree widget item
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @type int
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 super(HgHisteditPlanActionComboBox, self).__init__()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 self.__item = item
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.__column = column
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.addItems(["pick", "drop", "mess", "fold", "roll", "edit"])
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 txt = self.__item.text(self.__column)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 index = self.findText(txt)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 if index > -1:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.setCurrentIndex(index)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.currentIndexChanged.connect(self.__changeItem)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @pyqtSlot(int)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 def __changeItem(self, index):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 Private slot to handle the selection of a plan action.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 This method sets the text of the associated item for the specified
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 cell in order to be able to retrieve it with a call of the text()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 method of the item.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 @param index index of the selected action
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 @type int
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.__item.setText(self.__column, self.currentText())
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.__item.treeWidget().setCurrentItem(self.__item)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 def showPopup(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 Public method to show the list of items of the combo box.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 This is reimplemented in order to set the associated item as the
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 current item of the tree widget.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__item.treeWidget().setCurrentItem(self.__item)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 super(HgHisteditPlanActionComboBox, self).showPopup()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 class HgHisteditPlanEditor(QDialog, Ui_HgHisteditPlanEditor):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 Class implementing a dialog to edit the history modification plan.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 def __init__(self, fileName, parent=None):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Constructor
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 @param fileName name of the file containing the history edit plan
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 to be edited
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 @type str
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 @param parent reference to the parent widget
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 @type QWidget
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 super(HgHisteditPlanEditor, self).__init__(parent)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.setupUi(self)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow.png"))
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png"))
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.planTreeWidget.headerItem().setText(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.planTreeWidget.columnCount(), "")
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 self.__fileName = fileName
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.__readFile()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 self.__updateButtons()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 def __readFile(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 Private method to read the file containing the edit plan and
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 populate the dialog.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 try:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 f = open(self.__fileName, "r")
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 txt = f.read()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 f.close()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 except (IOError, OSError) as err:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 E5MessageBox.critical(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self,
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 self.tr("Edit Plan"),
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 self.tr("""<p>The file <b>{0}</b> could not be read.</p>"""
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """<p>Reason: {1}</p>""").format(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 self.__fileName, str(err)))
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 self.on_buttonBox_rejected()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 return
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 infoLines = []
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 for line in txt.splitlines():
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 if line.startswith("#"):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 infoLines.append(line[1:].lstrip())
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 else:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.__createPlanItem(line)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.infoEdit.setPlainText("\n".join(infoLines))
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 self.__resizeSections()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 def __addActionCombo(self, item):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 Private method to add an edit action combo to an item.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 @param item reference to the tree widget item
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 @type QTreeWidgetItem
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 actionCombo = HgHisteditPlanActionComboBox(item, 0)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 self.planTreeWidget.setItemWidget(item, 0, actionCombo)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 item.setSizeHint(0, actionCombo.sizeHint())
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 def __createPlanItem(self, text):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 Private method to create an edit plan tree item.
5291
e93d14b48c34 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5283
diff changeset
144
e93d14b48c34 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5283
diff changeset
145 @param text line of text to be parsed
e93d14b48c34 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5283
diff changeset
146 @type str
5283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 if not text.lstrip():
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 return
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 parts = text.split(" ", 3)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 action = parts[0]
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 try:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 rev = int(parts[2])
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 if len(parts) > 3:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 summary = parts[3]
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 else:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 summary = ""
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 except ValueError:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 rev = -1
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 summary = " ".join(parts[2:])
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 if rev > -1:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 revision = "{0:>7}:{1}".format(rev, parts[1])
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 else:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 revision = parts[1]
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 itm = QTreeWidgetItem(self.planTreeWidget, [
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 action,
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 revision,
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 summary,
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 ])
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 self.__addActionCombo(itm)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 def __resizeSections(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 Private method to resize the tree widget sections.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 for column in range(self.planTreeWidget.columnCount()):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 self.planTreeWidget.resizeColumnToContents(column)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 self.planTreeWidget.header().setStretchLastSection(True)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 def __updateButtons(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 Private method to set the enabled state of the up and down buttons.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 if self.planTreeWidget.currentItem() is None:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.upButton.setEnabled(False)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 self.downButton.setEnabled(False)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 else:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 row = self.planTreeWidget.indexOfTopLevelItem(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 self.planTreeWidget.currentItem())
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 self.upButton.setEnabled(row > 0)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 self.downButton.setEnabled(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 row < self.planTreeWidget.topLevelItemCount() - 1)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 def on_planTreeWidget_currentItemChanged(self, current, previous):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 Private slot handling the change of the current edit plan item.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 @param current reference to the current edit plan item
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 @type QTreeWidgetItem
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 @param previous reference to the previous current edit plan item
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 @type QTreeWidgetItem
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 self.__updateButtons()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 @pyqtSlot()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 def on_upButton_clicked(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 Private slot to move the current entry up one line.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 row = self.planTreeWidget.indexOfTopLevelItem(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 self.planTreeWidget.currentItem())
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 if row > 0:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 targetRow = row - 1
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 itm = self.planTreeWidget.takeTopLevelItem(row)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 self.planTreeWidget.insertTopLevelItem(targetRow, itm)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 self.__addActionCombo(itm)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 self.planTreeWidget.setCurrentItem(itm)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 @pyqtSlot()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 def on_downButton_clicked(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 Private slot to move the current entry down one line.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 row = self.planTreeWidget.indexOfTopLevelItem(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 self.planTreeWidget.currentItem())
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 if row < self.planTreeWidget.topLevelItemCount() - 1:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 targetRow = row + 1
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 itm = self.planTreeWidget.takeTopLevelItem(row)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 self.planTreeWidget.insertTopLevelItem(targetRow, itm)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 self.__addActionCombo(itm)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 self.planTreeWidget.setCurrentItem(itm)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 @pyqtSlot()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 def on_buttonBox_accepted(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 Private slot called by the buttonBox accepted signal.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 text = self.__assembleEditPlan()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 try:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 f = open(self.__fileName, "w")
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 f.write(text)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 f.close()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 except (IOError, OSError) as err:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 E5MessageBox.critical(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 self,
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 self.tr("Edit Plan"),
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 self.tr("""<p>The file <b>{0}</b> could not be read.</p>"""
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 """<p>Reason: {1}</p>""").format(
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 self.__fileName, str(err)))
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 self.on_buttonBox_rejected()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 return
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 self.close()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 QCoreApplication.exit(0)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 @pyqtSlot()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 def on_buttonBox_rejected(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 Private slot called by the buttonBox rejected signal.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 self.close()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 QCoreApplication.exit(1)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 def __assembleEditPlan(self):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 Private method to assemble the edit plan into text suitable for the
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 histedit file.
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 @return assembled edit plan text
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 @rtype str
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 """
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 lines = []
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 for row in range(self.planTreeWidget.topLevelItemCount()):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 itm = self.planTreeWidget.topLevelItem(row)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 if ":" in itm.text(1):
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 rev, changeset = itm.text(1).split(":", 1)
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 rev = "{0} {1}".format(changeset.strip(), rev.strip())
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 else:
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 rev = itm.text(1).strip()
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 lines.append("{0} {1} {2}".format(itm.text(0).strip(), rev,
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 itm.text(2)))
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286
06423d65a2b8 Added support for the Mercurial histedit extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 return "\n".join(lines)

eric ide

mercurial