26 import Preferences |
26 import Preferences |
27 |
27 |
28 from .ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \ |
28 from .ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \ |
29 ResourcesBrowserFlag, TranslationsBrowserFlag, InterfacesBrowserFlag, \ |
29 ResourcesBrowserFlag, TranslationsBrowserFlag, InterfacesBrowserFlag, \ |
30 OthersBrowserFlag, AllBrowsersFlag |
30 OthersBrowserFlag, AllBrowsersFlag |
|
31 |
31 |
32 |
32 class ProjectBrowser(E5TabWidget): |
33 class ProjectBrowser(E5TabWidget): |
33 """ |
34 """ |
34 Class implementing the project browser part of the eric5 UI. |
35 Class implementing the project browser part of the eric5 UI. |
35 |
36 |
39 the project interfaces (IDL) browser and a browser for stuff, |
40 the project interfaces (IDL) browser and a browser for stuff, |
40 that doesn't fit these categories. Optionally it contains an additional |
41 that doesn't fit these categories. Optionally it contains an additional |
41 tab with the file system browser. |
42 tab with the file system browser. |
42 """ |
43 """ |
43 |
44 |
44 def __init__(self, project, parent = None, embeddedBrowser = True): |
45 def __init__(self, project, parent=None, embeddedBrowser=True): |
45 """ |
46 """ |
46 Constructor |
47 Constructor |
47 |
48 |
48 @param project reference to the project object |
49 @param project reference to the project object |
49 @param parent parent widget (QWidget) |
50 @param parent parent widget (QWidget) |
58 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) |
59 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) |
59 |
60 |
60 self.vcsStatusIndicator = E5Led(self) |
61 self.vcsStatusIndicator = E5Led(self) |
61 self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner) |
62 self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner) |
62 self.vcsStatusColorNames = { |
63 self.vcsStatusColorNames = { |
63 "A" : "VcsAdded", |
64 "A": "VcsAdded", |
64 "M" : "VcsModified", |
65 "M": "VcsModified", |
65 "O" : "VcsRemoved", |
66 "O": "VcsRemoved", |
66 "R" : "VcsReplaced", |
67 "R": "VcsReplaced", |
67 "U" : "VcsUpdate", |
68 "U": "VcsUpdate", |
68 "Z" : "VcsConflict", |
69 "Z": "VcsConflict", |
69 } |
70 } |
70 self.vcsStatusText = { |
71 self.vcsStatusText = { |
71 " " : self.trUtf8("up to date"), |
72 " ": self.trUtf8("up to date"), |
72 "A" : self.trUtf8("files added"), |
73 "A": self.trUtf8("files added"), |
73 "M" : self.trUtf8("local modifications"), |
74 "M": self.trUtf8("local modifications"), |
74 "O" : self.trUtf8("files removed"), |
75 "O": self.trUtf8("files removed"), |
75 "R" : self.trUtf8("files replaced"), |
76 "R": self.trUtf8("files replaced"), |
76 "U" : self.trUtf8("update required"), |
77 "U": self.trUtf8("update required"), |
77 "Z" : self.trUtf8("conflict"), |
78 "Z": self.trUtf8("conflict"), |
78 } |
79 } |
79 self.__vcsStateChanged(" ") |
80 self.__vcsStateChanged(" ") |
80 |
81 |
81 # step 1: create all the individual browsers |
82 # step 1: create all the individual browsers |
82 # sources browser |
83 # sources browser |
164 index = self.addTab(self.psBrowser, |
165 index = self.addTab(self.psBrowser, |
165 UI.PixmapCache.getIcon("projectSources.png"), '') |
166 UI.PixmapCache.getIcon("projectSources.png"), '') |
166 self.setTabToolTip(index, self.psBrowser.windowTitle()) |
167 self.setTabToolTip(index, self.psBrowser.windowTitle()) |
167 |
168 |
168 if browserFlags & FormsBrowserFlag: |
169 if browserFlags & FormsBrowserFlag: |
169 index = self.addTab(self.pfBrowser, |
170 index = self.addTab(self.pfBrowser, |
170 UI.PixmapCache.getIcon("projectForms.png"), '') |
171 UI.PixmapCache.getIcon("projectForms.png"), '') |
171 self.setTabToolTip(index, self.pfBrowser.windowTitle()) |
172 self.setTabToolTip(index, self.pfBrowser.windowTitle()) |
172 |
173 |
173 if browserFlags & ResourcesBrowserFlag: |
174 if browserFlags & ResourcesBrowserFlag: |
174 index = self.addTab(self.prBrowser, |
175 index = self.addTab(self.prBrowser, |
175 UI.PixmapCache.getIcon("projectResources.png"), '') |
176 UI.PixmapCache.getIcon("projectResources.png"), '') |
176 self.setTabToolTip(index, self.prBrowser.windowTitle()) |
177 self.setTabToolTip(index, self.prBrowser.windowTitle()) |
177 |
178 |
178 if browserFlags & TranslationsBrowserFlag: |
179 if browserFlags & TranslationsBrowserFlag: |
179 index = self.addTab(self.ptBrowser, |
180 index = self.addTab(self.ptBrowser, |
180 UI.PixmapCache.getIcon("projectTranslations.png"), '') |
181 UI.PixmapCache.getIcon("projectTranslations.png"), '') |
181 self.setTabToolTip(index, self.ptBrowser.windowTitle()) |
182 self.setTabToolTip(index, self.ptBrowser.windowTitle()) |
182 |
183 |
183 if browserFlags & InterfacesBrowserFlag: |
184 if browserFlags & InterfacesBrowserFlag: |
184 index = self.addTab(self.piBrowser, |
185 index = self.addTab(self.piBrowser, |
185 UI.PixmapCache.getIcon("projectInterfaces.png"), '') |
186 UI.PixmapCache.getIcon("projectInterfaces.png"), '') |
186 self.setTabToolTip(index, self.piBrowser.windowTitle()) |
187 self.setTabToolTip(index, self.piBrowser.windowTitle()) |
187 |
188 |
188 if browserFlags & OthersBrowserFlag: |
189 if browserFlags & OthersBrowserFlag: |
189 index = self.addTab(self.poBrowser, |
190 index = self.addTab(self.poBrowser, |
190 UI.PixmapCache.getIcon("projectOthers.png"), '') |
191 UI.PixmapCache.getIcon("projectOthers.png"), '') |
191 self.setTabToolTip(index, self.poBrowser.windowTitle()) |
192 self.setTabToolTip(index, self.poBrowser.windowTitle()) |
192 |
193 |
193 if self.embeddedBrowser: |
194 if self.embeddedBrowser: |
194 index = self.addTab(self.fileBrowser, |
195 index = self.addTab(self.fileBrowser, |
195 UI.PixmapCache.getIcon("browser.png"), '') |
196 UI.PixmapCache.getIcon("browser.png"), '') |
196 self.setTabToolTip(index, self.fileBrowser.windowTitle()) |
197 self.setTabToolTip(index, self.fileBrowser.windowTitle()) |
197 |
198 |
198 QApplication.processEvents() |
199 QApplication.processEvents() |
199 |
200 |