22 QTreeWidgetItem, |
22 QTreeWidgetItem, |
23 QLineEdit, |
23 QLineEdit, |
24 QInputDialog, |
24 QInputDialog, |
25 ) |
25 ) |
26 |
26 |
27 from EricWidgets.EricApplication import ericApp |
27 from eric7.EricWidgets.EricApplication import ericApp |
28 from EricWidgets import EricMessageBox |
28 from eric7.EricWidgets import EricMessageBox |
29 |
29 |
30 from Globals import strToQByteArray |
30 from eric7.Globals import strToQByteArray |
31 |
31 |
32 from .Ui_GitStatusDialog import Ui_GitStatusDialog |
32 from .Ui_GitStatusDialog import Ui_GitStatusDialog |
33 |
33 |
34 from .GitDiffHighlighter import GitDiffHighlighter |
34 from .GitDiffHighlighter import GitDiffHighlighter |
35 from .GitDiffGenerator import GitDiffGenerator |
35 from .GitDiffGenerator import GitDiffGenerator |
36 from .GitDiffParser import GitDiffParser |
36 from .GitDiffParser import GitDiffParser |
37 |
37 |
38 import Preferences |
38 from eric7 import Preferences, Utilities |
39 import UI.PixmapCache |
39 from eric7.EricGui import EricPixmapCache |
40 import Utilities |
|
41 |
40 |
42 |
41 |
43 class GitStatusDialog(QWidget, Ui_GitStatusDialog): |
42 class GitStatusDialog(QWidget, Ui_GitStatusDialog): |
44 """ |
43 """ |
45 Class implementing a dialog to show the output of the git status command |
44 Class implementing a dialog to show the output of the git status command |
102 self.lDiffEdit.customContextMenuRequested.connect(self.__showLDiffContextMenu) |
101 self.lDiffEdit.customContextMenuRequested.connect(self.__showLDiffContextMenu) |
103 self.rDiffEdit.customContextMenuRequested.connect(self.__showRDiffContextMenu) |
102 self.rDiffEdit.customContextMenuRequested.connect(self.__showRDiffContextMenu) |
104 |
103 |
105 self.__lDiffMenu = QMenu() |
104 self.__lDiffMenu = QMenu() |
106 self.__stageLinesAct = self.__lDiffMenu.addAction( |
105 self.__stageLinesAct = self.__lDiffMenu.addAction( |
107 UI.PixmapCache.getIcon("vcsAdd"), |
106 EricPixmapCache.getIcon("vcsAdd"), |
108 self.tr("Stage Selected Lines"), |
107 self.tr("Stage Selected Lines"), |
109 self.__stageHunkOrLines, |
108 self.__stageHunkOrLines, |
110 ) |
109 ) |
111 self.__revertLinesAct = self.__lDiffMenu.addAction( |
110 self.__revertLinesAct = self.__lDiffMenu.addAction( |
112 UI.PixmapCache.getIcon("vcsRevert"), |
111 EricPixmapCache.getIcon("vcsRevert"), |
113 self.tr("Revert Selected Lines"), |
112 self.tr("Revert Selected Lines"), |
114 self.__revertHunkOrLines, |
113 self.__revertHunkOrLines, |
115 ) |
114 ) |
116 self.__stageHunkAct = self.__lDiffMenu.addAction( |
115 self.__stageHunkAct = self.__lDiffMenu.addAction( |
117 UI.PixmapCache.getIcon("vcsAdd"), |
116 EricPixmapCache.getIcon("vcsAdd"), |
118 self.tr("Stage Hunk"), |
117 self.tr("Stage Hunk"), |
119 self.__stageHunkOrLines, |
118 self.__stageHunkOrLines, |
120 ) |
119 ) |
121 self.__revertHunkAct = self.__lDiffMenu.addAction( |
120 self.__revertHunkAct = self.__lDiffMenu.addAction( |
122 UI.PixmapCache.getIcon("vcsRevert"), |
121 EricPixmapCache.getIcon("vcsRevert"), |
123 self.tr("Revert Hunk"), |
122 self.tr("Revert Hunk"), |
124 self.__revertHunkOrLines, |
123 self.__revertHunkOrLines, |
125 ) |
124 ) |
126 |
125 |
127 self.__rDiffMenu = QMenu() |
126 self.__rDiffMenu = QMenu() |
128 self.__unstageLinesAct = self.__rDiffMenu.addAction( |
127 self.__unstageLinesAct = self.__rDiffMenu.addAction( |
129 UI.PixmapCache.getIcon("vcsRemove"), |
128 EricPixmapCache.getIcon("vcsRemove"), |
130 self.tr("Unstage Selected Lines"), |
129 self.tr("Unstage Selected Lines"), |
131 self.__unstageHunkOrLines, |
130 self.__unstageHunkOrLines, |
132 ) |
131 ) |
133 self.__unstageHunkAct = self.__rDiffMenu.addAction( |
132 self.__unstageHunkAct = self.__rDiffMenu.addAction( |
134 UI.PixmapCache.getIcon("vcsRemove"), |
133 EricPixmapCache.getIcon("vcsRemove"), |
135 self.tr("Unstage Hunk"), |
134 self.tr("Unstage Hunk"), |
136 self.__unstageHunkOrLines, |
135 self.__unstageHunkOrLines, |
137 ) |
136 ) |
138 |
137 |
139 self.lDiffHighlighter = GitDiffHighlighter(self.lDiffEdit.document()) |
138 self.lDiffHighlighter = GitDiffHighlighter(self.lDiffEdit.document()) |
276 act = self.__actionsMenu.addAction( |
275 act = self.__actionsMenu.addAction( |
277 self.tr("Adjust column sizes"), self.__resizeColumns |
276 self.tr("Adjust column sizes"), self.__resizeColumns |
278 ) |
277 ) |
279 act.setToolTip(self.tr("Adjusts the width of all columns to their contents")) |
278 act.setToolTip(self.tr("Adjusts the width of all columns to their contents")) |
280 |
279 |
281 self.actionsButton.setIcon(UI.PixmapCache.getIcon("actionsToolButton")) |
280 self.actionsButton.setIcon(EricPixmapCache.getIcon("actionsToolButton")) |
282 self.actionsButton.setMenu(self.__actionsMenu) |
281 self.actionsButton.setMenu(self.__actionsMenu) |
283 |
282 |
284 def closeEvent(self, e): |
283 def closeEvent(self, e): |
285 """ |
284 """ |
286 Protected slot implementing a close event handler. |
285 Protected slot implementing a close event handler. |
375 self.__statusFilters.append(statusIndexText) |
374 self.__statusFilters.append(statusIndexText) |
376 |
375 |
377 if status in self.ConflictStates: |
376 if status in self.ConflictStates: |
378 itm.setIcon( |
377 itm.setIcon( |
379 self.__statusWorkColumn, |
378 self.__statusWorkColumn, |
380 UI.PixmapCache.getIcon( |
379 EricPixmapCache.getIcon( |
381 os.path.join("VcsPlugins", "vcsGit", "icons", "conflict.svg") |
380 os.path.join("VcsPlugins", "vcsGit", "icons", "conflict.svg") |
382 ), |
381 ), |
383 ) |
382 ) |
384 itm.setData(0, self.ConflictRole, status in self.ConflictStates) |
383 itm.setData(0, self.ConflictRole, status in self.ConflictStates) |
385 |
384 |