Preferences/ViewProfileDialog.py

changeset 2548
03c3840f887d
parent 2302
f29e9405c851
child 2677
3d4277929fb3
child 2964
84b65fb9e780
equal deleted inserted replaced
2544:3868561e3962 2548:03c3840f887d
15 15
16 class ViewProfileDialog(QDialog): 16 class ViewProfileDialog(QDialog):
17 """ 17 """
18 Class implementing a dialog to configure the various view profiles. 18 Class implementing a dialog to configure the various view profiles.
19 """ 19 """
20 def __init__(self, layout, profiles, separateShell, separateBrowser, parent=None): 20 def __init__(self, layout, editVisibilities, debugVisibilities, parent=None):
21 """ 21 """
22 Constructor 22 Constructor
23 23
24 @param layout type of the window layout (string) 24 @param layout type of the window layout (string)
25 @param profiles dictionary of tuples containing the visibility 25 @param editVisibilities list of flags giving the visibilities
26 of the windows for the various profiles 26 of the various parts for the 'edit' view profile (list of boolean)
27 @param separateShell flag indicating that the Python shell 27 @param debugVisibilities list of flags giving the visibilities
28 is a separate window (boolean) 28 of the various parts for the 'debug' view profile (list of boolean)
29 @param separateBrowser flag indicating that the file browser
30 is a separate window (boolean)
31 @param parent parent widget of this dialog (QWidget) 29 @param parent parent widget of this dialog (QWidget)
32 """ 30 """
33 super().__init__(parent) 31 super().__init__(parent)
34 32
35 self.__layout = layout 33 self.__layout = layout
39 self.ui = Ui_ViewProfileSidebarsDialog() 37 self.ui = Ui_ViewProfileSidebarsDialog()
40 else: 38 else:
41 raise ValueError("Illegal layout given ({0}).".format(self.__layout)) 39 raise ValueError("Illegal layout given ({0}).".format(self.__layout))
42 self.ui.setupUi(self) 40 self.ui.setupUi(self)
43 41
44 self.profiles = profiles
45
46 if self.__layout in ["Toolboxes", "Sidebars"]: 42 if self.__layout in ["Toolboxes", "Sidebars"]:
47 # set the edit profile 43 # set the edit profile
48 profile = self.profiles["edit"][5] 44 self.ui.epltCheckBox.setChecked(editVisibilities[0])
49 self.ui.epltCheckBox.setChecked(profile[0]) 45 self.ui.ephtCheckBox.setChecked(editVisibilities[1])
50 self.ui.ephtCheckBox.setChecked(profile[1]) 46 self.ui.eprtCheckBox.setChecked(editVisibilities[2])
51 self.ui.eprtCheckBox.setChecked(profile[2])
52 47
53 # set the debug profile 48 # set the debug profile
54 profile = self.profiles["debug"][5] 49 self.ui.dpltCheckBox.setChecked(debugVisibilities[0])
55 self.ui.dpltCheckBox.setChecked(profile[0]) 50 self.ui.dphtCheckBox.setChecked(debugVisibilities[1])
56 self.ui.dphtCheckBox.setChecked(profile[1]) 51 self.ui.dprtCheckBox.setChecked(debugVisibilities[2])
57 self.ui.dprtCheckBox.setChecked(profile[2])
58 52
59 def getProfiles(self): 53 def getVisibilities(self):
60 """ 54 """
61 Public method to retrieve the configured profiles. 55 Public method to retrieve the visibilities configuration.
62 56
63 @return dictionary of tuples containing the visibility 57 @return tuple of two lists giving the visibilities of the
64 of the windows for the various profiles 58 various parts ( two lists of boolean)
65 """ 59 """
66 if self.__layout in ["Toolboxes", "Sidebars"]: 60 if self.__layout in ["Toolboxes", "Sidebars"]:
67 # get the edit profile 61 return (
68 self.profiles["edit"][5] = [ 62 # edit profile
69 self.ui.epltCheckBox.isChecked(), 63 [
70 self.ui.ephtCheckBox.isChecked(), 64 self.ui.epltCheckBox.isChecked(),
71 self.ui.eprtCheckBox.isChecked(), 65 self.ui.ephtCheckBox.isChecked(),
72 ] 66 self.ui.eprtCheckBox.isChecked(),
73 # get the debug profile 67 ],
74 self.profiles["debug"][5] = [ 68 # debug profile
75 self.ui.dpltCheckBox.isChecked(), 69 [
76 self.ui.dphtCheckBox.isChecked(), 70 self.ui.dpltCheckBox.isChecked(),
77 self.ui.dprtCheckBox.isChecked(), 71 self.ui.dphtCheckBox.isChecked(),
78 ] 72 self.ui.dprtCheckBox.isChecked(),
79 73 ]
80 return self.profiles 74 )

eric ide

mercurial