13 from PyQt4.QtGui import QColor, QApplication |
13 from PyQt4.QtGui import QColor, QApplication |
14 |
14 |
15 from UI.Browser import Browser |
15 from UI.Browser import Browser |
16 |
16 |
17 from E5Gui.E5TabWidget import E5TabWidget |
17 from E5Gui.E5TabWidget import E5TabWidget |
18 from E5Gui.E5Led import E5Led |
18 from E5Gui.E5Led import E5ClickableLed |
19 |
19 |
20 import UI.PixmapCache |
20 import UI.PixmapCache |
21 import Preferences |
21 import Preferences |
22 |
22 |
23 from .ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \ |
23 from .ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \ |
52 |
52 |
53 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) |
53 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) |
54 |
54 |
55 self.setUsesScrollButtons(True) |
55 self.setUsesScrollButtons(True) |
56 |
56 |
57 self.vcsStatusIndicator = E5Led(self) |
57 self.vcsStatusIndicator = E5ClickableLed(self) |
58 self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner) |
58 self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner) |
|
59 self.vcsStatusIndicator.clicked.connect( |
|
60 self.__vcsStatusIndicatorClicked) |
59 self.vcsStatusColorNames = { |
61 self.vcsStatusColorNames = { |
60 "A": "VcsAdded", |
62 "A": "VcsAdded", |
61 "M": "VcsModified", |
63 "M": "VcsModified", |
62 "O": "VcsRemoved", |
64 "O": "VcsRemoved", |
63 "R": "VcsReplaced", |
65 "R": "VcsReplaced", |
64 "U": "VcsUpdate", |
66 "U": "VcsUpdate", |
65 "Z": "VcsConflict", |
67 "Z": "VcsConflict", |
66 } |
68 } |
67 self.vcsStatusText = { |
69 self.vcsStatusText = { |
68 " ": self.trUtf8("up to date"), |
70 " ": self.tr("up to date"), |
69 "A": self.trUtf8("files added"), |
71 "A": self.tr("files added"), |
70 "M": self.trUtf8("local modifications"), |
72 "M": self.tr("local modifications"), |
71 "O": self.trUtf8("files removed"), |
73 "O": self.tr("files removed"), |
72 "R": self.trUtf8("files replaced"), |
74 "R": self.tr("files replaced"), |
73 "U": self.trUtf8("update required"), |
75 "U": self.tr("update required"), |
74 "Z": self.trUtf8("conflict"), |
76 "Z": self.tr("conflict"), |
75 } |
77 } |
76 self.__vcsStateChanged(" ") |
78 self.__vcsStateChanged(" ") |
77 |
79 |
78 # step 1: create all the individual browsers |
80 # step 1: create all the individual browsers |
79 from .ProjectSourcesBrowser import ProjectSourcesBrowser |
81 from .ProjectSourcesBrowser import ProjectSourcesBrowser |
295 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": |
297 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": |
296 if self.project.pdata["MIXEDLANGUAGE"][0]: |
298 if self.project.pdata["MIXEDLANGUAGE"][0]: |
297 icon = UI.PixmapCache.getIcon("projectSourcesRbMixed.png") |
299 icon = UI.PixmapCache.getIcon("projectSourcesRbMixed.png") |
298 else: |
300 else: |
299 icon = UI.PixmapCache.getIcon("projectSourcesRb.png") |
301 icon = UI.PixmapCache.getIcon("projectSourcesRb.png") |
|
302 # TODO: add icon for JavaScript |
300 else: |
303 else: |
301 icon = UI.PixmapCache.getIcon("projectSources.png") |
304 icon = UI.PixmapCache.getIcon("projectSources.png") |
302 self.setTabIcon(self.indexOf(self.psBrowser), icon) |
305 self.setTabIcon(self.indexOf(self.psBrowser), icon) |
303 |
306 |
304 def handleEditorChanged(self, fn): |
307 def handleEditorChanged(self, fn): |
379 else: |
382 else: |
380 self.vcsStatusIndicator.setColor( |
383 self.vcsStatusIndicator.setColor( |
381 Preferences.getProjectBrowserColour( |
384 Preferences.getProjectBrowserColour( |
382 self.vcsStatusColorNames[state])) |
385 self.vcsStatusColorNames[state])) |
383 if state not in self.vcsStatusText: |
386 if state not in self.vcsStatusText: |
384 self.vcsStatusIndicator.setToolTip(self.trUtf8("unknown status")) |
387 self.vcsStatusIndicator.setToolTip(self.tr("unknown status")) |
385 else: |
388 else: |
386 self.vcsStatusIndicator.setToolTip(self.vcsStatusText[state]) |
389 self.vcsStatusIndicator.setToolTip(self.vcsStatusText[state]) |
|
390 |
|
391 def __vcsStatusIndicatorClicked(self, pos): |
|
392 """ |
|
393 Private slot to react upon clicks on the VCS indicator LED. |
|
394 |
|
395 @param pos position of the click (QPoint) |
|
396 """ |
|
397 vcs = self.project.getVcs() |
|
398 if vcs: |
|
399 if self.currentVcsStatus == " ": |
|
400 # call log browser dialog |
|
401 vcs.vcsLogBrowser(self.project.getProjectPath()) |
|
402 else: |
|
403 # call status dialog |
|
404 vcs.vcsStatus(self.project.getProjectPath()) |