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