UI/UserInterface.py

changeset 2548
03c3840f887d
parent 2474
8727522a69d5
child 2559
56b91939d319
equal deleted inserted replaced
2544:3868561e3962 2548:03c3840f887d
10 import os 10 import os
11 import sys 11 import sys
12 import logging 12 import logging
13 13
14 from PyQt4.QtCore import QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, \ 14 from PyQt4.QtCore import QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate, \
15 QIODevice, QByteArray, qVersion, QProcess, QSize, QUrl, QObject, Qt 15 QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt
16 from PyQt4.QtGui import QSizePolicy, QWidget, QKeySequence, QDesktopServices, \ 16 from PyQt4.QtGui import QSizePolicy, QWidget, QKeySequence, QDesktopServices, \
17 QWhatsThis, QToolBar, QDialog, QSplitter, QApplication, QMenu, QProgressDialog, \ 17 QWhatsThis, QToolBar, QDialog, QSplitter, QApplication, QMenu, QProgressDialog, \
18 QVBoxLayout, QDockWidget, QAction, QLabel 18 QVBoxLayout, QDockWidget, QAction, QLabel
19 from PyQt4.Qsci import QSCINTILLA_VERSION_STR 19 from PyQt4.Qsci import QSCINTILLA_VERSION_STR
20 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \ 20 from PyQt4.QtNetwork import QNetworkProxyFactory, QNetworkAccessManager, \
179 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) 179 QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
180 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png")) 180 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
181 self.__setWindowCaption() 181 self.__setWindowCaption()
182 182
183 # load the view profiles 183 # load the view profiles
184 self.profiles = Preferences.getUI("ViewProfiles") 184 self.profiles = Preferences.getUI("ViewProfiles2")
185 185
186 # Generate the debug server object 186 # Generate the debug server object
187 from Debugger.DebugServer import DebugServer 187 from Debugger.DebugServer import DebugServer
188 debugServer = DebugServer() 188 debugServer = DebugServer()
189 189
3132 """ 3132 """
3133 if self.currentProfile and save: 3133 if self.currentProfile and save:
3134 # step 1: save the window geometries of the active profile 3134 # step 1: save the window geometries of the active profile
3135 if self.layout in ["Toolboxes", "Sidebars"]: 3135 if self.layout in ["Toolboxes", "Sidebars"]:
3136 state = self.saveState() 3136 state = self.saveState()
3137 self.profiles[self.currentProfile][4] = bytes(state) 3137 self.profiles[self.currentProfile][0] = state
3138 if self.layout == "Sidebars": 3138 if self.layout == "Sidebars":
3139 state = self.leftSplitter.saveState() 3139 state = self.leftSplitter.saveState()
3140 self.profiles[self.currentProfile][6][0] = bytes(state) 3140 self.profiles[self.currentProfile][2][0] = state
3141 state = self.verticalSplitter.saveState() 3141 state = self.verticalSplitter.saveState()
3142 self.profiles[self.currentProfile][6][1] = bytes(state) 3142 self.profiles[self.currentProfile][2][1] = state
3143 state = self.leftSidebar.saveState() 3143 state = self.leftSidebar.saveState()
3144 self.profiles[self.currentProfile][6][2] = bytes(state) 3144 self.profiles[self.currentProfile][2][2] = state
3145 state = self.bottomSidebar.saveState() 3145 state = self.bottomSidebar.saveState()
3146 self.profiles[self.currentProfile][6][3] = bytes(state) 3146 self.profiles[self.currentProfile][2][3] = state
3147 state = self.rightSplitter.saveState() 3147 state = self.rightSplitter.saveState()
3148 self.profiles[self.currentProfile][6][4] = bytes(state) 3148 self.profiles[self.currentProfile][2][4] = state
3149 state = self.rightSidebar.saveState() 3149 state = self.rightSidebar.saveState()
3150 self.profiles[self.currentProfile][6][5] = bytes(state) 3150 self.profiles[self.currentProfile][2][5] = state
3151 # step 2: save the visibility of the windows of the active profile 3151 # step 2: save the visibility of the windows of the active profile
3152 if self.layout == "Toolboxes": 3152 if self.layout == "Toolboxes":
3153 self.profiles[self.currentProfile][5][0] = self.lToolboxDock.isVisible() 3153 self.profiles[self.currentProfile][1][0] = self.lToolboxDock.isVisible()
3154 self.profiles[self.currentProfile][5][1] = self.hToolboxDock.isVisible() 3154 self.profiles[self.currentProfile][1][1] = self.hToolboxDock.isVisible()
3155 self.profiles[self.currentProfile][5][2] = self.rToolboxDock.isVisible() 3155 self.profiles[self.currentProfile][1][2] = self.rToolboxDock.isVisible()
3156 elif self.layout == "Sidebars": 3156 elif self.layout == "Sidebars":
3157 self.profiles[self.currentProfile][5][0] = self.leftSidebar.isVisible() 3157 self.profiles[self.currentProfile][1][0] = self.leftSidebar.isVisible()
3158 self.profiles[self.currentProfile][5][1] = self.bottomSidebar.isVisible() 3158 self.profiles[self.currentProfile][1][1] = self.bottomSidebar.isVisible()
3159 self.profiles[self.currentProfile][5][2] = self.rightSidebar.isVisible() 3159 self.profiles[self.currentProfile][1][2] = self.rightSidebar.isVisible()
3160 Preferences.setUI("ViewProfiles", self.profiles) 3160 Preferences.setUI("ViewProfiles2", self.profiles)
3161 3161
3162 def __activateViewProfile(self, name, save=True): 3162 def __activateViewProfile(self, name, save=True):
3163 """ 3163 """
3164 Private slot to activate a view profile. 3164 Private slot to activate a view profile.
3165 3165
3171 # step 1: save the active profile 3171 # step 1: save the active profile
3172 self.__saveCurrentViewProfile(save) 3172 self.__saveCurrentViewProfile(save)
3173 3173
3174 # step 2: set the window geometries of the new profile 3174 # step 2: set the window geometries of the new profile
3175 if self.layout in ["Toolboxes", "Sidebars"]: 3175 if self.layout in ["Toolboxes", "Sidebars"]:
3176 state = QByteArray(self.profiles[name][4]) 3176 state = self.profiles[name][0]
3177 if not state.isEmpty(): 3177 if not state.isEmpty():
3178 self.restoreState(state) 3178 self.restoreState(state)
3179 if self.layout == "Sidebars": 3179 if self.layout == "Sidebars":
3180 state = QByteArray(self.profiles[name][6][0]) 3180 state = self.profiles[name][2][0]
3181 if not state.isEmpty(): 3181 if not state.isEmpty():
3182 self.leftSplitter.restoreState(state) 3182 self.leftSplitter.restoreState(state)
3183 state = QByteArray(self.profiles[name][6][1]) 3183 state = self.profiles[name][2][1]
3184 if not state.isEmpty(): 3184 if not state.isEmpty():
3185 self.verticalSplitter.restoreState(state) 3185 self.verticalSplitter.restoreState(state)
3186 state = QByteArray(self.profiles[name][6][2]) 3186 state = self.profiles[name][2][2]
3187 if not state.isEmpty(): 3187 if not state.isEmpty():
3188 self.leftSidebar.restoreState(state) 3188 self.leftSidebar.restoreState(state)
3189 state = QByteArray(self.profiles[name][6][3]) 3189 state = self.profiles[name][2][3]
3190 if not state.isEmpty(): 3190 if not state.isEmpty():
3191 self.bottomSidebar.restoreState(state) 3191 self.bottomSidebar.restoreState(state)
3192 state = QByteArray(self.profiles[name][6][4]) 3192 state = self.profiles[name][2][4]
3193 if not state.isEmpty(): 3193 if not state.isEmpty():
3194 self.rightSplitter.restoreState(state) 3194 self.rightSplitter.restoreState(state)
3195 state = QByteArray(self.profiles[name][6][5]) 3195 state = self.profiles[name][2][5]
3196 if not state.isEmpty(): 3196 if not state.isEmpty():
3197 self.rightSidebar.restoreState(state) 3197 self.rightSidebar.restoreState(state)
3198 self.__configureDockareaCornerUsage() 3198 self.__configureDockareaCornerUsage()
3199 3199
3200 # step 3: activate the windows of the new profile 3200 # step 3: activate the windows of the new profile
3201 if self.layout == "Toolboxes": 3201 if self.layout == "Toolboxes":
3202 self.lToolboxDock.setVisible(self.profiles[name][5][0]) 3202 self.lToolboxDock.setVisible(self.profiles[name][1][0])
3203 self.hToolboxDock.setVisible(self.profiles[name][5][1]) 3203 self.hToolboxDock.setVisible(self.profiles[name][1][1])
3204 self.rToolboxDock.setVisible(self.profiles[name][5][2]) 3204 self.rToolboxDock.setVisible(self.profiles[name][1][2])
3205 elif self.layout == "Sidebars": 3205 elif self.layout == "Sidebars":
3206 self.leftSidebar.setVisible(self.profiles[name][5][0]) 3206 self.leftSidebar.setVisible(self.profiles[name][1][0])
3207 self.bottomSidebar.setVisible(self.profiles[name][5][1]) 3207 self.bottomSidebar.setVisible(self.profiles[name][1][1])
3208 self.rightSidebar.setVisible(self.profiles[name][5][2]) 3208 self.rightSidebar.setVisible(self.profiles[name][1][2])
3209 3209
3210 # step 4: remember the new profile 3210 # step 4: remember the new profile
3211 self.currentProfile = name 3211 self.currentProfile = name
3212 3212
3213 # step 5: make sure that cursor of the shell is visible 3213 # step 5: make sure that cursor of the shell is visible
4725 def __configViewProfiles(self): 4725 def __configViewProfiles(self):
4726 """ 4726 """
4727 Private slot to configure the various view profiles. 4727 Private slot to configure the various view profiles.
4728 """ 4728 """
4729 from Preferences.ViewProfileDialog import ViewProfileDialog 4729 from Preferences.ViewProfileDialog import ViewProfileDialog
4730 dlg = ViewProfileDialog(self.layout, self.profiles, 4730 dlg = ViewProfileDialog(self.layout,
4731 not self.embeddedShell, not self.embeddedFileBrowser) 4731 self.profiles['edit'][1], self.profiles['debug'][1])
4732 if dlg.exec_() == QDialog.Accepted: 4732 if dlg.exec_() == QDialog.Accepted:
4733 self.profiles = dlg.getProfiles() 4733 edit, debug = dlg.getVisibilities()
4734 Preferences.setUI("ViewProfiles", self.profiles) 4734 self.profiles['edit'][1] = edit
4735 self.profiles['debug'][1] = debug
4736 Preferences.setUI("ViewProfiles2", self.profiles)
4735 if self.currentProfile == "edit": 4737 if self.currentProfile == "edit":
4736 self.__setEditProfile(False) 4738 self.__setEditProfile(False)
4737 elif self.currentProfile == "debug": 4739 elif self.currentProfile == "debug":
4738 self.setDebugProfile(False) 4740 self.setDebugProfile(False)
4739 4741

eric ide

mercurial