129 @param s data to be written (it must support the str-method) |
129 @param s data to be written (it must support the str-method) |
130 """ |
130 """ |
131 self.buffer += str(s) |
131 self.buffer += str(s) |
132 self.__nWrite(self.__bufferedWrite()) |
132 self.__nWrite(self.__bufferedWrite()) |
133 |
133 |
134 # TODO: make "Cooperation" and "IRC" configurable |
134 # TODO: make "File-Browser", "Symbols" and "Numbers" configurable |
135 class UserInterface(E5MainWindow): |
135 class UserInterface(E5MainWindow): |
136 """ |
136 """ |
137 Class implementing the main user interface. |
137 Class implementing the main user interface. |
138 |
138 |
139 @signal appendStderr(str) emitted to write data to stderr logger |
139 @signal appendStderr(str) emitted to write data to stderr logger |
485 self.preferencesChanged.connect( |
487 self.preferencesChanged.connect( |
486 self.taskViewer.handlePreferencesChanged) |
488 self.taskViewer.handlePreferencesChanged) |
487 self.preferencesChanged.connect(self.pluginManager.preferencesChanged) |
489 self.preferencesChanged.connect(self.pluginManager.preferencesChanged) |
488 self.preferencesChanged.connect(debugServer.preferencesChanged) |
490 self.preferencesChanged.connect(debugServer.preferencesChanged) |
489 self.preferencesChanged.connect(self.debugViewer.preferencesChanged) |
491 self.preferencesChanged.connect(self.debugViewer.preferencesChanged) |
490 self.preferencesChanged.connect(self.cooperation.preferencesChanged) |
|
491 self.preferencesChanged.connect( |
492 self.preferencesChanged.connect( |
492 self.backgroundService.preferencesOrProjectChanged) |
493 self.backgroundService.preferencesOrProjectChanged) |
493 |
494 |
494 if self.codeDocumentationViewer: |
495 if self.codeDocumentationViewer is not None: |
495 self.preferencesChanged.connect( |
496 self.preferencesChanged.connect( |
496 self.codeDocumentationViewer.preferencesChanged) |
497 self.codeDocumentationViewer.preferencesChanged) |
497 |
498 |
498 self.viewmanager.editorSaved.connect(self.project.repopulateItem) |
499 self.viewmanager.editorSaved.connect(self.project.repopulateItem) |
499 self.viewmanager.lastEditorClosed.connect(self.__lastEditorClosed) |
500 self.viewmanager.lastEditorClosed.connect(self.__lastEditorClosed) |
502 self.viewmanager.checkActions.connect(self.__checkActions) |
503 self.viewmanager.checkActions.connect(self.__checkActions) |
503 self.viewmanager.editorChanged.connect( |
504 self.viewmanager.editorChanged.connect( |
504 self.projectBrowser.handleEditorChanged) |
505 self.projectBrowser.handleEditorChanged) |
505 self.viewmanager.editorLineChanged.connect( |
506 self.viewmanager.editorLineChanged.connect( |
506 self.projectBrowser.handleEditorLineChanged) |
507 self.projectBrowser.handleEditorLineChanged) |
507 self.viewmanager.checkActions.connect( |
|
508 self.cooperation.checkEditorActions) |
|
509 self.viewmanager.editorOpened.connect(self.__writeCrashSession) |
508 self.viewmanager.editorOpened.connect(self.__writeCrashSession) |
510 self.viewmanager.editorClosed.connect(self.__writeCrashSession) |
509 self.viewmanager.editorClosed.connect(self.__writeCrashSession) |
511 self.viewmanager.editorRenamed.connect(self.__writeCrashSession) |
510 self.viewmanager.editorRenamed.connect(self.__writeCrashSession) |
512 self.viewmanager.editorChanged.connect(self.__writeCrashSession) |
511 self.viewmanager.editorChanged.connect(self.__writeCrashSession) |
513 |
512 |
514 self.shell.zoomValueChanged.connect( |
513 self.shell.zoomValueChanged.connect( |
515 lambda v: self.viewmanager.zoomValueChanged(v, self.shell)) |
514 lambda v: self.viewmanager.zoomValueChanged(v, self.shell)) |
516 |
515 |
517 self.cooperation.shareEditor.connect(self.viewmanager.shareEditor) |
516 if self.cooperation is not None: |
518 self.cooperation.startEdit.connect(self.viewmanager.startSharedEdit) |
517 self.viewmanager.checkActions.connect( |
519 self.cooperation.sendEdit.connect(self.viewmanager.sendSharedEdit) |
518 self.cooperation.checkEditorActions) |
520 self.cooperation.cancelEdit.connect(self.viewmanager.cancelSharedEdit) |
519 self.preferencesChanged.connect( |
521 self.cooperation.connected.connect(self.viewmanager.shareConnected) |
520 self.cooperation.preferencesChanged) |
522 self.cooperation.editorCommand.connect(self.viewmanager.receive) |
521 self.cooperation.shareEditor.connect( |
523 self.viewmanager.setCooperationClient(self.cooperation.getClient()) |
522 self.viewmanager.shareEditor) |
|
523 self.cooperation.startEdit.connect( |
|
524 self.viewmanager.startSharedEdit) |
|
525 self.cooperation.sendEdit.connect( |
|
526 self.viewmanager.sendSharedEdit) |
|
527 self.cooperation.cancelEdit.connect( |
|
528 self.viewmanager.cancelSharedEdit) |
|
529 self.cooperation.connected.connect( |
|
530 self.viewmanager.shareConnected) |
|
531 self.cooperation.editorCommand.connect( |
|
532 self.viewmanager.receive) |
|
533 self.viewmanager.setCooperationClient( |
|
534 self.cooperation.getClient()) |
524 |
535 |
525 self.symbolsViewer.insertSymbol.connect(self.viewmanager.insertSymbol) |
536 self.symbolsViewer.insertSymbol.connect(self.viewmanager.insertSymbol) |
526 |
537 |
527 self.numbersViewer.insertNumber.connect(self.viewmanager.insertNumber) |
538 self.numbersViewer.insertNumber.connect(self.viewmanager.insertNumber) |
528 |
539 |
529 self.irc.autoConnected.connect(self.__ircAutoConnected) |
540 if self.irc is not None: |
|
541 self.irc.autoConnected.connect(self.__ircAutoConnected) |
530 |
542 |
531 # create the toolbar manager object |
543 # create the toolbar manager object |
532 self.toolbarManager = E5ToolBarManager(self, self) |
544 self.toolbarManager = E5ToolBarManager(self, self) |
533 self.toolbarManager.setMainWindow(self) |
545 self.toolbarManager.setMainWindow(self) |
534 |
546 |
570 e5App().registerObject("Shell", self.shell) |
582 e5App().registerObject("Shell", self.shell) |
571 if self.dummyHelpViewer is not None: |
583 if self.dummyHelpViewer is not None: |
572 e5App().registerObject("DummyHelpViewer", self.dummyHelpViewer) |
584 e5App().registerObject("DummyHelpViewer", self.dummyHelpViewer) |
573 e5App().registerObject("PluginManager", self.pluginManager) |
585 e5App().registerObject("PluginManager", self.pluginManager) |
574 e5App().registerObject("ToolbarManager", self.toolbarManager) |
586 e5App().registerObject("ToolbarManager", self.toolbarManager) |
575 e5App().registerObject("Cooperation", self.cooperation) |
587 if self.cooperation is not None: |
576 e5App().registerObject("IRC", self.irc) |
588 e5App().registerObject("Cooperation", self.cooperation) |
|
589 if self.irc is not None: |
|
590 e5App().registerObject("IRC", self.irc) |
577 e5App().registerObject("Symbols", self.symbolsViewer) |
591 e5App().registerObject("Symbols", self.symbolsViewer) |
578 e5App().registerObject("Numbers", self.numbersViewer) |
592 e5App().registerObject("Numbers", self.numbersViewer) |
579 if self.codeDocumentationViewer: |
593 if self.codeDocumentationViewer is not None: |
580 e5App().registerObject("DocuViewer", self.codeDocumentationViewer) |
594 e5App().registerObject("DocuViewer", self.codeDocumentationViewer) |
581 |
595 |
582 # list of web addresses serving the versions file |
596 # list of web addresses serving the versions file |
583 self.__httpAlternatives = Preferences.getUI("VersionsUrls6") |
597 self.__httpAlternatives = Preferences.getUI("VersionsUrls6") |
584 self.__inVersionCheck = False |
598 self.__inVersionCheck = False |
645 # restore toolbar manager state |
659 # restore toolbar manager state |
646 splash.showMessage(self.tr("Restoring Toolbarmanager...")) |
660 splash.showMessage(self.tr("Restoring Toolbarmanager...")) |
647 self.toolbarManager.restoreState( |
661 self.toolbarManager.restoreState( |
648 Preferences.getUI("ToolbarManagerState")) |
662 Preferences.getUI("ToolbarManagerState")) |
649 |
663 |
650 if self.codeDocumentationViewer: |
664 if self.codeDocumentationViewer is not None: |
651 # finalize the initialization of the code documentation viewer |
665 # finalize the initialization of the code documentation viewer |
652 self.codeDocumentationViewer.finalizeSetup() |
666 self.codeDocumentationViewer.finalizeSetup() |
653 |
667 |
654 # now activate the initial view profile |
668 # now activate the initial view profile |
655 splash.showMessage(self.tr("Setting View Profile...")) |
669 splash.showMessage(self.tr("Setting View Profile...")) |
813 from Debugger.DebugViewer import DebugViewer |
827 from Debugger.DebugViewer import DebugViewer |
814 self.debugViewer = DebugViewer(debugServer, True, self.viewmanager) |
828 self.debugViewer = DebugViewer(debugServer, True, self.viewmanager) |
815 self.rToolbox.addItem(self.debugViewer, |
829 self.rToolbox.addItem(self.debugViewer, |
816 UI.PixmapCache.getIcon("debugViewer.png"), |
830 UI.PixmapCache.getIcon("debugViewer.png"), |
817 self.tr("Debug-Viewer")) |
831 self.tr("Debug-Viewer")) |
818 |
832 |
819 # Create the chat part of the user interface |
833 if Preferences.getUI("ShowCooperation"): |
820 logging.debug("Creating Chat Widget...") |
834 # Create the chat part of the user interface |
821 from Cooperation.ChatWidget import ChatWidget |
835 logging.debug("Creating Chat Widget...") |
822 self.cooperation = ChatWidget(self) |
836 from Cooperation.ChatWidget import ChatWidget |
823 self.rToolbox.addItem(self.cooperation, |
837 self.cooperation = ChatWidget(self) |
824 UI.PixmapCache.getIcon("cooperation.png"), |
838 self.rToolbox.addItem(self.cooperation, |
825 self.tr("Cooperation")) |
839 UI.PixmapCache.getIcon("cooperation.png"), |
826 |
840 self.tr("Cooperation")) |
827 # Create the IRC part of the user interface |
841 |
828 logging.debug("Creating IRC Widget...") |
842 if Preferences.getUI("ShowIrc"): |
829 from Network.IRC.IrcWidget import IrcWidget |
843 # Create the IRC part of the user interface |
830 self.irc = IrcWidget(self) |
844 logging.debug("Creating IRC Widget...") |
831 self.rToolbox.addItem(self.irc, |
845 from Network.IRC.IrcWidget import IrcWidget |
832 UI.PixmapCache.getIcon("irc.png"), |
846 self.irc = IrcWidget(self) |
833 self.tr("IRC")) |
847 self.rToolbox.addItem(self.irc, |
|
848 UI.PixmapCache.getIcon("irc.png"), |
|
849 self.tr("IRC")) |
834 |
850 |
835 # Create the task viewer part of the user interface |
851 # Create the task viewer part of the user interface |
836 logging.debug("Creating Task Viewer...") |
852 logging.debug("Creating Task Viewer...") |
837 from Tasks.TaskViewer import TaskViewer |
853 from Tasks.TaskViewer import TaskViewer |
838 self.taskViewer = TaskViewer(None, self.project) |
854 self.taskViewer = TaskViewer(None, self.project) |
949 self.debugViewer = DebugViewer(debugServer, True, self.viewmanager) |
965 self.debugViewer = DebugViewer(debugServer, True, self.viewmanager) |
950 self.rightSidebar.addTab( |
966 self.rightSidebar.addTab( |
951 self.debugViewer, UI.PixmapCache.getIcon("debugViewer.png"), |
967 self.debugViewer, UI.PixmapCache.getIcon("debugViewer.png"), |
952 self.tr("Debug-Viewer")) |
968 self.tr("Debug-Viewer")) |
953 |
969 |
954 # Create the chat part of the user interface |
970 if Preferences.getUI("ShowCooperation"): |
955 logging.debug("Creating Chat Widget...") |
971 # Create the chat part of the user interface |
956 from Cooperation.ChatWidget import ChatWidget |
972 logging.debug("Creating Chat Widget...") |
957 self.cooperation = ChatWidget(self) |
973 from Cooperation.ChatWidget import ChatWidget |
958 self.rightSidebar.addTab( |
974 self.cooperation = ChatWidget(self) |
959 self.cooperation, UI.PixmapCache.getIcon("cooperation.png"), |
975 self.rightSidebar.addTab( |
960 self.tr("Cooperation")) |
976 self.cooperation, UI.PixmapCache.getIcon("cooperation.png"), |
961 |
977 self.tr("Cooperation")) |
962 # Create the IRC part of the user interface |
978 |
963 logging.debug("Creating IRC Widget...") |
979 if Preferences.getUI("ShowIrc"): |
964 from Network.IRC.IrcWidget import IrcWidget |
980 # Create the IRC part of the user interface |
965 self.irc = IrcWidget(self) |
981 logging.debug("Creating IRC Widget...") |
966 self.rightSidebar.addTab( |
982 from Network.IRC.IrcWidget import IrcWidget |
967 self.irc, UI.PixmapCache.getIcon("irc.png"), self.tr("IRC")) |
983 self.irc = IrcWidget(self) |
|
984 self.rightSidebar.addTab( |
|
985 self.irc, UI.PixmapCache.getIcon("irc.png"), |
|
986 self.tr("IRC")) |
968 |
987 |
969 # Create the task viewer part of the user interface |
988 # Create the task viewer part of the user interface |
970 logging.debug("Creating Task Viewer...") |
989 logging.debug("Creating Task Viewer...") |
971 from Tasks.TaskViewer import TaskViewer |
990 from Tasks.TaskViewer import TaskViewer |
972 self.taskViewer = TaskViewer(None, self.project) |
991 self.taskViewer = TaskViewer(None, self.project) |
1645 """ If it is displayed then close it.</p>""" |
1664 """ If it is displayed then close it.</p>""" |
1646 )) |
1665 )) |
1647 self.bsbAct.triggered.connect(self.__toggleBottomSidebar) |
1666 self.bsbAct.triggered.connect(self.__toggleBottomSidebar) |
1648 self.actions.append(self.bsbAct) |
1667 self.actions.append(self.bsbAct) |
1649 |
1668 |
1650 self.cooperationViewerActivateAct = E5Action( |
1669 if self.cooperation is not None: |
1651 self.tr('Cooperation-Viewer'), |
1670 self.cooperationViewerActivateAct = E5Action( |
1652 self.tr('Co&operation-Viewer'), |
1671 self.tr('Cooperation-Viewer'), |
1653 QKeySequence(self.tr("Alt+Shift+O")), |
1672 self.tr('Co&operation-Viewer'), |
1654 0, self, |
1673 QKeySequence(self.tr("Alt+Shift+O")), |
1655 'cooperation_viewer_activate') |
1674 0, self, |
1656 self.cooperationViewerActivateAct.setStatusTip(self.tr( |
1675 'cooperation_viewer_activate') |
1657 "Switch the input focus to the Cooperation-Viewer window.")) |
1676 self.cooperationViewerActivateAct.setStatusTip(self.tr( |
1658 self.cooperationViewerActivateAct.setWhatsThis(self.tr( |
1677 "Switch the input focus to the Cooperation-Viewer window.")) |
1659 """<b>Activate Cooperation-Viewer</b>""" |
1678 self.cooperationViewerActivateAct.setWhatsThis(self.tr( |
1660 """<p>This switches the input focus to the Cooperation-Viewer""" |
1679 """<b>Activate Cooperation-Viewer</b>""" |
1661 """ window.</p>""" |
1680 """<p>This switches the input focus to the""" |
1662 )) |
1681 """ Cooperation-Viewer window.</p>""" |
1663 self.cooperationViewerActivateAct.triggered.connect( |
1682 )) |
1664 self.activateCooperationViewer) |
1683 self.cooperationViewerActivateAct.triggered.connect( |
1665 self.actions.append(self.cooperationViewerActivateAct) |
1684 self.activateCooperationViewer) |
1666 self.addAction(self.cooperationViewerActivateAct) |
1685 self.actions.append(self.cooperationViewerActivateAct) |
1667 |
1686 self.addAction(self.cooperationViewerActivateAct) |
1668 self.ircActivateAct = E5Action( |
1687 |
1669 self.tr('IRC'), |
1688 if self.irc is not None: |
1670 self.tr('&IRC'), |
1689 self.ircActivateAct = E5Action( |
1671 QKeySequence(self.tr("Meta+Shift+I")), |
1690 self.tr('IRC'), |
1672 0, self, |
1691 self.tr('&IRC'), |
1673 'irc_widget_activate') |
1692 QKeySequence(self.tr("Meta+Shift+I")), |
1674 self.ircActivateAct.setStatusTip(self.tr( |
1693 0, self, |
1675 "Switch the input focus to the IRC window.")) |
1694 'irc_widget_activate') |
1676 self.ircActivateAct.setWhatsThis(self.tr( |
1695 self.ircActivateAct.setStatusTip(self.tr( |
1677 """<b>Activate IRC</b>""" |
1696 "Switch the input focus to the IRC window.")) |
1678 """<p>This switches the input focus to the IRC window.</p>""" |
1697 self.ircActivateAct.setWhatsThis(self.tr( |
1679 )) |
1698 """<b>Activate IRC</b>""" |
1680 self.ircActivateAct.triggered.connect( |
1699 """<p>This switches the input focus to the IRC window.</p>""" |
1681 self.__activateIRC) |
1700 )) |
1682 self.actions.append(self.ircActivateAct) |
1701 self.ircActivateAct.triggered.connect( |
1683 self.addAction(self.ircActivateAct) |
1702 self.__activateIRC) |
|
1703 self.actions.append(self.ircActivateAct) |
|
1704 self.addAction(self.ircActivateAct) |
1684 |
1705 |
1685 self.symbolsViewerActivateAct = E5Action( |
1706 self.symbolsViewerActivateAct = E5Action( |
1686 self.tr('Symbols-Viewer'), |
1707 self.tr('Symbols-Viewer'), |
1687 self.tr('S&ymbols-Viewer'), |
1708 self.tr('S&ymbols-Viewer'), |
1688 QKeySequence(self.tr("Alt+Shift+Y")), |
1709 QKeySequence(self.tr("Alt+Shift+Y")), |
2762 self.__menus["subwindow"].addSection(self.tr("Right Side")) |
2783 self.__menus["subwindow"].addSection(self.tr("Right Side")) |
2763 except AttributeError: |
2784 except AttributeError: |
2764 # Qt4 |
2785 # Qt4 |
2765 self.__menus["subwindow"].addSeparator() |
2786 self.__menus["subwindow"].addSeparator() |
2766 # right side |
2787 # right side |
2767 if self.codeDocumentationViewer: |
2788 if self.codeDocumentationViewer is not None: |
2768 self.__menus["subwindow"].addAction( |
2789 self.__menus["subwindow"].addAction( |
2769 self.tr("Code Documentation Viewer"), |
2790 self.tr("Code Documentation Viewer"), |
2770 self.activateCodeDocumentationViewer) |
2791 self.activateCodeDocumentationViewer) |
2771 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) |
2792 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) |
2772 self.__menus["subwindow"].addAction(self.cooperationViewerActivateAct) |
2793 if self.cooperation is not None: |
2773 self.__menus["subwindow"].addAction(self.ircActivateAct) |
2794 self.__menus["subwindow"].addAction( |
|
2795 self.cooperationViewerActivateAct) |
|
2796 if self.irc is not None: |
|
2797 self.__menus["subwindow"].addAction(self.ircActivateAct) |
2774 try: |
2798 try: |
2775 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) |
2799 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) |
2776 except AttributeError: |
2800 except AttributeError: |
2777 # Qt4 |
2801 # Qt4 |
2778 self.__menus["subwindow"].addSeparator() |
2802 self.__menus["subwindow"].addSeparator() |
4226 |
4250 |
4227 def activateCooperationViewer(self): |
4251 def activateCooperationViewer(self): |
4228 """ |
4252 """ |
4229 Public slot to handle the activation of the cooperation window. |
4253 Public slot to handle the activation of the cooperation window. |
4230 """ |
4254 """ |
4231 if self.layoutType == "Toolboxes": |
4255 if self.cooperation is not None: |
4232 self.rToolboxDock.show() |
4256 if self.layoutType == "Toolboxes": |
4233 self.rToolbox.setCurrentWidget(self.cooperation) |
4257 self.rToolboxDock.show() |
4234 elif self.layoutType == "Sidebars": |
4258 self.rToolbox.setCurrentWidget(self.cooperation) |
4235 self.rightSidebar.show() |
4259 elif self.layoutType == "Sidebars": |
4236 self.rightSidebar.setCurrentWidget(self.cooperation) |
4260 self.rightSidebar.show() |
4237 else: |
4261 self.rightSidebar.setCurrentWidget(self.cooperation) |
4238 self.cooperation.show() |
4262 else: |
4239 self.cooperation.setFocus(Qt.ActiveWindowFocusReason) |
4263 self.cooperation.show() |
|
4264 self.cooperation.setFocus(Qt.ActiveWindowFocusReason) |
4240 |
4265 |
4241 def __activateIRC(self): |
4266 def __activateIRC(self): |
4242 """ |
4267 """ |
4243 Private slot to handle the activation of the IRC window. |
4268 Private slot to handle the activation of the IRC window. |
4244 """ |
4269 """ |
4245 if self.layoutType == "Toolboxes": |
4270 if self.irc is not None: |
4246 self.rToolboxDock.show() |
4271 if self.layoutType == "Toolboxes": |
4247 self.rToolbox.setCurrentWidget(self.irc) |
4272 self.rToolboxDock.show() |
4248 elif self.layoutType == "Sidebars": |
4273 self.rToolbox.setCurrentWidget(self.irc) |
4249 self.rightSidebar.show() |
4274 elif self.layoutType == "Sidebars": |
4250 self.rightSidebar.setCurrentWidget(self.irc) |
4275 self.rightSidebar.show() |
4251 else: |
4276 self.rightSidebar.setCurrentWidget(self.irc) |
4252 self.irc.show() |
4277 else: |
4253 self.irc.setFocus(Qt.ActiveWindowFocusReason) |
4278 self.irc.show() |
|
4279 self.irc.setFocus(Qt.ActiveWindowFocusReason) |
4254 |
4280 |
4255 def __activateSymbolsViewer(self): |
4281 def __activateSymbolsViewer(self): |
4256 """ |
4282 """ |
4257 Private slot to handle the activation of the Symbols Viewer. |
4283 Private slot to handle the activation of the Symbols Viewer. |
4258 """ |
4284 """ |
4293 Public slot to handle the activation of the Code Documentation Viewer. |
4319 Public slot to handle the activation of the Code Documentation Viewer. |
4294 |
4320 |
4295 @param switchFocus flag indicating to transfer the input focus |
4321 @param switchFocus flag indicating to transfer the input focus |
4296 @type bool |
4322 @type bool |
4297 """ |
4323 """ |
4298 if self.codeDocumentationViewer: |
4324 if self.codeDocumentationViewer is not None: |
4299 if self.layoutType == "Toolboxes": |
4325 if self.layoutType == "Toolboxes": |
4300 self.rToolboxDock.show() |
4326 self.rToolboxDock.show() |
4301 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) |
4327 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) |
4302 elif self.layoutType == "Sidebars": |
4328 elif self.layoutType == "Sidebars": |
4303 self.rightSidebar.show() |
4329 self.rightSidebar.show() |