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, editVisibilities, debugVisibilities, |
20 |
21 parent=None): |
21 def __init__(self, layout, editVisibilities, debugVisibilities, parent=None): |
22 """ |
22 """ |
23 Constructor |
23 Constructor |
24 |
24 |
25 @param layout type of the window layout (string) |
25 @param layout type of the window layout (string) |
26 @param editVisibilities list of flags giving the visibilities |
26 @param editVisibilities list of flags giving the visibilities |
27 of the various parts for the 'edit' view profile (list of boolean) |
27 of the various parts for the 'edit' view profile (list of boolean) |
28 @param debugVisibilities list of flags giving the visibilities |
28 @param debugVisibilities list of flags giving the visibilities |
29 of the various parts for the 'debug' view profile (list of boolean) |
29 of the various parts for the 'debug' view profile (list of boolean) |
30 @param parent parent widget of this dialog (QWidget) |
30 @param parent parent widget of this dialog (QWidget) |
31 @exception ValueError raised to indicate an invalid layout |
31 @exception ValueError raised to indicate an invalid layout |
32 """ |
32 """ |
33 super().__init__(parent) |
33 super().__init__(parent) |
34 |
34 |
35 if layout not in ("Toolboxes", "Sidebars"): |
35 if layout not in ("Toolboxes", "Sidebars"): |
36 raise ValueError( |
36 raise ValueError("Illegal layout given ({0}).".format(self.__layout)) |
37 "Illegal layout given ({0}).".format(self.__layout)) |
37 |
38 |
|
39 self.__layout = layout |
38 self.__layout = layout |
40 if self.__layout == "Toolboxes": |
39 if self.__layout == "Toolboxes": |
41 self.ui = Ui_ViewProfileToolboxesDialog() |
40 self.ui = Ui_ViewProfileToolboxesDialog() |
42 else: |
41 else: |
43 self.ui = Ui_ViewProfileSidebarsDialog() |
42 self.ui = Ui_ViewProfileSidebarsDialog() |
44 self.ui.setupUi(self) |
43 self.ui.setupUi(self) |
45 |
44 |
46 if self.__layout in ["Toolboxes", "Sidebars"]: |
45 if self.__layout in ["Toolboxes", "Sidebars"]: |
47 # set the edit profile |
46 # set the edit profile |
48 self.ui.epltCheckBox.setChecked(editVisibilities[0]) |
47 self.ui.epltCheckBox.setChecked(editVisibilities[0]) |
49 self.ui.ephtCheckBox.setChecked(editVisibilities[1]) |
48 self.ui.ephtCheckBox.setChecked(editVisibilities[1]) |
50 self.ui.eprtCheckBox.setChecked(editVisibilities[2]) |
49 self.ui.eprtCheckBox.setChecked(editVisibilities[2]) |
51 |
50 |
52 # set the debug profile |
51 # set the debug profile |
53 self.ui.dpltCheckBox.setChecked(debugVisibilities[0]) |
52 self.ui.dpltCheckBox.setChecked(debugVisibilities[0]) |
54 self.ui.dphtCheckBox.setChecked(debugVisibilities[1]) |
53 self.ui.dphtCheckBox.setChecked(debugVisibilities[1]) |
55 self.ui.dprtCheckBox.setChecked(debugVisibilities[2]) |
54 self.ui.dprtCheckBox.setChecked(debugVisibilities[2]) |
56 |
55 |
57 msh = self.minimumSizeHint() |
56 msh = self.minimumSizeHint() |
58 self.resize(max(self.width(), msh.width()), msh.height()) |
57 self.resize(max(self.width(), msh.width()), msh.height()) |
59 |
58 |
60 def getVisibilities(self): |
59 def getVisibilities(self): |
61 """ |
60 """ |
62 Public method to retrieve the visibilities configuration. |
61 Public method to retrieve the visibilities configuration. |
63 |
62 |
64 @return tuple of two lists giving the visibilities of the |
63 @return tuple of two lists giving the visibilities of the |
65 various parts (two lists of boolean) |
64 various parts (two lists of boolean) |
66 """ |
65 """ |
67 if self.__layout in ["Toolboxes", "Sidebars"]: |
66 if self.__layout in ["Toolboxes", "Sidebars"]: |
68 return ( |
67 return ( |
75 # debug profile |
74 # debug profile |
76 [ |
75 [ |
77 self.ui.dpltCheckBox.isChecked(), |
76 self.ui.dpltCheckBox.isChecked(), |
78 self.ui.dphtCheckBox.isChecked(), |
77 self.ui.dphtCheckBox.isChecked(), |
79 self.ui.dprtCheckBox.isChecked(), |
78 self.ui.dprtCheckBox.isChecked(), |
80 ] |
79 ], |
81 ) |
80 ) |
82 |
81 |
83 return ( |
82 return ( |
84 [True, True, True], # edit profile |
83 [True, True, True], # edit profile |
85 [True, True, True], # debug profile |
84 [True, True, True], # debug profile |
86 ) |
85 ) |