684 self.codeDocumentationViewer.finalizeSetup() |
684 self.codeDocumentationViewer.finalizeSetup() |
685 |
685 |
686 # now activate the initial view profile |
686 # now activate the initial view profile |
687 splash.showMessage(self.tr("Setting View Profile...")) |
687 splash.showMessage(self.tr("Setting View Profile...")) |
688 self.__setEditProfile() |
688 self.__setEditProfile() |
|
689 |
|
690 # special treatment for the VCS toolbars |
|
691 for tb in self.getToolbarsByCategory("vcs"): |
|
692 tb.setVisible(False) |
|
693 tb.setEnabled(False) |
|
694 tb = self.getToolbar("vcs")[1] |
|
695 tb.setEnabled(True) |
|
696 if Preferences.getVCS("ShowVcsToolbar"): |
|
697 tb.setVisible(True) |
689 |
698 |
690 # now read the saved tasks |
699 # now read the saved tasks |
691 splash.showMessage(self.tr("Reading Tasks...")) |
700 splash.showMessage(self.tr("Reading Tasks...")) |
692 self.__readTasks() |
701 self.__readTasks() |
693 |
702 |
3296 unittesttb.hide() |
3305 unittesttb.hide() |
3297 pluginstb.hide() |
3306 pluginstb.hide() |
3298 |
3307 |
3299 # just add new toolbars to the end of the list |
3308 # just add new toolbars to the end of the list |
3300 self.__toolbars = {} |
3309 self.__toolbars = {} |
3301 self.__toolbars["file"] = [filetb.windowTitle(), filetb] |
3310 self.__toolbars["file"] = [filetb.windowTitle(), filetb, ""] |
3302 self.__toolbars["edit"] = [edittb.windowTitle(), edittb] |
3311 self.__toolbars["edit"] = [edittb.windowTitle(), edittb, ""] |
3303 self.__toolbars["search"] = [searchtb.windowTitle(), searchtb] |
3312 self.__toolbars["search"] = [searchtb.windowTitle(), searchtb, ""] |
3304 self.__toolbars["view"] = [viewtb.windowTitle(), viewtb] |
3313 self.__toolbars["view"] = [viewtb.windowTitle(), viewtb, ""] |
3305 self.__toolbars["start"] = [starttb.windowTitle(), starttb] |
3314 self.__toolbars["start"] = [starttb.windowTitle(), starttb, ""] |
3306 self.__toolbars["debug"] = [debugtb.windowTitle(), debugtb] |
3315 self.__toolbars["debug"] = [debugtb.windowTitle(), debugtb, ""] |
3307 self.__toolbars["project"] = [projecttb.windowTitle(), projecttb] |
3316 self.__toolbars["project"] = [projecttb.windowTitle(), projecttb, ""] |
3308 self.__toolbars["tools"] = [toolstb.windowTitle(), toolstb] |
3317 self.__toolbars["tools"] = [toolstb.windowTitle(), toolstb, ""] |
3309 self.__toolbars["help"] = [helptb.windowTitle(), helptb] |
3318 self.__toolbars["help"] = [helptb.windowTitle(), helptb, ""] |
3310 self.__toolbars["settings"] = [settingstb.windowTitle(), settingstb] |
3319 self.__toolbars["settings"] = [settingstb.windowTitle(), settingstb, |
3311 self.__toolbars["bookmarks"] = [bookmarktb.windowTitle(), bookmarktb] |
3320 ""] |
3312 self.__toolbars["unittest"] = [unittesttb.windowTitle(), unittesttb] |
3321 self.__toolbars["bookmarks"] = [bookmarktb.windowTitle(), bookmarktb, |
|
3322 ""] |
|
3323 self.__toolbars["unittest"] = [unittesttb.windowTitle(), unittesttb, |
|
3324 ""] |
3313 self.__toolbars["view_profiles"] = [profilestb.windowTitle(), |
3325 self.__toolbars["view_profiles"] = [profilestb.windowTitle(), |
3314 profilestb] |
3326 profilestb, ""] |
3315 self.__toolbars["plugins"] = [pluginstb.windowTitle(), pluginstb] |
3327 self.__toolbars["plugins"] = [pluginstb.windowTitle(), pluginstb, ""] |
3316 self.__toolbars["quicksearch"] = [quicksearchtb.windowTitle(), |
3328 self.__toolbars["quicksearch"] = [quicksearchtb.windowTitle(), |
3317 quicksearchtb] |
3329 quicksearchtb, ""] |
3318 self.__toolbars["multiproject"] = [multiprojecttb.windowTitle(), |
3330 self.__toolbars["multiproject"] = [multiprojecttb.windowTitle(), |
3319 multiprojecttb] |
3331 multiprojecttb, ""] |
3320 self.__toolbars["spelling"] = [spellingtb.windowTitle(), spellingtb] |
3332 self.__toolbars["spelling"] = [spellingtb.windowTitle(), spellingtb, |
3321 self.__toolbars["vcs"] = [vcstb.windowTitle(), vcstb] |
3333 ""] |
|
3334 self.__toolbars["vcs"] = [vcstb.windowTitle(), vcstb, "vcs"] |
3322 |
3335 |
3323 def __initDebugToolbarsLayout(self): |
3336 def __initDebugToolbarsLayout(self): |
3324 """ |
3337 """ |
3325 Private slot to initialize the toolbars layout for the debug profile. |
3338 Private slot to initialize the toolbars layout for the debug profile. |
3326 """ |
3339 """ |
3840 try: |
3853 try: |
3841 return self.__menus[name] |
3854 return self.__menus[name] |
3842 except KeyError: |
3855 except KeyError: |
3843 return None |
3856 return None |
3844 |
3857 |
3845 def registerToolbar(self, name, text, toolbar): |
3858 def registerToolbar(self, name, text, toolbar, category=""): |
3846 """ |
3859 """ |
3847 Public method to register a toolbar. |
3860 Public method to register a toolbar. |
3848 |
3861 |
3849 This method must be called in order to make a toolbar manageable by the |
3862 This method must be called in order to make a toolbar manageable by the |
3850 UserInterface object. |
3863 UserInterface object. |
3851 |
3864 |
3852 @param name name of the toolbar (string). This is used as the key into |
3865 @param name name of the toolbar. This is used as the key into |
3853 the dictionary of toolbar references. |
3866 the dictionary of toolbar references. |
3854 @param text user visible text for the toolbar entry (string) |
3867 @type str |
3855 @param toolbar reference to the toolbar to be registered (QToolBar) |
3868 @param text user visible text for the toolbar entry |
|
3869 @type str |
|
3870 @param toolbar reference to the toolbar to be registered |
|
3871 @type QToolBar |
|
3872 @param category toolbar category |
|
3873 @type str |
3856 @exception KeyError raised, if a toolbar with the given name was |
3874 @exception KeyError raised, if a toolbar with the given name was |
3857 already registered |
3875 already registered |
3858 """ |
3876 """ |
3859 if name in self.__toolbars: |
3877 if name in self.__toolbars: |
3860 raise KeyError("Toolbar '{0}' already registered.".format(name)) |
3878 raise KeyError("Toolbar '{0}' already registered.".format(name)) |
3861 |
3879 |
3862 self.__toolbars[name] = [text, toolbar] |
3880 self.__toolbars[name] = [text, toolbar, category] |
3863 |
3881 |
3864 def reregisterToolbar(self, name, text): |
3882 def reregisterToolbar(self, name, text, category=""): |
3865 """ |
3883 """ |
3866 Public method to change the visible text for the named toolbar. |
3884 Public method to change the visible text for the named toolbar. |
3867 |
3885 |
3868 @param name name of the toolbar to be changed (string) |
3886 @param name name of the toolbar to be changed |
3869 @param text new user visible text for the toolbar entry (string) |
3887 @type str |
|
3888 @param text new user visible text for the toolbar entry |
|
3889 @type str |
|
3890 @param category new toolbar category for the toolbar entry |
|
3891 @type str |
3870 """ |
3892 """ |
3871 if name in self.__toolbars: |
3893 if name in self.__toolbars: |
3872 self.__toolbars[name][0] = text |
3894 self.__toolbars[name][0] = text |
|
3895 self.__toolbars[name][2] = category |
3873 |
3896 |
3874 def unregisterToolbar(self, name): |
3897 def unregisterToolbar(self, name): |
3875 """ |
3898 """ |
3876 Public method to unregister a toolbar. |
3899 Public method to unregister a toolbar. |
3877 |
3900 |
3889 """ |
3912 """ |
3890 try: |
3913 try: |
3891 return self.__toolbars[name] |
3914 return self.__toolbars[name] |
3892 except KeyError: |
3915 except KeyError: |
3893 return None |
3916 return None |
3894 |
3917 |
|
3918 def getToolbarsByCategory(self, category): |
|
3919 """ |
|
3920 Public method to get a list of toolbars belonging to a given toolbar |
|
3921 category. |
|
3922 |
|
3923 @param category toolbar category |
|
3924 @type str |
|
3925 @return list of toolbars |
|
3926 @rtype list of QToolBar |
|
3927 """ |
|
3928 toolbars = [] |
|
3929 for tbName in self.__toolbars: |
|
3930 try: |
|
3931 if self.__toolbars[tbName][2] == category: |
|
3932 toolbars.append(self.__toolbars[tbName][1]) |
|
3933 except IndexError: |
|
3934 # backward compatibility; category is not yet supported |
|
3935 pass |
|
3936 |
|
3937 return toolbars |
|
3938 |
3895 def getLocale(self): |
3939 def getLocale(self): |
3896 """ |
3940 """ |
3897 Public method to get the locale of the IDE. |
3941 Public method to get the locale of the IDE. |
3898 |
3942 |
3899 @return locale of the IDE (string or None) |
3943 @return locale of the IDE (string or None) |
4108 |
4152 |
4109 @param menu reference to the menu to be populated (QMenu) |
4153 @param menu reference to the menu to be populated (QMenu) |
4110 """ |
4154 """ |
4111 menu.clear() |
4155 menu.clear() |
4112 |
4156 |
4113 for name, (text, tb) in sorted(self.__toolbars.items(), |
4157 for name, (text, tb, category) in sorted( |
4114 key=lambda t: t[1][0]): |
4158 self.__toolbars.items(), key=lambda t: t[1][0] |
|
4159 ): |
4115 act = menu.addAction(text) |
4160 act = menu.addAction(text) |
4116 act.setCheckable(True) |
4161 act.setCheckable(True) |
4117 act.setChecked(not tb.isHidden()) |
4162 act.setChecked(not tb.isHidden()) |
4118 act.setData(name) |
4163 act.setData(name) |
4119 menu.addSeparator() |
4164 menu.addSeparator() |
4149 @param act reference to the action that was triggered (QAction) |
4194 @param act reference to the action that was triggered (QAction) |
4150 """ |
4195 """ |
4151 name = act.data() |
4196 name = act.data() |
4152 if name: |
4197 if name: |
4153 if name == "__SHOW__": |
4198 if name == "__SHOW__": |
4154 for _text, tb in self.__toolbars.values(): |
4199 for _text, tb, category in self.__toolbars.values(): |
4155 tb.show() |
4200 tb.show() |
4156 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4201 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4157 self.__menus["toolbars"].hideTearOffMenu() |
4202 self.__menus["toolbars"].hideTearOffMenu() |
4158 elif name == "__HIDE__": |
4203 elif name == "__HIDE__": |
4159 for _text, tb in self.__toolbars.values(): |
4204 for _text, tb, category in self.__toolbars.values(): |
4160 tb.hide() |
4205 tb.hide() |
4161 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4206 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4162 self.__menus["toolbars"].hideTearOffMenu() |
4207 self.__menus["toolbars"].hideTearOffMenu() |
4163 else: |
4208 else: |
4164 tb = self.__toolbars[name][1] |
4209 tb = self.__toolbars[name][1] |
4165 if act.isChecked(): |
4210 if act.isChecked(): |
4166 tb.show() |
4211 tb.show() |
|
4212 tb.setEnabled(True) |
4167 else: |
4213 else: |
4168 tb.hide() |
4214 tb.hide() |
4169 |
4215 |
4170 def __TBPopupMenuTriggered(self, act): |
4216 def __TBPopupMenuTriggered(self, act): |
4171 """ |
4217 """ |
4175 @param act reference to the action that was triggered (QAction) |
4221 @param act reference to the action that was triggered (QAction) |
4176 """ |
4222 """ |
4177 name = act.data() |
4223 name = act.data() |
4178 if name: |
4224 if name: |
4179 if name == "__SHOW__": |
4225 if name == "__SHOW__": |
4180 for _text, tb in self.__toolbars.values(): |
4226 for _text, tb, category in self.__toolbars.values(): |
4181 tb.show() |
4227 tb.show() |
4182 elif name == "__HIDE__": |
4228 elif name == "__HIDE__": |
4183 for _text, tb in self.__toolbars.values(): |
4229 for _text, tb, category in self.__toolbars.values(): |
4184 tb.hide() |
4230 tb.hide() |
4185 else: |
4231 else: |
4186 tb = self.__toolbars[name][1] |
4232 tb = self.__toolbars[name][1] |
4187 if act.isChecked(): |
4233 if act.isChecked(): |
4188 tb.show() |
4234 tb.show() |
|
4235 tb.setEnabled(True) |
4189 else: |
4236 else: |
4190 tb.hide() |
4237 tb.hide() |
4191 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4238 if self.__menus["toolbars"].isTearOffMenuVisible(): |
4192 self.__menus["toolbars"].hideTearOffMenu() |
4239 self.__menus["toolbars"].hideTearOffMenu() |
4193 |
4240 |