UI/UserInterface.py

branch
maintenance
changeset 6602
331ac8f99cf8
parent 6569
b4aeb61b3e3c
parent 6599
419f36a46608
child 6646
51eefa621de4
equal deleted inserted replaced
6570:06e7d2941ead 6602:331ac8f99cf8
164 164
165 ErrorLogFileName = "eric6_error.log" 165 ErrorLogFileName = "eric6_error.log"
166 166
167 def __init__(self, app, locale, splash, plugin, disabledPlugins, 167 def __init__(self, app, locale, splash, plugin, disabledPlugins,
168 noOpenAtStartup, noCrashOpenAtStartup, disableCrashSession, 168 noOpenAtStartup, noCrashOpenAtStartup, disableCrashSession,
169 restartArguments): 169 restartArguments, originalPathString):
170 """ 170 """
171 Constructor 171 Constructor
172 172
173 @param app reference to the application object 173 @param app reference to the application object
174 @type E5Application 174 @type E5Application
192 support 192 support
193 @type bool 193 @type bool
194 @param restartArguments list of command line parameters to be used for 194 @param restartArguments list of command line parameters to be used for
195 a restart 195 a restart
196 @type list of str 196 @type list of str
197 @param originalPathString original PATH environment variable
198 @type str
197 """ 199 """
198 super(UserInterface, self).__init__() 200 super(UserInterface, self).__init__()
199 201
200 self.__restartArgs = restartArguments[:] 202 self.__restartArgs = restartArguments[:]
201 203
207 self.__noOpenAtStartup = noOpenAtStartup 209 self.__noOpenAtStartup = noOpenAtStartup
208 self.__noCrashOpenAtStartup = noCrashOpenAtStartup 210 self.__noCrashOpenAtStartup = noCrashOpenAtStartup
209 self.__disableCrashSession = disableCrashSession 211 self.__disableCrashSession = disableCrashSession
210 self.__disabledPlugins = disabledPlugins[:] 212 self.__disabledPlugins = disabledPlugins[:]
211 213
214 self.__originalPathString = originalPathString
215
212 self.__layoutType = Preferences.getUI("LayoutType") 216 self.__layoutType = Preferences.getUI("LayoutType")
213 217
214 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled") 218 self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled")
215 219
216 g = Preferences.getGeometry("MainGeometry") 220 g = Preferences.getGeometry("MainGeometry")
246 # register it early because it is needed very soon 250 # register it early because it is needed very soon
247 e5App().registerObject("VirtualEnvManager", self.virtualenvManager) 251 e5App().registerObject("VirtualEnvManager", self.virtualenvManager)
248 252
249 # Generate the debug server object 253 # Generate the debug server object
250 from Debugger.DebugServer import DebugServer 254 from Debugger.DebugServer import DebugServer
251 debugServer = DebugServer() 255 debugServer = DebugServer(self.__originalPathString)
252 256
253 # Create the background service object 257 # Create the background service object
254 from Utilities.BackgroundService import BackgroundService 258 from Utilities.BackgroundService import BackgroundService
255 self.backgroundService = BackgroundService() 259 self.backgroundService = BackgroundService()
256 260
695 if self.templateViewer is not None: 699 if self.templateViewer is not None:
696 # now read the saved templates 700 # now read the saved templates
697 splash.showMessage(self.tr("Reading Templates...")) 701 splash.showMessage(self.tr("Reading Templates..."))
698 self.templateViewer.readTemplates() 702 self.templateViewer.readTemplates()
699 703
700 # now start the debug client 704 # now start the debug client with the most recently used virtual
705 # environment
701 splash.showMessage(self.tr("Starting Debugger...")) 706 splash.showMessage(self.tr("Starting Debugger..."))
702 debugServer.startClient(False) 707 if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"):
708 debugServer.startClient(
709 False, venvName=Preferences.getShell("LastVirtualEnvironment")
710 )
711 else:
712 debugServer.startClient(False)
703 713
704 # attributes for the network objects 714 # attributes for the network objects
705 self.__networkManager = QNetworkAccessManager(self) 715 self.__networkManager = QNetworkAccessManager(self)
706 self.__networkManager.proxyAuthenticationRequired.connect( 716 self.__networkManager.proxyAuthenticationRequired.connect(
707 proxyAuthenticationRequired) 717 proxyAuthenticationRequired)
887 897
888 # Create the shell 898 # Create the shell
889 logging.debug("Creating Shell...") 899 logging.debug("Creating Shell...")
890 from QScintilla.Shell import ShellAssembly 900 from QScintilla.Shell import ShellAssembly
891 self.shellAssembly = \ 901 self.shellAssembly = \
892 ShellAssembly(debugServer, self.viewmanager, True) 902 ShellAssembly(debugServer, self.viewmanager, self.project, True)
893 self.shell = self.shellAssembly.shell() 903 self.shell = self.shellAssembly.shell()
894 self.hToolbox.insertItem(0, self.shellAssembly, 904 self.hToolbox.insertItem(0, self.shellAssembly,
895 UI.PixmapCache.getIcon("shell.png"), 905 UI.PixmapCache.getIcon("shell.png"),
896 self.tr("Shell")) 906 self.tr("Shell"))
897 907
1028 1038
1029 # Create the shell 1039 # Create the shell
1030 logging.debug("Creating Shell...") 1040 logging.debug("Creating Shell...")
1031 from QScintilla.Shell import ShellAssembly 1041 from QScintilla.Shell import ShellAssembly
1032 self.shellAssembly = \ 1042 self.shellAssembly = \
1033 ShellAssembly(debugServer, self.viewmanager, True) 1043 ShellAssembly(debugServer, self.viewmanager, self.project, True)
1034 self.shell = self.shellAssembly.shell() 1044 self.shell = self.shellAssembly.shell()
1035 self.bottomSidebar.insertTab(0, self.shellAssembly, 1045 self.bottomSidebar.insertTab(0, self.shellAssembly,
1036 UI.PixmapCache.getIcon("shell.png"), 1046 UI.PixmapCache.getIcon("shell.png"),
1037 self.tr("Shell")) 1047 self.tr("Shell"))
1038 1048
4555 def __designer(self, fn=None, version=0): 4565 def __designer(self, fn=None, version=0):
4556 """ 4566 """
4557 Private slot to start the Qt-Designer executable. 4567 Private slot to start the Qt-Designer executable.
4558 4568
4559 @param fn filename of the form to be opened 4569 @param fn filename of the form to be opened
4560 @param version indication for the requested version (Qt 4) (integer) 4570 @type str
4571 @param version indication for the requested version (4 = Qt 4/5)
4572 @type int
4561 """ 4573 """
4562 if fn is not None and version == 0: 4574 if fn is not None and version == 0:
4563 # determine version from file, if not specified 4575 # determine version from file, if not specified
4564 try: 4576 try:
4565 f = open(fn, "r", encoding="utf-8") 4577 f = open(fn, "r", encoding="utf-8")
4631 'Ensure that it is available as <b>{0}</b>.</p>' 4643 'Ensure that it is available as <b>{0}</b>.</p>'
4632 ).format(designer)) 4644 ).format(designer))
4633 4645
4634 def __designer4(self): 4646 def __designer4(self):
4635 """ 4647 """
4636 Private slot to start the Qt-Designer 4 executable. 4648 Private slot to start the Qt-Designer 4/5 executable.
4637 """ 4649 """
4638 self.__designer(version=4) 4650 self.__designer(version=4)
4639 4651
4640 def __linguist(self, fn=None, version=0): 4652 def __linguist(self, fn=None, version=0):
4641 """ 4653 """
4642 Private slot to start the Qt-Linguist executable. 4654 Private slot to start the Qt-Linguist executable.
4643 4655
4644 @param fn filename of the translation file to be opened 4656 @param fn filename of the translation file to be opened
4645 @param version indication for the requested version (Qt 4) (integer) 4657 @type str
4658 @param version indication for the requested version (4 = Qt 4/5)
4659 @type int
4646 """ 4660 """
4647 if version < 4: 4661 if version < 4:
4648 E5MessageBox.information( 4662 E5MessageBox.information(
4649 self, 4663 self,
4650 self.tr("Qt 3 support"), 4664 self.tr("Qt 3 support"),
4700 4714
4701 @pyqtSlot() 4715 @pyqtSlot()
4702 @pyqtSlot(str) 4716 @pyqtSlot(str)
4703 def __linguist4(self, fn=None): 4717 def __linguist4(self, fn=None):
4704 """ 4718 """
4705 Private slot to start the Qt-Linguist 4 executable. 4719 Private slot to start the Qt-Linguist 4/5 executable.
4706 4720
4707 @param fn filename of the translation file to be opened 4721 @param fn filename of the translation file to be opened
4708 """ 4722 """
4709 self.__linguist(fn, version=4) 4723 self.__linguist(fn, version=4)
4710 4724
4711 def __assistant(self, home=None, version=0): 4725 def __assistant(self, home=None, version=0):
4712 """ 4726 """
4713 Private slot to start the Qt-Assistant executable. 4727 Private slot to start the Qt-Assistant executable.
4714 4728
4715 @param home full pathname of a file to display (string) 4729 @param home full pathname of a file to display
4716 @param version indication for the requested version (Qt 4) (integer) 4730 @type str
4731 @param version indication for the requested version (4 = Qt 4/5)
4732 @type int
4717 """ 4733 """
4718 if version < 4: 4734 if version < 4:
4719 E5MessageBox.information( 4735 E5MessageBox.information(
4720 self, 4736 self,
4721 self.tr("Qt 3 support"), 4737 self.tr("Qt 3 support"),
4749 'Ensure that it is available as <b>{0}</b>.</p>' 4765 'Ensure that it is available as <b>{0}</b>.</p>'
4750 ).format(assistant)) 4766 ).format(assistant))
4751 4767
4752 def __assistant4(self): 4768 def __assistant4(self):
4753 """ 4769 """
4754 Private slot to start the Qt-Assistant 4 executable. 4770 Private slot to start the Qt-Assistant 4/5 executable.
4755 """ 4771 """
4756 self.__assistant(version=4) 4772 self.__assistant(version=4)
4757 4773
4758 def __startWebBrowser(self): 4774 def __startWebBrowser(self):
4759 """ 4775 """
5857 @param newPassword new master password (string) 5873 @param newPassword new master password (string)
5858 """ 5874 """
5859 self.masterPasswordChanged.emit(oldPassword, newPassword) 5875 self.masterPasswordChanged.emit(oldPassword, newPassword)
5860 Preferences.convertPasswords(oldPassword, newPassword) 5876 Preferences.convertPasswords(oldPassword, newPassword)
5861 if self.helpWindow is None: 5877 if self.helpWindow is None:
5862 from Helpviewer.Passwords.PasswordManager import PasswordManager 5878 if WEBENGINE_AVAILABLE:
5863 pwManager = PasswordManager() 5879 from WebBrowser.Passwords.PasswordManager import \
5864 pwManager.masterPasswordChanged(oldPassword, newPassword) 5880 PasswordManager
5881 pwManager = PasswordManager()
5882 pwManager.masterPasswordChanged(oldPassword, newPassword)
5883 elif WEBKIT_AVAILABLE:
5884 from Helpviewer.Passwords.PasswordManager import \
5885 PasswordManager
5886 pwManager = PasswordManager()
5887 pwManager.masterPasswordChanged(oldPassword, newPassword)
5865 Utilities.crypto.changeRememberedMaster(newPassword) 5888 Utilities.crypto.changeRememberedMaster(newPassword)
5866 5889
5867 def __reloadAPIs(self): 5890 def __reloadAPIs(self):
5868 """ 5891 """
5869 Private slot to reload the api information. 5892 Private slot to reload the api information.
6437 def showPluginsAvailable(self): 6460 def showPluginsAvailable(self):
6438 """ 6461 """
6439 Public slot to show the plugins available for download. 6462 Public slot to show the plugins available for download.
6440 """ 6463 """
6441 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog 6464 from PluginManager.PluginRepositoryDialog import PluginRepositoryDialog
6442 dlg = PluginRepositoryDialog(self) 6465 dlg = PluginRepositoryDialog(self.pluginManager, self)
6443 res = dlg.exec_() 6466 res = dlg.exec_()
6444 if res == (QDialog.Accepted + 1): 6467 if res == (QDialog.Accepted + 1):
6445 self.__installPlugins(dlg.getDownloadedPlugins()) 6468 self.__installPlugins(dlg.getDownloadedPlugins())
6446 6469
6447 def __pluginsConfigure(self): 6470 def __pluginsConfigure(self):
7037 """ 7060 """
7038 s = w.size() 7061 s = w.size()
7039 p = w.pos() 7062 p = w.pos()
7040 return [p.x(), p.y(), s.width(), s.height(), not w.isHidden()] 7063 return [p.x(), p.y(), s.width(), s.height(), not w.isHidden()]
7041 7064
7065 def getOriginalPathString(self):
7066 """
7067 Public method to get the original PATH environment variable
7068 (i.e. before modifications by eric6 and PyQt5).
7069
7070 @return original PATH environment variable
7071 @rtype str
7072 """
7073 return self.__originalPathString
7074
7042 ############################ 7075 ############################
7043 ## some event handlers below 7076 ## some event handlers below
7044 ############################ 7077 ############################
7045 7078
7046 def showEvent(self, evt): 7079 def showEvent(self, evt):

eric ide

mercurial