src/eric7/UI/UserInterface.py

branch
eric7
changeset 11227
023943c77c42
parent 11217
856628e8a303
child 11230
8a15b05eeee3
equal deleted inserted replaced
11226:84cbcddd7d10 11227:023943c77c42
555 self.symbolsViewer.insertSymbol.connect(self.viewmanager.insertSymbol) 555 self.symbolsViewer.insertSymbol.connect(self.viewmanager.insertSymbol)
556 556
557 if self.numbersViewer is not None: 557 if self.numbersViewer is not None:
558 self.numbersViewer.insertNumber.connect(self.viewmanager.insertNumber) 558 self.numbersViewer.insertNumber.connect(self.viewmanager.insertNumber)
559 559
560 if self.irc is not None:
561 self.irc.autoConnected.connect(self.__ircAutoConnected)
562
563 if self.pipWidget is not None: 560 if self.pipWidget is not None:
564 self.preferencesChanged.connect(self.pipWidget.preferencesChanged) 561 self.preferencesChanged.connect(self.pipWidget.preferencesChanged)
565 562
566 if self.microPythonWidget is not None: 563 if self.microPythonWidget is not None:
567 self.microPythonWidget.aboutToDisconnect.connect( 564 self.microPythonWidget.aboutToDisconnect.connect(
619 ericApp().registerObject("Shell", self.shell) 616 ericApp().registerObject("Shell", self.shell)
620 ericApp().registerObject("PluginManager", self.pluginManager) 617 ericApp().registerObject("PluginManager", self.pluginManager)
621 ericApp().registerObject("ToolbarManager", self.toolbarManager) 618 ericApp().registerObject("ToolbarManager", self.toolbarManager)
622 if self.cooperation is not None: 619 if self.cooperation is not None:
623 ericApp().registerObject("Cooperation", self.cooperation) 620 ericApp().registerObject("Cooperation", self.cooperation)
624 if self.irc is not None:
625 ericApp().registerObject("IRC", self.irc)
626 if self.symbolsViewer is not None: 621 if self.symbolsViewer is not None:
627 ericApp().registerObject("Symbols", self.symbolsViewer) 622 ericApp().registerObject("Symbols", self.symbolsViewer)
628 if self.numbersViewer is not None: 623 if self.numbersViewer is not None:
629 ericApp().registerObject("Numbers", self.numbersViewer) 624 ericApp().registerObject("Numbers", self.numbersViewer)
630 if self.codeDocumentationViewer is not None: 625 if self.codeDocumentationViewer is not None:
920 self.cooperation = ChatWidget(self) 915 self.cooperation = ChatWidget(self)
921 else: 916 else:
922 logging.getLogger(__name__).debug("Chat Widget disabled") 917 logging.getLogger(__name__).debug("Chat Widget disabled")
923 self.cooperation = None 918 self.cooperation = None
924 919
925 if Preferences.getUI("ShowIrc"):
926 # Create the IRC part of the user interface
927 logging.getLogger(__name__).debug("Creating IRC Widget...")
928 from eric7.Network.IRC.IrcWidget import IrcWidget # noqa: I-101
929
930 self.irc = IrcWidget(self)
931 else:
932 logging.getLogger(__name__).debug("IRC Widget disabled")
933 self.irc = None
934
935 if Preferences.getUI("ShowMicroPython"): 920 if Preferences.getUI("ShowMicroPython"):
936 # Create the MicroPython part of the user interface 921 # Create the MicroPython part of the user interface
937 logging.getLogger(__name__).debug("Creating MicroPython Widget...") 922 logging.getLogger(__name__).debug("Creating MicroPython Widget...")
938 from eric7.MicroPython.MicroPythonWidget import ( # noqa: I-101 923 from eric7.MicroPython.MicroPythonWidget import ( # noqa: I-101
939 MicroPythonWidget, 924 MicroPythonWidget,
1232 self.cooperation, 1217 self.cooperation,
1233 EricPixmapCache.getIcon("cooperation"), 1218 EricPixmapCache.getIcon("cooperation"),
1234 self.tr("Cooperation"), 1219 self.tr("Cooperation"),
1235 ) 1220 )
1236 1221
1237 if self.irc:
1238 self.rToolbox.addItem(
1239 self.irc, EricPixmapCache.getIcon("irc"), self.tr("IRC")
1240 )
1241
1242 if self.microPythonWidget: 1222 if self.microPythonWidget:
1243 self.rToolbox.addItem( 1223 self.rToolbox.addItem(
1244 self.microPythonWidget, 1224 self.microPythonWidget,
1245 EricPixmapCache.getIcon("micropython"), 1225 EricPixmapCache.getIcon("micropython"),
1246 self.tr("MicroPython"), 1226 self.tr("MicroPython"),
1431 sidebar.addTab( 1411 sidebar.addTab(
1432 self.cooperation, 1412 self.cooperation,
1433 EricPixmapCache.getIcon("sbCooperation96"), 1413 EricPixmapCache.getIcon("sbCooperation96"),
1434 self.tr("Cooperation"), 1414 self.tr("Cooperation"),
1435 ) 1415 )
1436
1437 if self.irc:
1438 sidebar.addTab(self.irc, EricPixmapCache.getIcon("sbIrc96"), self.tr("IRC"))
1439 1416
1440 if self.microPythonWidget: 1417 if self.microPythonWidget:
1441 sidebar.addTab( 1418 sidebar.addTab(
1442 self.microPythonWidget, 1419 self.microPythonWidget,
1443 EricPixmapCache.getIcon("sbMicroPython96"), 1420 EricPixmapCache.getIcon("sbMicroPython96"),
2370 self.activateCooperationViewer 2347 self.activateCooperationViewer
2371 ) 2348 )
2372 self.actions.append(self.cooperationViewerActivateAct) 2349 self.actions.append(self.cooperationViewerActivateAct)
2373 self.addAction(self.cooperationViewerActivateAct) 2350 self.addAction(self.cooperationViewerActivateAct)
2374 2351
2375 if self.irc is not None:
2376 self.ircActivateAct = EricAction(
2377 self.tr("IRC"),
2378 self.tr("&IRC"),
2379 QKeySequence(self.tr("Ctrl+Alt+Shift+I")),
2380 0,
2381 self,
2382 "irc_widget_activate",
2383 )
2384 self.ircActivateAct.setStatusTip(
2385 self.tr("Switch the input focus to the IRC window.")
2386 )
2387 self.ircActivateAct.setWhatsThis(
2388 self.tr(
2389 """<b>Activate IRC</b>"""
2390 """<p>This switches the input focus to the IRC window.</p>"""
2391 )
2392 )
2393 self.ircActivateAct.triggered.connect(self.__activateIRC)
2394 self.actions.append(self.ircActivateAct)
2395 self.addAction(self.ircActivateAct)
2396
2397 if self.symbolsViewer is not None: 2352 if self.symbolsViewer is not None:
2398 self.symbolsViewerActivateAct = EricAction( 2353 self.symbolsViewerActivateAct = EricAction(
2399 self.tr("Symbols-Viewer"), 2354 self.tr("Symbols-Viewer"),
2400 self.tr("S&ymbols-Viewer"), 2355 self.tr("S&ymbols-Viewer"),
2401 QKeySequence(self.tr("Alt+Shift+Y")), 2356 QKeySequence(self.tr("Alt+Shift+Y")),
4029 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct) 3984 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct)
4030 if self.condaWidget is not None: 3985 if self.condaWidget is not None:
4031 self.__menus["subwindow"].addAction(self.condaWidgetActivateAct) 3986 self.__menus["subwindow"].addAction(self.condaWidgetActivateAct)
4032 if self.cooperation is not None: 3987 if self.cooperation is not None:
4033 self.__menus["subwindow"].addAction(self.cooperationViewerActivateAct) 3988 self.__menus["subwindow"].addAction(self.cooperationViewerActivateAct)
4034 if self.irc is not None:
4035 self.__menus["subwindow"].addAction(self.ircActivateAct)
4036 if self.microPythonWidget is not None: 3989 if self.microPythonWidget is not None:
4037 self.__menus["subwindow"].addAction(self.microPythonWidgetActivateAct) 3990 self.__menus["subwindow"].addAction(self.microPythonWidgetActivateAct)
4038 3991
4039 # bottom side 3992 # bottom side
4040 self.__menus["subwindow"].addSection(self.tr("Bottom Side")) 3993 self.__menus["subwindow"].addSection(self.tr("Bottom Side"))
5854 self.rToolboxDock.show() 5807 self.rToolboxDock.show()
5855 self.rToolbox.setCurrentWidget(self.cooperation) 5808 self.rToolbox.setCurrentWidget(self.cooperation)
5856 elif self.__layoutType == "Sidebars": 5809 elif self.__layoutType == "Sidebars":
5857 self.activateLeftRightSidebarWidget(self.cooperation) 5810 self.activateLeftRightSidebarWidget(self.cooperation)
5858 self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason) 5811 self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
5859
5860 def __activateIRC(self):
5861 """
5862 Private slot to handle the activation of the IRC window.
5863 """
5864 if self.irc is not None:
5865 if self.__layoutType == "Toolboxes":
5866 self.rToolboxDock.show()
5867 self.rToolbox.setCurrentWidget(self.irc)
5868 elif self.__layoutType == "Sidebars":
5869 self.activateLeftRightSidebarWidget(self.irc)
5870 self.irc.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
5871 5812
5872 def __activateSymbolsViewer(self): 5813 def __activateSymbolsViewer(self):
5873 """ 5814 """
5874 Private slot to handle the activation of the Symbols Viewer. 5815 Private slot to handle the activation of the Symbols Viewer.
5875 """ 5816 """
8370 return False 8311 return False
8371 8312
8372 if self.__webBrowserProcess is not None: 8313 if self.__webBrowserProcess is not None:
8373 self.__webBrowserShutdown() 8314 self.__webBrowserShutdown()
8374 8315
8375 if self.irc is not None and not self.irc.shutdown():
8376 return False
8377
8378 sessionCreated = self.__writeSession() 8316 sessionCreated = self.__writeSession()
8379 8317
8380 self.shell.closeShell() 8318 self.shell.closeShell()
8381 8319
8382 if not self.project.closeProject(shutdown=True): 8320 if not self.project.closeProject(shutdown=True):
8695 timeout = Preferences.getUI("NotificationTimeout") 8633 timeout = Preferences.getUI("NotificationTimeout")
8696 self.__notification.showNotification( 8634 self.__notification.showNotification(
8697 icon, heading, text, kind=kind, timeout=timeout 8635 icon, heading, text, kind=kind, timeout=timeout
8698 ) 8636 )
8699 8637
8700 #########################
8701 ## Support for IRC below
8702 #########################
8703
8704 def autoConnectIrc(self):
8705 """
8706 Public method to initiate the IRC auto connection.
8707 """
8708 if self.irc is not None:
8709 self.irc.autoConnect()
8710
8711 def __ircAutoConnected(self):
8712 """
8713 Private slot handling the automatic connection of the IRC client.
8714 """
8715 self.__activateIRC()
8716
8717 ############################################## 8638 ##############################################
8718 ## Support for Code Documentation Viewer below 8639 ## Support for Code Documentation Viewer below
8719 ############################################## 8640 ##############################################
8720 8641
8721 def documentationViewer(self): 8642 def documentationViewer(self):

eric ide

mercurial