UI/UserInterface.py

changeset 4078
0e14bef0b47b
parent 4021
195a471c327b
child 4079
a3319822d303
equal deleted inserted replaced
4077:3f1df0fca60a 4078:0e14bef0b47b
170 170
171 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") 171 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength")
172 self.locale = locale 172 self.locale = locale
173 self.__noOpenAtStartup = noOpenAtStartup 173 self.__noOpenAtStartup = noOpenAtStartup
174 174
175 self.layout, self.embeddedShell, self.embeddedFileBrowser = \ 175 self.layoutType, self.embeddedShell, self.embeddedFileBrowser = \
176 Preferences.getUILayout() 176 Preferences.getUILayout()
177 177
178 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled") 178 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled")
179 179
180 g = Preferences.getGeometry("MainGeometry") 180 g = Preferences.getGeometry("MainGeometry")
608 from .Previewer import Previewer 608 from .Previewer import Previewer
609 self.__previewer = Previewer(self.viewmanager, splitter) 609 self.__previewer = Previewer(self.viewmanager, splitter)
610 splitter.addWidget(self.__previewer) 610 splitter.addWidget(self.__previewer)
611 611
612 # Create layout with toolbox windows embedded in dock windows 612 # Create layout with toolbox windows embedded in dock windows
613 if self.layout == "Toolboxes": 613 if self.layoutType == "Toolboxes":
614 logging.debug("Creating toolboxes...") 614 logging.debug("Creating toolboxes...")
615 self.__createToolboxesLayout(debugServer) 615 self.__createToolboxesLayout(debugServer)
616 616
617 # Create layout with sidebar windows embedded in dock windows 617 # Create layout with sidebar windows embedded in dock windows
618 elif self.layout == "Sidebars": 618 elif self.layoutType == "Sidebars":
619 logging.debug("Creating sidebars...") 619 logging.debug("Creating sidebars...")
620 self.__createSidebarsLayout(debugServer) 620 self.__createSidebarsLayout(debugServer)
621 621
622 else: 622 else:
623 raise ValueError("Wrong layout type given ({0})".format( 623 raise ValueError("Wrong layout type given ({0})".format(
624 self.layout)) 624 self.layoutType))
625 logging.debug("Created Layout") 625 logging.debug("Created Layout")
626 626
627 def __createToolboxesLayout(self, debugServer): 627 def __createToolboxesLayout(self, debugServer):
628 """ 628 """
629 Private method to create the Toolboxes layout. 629 Private method to create the Toolboxes layout.
936 @param icon icon to be used (QIcon) 936 @param icon icon to be used (QIcon)
937 @param label label text to be shown (string) 937 @param label label text to be shown (string)
938 """ 938 """
939 assert side in [UserInterface.LeftSide, UserInterface.BottomSide] 939 assert side in [UserInterface.LeftSide, UserInterface.BottomSide]
940 940
941 if self.layout == "Toolboxes": 941 if self.layoutType == "Toolboxes":
942 if side == UserInterface.LeftSide: 942 if side == UserInterface.LeftSide:
943 self.lToolbox.addItem(widget, icon, label) 943 self.lToolbox.addItem(widget, icon, label)
944 elif side == UserInterface.BottomSide: 944 elif side == UserInterface.BottomSide:
945 self.hToolbox.addItem(widget, icon, label) 945 self.hToolbox.addItem(widget, icon, label)
946 elif side == UserInterface.RightSide: 946 elif side == UserInterface.RightSide:
947 self.rToolbox.addItem(widget, icon, label) 947 self.rToolbox.addItem(widget, icon, label)
948 elif self.layout == "Sidebars": 948 elif self.layoutType == "Sidebars":
949 if side == UserInterface.LeftSide: 949 if side == UserInterface.LeftSide:
950 self.leftSidebar.addTab(widget, icon, label) 950 self.leftSidebar.addTab(widget, icon, label)
951 elif side == UserInterface.BottomSide: 951 elif side == UserInterface.BottomSide:
952 self.bottomSidebar.addTab(widget, icon, label) 952 self.bottomSidebar.addTab(widget, icon, label)
953 elif side == UserInterface.RightSide: 953 elif side == UserInterface.RightSide:
957 """ 957 """
958 Public method to remove a widget added using addSideWidget(). 958 Public method to remove a widget added using addSideWidget().
959 959
960 @param widget reference to the widget to remove (QWidget) 960 @param widget reference to the widget to remove (QWidget)
961 """ 961 """
962 if self.layout == "Toolboxes": 962 if self.layoutType == "Toolboxes":
963 for container in [self.lToolbox, self.hToolbox, self.rToolbox]: 963 for container in [self.lToolbox, self.hToolbox, self.rToolbox]:
964 index = container.indexOf(widget) 964 index = container.indexOf(widget)
965 if index != -1: 965 if index != -1:
966 container.removeItem(index) 966 container.removeItem(index)
967 elif self.layout == "Sidebars": 967 elif self.layoutType == "Sidebars":
968 for container in [self.leftSidebar, self.bottomSidebar, 968 for container in [self.leftSidebar, self.bottomSidebar,
969 self.rightSidebar]: 969 self.rightSidebar]:
970 index = container.indexOf(widget) 970 index = container.indexOf(widget)
971 if index != -1: 971 if index != -1:
972 container.removeTab(index) 972 container.removeTab(index)
976 Public method to show a particular Log-Viewer tab. 976 Public method to show a particular Log-Viewer tab.
977 977
978 @param tabname string naming the tab to be shown (string) 978 @param tabname string naming the tab to be shown (string)
979 """ 979 """
980 if Preferences.getUI("LogViewerAutoRaise"): 980 if Preferences.getUI("LogViewerAutoRaise"):
981 if self.layout == "Toolboxes": 981 if self.layoutType == "Toolboxes":
982 self.hToolboxDock.show() 982 self.hToolboxDock.show()
983 self.hToolbox.setCurrentWidget(self.logViewer) 983 self.hToolbox.setCurrentWidget(self.logViewer)
984 self.hToolboxDock.raise_() 984 self.hToolboxDock.raise_()
985 elif self.layout == "Sidebars": 985 elif self.layoutType == "Sidebars":
986 self.bottomSidebar.show() 986 self.bottomSidebar.show()
987 self.bottomSidebar.setCurrentWidget(self.logViewer) 987 self.bottomSidebar.setCurrentWidget(self.logViewer)
988 self.bottomSidebar.raise_() 988 self.bottomSidebar.raise_()
989 if self.bottomSidebar.isAutoHiding(): 989 if self.bottomSidebar.isAutoHiding():
990 self.bottomSidebar.setFocus() 990 self.bottomSidebar.setFocus()
3400 self.__menus["window"].clear() 3400 self.__menus["window"].clear()
3401 3401
3402 self.__menus["window"].addActions(self.viewProfileActGrp.actions()) 3402 self.__menus["window"].addActions(self.viewProfileActGrp.actions())
3403 self.__menus["window"].addSeparator() 3403 self.__menus["window"].addSeparator()
3404 3404
3405 if self.layout == "Toolboxes": 3405 if self.layoutType == "Toolboxes":
3406 self.__menus["window"].addAction(self.ltAct) 3406 self.__menus["window"].addAction(self.ltAct)
3407 self.ltAct.setChecked(not self.lToolboxDock.isHidden()) 3407 self.ltAct.setChecked(not self.lToolboxDock.isHidden())
3408 self.__menus["window"].addAction(self.rtAct) 3408 self.__menus["window"].addAction(self.rtAct)
3409 self.rtAct.setChecked(not self.lToolboxDock.isHidden()) 3409 self.rtAct.setChecked(not self.lToolboxDock.isHidden())
3410 self.__menus["window"].addAction(self.htAct) 3410 self.__menus["window"].addAction(self.htAct)
3411 self.htAct.setChecked(not self.hToolboxDock.isHidden()) 3411 self.htAct.setChecked(not self.hToolboxDock.isHidden())
3412 elif self.layout == "Sidebars": 3412 elif self.layoutType == "Sidebars":
3413 self.__menus["window"].addAction(self.lsbAct) 3413 self.__menus["window"].addAction(self.lsbAct)
3414 self.lsbAct.setChecked(not self.leftSidebar.isHidden()) 3414 self.lsbAct.setChecked(not self.leftSidebar.isHidden())
3415 self.__menus["window"].addAction(self.rsbAct) 3415 self.__menus["window"].addAction(self.rsbAct)
3416 self.rsbAct.setChecked(not self.rightSidebar.isHidden()) 3416 self.rsbAct.setChecked(not self.rightSidebar.isHidden())
3417 self.__menus["window"].addAction(self.bsbAct) 3417 self.__menus["window"].addAction(self.bsbAct)
3490 @param save flag indicating that the current profile should 3490 @param save flag indicating that the current profile should
3491 be saved (boolean) 3491 be saved (boolean)
3492 """ 3492 """
3493 if self.currentProfile and save: 3493 if self.currentProfile and save:
3494 # step 1: save the window geometries of the active profile 3494 # step 1: save the window geometries of the active profile
3495 if self.layout in ["Toolboxes", "Sidebars"]: 3495 if self.layoutType in ["Toolboxes", "Sidebars"]:
3496 state = self.saveState() 3496 state = self.saveState()
3497 self.profiles[self.currentProfile][0] = state 3497 self.profiles[self.currentProfile][0] = state
3498 if self.layout == "Sidebars": 3498 if self.layoutType == "Sidebars":
3499 state = self.leftSplitter.saveState() 3499 state = self.leftSplitter.saveState()
3500 self.profiles[self.currentProfile][2][0] = state 3500 self.profiles[self.currentProfile][2][0] = state
3501 state = self.verticalSplitter.saveState() 3501 state = self.verticalSplitter.saveState()
3502 self.profiles[self.currentProfile][2][1] = state 3502 self.profiles[self.currentProfile][2][1] = state
3503 state = self.leftSidebar.saveState() 3503 state = self.leftSidebar.saveState()
3507 state = self.rightSplitter.saveState() 3507 state = self.rightSplitter.saveState()
3508 self.profiles[self.currentProfile][2][4] = state 3508 self.profiles[self.currentProfile][2][4] = state
3509 state = self.rightSidebar.saveState() 3509 state = self.rightSidebar.saveState()
3510 self.profiles[self.currentProfile][2][5] = state 3510 self.profiles[self.currentProfile][2][5] = state
3511 # step 2: save the visibility of the windows of the active profile 3511 # step 2: save the visibility of the windows of the active profile
3512 if self.layout == "Toolboxes": 3512 if self.layoutType == "Toolboxes":
3513 self.profiles[self.currentProfile][1][0] = \ 3513 self.profiles[self.currentProfile][1][0] = \
3514 self.lToolboxDock.isVisible() 3514 self.lToolboxDock.isVisible()
3515 self.profiles[self.currentProfile][1][1] = \ 3515 self.profiles[self.currentProfile][1][1] = \
3516 self.hToolboxDock.isVisible() 3516 self.hToolboxDock.isVisible()
3517 self.profiles[self.currentProfile][1][2] = \ 3517 self.profiles[self.currentProfile][1][2] = \
3518 self.rToolboxDock.isVisible() 3518 self.rToolboxDock.isVisible()
3519 elif self.layout == "Sidebars": 3519 elif self.layoutType == "Sidebars":
3520 self.profiles[self.currentProfile][1][0] = \ 3520 self.profiles[self.currentProfile][1][0] = \
3521 self.leftSidebar.isVisible() 3521 self.leftSidebar.isVisible()
3522 self.profiles[self.currentProfile][1][1] = \ 3522 self.profiles[self.currentProfile][1][1] = \
3523 self.bottomSidebar.isVisible() 3523 self.bottomSidebar.isVisible()
3524 self.profiles[self.currentProfile][1][2] = \ 3524 self.profiles[self.currentProfile][1][2] = \
3536 if self.currentProfile != name or not save: 3536 if self.currentProfile != name or not save:
3537 # step 1: save the active profile 3537 # step 1: save the active profile
3538 self.__saveCurrentViewProfile(save) 3538 self.__saveCurrentViewProfile(save)
3539 3539
3540 # step 2: set the window geometries of the new profile 3540 # step 2: set the window geometries of the new profile
3541 if self.layout in ["Toolboxes", "Sidebars"]: 3541 if self.layoutType in ["Toolboxes", "Sidebars"]:
3542 state = self.profiles[name][0] 3542 state = self.profiles[name][0]
3543 if not state.isEmpty(): 3543 if not state.isEmpty():
3544 self.restoreState(state) 3544 self.restoreState(state)
3545 if self.layout == "Sidebars": 3545 if self.layoutType == "Sidebars":
3546 state = self.profiles[name][2][0] 3546 state = self.profiles[name][2][0]
3547 if not state.isEmpty(): 3547 if not state.isEmpty():
3548 self.leftSplitter.restoreState(state) 3548 self.leftSplitter.restoreState(state)
3549 state = self.profiles[name][2][1] 3549 state = self.profiles[name][2][1]
3550 if not state.isEmpty(): 3550 if not state.isEmpty():
3562 if not state.isEmpty(): 3562 if not state.isEmpty():
3563 self.rightSidebar.restoreState(state) 3563 self.rightSidebar.restoreState(state)
3564 self.__configureDockareaCornerUsage() 3564 self.__configureDockareaCornerUsage()
3565 3565
3566 # step 3: activate the windows of the new profile 3566 # step 3: activate the windows of the new profile
3567 if self.layout == "Toolboxes": 3567 if self.layoutType == "Toolboxes":
3568 self.lToolboxDock.setVisible(self.profiles[name][1][0]) 3568 self.lToolboxDock.setVisible(self.profiles[name][1][0])
3569 self.hToolboxDock.setVisible(self.profiles[name][1][1]) 3569 self.hToolboxDock.setVisible(self.profiles[name][1][1])
3570 self.rToolboxDock.setVisible(self.profiles[name][1][2]) 3570 self.rToolboxDock.setVisible(self.profiles[name][1][2])
3571 elif self.layout == "Sidebars": 3571 elif self.layoutType == "Sidebars":
3572 self.leftSidebar.setVisible(self.profiles[name][1][0]) 3572 self.leftSidebar.setVisible(self.profiles[name][1][0])
3573 self.bottomSidebar.setVisible(self.profiles[name][1][1]) 3573 self.bottomSidebar.setVisible(self.profiles[name][1][1])
3574 self.rightSidebar.setVisible(self.profiles[name][1][2]) 3574 self.rightSidebar.setVisible(self.profiles[name][1][2])
3575 3575
3576 # step 4: remember the new profile 3576 # step 4: remember the new profile
3589 def __debuggingStarted(self): 3589 def __debuggingStarted(self):
3590 """ 3590 """
3591 Private slot to handle the start of a debugging session. 3591 Private slot to handle the start of a debugging session.
3592 """ 3592 """
3593 self.setDebugProfile() 3593 self.setDebugProfile()
3594 if self.layout == "Toolboxes": 3594 if self.layoutType == "Toolboxes":
3595 self.__currentRightWidget = self.rToolbox.currentWidget() 3595 self.__currentRightWidget = self.rToolbox.currentWidget()
3596 self.rToolbox.setCurrentWidget(self.debugViewer) 3596 self.rToolbox.setCurrentWidget(self.debugViewer)
3597 if not self.embeddedShell: 3597 if not self.embeddedShell:
3598 self.__currentBottomWidget = self.hToolbox.currentWidget() 3598 self.__currentBottomWidget = self.hToolbox.currentWidget()
3599 self.hToolbox.setCurrentWidget(self.shellAssembly) 3599 self.hToolbox.setCurrentWidget(self.shellAssembly)
3600 elif self.layout == "Sidebars": 3600 elif self.layoutType == "Sidebars":
3601 self.__currentRightWidget = self.rightSidebar.currentWidget() 3601 self.__currentRightWidget = self.rightSidebar.currentWidget()
3602 self.rightSidebar.setCurrentWidget(self.debugViewer) 3602 self.rightSidebar.setCurrentWidget(self.debugViewer)
3603 if not self.embeddedShell: 3603 if not self.embeddedShell:
3604 self.__currentBottomWidget = self.bottomSidebar.currentWidget() 3604 self.__currentBottomWidget = self.bottomSidebar.currentWidget()
3605 self.bottomSidebar.setCurrentWidget(self.shellAssembly) 3605 self.bottomSidebar.setCurrentWidget(self.shellAssembly)
3607 def __debuggingDone(self): 3607 def __debuggingDone(self):
3608 """ 3608 """
3609 Private slot to handle the end of a debugging session. 3609 Private slot to handle the end of a debugging session.
3610 """ 3610 """
3611 self.__setEditProfile() 3611 self.__setEditProfile()
3612 if self.layout == "Toolboxes": 3612 if self.layoutType == "Toolboxes":
3613 if self.__currentRightWidget: 3613 if self.__currentRightWidget:
3614 self.rToolbox.setCurrentWidget(self.__currentRightWidget) 3614 self.rToolbox.setCurrentWidget(self.__currentRightWidget)
3615 if self.__currentBottomWidget: 3615 if self.__currentBottomWidget:
3616 self.hToolbox.setCurrentWidget(self.__currentBottomWidget) 3616 self.hToolbox.setCurrentWidget(self.__currentBottomWidget)
3617 elif self.layout == "Sidebars": 3617 elif self.layoutType == "Sidebars":
3618 if self.__currentRightWidget: 3618 if self.__currentRightWidget:
3619 self.rightSidebar.setCurrentWidget(self.__currentRightWidget) 3619 self.rightSidebar.setCurrentWidget(self.__currentRightWidget)
3620 if self.__currentBottomWidget: 3620 if self.__currentBottomWidget:
3621 self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget) 3621 self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget)
3622 self.__currentRightWidget = None 3622 self.__currentRightWidget = None
3657 3657
3658 def __activateProjectBrowser(self): 3658 def __activateProjectBrowser(self):
3659 """ 3659 """
3660 Private slot to handle the activation of the project browser. 3660 Private slot to handle the activation of the project browser.
3661 """ 3661 """
3662 if self.layout == "Toolboxes": 3662 if self.layoutType == "Toolboxes":
3663 self.lToolboxDock.show() 3663 self.lToolboxDock.show()
3664 self.lToolbox.setCurrentWidget(self.projectBrowser) 3664 self.lToolbox.setCurrentWidget(self.projectBrowser)
3665 elif self.layout == "Sidebars": 3665 elif self.layoutType == "Sidebars":
3666 self.leftSidebar.show() 3666 self.leftSidebar.show()
3667 self.leftSidebar.setCurrentWidget(self.projectBrowser) 3667 self.leftSidebar.setCurrentWidget(self.projectBrowser)
3668 else: 3668 else:
3669 self.projectBrowser.show() 3669 self.projectBrowser.show()
3670 self.projectBrowser.currentWidget().setFocus( 3670 self.projectBrowser.currentWidget().setFocus(
3672 3672
3673 def __activateMultiProjectBrowser(self): 3673 def __activateMultiProjectBrowser(self):
3674 """ 3674 """
3675 Private slot to handle the activation of the project browser. 3675 Private slot to handle the activation of the project browser.
3676 """ 3676 """
3677 if self.layout == "Toolboxes": 3677 if self.layoutType == "Toolboxes":
3678 self.lToolboxDock.show() 3678 self.lToolboxDock.show()
3679 self.lToolbox.setCurrentWidget(self.multiProjectBrowser) 3679 self.lToolbox.setCurrentWidget(self.multiProjectBrowser)
3680 elif self.layout == "Sidebars": 3680 elif self.layoutType == "Sidebars":
3681 self.leftSidebar.show() 3681 self.leftSidebar.show()
3682 self.leftSidebar.setCurrentWidget(self.multiProjectBrowser) 3682 self.leftSidebar.setCurrentWidget(self.multiProjectBrowser)
3683 else: 3683 else:
3684 self.multiProjectBrowser.show() 3684 self.multiProjectBrowser.show()
3685 self.multiProjectBrowser.setFocus(Qt.ActiveWindowFocusReason) 3685 self.multiProjectBrowser.setFocus(Qt.ActiveWindowFocusReason)
3686 3686
3687 def __activateDebugViewer(self): 3687 def __activateDebugViewer(self):
3688 """ 3688 """
3689 Private slot to handle the activation of the debug viewer. 3689 Private slot to handle the activation of the debug viewer.
3690 """ 3690 """
3691 if self.layout == "Toolboxes": 3691 if self.layoutType == "Toolboxes":
3692 self.rToolboxDock.show() 3692 self.rToolboxDock.show()
3693 self.rToolbox.setCurrentWidget(self.debugViewer) 3693 self.rToolbox.setCurrentWidget(self.debugViewer)
3694 elif self.layout == "Sidebars": 3694 elif self.layoutType == "Sidebars":
3695 self.rightSidebar.show() 3695 self.rightSidebar.show()
3696 self.rightSidebar.setCurrentWidget(self.debugViewer) 3696 self.rightSidebar.setCurrentWidget(self.debugViewer)
3697 else: 3697 else:
3698 self.debugViewer.show() 3698 self.debugViewer.show()
3699 self.debugViewer.currentWidget().setFocus(Qt.ActiveWindowFocusReason) 3699 self.debugViewer.currentWidget().setFocus(Qt.ActiveWindowFocusReason)
3701 def __activateShell(self): 3701 def __activateShell(self):
3702 """ 3702 """
3703 Private slot to handle the activation of the Shell window. 3703 Private slot to handle the activation of the Shell window.
3704 """ 3704 """
3705 if self.embeddedShell: # embedded in debug browser 3705 if self.embeddedShell: # embedded in debug browser
3706 if self.layout == "Toolboxes": 3706 if self.layoutType == "Toolboxes":
3707 self.rToolboxDock.show() 3707 self.rToolboxDock.show()
3708 self.rToolbox.setCurrentWidget(self.debugViewer) 3708 self.rToolbox.setCurrentWidget(self.debugViewer)
3709 elif self.layout == "Sidebars": 3709 elif self.layoutType == "Sidebars":
3710 self.rightSidebar.show() 3710 self.rightSidebar.show()
3711 self.rightSidebar.setCurrentWidget(self.debugViewer) 3711 self.rightSidebar.setCurrentWidget(self.debugViewer)
3712 else: 3712 else:
3713 self.debugViewer.show() 3713 self.debugViewer.show()
3714 self.debugViewer.setCurrentWidget(self.shellAssembly) 3714 self.debugViewer.setCurrentWidget(self.shellAssembly)
3715 else: # separate window 3715 else: # separate window
3716 if self.layout == "Toolboxes": 3716 if self.layoutType == "Toolboxes":
3717 self.hToolboxDock.show() 3717 self.hToolboxDock.show()
3718 self.hToolbox.setCurrentWidget(self.shellAssembly) 3718 self.hToolbox.setCurrentWidget(self.shellAssembly)
3719 elif self.layout == "Sidebars": 3719 elif self.layoutType == "Sidebars":
3720 self.bottomSidebar.show() 3720 self.bottomSidebar.show()
3721 self.bottomSidebar.setCurrentWidget(self.shellAssembly) 3721 self.bottomSidebar.setCurrentWidget(self.shellAssembly)
3722 else: 3722 else:
3723 self.shell.show() 3723 self.shell.show()
3724 self.shell.setFocus(Qt.ActiveWindowFocusReason) 3724 self.shell.setFocus(Qt.ActiveWindowFocusReason)
3725 3725
3726 def __activateLogViewer(self): 3726 def __activateLogViewer(self):
3727 """ 3727 """
3728 Private slot to handle the activation of the Log Viewer. 3728 Private slot to handle the activation of the Log Viewer.
3729 """ 3729 """
3730 if self.layout == "Toolboxes": 3730 if self.layoutType == "Toolboxes":
3731 self.hToolboxDock.show() 3731 self.hToolboxDock.show()
3732 self.hToolbox.setCurrentWidget(self.logViewer) 3732 self.hToolbox.setCurrentWidget(self.logViewer)
3733 elif self.layout == "Sidebars": 3733 elif self.layoutType == "Sidebars":
3734 self.bottomSidebar.show() 3734 self.bottomSidebar.show()
3735 self.bottomSidebar.setCurrentWidget(self.logViewer) 3735 self.bottomSidebar.setCurrentWidget(self.logViewer)
3736 else: 3736 else:
3737 self.logViewer.show() 3737 self.logViewer.show()
3738 self.logViewer.setFocus(Qt.ActiveWindowFocusReason) 3738 self.logViewer.setFocus(Qt.ActiveWindowFocusReason)
3739 3739
3740 def __activateTaskViewer(self): 3740 def __activateTaskViewer(self):
3741 """ 3741 """
3742 Private slot to handle the activation of the Task Viewer. 3742 Private slot to handle the activation of the Task Viewer.
3743 """ 3743 """
3744 if self.layout == "Toolboxes": 3744 if self.layoutType == "Toolboxes":
3745 self.hToolboxDock.show() 3745 self.hToolboxDock.show()
3746 self.hToolbox.setCurrentWidget(self.taskViewer) 3746 self.hToolbox.setCurrentWidget(self.taskViewer)
3747 elif self.layout == "Sidebars": 3747 elif self.layoutType == "Sidebars":
3748 self.bottomSidebar.show() 3748 self.bottomSidebar.show()
3749 self.bottomSidebar.setCurrentWidget(self.taskViewer) 3749 self.bottomSidebar.setCurrentWidget(self.taskViewer)
3750 else: 3750 else:
3751 self.taskViewer.show() 3751 self.taskViewer.show()
3752 self.taskViewer.setFocus(Qt.ActiveWindowFocusReason) 3752 self.taskViewer.setFocus(Qt.ActiveWindowFocusReason)
3753 3753
3754 def __activateTemplateViewer(self): 3754 def __activateTemplateViewer(self):
3755 """ 3755 """
3756 Private slot to handle the activation of the Template Viewer. 3756 Private slot to handle the activation of the Template Viewer.
3757 """ 3757 """
3758 if self.layout == "Toolboxes": 3758 if self.layoutType == "Toolboxes":
3759 self.lToolboxDock.show() 3759 self.lToolboxDock.show()
3760 self.lToolbox.setCurrentWidget(self.templateViewer) 3760 self.lToolbox.setCurrentWidget(self.templateViewer)
3761 elif self.layout == "Sidebars": 3761 elif self.layoutType == "Sidebars":
3762 self.leftSidebar.show() 3762 self.leftSidebar.show()
3763 self.leftSidebar.setCurrentWidget(self.templateViewer) 3763 self.leftSidebar.setCurrentWidget(self.templateViewer)
3764 else: 3764 else:
3765 self.templateViewer.show() 3765 self.templateViewer.show()
3766 self.templateViewer.setFocus(Qt.ActiveWindowFocusReason) 3766 self.templateViewer.setFocus(Qt.ActiveWindowFocusReason)
3768 def __activateBrowser(self): 3768 def __activateBrowser(self):
3769 """ 3769 """
3770 Private slot to handle the activation of the file browser. 3770 Private slot to handle the activation of the file browser.
3771 """ 3771 """
3772 if self.embeddedFileBrowser == 0: # separate window 3772 if self.embeddedFileBrowser == 0: # separate window
3773 if self.layout == "Toolboxes": 3773 if self.layoutType == "Toolboxes":
3774 self.lToolboxDock.show() 3774 self.lToolboxDock.show()
3775 self.lToolbox.setCurrentWidget(self.browser) 3775 self.lToolbox.setCurrentWidget(self.browser)
3776 elif self.layout == "Sidebars": 3776 elif self.layoutType == "Sidebars":
3777 self.leftSidebar.show() 3777 self.leftSidebar.show()
3778 self.leftSidebar.setCurrentWidget(self.browser) 3778 self.leftSidebar.setCurrentWidget(self.browser)
3779 else: 3779 else:
3780 self.browser.show() 3780 self.browser.show()
3781 elif self.embeddedFileBrowser == 1: # embedded in debug browser 3781 elif self.embeddedFileBrowser == 1: # embedded in debug browser
3782 if self.layout == "Toolboxes": 3782 if self.layoutType == "Toolboxes":
3783 self.rToolboxDock.show() 3783 self.rToolboxDock.show()
3784 self.rToolbox.setCurrentWidget(self.debugViewer) 3784 self.rToolbox.setCurrentWidget(self.debugViewer)
3785 elif self.layout == "Sidebars": 3785 elif self.layoutType == "Sidebars":
3786 self.rightSidebar.show() 3786 self.rightSidebar.show()
3787 self.rightSidebar.setCurrentWidget(self.debugViewer) 3787 self.rightSidebar.setCurrentWidget(self.debugViewer)
3788 else: 3788 else:
3789 self.debugViewer.show() 3789 self.debugViewer.show()
3790 self.debugViewer.setCurrentWidget(self.browser) 3790 self.debugViewer.setCurrentWidget(self.browser)
3791 else: # embedded in project browser 3791 else: # embedded in project browser
3792 if self.layout == "Toolboxes": 3792 if self.layoutType == "Toolboxes":
3793 self.lToolboxDock.show() 3793 self.lToolboxDock.show()
3794 self.lToolbox.setCurrentWidget(self.projectBrowser) 3794 self.lToolbox.setCurrentWidget(self.projectBrowser)
3795 elif self.layout == "Sidebars": 3795 elif self.layoutType == "Sidebars":
3796 self.leftSidebar.show() 3796 self.leftSidebar.show()
3797 self.leftSidebar.setCurrentWidget(self.projectBrowser) 3797 self.leftSidebar.setCurrentWidget(self.projectBrowser)
3798 else: 3798 else:
3799 self.projectBrowser.show() 3799 self.projectBrowser.show()
3800 self.projectBrowser.setCurrentWidget(self.browser) 3800 self.projectBrowser.setCurrentWidget(self.browser)
3877 3877
3878 def activateCooperationViewer(self): 3878 def activateCooperationViewer(self):
3879 """ 3879 """
3880 Public slot to handle the activation of the cooperation window. 3880 Public slot to handle the activation of the cooperation window.
3881 """ 3881 """
3882 if self.layout == "Toolboxes": 3882 if self.layoutType == "Toolboxes":
3883 self.rToolboxDock.show() 3883 self.rToolboxDock.show()
3884 self.rToolbox.setCurrentWidget(self.cooperation) 3884 self.rToolbox.setCurrentWidget(self.cooperation)
3885 elif self.layout == "Sidebars": 3885 elif self.layoutType == "Sidebars":
3886 self.rightSidebar.show() 3886 self.rightSidebar.show()
3887 self.rightSidebar.setCurrentWidget(self.cooperation) 3887 self.rightSidebar.setCurrentWidget(self.cooperation)
3888 else: 3888 else:
3889 self.cooperation.show() 3889 self.cooperation.show()
3890 self.cooperation.setFocus(Qt.ActiveWindowFocusReason) 3890 self.cooperation.setFocus(Qt.ActiveWindowFocusReason)
3891 3891
3892 def __activateIRC(self): 3892 def __activateIRC(self):
3893 """ 3893 """
3894 Private slot to handle the activation of the IRC window. 3894 Private slot to handle the activation of the IRC window.
3895 """ 3895 """
3896 if self.layout == "Toolboxes": 3896 if self.layoutType == "Toolboxes":
3897 self.rToolboxDock.show() 3897 self.rToolboxDock.show()
3898 self.rToolbox.setCurrentWidget(self.irc) 3898 self.rToolbox.setCurrentWidget(self.irc)
3899 elif self.layout == "Sidebars": 3899 elif self.layoutType == "Sidebars":
3900 self.rightSidebar.show() 3900 self.rightSidebar.show()
3901 self.rightSidebar.setCurrentWidget(self.irc) 3901 self.rightSidebar.setCurrentWidget(self.irc)
3902 else: 3902 else:
3903 self.irc.show() 3903 self.irc.show()
3904 self.irc.setFocus(Qt.ActiveWindowFocusReason) 3904 self.irc.setFocus(Qt.ActiveWindowFocusReason)
3905 3905
3906 def __activateSymbolsViewer(self): 3906 def __activateSymbolsViewer(self):
3907 """ 3907 """
3908 Private slot to handle the activation of the Symbols Viewer. 3908 Private slot to handle the activation of the Symbols Viewer.
3909 """ 3909 """
3910 if self.layout == "Toolboxes": 3910 if self.layoutType == "Toolboxes":
3911 self.lToolboxDock.show() 3911 self.lToolboxDock.show()
3912 self.lToolbox.setCurrentWidget(self.symbolsViewer) 3912 self.lToolbox.setCurrentWidget(self.symbolsViewer)
3913 elif self.layout == "Sidebars": 3913 elif self.layoutType == "Sidebars":
3914 self.leftSidebar.show() 3914 self.leftSidebar.show()
3915 self.leftSidebar.setCurrentWidget(self.symbolsViewer) 3915 self.leftSidebar.setCurrentWidget(self.symbolsViewer)
3916 else: 3916 else:
3917 self.symbolsViewer.show() 3917 self.symbolsViewer.show()
3918 self.symbolsViewer.setFocus(Qt.ActiveWindowFocusReason) 3918 self.symbolsViewer.setFocus(Qt.ActiveWindowFocusReason)
3919 3919
3920 def __activateNumbersViewer(self): 3920 def __activateNumbersViewer(self):
3921 """ 3921 """
3922 Private slot to handle the activation of the Numbers Viewer. 3922 Private slot to handle the activation of the Numbers Viewer.
3923 """ 3923 """
3924 if self.layout == "Toolboxes": 3924 if self.layoutType == "Toolboxes":
3925 self.hToolboxDock.show() 3925 self.hToolboxDock.show()
3926 self.hToolboxDock.setCurrentWidget(self.numbersViewer) 3926 self.hToolboxDock.setCurrentWidget(self.numbersViewer)
3927 elif self.layout == "Sidebars": 3927 elif self.layoutType == "Sidebars":
3928 self.bottomSidebar.show() 3928 self.bottomSidebar.show()
3929 self.bottomSidebar.setCurrentWidget(self.numbersViewer) 3929 self.bottomSidebar.setCurrentWidget(self.numbersViewer)
3930 else: 3930 else:
3931 self.numbersViewer.show() 3931 self.numbersViewer.show()
3932 self.numbersViewer.setFocus(Qt.ActiveWindowFocusReason) 3932 self.numbersViewer.setFocus(Qt.ActiveWindowFocusReason)
5220 5220
5221 from QScintilla.SpellChecker import SpellChecker 5221 from QScintilla.SpellChecker import SpellChecker
5222 SpellChecker.setDefaultLanguage( 5222 SpellChecker.setDefaultLanguage(
5223 Preferences.getEditor("SpellCheckingDefaultLanguage")) 5223 Preferences.getEditor("SpellCheckingDefaultLanguage"))
5224 5224
5225 if self.layout == "Sidebars": 5225 if self.layoutType == "Sidebars":
5226 delay = Preferences.getUI("SidebarDelay") 5226 delay = Preferences.getUI("SidebarDelay")
5227 self.leftSidebar.setDelay(delay) 5227 self.leftSidebar.setDelay(delay)
5228 self.bottomSidebar.setDelay(delay) 5228 self.bottomSidebar.setDelay(delay)
5229 self.rightSidebar.setDelay(delay) 5229 self.rightSidebar.setDelay(delay)
5230 5230
5265 """ 5265 """
5266 Private slot to configure the various view profiles. 5266 Private slot to configure the various view profiles.
5267 """ 5267 """
5268 from Preferences.ViewProfileDialog import ViewProfileDialog 5268 from Preferences.ViewProfileDialog import ViewProfileDialog
5269 dlg = ViewProfileDialog( 5269 dlg = ViewProfileDialog(
5270 self.layout, self.profiles['edit'][1], self.profiles['debug'][1]) 5270 self.layoutType, self.profiles['edit'][1], self.profiles['debug'][1])
5271 if dlg.exec_() == QDialog.Accepted: 5271 if dlg.exec_() == QDialog.Accepted:
5272 edit, debug = dlg.getVisibilities() 5272 edit, debug = dlg.getVisibilities()
5273 self.profiles['edit'][1] = edit 5273 self.profiles['edit'][1] = edit
5274 self.profiles['debug'][1] = debug 5274 self.profiles['debug'][1] = debug
5275 Preferences.setUI("ViewProfiles2", self.profiles) 5275 Preferences.setUI("ViewProfiles2", self.profiles)
5798 5798
5799 self.cooperation.shutdown() 5799 self.cooperation.shutdown()
5800 5800
5801 self.pluginManager.doShutdown() 5801 self.pluginManager.doShutdown()
5802 5802
5803 if self.layout == "Sidebars": 5803 if self.layoutType == "Sidebars":
5804 self.leftSidebar.shutdown() 5804 self.leftSidebar.shutdown()
5805 self.bottomSidebar.shutdown() 5805 self.bottomSidebar.shutdown()
5806 self.rightSidebar.shutdown() 5806 self.rightSidebar.shutdown()
5807 5807
5808 if self.SAServer is not None: 5808 if self.SAServer is not None:

eric ide

mercurial