9 |
9 |
10 from PyQt6.QtCore import Qt |
10 from PyQt6.QtCore import Qt |
11 from PyQt6.QtGui import QColor |
11 from PyQt6.QtGui import QColor |
12 from PyQt6.QtWidgets import QApplication |
12 from PyQt6.QtWidgets import QApplication |
13 |
13 |
14 from EricWidgets.EricTabWidget import EricTabWidget |
14 from eric7.EricWidgets.EricTabWidget import EricTabWidget |
15 from EricWidgets.EricLed import EricClickableLed |
15 from eric7.EricWidgets.EricLed import EricClickableLed |
16 |
16 |
17 import UI.PixmapCache |
17 from eric7.EricGui import EricPixmapCache |
18 import Preferences |
18 from eric7 import Preferences |
19 |
19 |
20 from .ProjectBrowserFlags import ( |
20 from .ProjectBrowserFlags import ( |
21 SourcesBrowserFlag, |
21 SourcesBrowserFlag, |
22 FormsBrowserFlag, |
22 FormsBrowserFlag, |
23 ResourcesBrowserFlag, |
23 ResourcesBrowserFlag, |
49 @param parent parent widget (QWidget) |
49 @param parent parent widget (QWidget) |
50 """ |
50 """ |
51 EricTabWidget.__init__(self, parent) |
51 EricTabWidget.__init__(self, parent) |
52 self.project = project |
52 self.project = project |
53 |
53 |
54 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
54 self.setWindowIcon(EricPixmapCache.getIcon("eric")) |
55 |
55 |
56 self.setUsesScrollButtons(True) |
56 self.setUsesScrollButtons(True) |
57 |
57 |
58 self.vcsStatusIndicator = EricClickableLed(self) |
58 self.vcsStatusIndicator = EricClickableLed(self) |
59 self.setCornerWidget(self.vcsStatusIndicator, Qt.Corner.TopLeftCorner) |
59 self.setCornerWidget(self.vcsStatusIndicator, Qt.Corner.TopLeftCorner) |
174 self.removeTab(0) |
174 self.removeTab(0) |
175 |
175 |
176 # step 2: add browsers |
176 # step 2: add browsers |
177 if browserFlags & SourcesBrowserFlag: |
177 if browserFlags & SourcesBrowserFlag: |
178 index = self.addTab( |
178 index = self.addTab( |
179 self.psBrowser, UI.PixmapCache.getIcon("projectSources"), "" |
179 self.psBrowser, EricPixmapCache.getIcon("projectSources"), "" |
180 ) |
180 ) |
181 self.setTabToolTip(index, self.psBrowser.windowTitle()) |
181 self.setTabToolTip(index, self.psBrowser.windowTitle()) |
182 |
182 |
183 if browserFlags & FormsBrowserFlag: |
183 if browserFlags & FormsBrowserFlag: |
184 index = self.addTab( |
184 index = self.addTab( |
185 self.pfBrowser, UI.PixmapCache.getIcon("projectForms"), "" |
185 self.pfBrowser, EricPixmapCache.getIcon("projectForms"), "" |
186 ) |
186 ) |
187 self.setTabToolTip(index, self.pfBrowser.windowTitle()) |
187 self.setTabToolTip(index, self.pfBrowser.windowTitle()) |
188 |
188 |
189 if browserFlags & ResourcesBrowserFlag: |
189 if browserFlags & ResourcesBrowserFlag: |
190 index = self.addTab( |
190 index = self.addTab( |
191 self.prBrowser, UI.PixmapCache.getIcon("projectResources"), "" |
191 self.prBrowser, EricPixmapCache.getIcon("projectResources"), "" |
192 ) |
192 ) |
193 self.setTabToolTip(index, self.prBrowser.windowTitle()) |
193 self.setTabToolTip(index, self.prBrowser.windowTitle()) |
194 |
194 |
195 if browserFlags & TranslationsBrowserFlag: |
195 if browserFlags & TranslationsBrowserFlag: |
196 index = self.addTab( |
196 index = self.addTab( |
197 self.ptBrowser, UI.PixmapCache.getIcon("projectTranslations"), "" |
197 self.ptBrowser, EricPixmapCache.getIcon("projectTranslations"), "" |
198 ) |
198 ) |
199 self.setTabToolTip(index, self.ptBrowser.windowTitle()) |
199 self.setTabToolTip(index, self.ptBrowser.windowTitle()) |
200 |
200 |
201 if browserFlags & InterfacesBrowserFlag: |
201 if browserFlags & InterfacesBrowserFlag: |
202 index = self.addTab( |
202 index = self.addTab( |
203 self.piBrowser, UI.PixmapCache.getIcon("projectInterfaces"), "" |
203 self.piBrowser, EricPixmapCache.getIcon("projectInterfaces"), "" |
204 ) |
204 ) |
205 self.setTabToolTip(index, self.piBrowser.windowTitle()) |
205 self.setTabToolTip(index, self.piBrowser.windowTitle()) |
206 |
206 |
207 if browserFlags & ProtocolsBrowserFlag: |
207 if browserFlags & ProtocolsBrowserFlag: |
208 index = self.addTab(self.ppBrowser, UI.PixmapCache.getIcon("protobuf"), "") |
208 index = self.addTab(self.ppBrowser, EricPixmapCache.getIcon("protobuf"), "") |
209 self.setTabToolTip(index, self.ppBrowser.windowTitle()) |
209 self.setTabToolTip(index, self.ppBrowser.windowTitle()) |
210 |
210 |
211 if browserFlags & OthersBrowserFlag: |
211 if browserFlags & OthersBrowserFlag: |
212 index = self.addTab( |
212 index = self.addTab( |
213 self.poBrowser, UI.PixmapCache.getIcon("projectOthers"), "" |
213 self.poBrowser, EricPixmapCache.getIcon("projectOthers"), "" |
214 ) |
214 ) |
215 self.setTabToolTip(index, self.poBrowser.windowTitle()) |
215 self.setTabToolTip(index, self.poBrowser.windowTitle()) |
216 |
216 |
217 QApplication.processEvents() |
217 QApplication.processEvents() |
218 |
218 |
274 def __setSourcesIcon(self): |
274 def __setSourcesIcon(self): |
275 """ |
275 """ |
276 Private method to set the right icon for the sources browser tab. |
276 Private method to set the right icon for the sources browser tab. |
277 """ |
277 """ |
278 if not self.project.isOpen(): |
278 if not self.project.isOpen(): |
279 icon = UI.PixmapCache.getIcon("projectSources") |
279 icon = EricPixmapCache.getIcon("projectSources") |
280 else: |
280 else: |
281 if self.project.getProjectLanguage() == "Python3": |
281 if self.project.getProjectLanguage() == "Python3": |
282 if self.project.isMixedLanguageProject(): |
282 if self.project.isMixedLanguageProject(): |
283 icon = UI.PixmapCache.getIcon("projectSourcesPyMixed") |
283 icon = EricPixmapCache.getIcon("projectSourcesPyMixed") |
284 else: |
284 else: |
285 icon = UI.PixmapCache.getIcon("projectSourcesPy") |
285 icon = EricPixmapCache.getIcon("projectSourcesPy") |
286 elif self.project.getProjectLanguage() == "MicroPython": |
286 elif self.project.getProjectLanguage() == "MicroPython": |
287 icon = UI.PixmapCache.getIcon("micropython") |
287 icon = EricPixmapCache.getIcon("micropython") |
288 elif self.project.getProjectLanguage() == "Ruby": |
288 elif self.project.getProjectLanguage() == "Ruby": |
289 if self.project.isMixedLanguageProject(): |
289 if self.project.isMixedLanguageProject(): |
290 icon = UI.PixmapCache.getIcon("projectSourcesRbMixed") |
290 icon = EricPixmapCache.getIcon("projectSourcesRbMixed") |
291 else: |
291 else: |
292 icon = UI.PixmapCache.getIcon("projectSourcesRb") |
292 icon = EricPixmapCache.getIcon("projectSourcesRb") |
293 elif self.project.getProjectLanguage() == "JavaScript": |
293 elif self.project.getProjectLanguage() == "JavaScript": |
294 icon = UI.PixmapCache.getIcon("projectSourcesJavaScript") |
294 icon = EricPixmapCache.getIcon("projectSourcesJavaScript") |
295 else: |
295 else: |
296 icon = UI.PixmapCache.getIcon("projectSources") |
296 icon = EricPixmapCache.getIcon("projectSources") |
297 self.setTabIcon(self.indexOf(self.psBrowser), icon) |
297 self.setTabIcon(self.indexOf(self.psBrowser), icon) |
298 |
298 |
299 def handleEditorChanged(self, fn): |
299 def handleEditorChanged(self, fn): |
300 """ |
300 """ |
301 Public slot to handle the editorChanged signal. |
301 Public slot to handle the editorChanged signal. |