603 e5App().registerObject("Symbols", self.symbolsViewer) |
604 e5App().registerObject("Symbols", self.symbolsViewer) |
604 if self.numbersViewer is not None: |
605 if self.numbersViewer is not None: |
605 e5App().registerObject("Numbers", self.numbersViewer) |
606 e5App().registerObject("Numbers", self.numbersViewer) |
606 if self.codeDocumentationViewer is not None: |
607 if self.codeDocumentationViewer is not None: |
607 e5App().registerObject("DocuViewer", self.codeDocumentationViewer) |
608 e5App().registerObject("DocuViewer", self.codeDocumentationViewer) |
|
609 if self.microPythonWidget is not None: |
|
610 e5App().registerObject("MicroPython", self.microPythonWidget) |
608 |
611 |
609 # list of web addresses serving the versions file |
612 # list of web addresses serving the versions file |
610 self.__httpAlternatives = Preferences.getUI("VersionsUrls6") |
613 self.__httpAlternatives = Preferences.getUI("VersionsUrls6") |
611 self.__inVersionCheck = False |
614 self.__inVersionCheck = False |
612 self.__versionCheckProgress = None |
615 self.__versionCheckProgress = None |
904 self.irc = IrcWidget(self) |
907 self.irc = IrcWidget(self) |
905 self.rToolbox.addItem(self.irc, |
908 self.rToolbox.addItem(self.irc, |
906 UI.PixmapCache.getIcon("irc.png"), |
909 UI.PixmapCache.getIcon("irc.png"), |
907 self.tr("IRC")) |
910 self.tr("IRC")) |
908 |
911 |
|
912 if Preferences.getUI("ShowMicroPython"): |
|
913 # Create the MicroPython part of the user interface |
|
914 logging.debug("Creating MicroPython Widget...") |
|
915 from MicroPython.MicroPythonWidget import MicroPythonWidget |
|
916 self.microPythonWidget = MicroPythonWidget(self) |
|
917 self.rToolbox.addItem(self.microPythonWidget, |
|
918 UI.PixmapCache.getIcon("micropython"), |
|
919 self.tr("MicroPython")) |
|
920 |
909 #################################################### |
921 #################################################### |
910 ## Populate the bottom toolbox |
922 ## Populate the bottom toolbox |
911 #################################################### |
923 #################################################### |
912 |
924 |
913 # Create the task viewer part of the user interface |
925 # Create the task viewer part of the user interface |
1092 self.irc = IrcWidget(self) |
1104 self.irc = IrcWidget(self) |
1093 self.rightSidebar.addTab( |
1105 self.rightSidebar.addTab( |
1094 self.irc, UI.PixmapCache.getIcon("irc.png"), |
1106 self.irc, UI.PixmapCache.getIcon("irc.png"), |
1095 self.tr("IRC")) |
1107 self.tr("IRC")) |
1096 |
1108 |
|
1109 if Preferences.getUI("ShowMicroPython"): |
|
1110 # Create the MicroPython part of the user interface |
|
1111 logging.debug("Creating MicroPython Widget...") |
|
1112 from MicroPython.MicroPythonWidget import MicroPythonWidget |
|
1113 self.microPythonWidget = MicroPythonWidget(self) |
|
1114 self.rightSidebar.addTab( |
|
1115 self.microPythonWidget, UI.PixmapCache.getIcon("micropython"), |
|
1116 self.tr("MicroPython")) |
|
1117 |
1097 #################################################### |
1118 #################################################### |
1098 ## Populate the bottom side bar |
1119 ## Populate the bottom side bar |
1099 #################################################### |
1120 #################################################### |
1100 |
1121 |
1101 # Create the task viewer part of the user interface |
1122 # Create the task viewer part of the user interface |
1190 |
1211 |
1191 def addSideWidget(self, side, widget, icon, label): |
1212 def addSideWidget(self, side, widget, icon, label): |
1192 """ |
1213 """ |
1193 Public method to add a widget to the sides. |
1214 Public method to add a widget to the sides. |
1194 |
1215 |
1195 @param side side to add the widget to (UserInterface.LeftSide, |
1216 @param side side to add the widget to |
1196 UserInterface.BottomSide) |
1217 @type int (one of UserInterface.LeftSide, UserInterface.BottomSide, |
1197 @param widget reference to the widget to add (QWidget) |
1218 UserInterface.RightSide) |
1198 @param icon icon to be used (QIcon) |
1219 @param widget reference to the widget to add |
1199 @param label label text to be shown (string) |
1220 @type QWidget |
|
1221 @param icon icon to be used |
|
1222 @type QIcon |
|
1223 @param label label text to be shown |
|
1224 @type str |
1200 """ |
1225 """ |
1201 assert side in [UserInterface.LeftSide, UserInterface.BottomSide, |
1226 assert side in [UserInterface.LeftSide, UserInterface.BottomSide, |
1202 UserInterface.RightSide] |
1227 UserInterface.RightSide] |
1203 |
1228 |
1204 if self.__layoutType == "Toolboxes": |
1229 if self.__layoutType == "Toolboxes": |
1213 self.leftSidebar.addTab(widget, icon, label) |
1238 self.leftSidebar.addTab(widget, icon, label) |
1214 elif side == UserInterface.BottomSide: |
1239 elif side == UserInterface.BottomSide: |
1215 self.bottomSidebar.addTab(widget, icon, label) |
1240 self.bottomSidebar.addTab(widget, icon, label) |
1216 elif side == UserInterface.RightSide: |
1241 elif side == UserInterface.RightSide: |
1217 self.rightSidebar.addTab(widget, icon, label) |
1242 self.rightSidebar.addTab(widget, icon, label) |
1218 |
1243 |
1219 def removeSideWidget(self, widget): |
1244 def removeSideWidget(self, widget): |
1220 """ |
1245 """ |
1221 Public method to remove a widget added using addSideWidget(). |
1246 Public method to remove a widget added using addSideWidget(). |
1222 |
1247 |
1223 @param widget reference to the widget to remove (QWidget) |
1248 @param widget reference to the widget to remove |
|
1249 @type QWidget |
1224 """ |
1250 """ |
1225 if self.__layoutType == "Toolboxes": |
1251 if self.__layoutType == "Toolboxes": |
1226 for container in [self.lToolbox, self.hToolbox, self.rToolbox]: |
1252 for container in [self.lToolbox, self.hToolbox, self.rToolbox]: |
1227 index = container.indexOf(widget) |
1253 index = container.indexOf(widget) |
1228 if index != -1: |
1254 if index != -1: |
1231 for container in [self.leftSidebar, self.bottomSidebar, |
1257 for container in [self.leftSidebar, self.bottomSidebar, |
1232 self.rightSidebar]: |
1258 self.rightSidebar]: |
1233 index = container.indexOf(widget) |
1259 index = container.indexOf(widget) |
1234 if index != -1: |
1260 if index != -1: |
1235 container.removeTab(index) |
1261 container.removeTab(index) |
1236 |
1262 |
|
1263 def showSideWidget(self, widget): |
|
1264 """ |
|
1265 Public method to show a specific widget placed in the side widgets. |
|
1266 |
|
1267 @param widget reference to the widget to be shown |
|
1268 @type QWidget |
|
1269 """ |
|
1270 if self.__layoutType == "Toolboxes": |
|
1271 for dock in [self.lToolboxDock, self.hToolboxDock, |
|
1272 self.rToolboxDock]: |
|
1273 container = dock.widget() |
|
1274 index = container.indexOf(widget) |
|
1275 if index != -1: |
|
1276 dock.show() |
|
1277 container.setCurrentIndex(index) |
|
1278 dock.raise_() |
|
1279 elif self.__layoutType == "Sidebars": |
|
1280 for container in [self.leftSidebar, self.bottomSidebar, |
|
1281 self.rightSidebar]: |
|
1282 index = container.indexOf(widget) |
|
1283 if index != -1: |
|
1284 container.show() |
|
1285 container.setCurrentIndex(index) |
|
1286 container.raise_() |
|
1287 if container.isAutoHiding(): |
|
1288 container.setFocus() |
|
1289 |
1237 def showLogViewer(self): |
1290 def showLogViewer(self): |
1238 """ |
1291 """ |
1239 Public method to show the Log-Viewer. |
1292 Public method to show the Log-Viewer. |
1240 """ |
1293 """ |
1241 if Preferences.getUI("LogViewerAutoRaise"): |
1294 if Preferences.getUI("LogViewerAutoRaise"): |
1869 )) |
1922 )) |
1870 self.numbersViewerActivateAct.triggered.connect( |
1923 self.numbersViewerActivateAct.triggered.connect( |
1871 self.__activateNumbersViewer) |
1924 self.__activateNumbersViewer) |
1872 self.actions.append(self.numbersViewerActivateAct) |
1925 self.actions.append(self.numbersViewerActivateAct) |
1873 self.addAction(self.numbersViewerActivateAct) |
1926 self.addAction(self.numbersViewerActivateAct) |
1874 |
1927 |
|
1928 if self.codeDocumentationViewer is not None: |
|
1929 self.codeDocumentationViewerActivateAct = E5Action( |
|
1930 self.tr('Code Documentation Viewer'), |
|
1931 self.tr('Code Documentation Viewer'), |
|
1932 QKeySequence(self.tr("Ctrl+Alt+Shift+D")), |
|
1933 0, self, |
|
1934 'code_documentation_viewer_activate') |
|
1935 self.codeDocumentationViewerActivateAct.setStatusTip(self.tr( |
|
1936 "Switch the input focus to the Code Documentation Viewer" |
|
1937 " window.")) |
|
1938 self.codeDocumentationViewerActivateAct.setWhatsThis(self.tr( |
|
1939 """<b>Code Documentation Viewer</b>""" |
|
1940 """<p>This switches the input focus to the Code""" |
|
1941 """ Documentation Viewer window.</p>""" |
|
1942 )) |
|
1943 self.codeDocumentationViewerActivateAct.triggered.connect( |
|
1944 self.activateCodeDocumentationViewer) |
|
1945 self.actions.append(self.codeDocumentationViewerActivateAct) |
|
1946 self.addAction(self.codeDocumentationViewerActivateAct) |
|
1947 |
|
1948 if self.pipWidget is not None: |
|
1949 self.pipWidgetActivateAct = E5Action( |
|
1950 self.tr('PyPI'), |
|
1951 self.tr('PyPI'), |
|
1952 QKeySequence(self.tr("Ctrl+Alt+Shift+P")), |
|
1953 0, self, |
|
1954 'pip_widget_activate') |
|
1955 self.pipWidgetActivateAct.setStatusTip(self.tr( |
|
1956 "Switch the input focus to the PyPI window.")) |
|
1957 self.pipWidgetActivateAct.setWhatsThis(self.tr( |
|
1958 """<b>PyPI</b>""" |
|
1959 """<p>This switches the input focus to the PyPI window.</p>""" |
|
1960 )) |
|
1961 self.pipWidgetActivateAct.triggered.connect( |
|
1962 self.__activatePipWidget) |
|
1963 self.actions.append(self.pipWidgetActivateAct) |
|
1964 self.addAction(self.pipWidgetActivateAct) |
|
1965 |
|
1966 if self.condaWidget is not None: |
|
1967 self.condaWidgetActivateAct = E5Action( |
|
1968 self.tr('Conda'), |
|
1969 self.tr('Conda'), |
|
1970 QKeySequence(self.tr("Ctrl+Alt+Shift+C")), |
|
1971 0, self, |
|
1972 'conda_widget_activate') |
|
1973 self.condaWidgetActivateAct.setStatusTip(self.tr( |
|
1974 "Switch the input focus to the Conda window.")) |
|
1975 self.condaWidgetActivateAct.setWhatsThis(self.tr( |
|
1976 """<b>Conda</b>""" |
|
1977 """<p>This switches the input focus to the Conda window.</p>""" |
|
1978 )) |
|
1979 self.condaWidgetActivateAct.triggered.connect( |
|
1980 self.__activateCondaWidget) |
|
1981 self.actions.append(self.condaWidgetActivateAct) |
|
1982 self.addAction(self.condaWidgetActivateAct) |
|
1983 |
|
1984 # TODO: add action for "MicroPython", Ctrl+Alt+Shift+M |
|
1985 if self.microPythonWidget is not None: |
|
1986 self.microPythonWidgetActivateAct = E5Action( |
|
1987 self.tr('MicroPython'), |
|
1988 self.tr('MicroPython'), |
|
1989 QKeySequence(self.tr("Ctrl+Alt+Shift+M")), |
|
1990 0, self, |
|
1991 'micropython_widget_activate') |
|
1992 self.microPythonWidgetActivateAct.setStatusTip(self.tr( |
|
1993 "Switch the input focus to the MicroPython window.")) |
|
1994 self.microPythonWidgetActivateAct.setWhatsThis(self.tr( |
|
1995 """<b>MicroPython</b>""" |
|
1996 """<p>This switches the input focus to the MicroPython""" |
|
1997 """ window.</p>""" |
|
1998 )) |
|
1999 self.microPythonWidgetActivateAct.triggered.connect( |
|
2000 self.__activateMicroPython) |
|
2001 self.actions.append(self.microPythonWidgetActivateAct) |
|
2002 self.addAction(self.microPythonWidgetActivateAct) |
|
2003 |
1875 self.whatsThisAct = E5Action( |
2004 self.whatsThisAct = E5Action( |
1876 self.tr('What\'s This?'), |
2005 self.tr('What\'s This?'), |
1877 UI.PixmapCache.getIcon("whatsThis.png"), |
2006 UI.PixmapCache.getIcon("whatsThis.png"), |
1878 self.tr('&What\'s This?'), |
2007 self.tr('&What\'s This?'), |
1879 QKeySequence(self.tr("Shift+F1")), |
2008 QKeySequence(self.tr("Shift+F1")), |
2464 |
2593 |
2465 self.viewmanagerActivateAct = E5Action( |
2594 self.viewmanagerActivateAct = E5Action( |
2466 self.tr('Activate current editor'), |
2595 self.tr('Activate current editor'), |
2467 self.tr('Activate current editor'), |
2596 self.tr('Activate current editor'), |
2468 QKeySequence(self.tr("Alt+Shift+E")), |
2597 QKeySequence(self.tr("Alt+Shift+E")), |
2469 0, self, 'viewmanager_activate', 1) |
2598 0, self, 'viewmanager_activate') |
2470 self.viewmanagerActivateAct.triggered.connect( |
2599 self.viewmanagerActivateAct.triggered.connect( |
2471 self.__activateViewmanager) |
2600 self.__activateViewmanager) |
2472 self.actions.append(self.viewmanagerActivateAct) |
2601 self.actions.append(self.viewmanagerActivateAct) |
2473 self.addAction(self.viewmanagerActivateAct) |
2602 self.addAction(self.viewmanagerActivateAct) |
2474 |
2603 |
2991 ############################################################## |
3120 ############################################################## |
2992 |
3121 |
2993 self.__menus["subwindow"] = QMenu(self.tr("&Windows"), |
3122 self.__menus["subwindow"] = QMenu(self.tr("&Windows"), |
2994 self.__menus["window"]) |
3123 self.__menus["window"]) |
2995 self.__menus["subwindow"].setTearOffEnabled(True) |
3124 self.__menus["subwindow"].setTearOffEnabled(True) |
|
3125 # central park |
|
3126 try: |
|
3127 self.__menus["subwindow"].addSection(self.tr("Central Park")) |
|
3128 except AttributeError: |
|
3129 # Qt4 |
|
3130 self.__menus["subwindow"].addSeparator() |
|
3131 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct) |
2996 # left side |
3132 # left side |
2997 try: |
3133 try: |
2998 self.__menus["subwindow"].addSection(self.tr("Left Side")) |
3134 self.__menus["subwindow"].addSection(self.tr("Left Side")) |
2999 except AttributeError: |
3135 except AttributeError: |
3000 # Qt4 |
3136 # Qt4 |
3029 # right side |
3165 # right side |
3030 if self.__shellPosition == "right": |
3166 if self.__shellPosition == "right": |
3031 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3167 self.__menus["subwindow"].addAction(self.shellActivateAct) |
3032 if self.codeDocumentationViewer is not None: |
3168 if self.codeDocumentationViewer is not None: |
3033 self.__menus["subwindow"].addAction( |
3169 self.__menus["subwindow"].addAction( |
3034 self.tr("Code Documentation Viewer"), |
3170 self.codeDocumentationViewerActivateAct) |
3035 self.activateCodeDocumentationViewer) |
|
3036 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) |
3171 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) |
3037 if self.pipWidget is not None: |
3172 if self.pipWidget is not None: |
3038 self.__menus["subwindow"].addAction( |
3173 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct) |
3039 self.tr("PyPI"), |
|
3040 self.__activatePipWidget) |
|
3041 if self.condaWidget is not None: |
3174 if self.condaWidget is not None: |
3042 self.__menus["subwindow"].addAction( |
3175 self.__menus["subwindow"].addAction(self.condaWidgetActivateAct) |
3043 self.tr("Conda"), |
|
3044 self.__activateCondaWidget) |
|
3045 if self.cooperation is not None: |
3176 if self.cooperation is not None: |
3046 self.__menus["subwindow"].addAction( |
3177 self.__menus["subwindow"].addAction( |
3047 self.cooperationViewerActivateAct) |
3178 self.cooperationViewerActivateAct) |
3048 if self.irc is not None: |
3179 if self.irc is not None: |
3049 self.__menus["subwindow"].addAction(self.ircActivateAct) |
3180 self.__menus["subwindow"].addAction(self.ircActivateAct) |
|
3181 if self.microPythonWidget is not None: |
|
3182 self.__menus["subwindow"].addAction( |
|
3183 self.microPythonWidgetActivateAct) |
3050 try: |
3184 try: |
3051 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) |
3185 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) |
3052 except AttributeError: |
3186 except AttributeError: |
3053 # Qt4 |
3187 # Qt4 |
3054 self.__menus["subwindow"].addSeparator() |
3188 self.__menus["subwindow"].addSeparator() |
4618 self.rToolbox.setCurrentWidget(self.condaWidget) |
4752 self.rToolbox.setCurrentWidget(self.condaWidget) |
4619 elif self.__layoutType == "Sidebars": |
4753 elif self.__layoutType == "Sidebars": |
4620 self.rightSidebar.show() |
4754 self.rightSidebar.show() |
4621 self.rightSidebar.setCurrentWidget(self.condaWidget) |
4755 self.rightSidebar.setCurrentWidget(self.condaWidget) |
4622 self.condaWidget.setFocus(Qt.ActiveWindowFocusReason) |
4756 self.condaWidget.setFocus(Qt.ActiveWindowFocusReason) |
|
4757 |
|
4758 def __activateMicroPython(self): |
|
4759 """ |
|
4760 Private slot to handle the activation of the MicroPython widget. |
|
4761 """ |
|
4762 if self.microPythonWidget is not None: |
|
4763 if self.__layoutType == "Toolboxes": |
|
4764 self.rToolboxDock.show() |
|
4765 self.rToolbox.setCurrentWidget(self.microPythonWidget) |
|
4766 elif self.__layoutType == "Sidebars": |
|
4767 self.rightSidebar.show() |
|
4768 self.rightSidebar.setCurrentWidget(self.microPythonWidget) |
|
4769 self.microPythonWidget.setFocus(Qt.ActiveWindowFocusReason) |
4623 |
4770 |
4624 def __toggleWindow(self, w): |
4771 def __toggleWindow(self, w): |
4625 """ |
4772 """ |
4626 Private method to toggle a workspace editor window. |
4773 Private method to toggle a workspace editor window. |
4627 |
4774 |