UI/UserInterface.py

branch
Py2 comp.
changeset 2550
e15087ddb41e
parent 2525
8b507a9a2d40
child 2677
3d4277929fb3
equal deleted inserted replaced
2547:bd6070462f4c 2550:e15087ddb41e
16 import os 16 import os
17 import sys 17 import sys
18 import logging 18 import logging
19 19
20 from PyQt4.QtCore import QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, \ 20 from PyQt4.QtCore import QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, \
21 QIODevice, QByteArray, qVersion, QProcess, QSize, QUrl, QObject, Qt 21 QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt
22 from PyQt4.QtGui import QSizePolicy, QWidget, QKeySequence, QDesktopServices, \ 22 from PyQt4.QtGui import QSizePolicy, QWidget, QKeySequence, QDesktopServices, \
23 QWhatsThis, QToolBar, QDialog, QSplitter, QApplication, QMenu, QProgressDialog, \ 23 QWhatsThis, QToolBar, QDialog, QSplitter, QApplication, QMenu, QProgressDialog, \
24 QVBoxLayout, QDockWidget, QAction, QLabel 24 QVBoxLayout, QDockWidget, QAction, QLabel
25 from PyQt4.Qsci import QSCINTILLA_VERSION_STR 25 from PyQt4.Qsci import QSCINTILLA_VERSION_STR
26 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \ 26 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \
185 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) 185 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
186 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) 186 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
187 self.__setWindowCaption() 187 self.__setWindowCaption()
188 188
189 # load the view profiles 189 # load the view profiles
190 self.profiles = Preferences.getUI("ViewProfiles") 190 self.profiles = Preferences.getUI("ViewProfiles2")
191 191
192 # Generate the debug server object 192 # Generate the debug server object
193 from Debugger.DebugServer import DebugServer 193 from Debugger.DebugServer import DebugServer
194 debugServer = DebugServer() 194 debugServer = DebugServer()
195 195
3138 """ 3138 """
3139 if self.currentProfile and save: 3139 if self.currentProfile and save:
3140 # step 1: save the window geometries of the active profile 3140 # step 1: save the window geometries of the active profile
3141 if self.layout in ["Toolboxes", "Sidebars"]: 3141 if self.layout in ["Toolboxes", "Sidebars"]:
3142 state = self.saveState() 3142 state = self.saveState()
3143 self.profiles[self.currentProfile][4] = bytes(state) 3143 self.profiles[self.currentProfile][0] = state
3144 if self.layout == "Sidebars": 3144 if self.layout == "Sidebars":
3145 state = self.leftSplitter.saveState() 3145 state = self.leftSplitter.saveState()
3146 self.profiles[self.currentProfile][6][0] = bytes(state) 3146 self.profiles[self.currentProfile][2][0] = state
3147 state = self.verticalSplitter.saveState() 3147 state = self.verticalSplitter.saveState()
3148 self.profiles[self.currentProfile][6][1] = bytes(state) 3148 self.profiles[self.currentProfile][2][1] = state
3149 state = self.leftSidebar.saveState() 3149 state = self.leftSidebar.saveState()
3150 self.profiles[self.currentProfile][6][2] = bytes(state) 3150 self.profiles[self.currentProfile][2][2] = state
3151 state = self.bottomSidebar.saveState() 3151 state = self.bottomSidebar.saveState()
3152 self.profiles[self.currentProfile][6][3] = bytes(state) 3152 self.profiles[self.currentProfile][2][3] = state
3153 state = self.rightSplitter.saveState() 3153 state = self.rightSplitter.saveState()
3154 self.profiles[self.currentProfile][6][4] = bytes(state) 3154 self.profiles[self.currentProfile][2][4] = state
3155 state = self.rightSidebar.saveState() 3155 state = self.rightSidebar.saveState()
3156 self.profiles[self.currentProfile][6][5] = bytes(state) 3156 self.profiles[self.currentProfile][2][5] = state
3157 # step 2: save the visibility of the windows of the active profile 3157 # step 2: save the visibility of the windows of the active profile
3158 if self.layout == "Toolboxes": 3158 if self.layout == "Toolboxes":
3159 self.profiles[self.currentProfile][5][0] = self.lToolboxDock.isVisible() 3159 self.profiles[self.currentProfile][1][0] = self.lToolboxDock.isVisible()
3160 self.profiles[self.currentProfile][5][1] = self.hToolboxDock.isVisible() 3160 self.profiles[self.currentProfile][1][1] = self.hToolboxDock.isVisible()
3161 self.profiles[self.currentProfile][5][2] = self.rToolboxDock.isVisible() 3161 self.profiles[self.currentProfile][1][2] = self.rToolboxDock.isVisible()
3162 elif self.layout == "Sidebars": 3162 elif self.layout == "Sidebars":
3163 self.profiles[self.currentProfile][5][0] = self.leftSidebar.isVisible() 3163 self.profiles[self.currentProfile][1][0] = self.leftSidebar.isVisible()
3164 self.profiles[self.currentProfile][5][1] = self.bottomSidebar.isVisible() 3164 self.profiles[self.currentProfile][1][1] = self.bottomSidebar.isVisible()
3165 self.profiles[self.currentProfile][5][2] = self.rightSidebar.isVisible() 3165 self.profiles[self.currentProfile][1][2] = self.rightSidebar.isVisible()
3166 Preferences.setUI("ViewProfiles", self.profiles) 3166 Preferences.setUI("ViewProfiles2", self.profiles)
3167 3167
3168 def __activateViewProfile(self, name, save=True): 3168 def __activateViewProfile(self, name, save=True):
3169 """ 3169 """
3170 Private slot to activate a view profile. 3170 Private slot to activate a view profile.
3171 3171
3177 # step 1: save the active profile 3177 # step 1: save the active profile
3178 self.__saveCurrentViewProfile(save) 3178 self.__saveCurrentViewProfile(save)
3179 3179
3180 # step 2: set the window geometries of the new profile 3180 # step 2: set the window geometries of the new profile
3181 if self.layout in ["Toolboxes", "Sidebars"]: 3181 if self.layout in ["Toolboxes", "Sidebars"]:
3182 state = QByteArray(self.profiles[name][4]) 3182 state = self.profiles[name][0]
3183 if not state.isEmpty(): 3183 if not state.isEmpty():
3184 self.restoreState(state) 3184 self.restoreState(state)
3185 if self.layout == "Sidebars": 3185 if self.layout == "Sidebars":
3186 state = QByteArray(self.profiles[name][6][0]) 3186 state = self.profiles[name][2][0]
3187 if not state.isEmpty(): 3187 if not state.isEmpty():
3188 self.leftSplitter.restoreState(state) 3188 self.leftSplitter.restoreState(state)
3189 state = QByteArray(self.profiles[name][6][1]) 3189 state = self.profiles[name][2][1]
3190 if not state.isEmpty(): 3190 if not state.isEmpty():
3191 self.verticalSplitter.restoreState(state) 3191 self.verticalSplitter.restoreState(state)
3192 state = QByteArray(self.profiles[name][6][2]) 3192 state = self.profiles[name][2][2]
3193 if not state.isEmpty(): 3193 if not state.isEmpty():
3194 self.leftSidebar.restoreState(state) 3194 self.leftSidebar.restoreState(state)
3195 state = QByteArray(self.profiles[name][6][3]) 3195 state = self.profiles[name][2][3]
3196 if not state.isEmpty(): 3196 if not state.isEmpty():
3197 self.bottomSidebar.restoreState(state) 3197 self.bottomSidebar.restoreState(state)
3198 state = QByteArray(self.profiles[name][6][4]) 3198 state = self.profiles[name][2][4]
3199 if not state.isEmpty(): 3199 if not state.isEmpty():
3200 self.rightSplitter.restoreState(state) 3200 self.rightSplitter.restoreState(state)
3201 state = QByteArray(self.profiles[name][6][5]) 3201 state = self.profiles[name][2][5]
3202 if not state.isEmpty(): 3202 if not state.isEmpty():
3203 self.rightSidebar.restoreState(state) 3203 self.rightSidebar.restoreState(state)
3204 self.__configureDockareaCornerUsage() 3204 self.__configureDockareaCornerUsage()
3205 3205
3206 # step 3: activate the windows of the new profile 3206 # step 3: activate the windows of the new profile
3207 if self.layout == "Toolboxes": 3207 if self.layout == "Toolboxes":
3208 self.lToolboxDock.setVisible(self.profiles[name][5][0]) 3208 self.lToolboxDock.setVisible(self.profiles[name][1][0])
3209 self.hToolboxDock.setVisible(self.profiles[name][5][1]) 3209 self.hToolboxDock.setVisible(self.profiles[name][1][1])
3210 self.rToolboxDock.setVisible(self.profiles[name][5][2]) 3210 self.rToolboxDock.setVisible(self.profiles[name][1][2])
3211 elif self.layout == "Sidebars": 3211 elif self.layout == "Sidebars":
3212 self.leftSidebar.setVisible(self.profiles[name][5][0]) 3212 self.leftSidebar.setVisible(self.profiles[name][1][0])
3213 self.bottomSidebar.setVisible(self.profiles[name][5][1]) 3213 self.bottomSidebar.setVisible(self.profiles[name][1][1])
3214 self.rightSidebar.setVisible(self.profiles[name][5][2]) 3214 self.rightSidebar.setVisible(self.profiles[name][1][2])
3215 3215
3216 # step 4: remember the new profile 3216 # step 4: remember the new profile
3217 self.currentProfile = name 3217 self.currentProfile = name
3218 3218
3219 # step 5: make sure that cursor of the shell is visible 3219 # step 5: make sure that cursor of the shell is visible
4731 def __configViewProfiles(self): 4731 def __configViewProfiles(self):
4732 """ 4732 """
4733 Private slot to configure the various view profiles. 4733 Private slot to configure the various view profiles.
4734 """ 4734 """
4735 from Preferences.ViewProfileDialog import ViewProfileDialog 4735 from Preferences.ViewProfileDialog import ViewProfileDialog
4736 dlg = ViewProfileDialog(self.layout, self.profiles, 4736 dlg = ViewProfileDialog(self.layout,
4737 not self.embeddedShell, not self.embeddedFileBrowser) 4737 self.profiles['edit'][1], self.profiles['debug'][1])
4738 if dlg.exec_() == QDialog.Accepted: 4738 if dlg.exec_() == QDialog.Accepted:
4739 self.profiles = dlg.getProfiles() 4739 edit, debug = dlg.getVisibilities()
4740 Preferences.setUI("ViewProfiles", self.profiles) 4740 self.profiles['edit'][1] = edit
4741 self.profiles['debug'][1] = debug
4742 Preferences.setUI("ViewProfiles2", self.profiles)
4741 if self.currentProfile == "edit": 4743 if self.currentProfile == "edit":
4742 self.__setEditProfile(False) 4744 self.__setEditProfile(False)
4743 elif self.currentProfile == "debug": 4745 elif self.currentProfile == "debug":
4744 self.setDebugProfile(False) 4746 self.setDebugProfile(False)
4745 4747

eric ide

mercurial