예제 #1
0
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(self, parent, "compact_bar_settings", "Compact Bar"
                        "Plot")
     self.bar_cols = LabelledSpinBox(self,
                                     text="Columns Per Page",
                                     minimum=1,
                                     step=1)
     self.bar_rows = LabelledSpinBox(self,
                                     text="Rows Per Page",
                                     minimum=1,
                                     step=1)
     self.x_tick_font = FontComboBox(self, "X Tick Font")
     self.x_tick_font_size = LabelledSpinBox(self,
                                             "X Tick Font Size",
                                             minimum=0,
                                             step=1)
     self.x_tick_rotation = LabelledSpinBox(self,
                                            "X Tick Rotation",
                                            minimum=0,
                                            maximum=360,
                                            step=1)
     self.x_tick_weight = LabelledCombobox(self,
                                           "X Tick Font Weight",
                                           items=font_weights)
     self.shade_unassigned_checkbox = LabelledCheckbox(
         self, "Shade Unassigned?")
     self.unassigned_shade_alpha = LabelledDoubleSpinBox(self,
                                                         "Unassigned Shade "
                                                         "Transparency",
                                                         minimum=0,
                                                         maximum=1,
                                                         step=0.1)
     self.layout().addWidget(self.bar_cols, 0, 0)
     self.layout().addWidget(self.bar_rows, 1, 0)
     self.layout().addWidget(self.x_tick_font_size, 2, 0)
     self.layout().addWidget(self.x_tick_font, 3, 0)
     self.layout().addWidget(self.x_tick_rotation, 4, 0)
     self.layout().addWidget(self.x_tick_weight, 5, 0)
     self.layout().addWidget(self.shade_unassigned_checkbox, 6, 0)
     self.layout().addWidget(self.unassigned_shade_alpha, 7, 0)
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                       | QDialogButtonBox.Cancel
                                       | QDialogButtonBox.RestoreDefaults)
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(
         QDialogButtonBox.RestoreDefaults).clicked.connect(
             self.get_defaults)
     self.layout().addWidget(self.buttonBox, 8, 0)
     self.get_values()
예제 #2
0
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(self,
                        parent,
                        title="Extended Bar Plot",
                        settings_key=["extended_bar_settings"])
     self.bar_cols = LabelledSpinBox(self,
                                     text="Columns Per Page",
                                     minimum=1,
                                     step=1)
     self.bar_rows = LabelledSpinBox(self,
                                     text="Rows Per Page",
                                     minimum=1,
                                     step=1)
     self.x_tick_font = FontComboBox(self, "X Tick Font")
     self.x_tick_font_size = LabelledSpinBox(self,
                                             "X Tick Font Size",
                                             minimum=0,
                                             step=1)
     self.x_tick_rotation = LabelledSpinBox(self,
                                            "X Tick Rotation",
                                            minimum=0,
                                            maximum=90,
                                            step=1)
     self.x_tick_font_weight = LabelledCombobox(self,
                                                "X Tick Font Weight",
                                                items=font_weights)
     self.x_tick_colour = LabelledCheckbox(self, "Colour X Ticks?")
     # adds widgets
     self.layout().addWidget(self.bar_cols, 0, 0)
     self.layout().addWidget(self.bar_rows, 1, 0)
     self.layout().addWidget(self.x_tick_font_size, 2, 0)
     self.layout().addWidget(self.x_tick_font, 3, 0)
     self.layout().addWidget(self.x_tick_rotation, 4, 0)
     self.layout().addWidget(self.x_tick_font_weight, 5, 0)
     self.layout().addWidget(self.x_tick_colour, 6, 0)
     # buttons
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                       | QDialogButtonBox.Cancel
                                       | QDialogButtonBox.RestoreDefaults)
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(
         QDialogButtonBox.RestoreDefaults).clicked.connect(
             self.get_defaults)
     # sets widget in tab
     self.layout().addWidget(self.buttonBox, 8, 0)
     self.get_values()
예제 #3
0
class ResidueEvolutionPopup(BasePopup):
    """
    A popup for setting Residue Evolution Plot specific settings in the
    Farseer-NMR configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(self,
                           parent,
                           title="Residue Evolution Plot",
                           settings_key=["res_evo_settings"])
        self.res_evo_cols = LabelledSpinBox(self,
                                            text="Columns Per Page",
                                            minimum=1,
                                            step=1)
        self.res_evo_rows = LabelledSpinBox(self,
                                            text="Rows Per Page",
                                            minimum=1,
                                            step=1)
        self.res_evo_set_x_values = LabelledCheckbox(
            self, "Use User Defined X Values?")
        self.res_evo_x_ticks_nbins = LabelledSpinBox(self,
                                                     text="Number of Ticks",
                                                     minimum=1,
                                                     step=1)
        self.res_evo_x_label = LabelledLineEdit(self, text="X Label")
        self.res_evo_plot_line_style = LabelledCombobox(
            self, text="Plot Line Style", items=["-", "--", "-.", ":"])
        self.res_evo_plot_line_width = LabelledSpinBox(self,
                                                       "Line Width",
                                                       minimum=0,
                                                       step=1)
        self.res_evo_line_color = ColourBox(self, text="Line Colour")
        self.res_evo_plot_marker_style = LabelledCombobox(
            self, text="Marker Style", items=["-", "--", "-.", ":", "o"])
        self.res_evo_plot_marker_size = LabelledSpinBox(self,
                                                        "Marker Size",
                                                        minimum=0,
                                                        step=1)
        self.res_evo_marker_color = ColourBox(self, text="Marker Colour")
        self.res_evo_plot_fill_between = LabelledCheckbox(
            self, text="Draw Data Shade")
        self.res_evo_plot_fill_colour = ColourBox(self, text="Shade Colour")
        self.res_evo_fill_alpha = LabelledDoubleSpinBox(
            self, text="Shade Transparency", minimum=0, maximum=1, step=0.1)
        self.res_evo_fit_line_colour = ColourBox(self, text="Fit Line Colour")
        self.res_evo_fit_line_width = LabelledSpinBox(self,
                                                      text="Fit Line Width",
                                                      minimum=0,
                                                      step=1)
        self.res_evo_fit_line_style = LabelledCombobox(
            self, text="Fit Line Style", items=["-", "--", "-.", ":", "o"])
        self.layout().addWidget(self.res_evo_cols, 0, 0)
        self.layout().addWidget(self.res_evo_rows, 1, 0)
        self.layout().addWidget(self.res_evo_set_x_values, 2, 0)
        self.layout().addWidget(self.res_evo_x_ticks_nbins, 3, 0)
        self.layout().addWidget(self.res_evo_x_label, 4, 0)
        self.layout().addWidget(self.res_evo_plot_line_style, 5, 0)
        self.layout().addWidget(self.res_evo_plot_line_width, 6, 0)
        self.layout().addWidget(self.res_evo_line_color, 7, 0)
        self.layout().addWidget(self.res_evo_plot_marker_style, 0, 1)
        self.layout().addWidget(self.res_evo_plot_marker_size, 1, 1)
        self.layout().addWidget(self.res_evo_marker_color, 2, 1)
        self.layout().addWidget(self.res_evo_plot_fill_between, 3, 1)
        self.layout().addWidget(self.res_evo_plot_fill_colour, 4, 1)
        self.layout().addWidget(self.res_evo_fill_alpha, 5, 1)
        self.layout().addWidget(self.res_evo_fit_line_colour, 6, 1)
        self.layout().addWidget(self.res_evo_fit_line_width, 7, 1)
        self.layout().addWidget(self.res_evo_fit_line_style, 8, 1)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.RestoreDefaults)
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(
            QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.get_defaults)
        self.layout().addWidget(self.buttonBox, 9, 0, 1, 2)
        self.get_values()

    def get_defaults(self):
        # value
        self.res_evo_cols.setValue(self.defaults["cols_page"])
        self.res_evo_rows.setValue(self.defaults["rows_page"])
        self.res_evo_x_ticks_nbins.setValue(self.defaults["x_ticks_nbins"])
        self.res_evo_plot_line_width.setValue(self.defaults["line_width"])
        self.res_evo_plot_marker_size.setValue(self.defaults["marker_size"])
        self.res_evo_fill_alpha.setValue(self.defaults["fill_alpha"])
        self.res_evo_fit_line_width.setValue(self.defaults["fit_line_width"])
        # checked
        self.res_evo_set_x_values.setChecked(self.defaults["set_x_values"])
        # text
        self.res_evo_x_label.field.setText(self.defaults["x_label"])
        # dropdown
        self.res_evo_plot_line_style.select(self.defaults["line_style"])
        self.res_evo_plot_marker_style.select(self.defaults["marker_style"])
        self.res_evo_plot_fill_between.setChecked(
            self.defaults["fill_between"])
        self.res_evo_fit_line_style.select(self.defaults["fit_line_style"])
        # colour
        self.res_evo_line_color.get_colour(self.defaults["line_color"])
        self.res_evo_marker_color.get_colour(self.defaults["marker_color"])
        self.res_evo_plot_fill_colour.get_colour(self.defaults["fill_color"])
        self.res_evo_fit_line_colour.get_colour(
            self.defaults["fit_line_color"])

    def set_values(self):
        # value
        self.local_variables["cols_page"] = self.res_evo_cols.field.value()
        self.local_variables["rows_page"] = self.res_evo_rows.field.value()
        self.local_variables[
            "x_ticks_nbins"] = self.res_evo_x_ticks_nbins.field.value()
        self.local_variables[
            "line_width"] = self.res_evo_plot_line_width.field.value()
        self.local_variables[
            "marker_size"] = self.res_evo_plot_marker_size.field.value()
        self.local_variables[
            "fill_alpha"] = self.res_evo_fill_alpha.field.value()
        self.local_variables[
            "fit_line_width"] = self.res_evo_fit_line_width.field.value()
        # check
        self.local_variables[
            "set_x_values"] = self.res_evo_set_x_values.isChecked()
        self.local_variables[
            "fill_between"] = self.res_evo_plot_fill_between.isChecked()
        # text
        self.local_variables["x_label"] = self.res_evo_x_label.field.text()
        # dropdown
        self.local_variables[
            "line_style"] = self.res_evo_plot_line_style.fields.currentText()
        self.local_variables[
            "marker_style"] = self.res_evo_plot_marker_style.fields.currentText(
            )
        self.local_variables[
            "fit_line_style"] = self.res_evo_fit_line_style.fields.currentText(
            )
        # colours
        self.local_variables[
            "line_color"] = self.res_evo_line_color.fields.currentText()
        self.local_variables[
            "marker_color"] = self.res_evo_marker_color.fields.currentText()
        self.local_variables[
            "fit_line_color"] = self.res_evo_fit_line_colour.fields.currentText(
            )
        self.local_variables[
            "fill_color"] = self.res_evo_plot_fill_colour.fields.currentText()
        self.accept()

    def get_values(self):
        # values
        self.res_evo_cols.setValue(self.local_variables["cols_page"])
        self.res_evo_rows.setValue(self.local_variables["rows_page"])
        self.res_evo_x_ticks_nbins.setValue(
            self.local_variables["x_ticks_nbins"])
        self.res_evo_plot_line_width.setValue(
            self.local_variables["line_width"])
        self.res_evo_plot_marker_size.setValue(
            self.local_variables["marker_size"])
        self.res_evo_fill_alpha.setValue(self.local_variables["fill_alpha"])
        self.res_evo_fit_line_width.setValue(
            self.local_variables["fit_line_width"])
        # checked
        self.res_evo_set_x_values.setChecked(
            self.local_variables["set_x_values"])
        self.res_evo_plot_fill_between.setChecked(
            self.local_variables["fill_between"])
        # text
        self.res_evo_x_label.field.setText(self.local_variables["x_label"])
        # select
        self.res_evo_plot_line_style.select(self.local_variables["line_style"])
        self.res_evo_plot_marker_style.select(
            self.local_variables["marker_style"])
        self.res_evo_fit_line_style.select(
            self.local_variables["fit_line_style"])
        # colour
        self.res_evo_line_color.get_colour(self.local_variables["line_color"])
        self.res_evo_plot_fill_colour.get_colour(
            self.local_variables["fill_color"])
        self.res_evo_fit_line_colour.get_colour(
            self.local_variables["fit_line_color"])
        self.res_evo_marker_color.get_colour(
            self.local_variables["marker_color"])
예제 #4
0
class ExtendedBarPopup(BasePopup):
    """
    A popup for setting Extended Bar Plot specific settings in the Farseer-NMR
    configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(self,
                           parent,
                           title="Extended Bar Plot",
                           settings_key=["extended_bar_settings"])
        self.bar_cols = LabelledSpinBox(self,
                                        text="Columns Per Page",
                                        minimum=1,
                                        step=1)
        self.bar_rows = LabelledSpinBox(self,
                                        text="Rows Per Page",
                                        minimum=1,
                                        step=1)
        self.x_tick_font = FontComboBox(self, "X Tick Font")
        self.x_tick_font_size = LabelledSpinBox(self,
                                                "X Tick Font Size",
                                                minimum=0,
                                                step=1)
        self.x_tick_rotation = LabelledSpinBox(self,
                                               "X Tick Rotation",
                                               minimum=0,
                                               maximum=90,
                                               step=1)
        self.x_tick_font_weight = LabelledCombobox(self,
                                                   "X Tick Font Weight",
                                                   items=font_weights)
        self.x_tick_colour = LabelledCheckbox(self, "Colour X Ticks?")
        # adds widgets
        self.layout().addWidget(self.bar_cols, 0, 0)
        self.layout().addWidget(self.bar_rows, 1, 0)
        self.layout().addWidget(self.x_tick_font_size, 2, 0)
        self.layout().addWidget(self.x_tick_font, 3, 0)
        self.layout().addWidget(self.x_tick_rotation, 4, 0)
        self.layout().addWidget(self.x_tick_font_weight, 5, 0)
        self.layout().addWidget(self.x_tick_colour, 6, 0)
        # buttons
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.RestoreDefaults)
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(
            QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.get_defaults)
        # sets widget in tab
        self.layout().addWidget(self.buttonBox, 8, 0)
        self.get_values()

    def get_defaults(self):
        # check
        self.x_tick_colour.setChecked(self.defaults["x_ticks_color_flag"])
        # values
        self.bar_cols.setValue(self.defaults["cols_page"])
        self.bar_rows.setValue(self.defaults["rows_page"])
        self.x_tick_font_size.setValue(self.defaults["x_ticks_fs"])
        self.x_tick_rotation.setValue(self.defaults["x_ticks_rot"])
        # select
        self.x_tick_font.select(self.defaults["x_ticks_fn"])
        self.x_tick_font_weight.select(self.defaults["x_ticks_weight"])

    def get_values(self):
        # checked
        self.x_tick_colour.setChecked(
            self.local_variables["x_ticks_color_flag"])
        # value
        self.bar_cols.setValue(self.local_variables["cols_page"])
        self.bar_rows.setValue(self.local_variables["rows_page"])
        self.x_tick_font_size.setValue(self.local_variables["x_ticks_fs"])
        self.x_tick_rotation.setValue(self.local_variables["x_ticks_rot"])
        # select
        self.x_tick_font.select(self.local_variables["x_ticks_fn"])
        self.x_tick_font_weight.select(self.local_variables["x_ticks_weight"])

    def set_values(self):
        # checked
        self.local_variables[
            "x_ticks_color_flag"] = self.x_tick_colour.isChecked()
        # value
        self.local_variables["cols_page"] = self.bar_cols.field.value()
        self.local_variables["rows_page"] = self.bar_rows.field.value()
        self.local_variables["x_ticks_fs"] = self.x_tick_font_size.field.value(
        )
        self.local_variables["x_ticks_rot"] = self.x_tick_rotation.field.value(
        )
        # text
        self.local_variables["x_ticks_fn"] = str(
            self.x_tick_font.fields.currentText())
        self.local_variables["x_ticks_weight"] = str(
            self.x_tick_font_weight.fields.currentText())
        self.accept()
예제 #5
0
 def __init__(self, parent, text=None):
     LabelledCombobox.__init__(self, parent, text)
     for item in colours.items():
         pix = QPixmap(QtCore.QSize(20, 20))
         pix.fill(QColor(item[1]))
         self.fields.addItem(QIcon(pix), item[0])
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(
         self,
         parent,
         title="Scatter Flower Plot",
         settings_key=["cs_scatter_flower_settings"]
         )
     self.x_label = LabelledLineEdit(self, "X Label")
     self.y_label = LabelledLineEdit(self, "Y Label")
     self.mksize = LabelledSpinBox(self, "Mark Size", minimum=0, step=1)
     self.color_grad = LabelledCheckbox(self, "Colour Gradient")
     self.color_start = ColourBox(self, text="Mark Start Colour")
     self.color_end = ColourBox(self, text="Mark End Colour")
     self.color_list = LabelledLineEdit(self, "Colour List")
     self.x_label_fn = FontComboBox(self, "X Label Font")
     self.x_label_fs = LabelledSpinBox(self, "X Label Font Size", minimum=0, step=1)
     self.x_label_pad = LabelledDoubleSpinBox(
         self,
         "X Label Padding",
         minimum=-100,
         maximum=100,
         step=0.1
         )
     self.x_label_weight = LabelledCombobox(self, text="X Label Font Weight", items=font_weights)
     self.y_label_fn = FontComboBox(self, "Y Label Font")
     self.y_label_fs = LabelledSpinBox(self, "Y Label Font Size", minimum=0, step=1)
     self.y_label_pad = LabelledDoubleSpinBox(
         self,
         "Y Label Padding",
         minimum=-100,
         maximum=100,
         step=0.1
         )
     self.y_label_weight = LabelledCombobox(
         self,
         text="Y Label Font Weight",
         items=font_weights
         )
     self.x_ticks_fn = FontComboBox(self, "X Tick Font")
     self.x_ticks_fs = LabelledSpinBox(self, "X Tick Font Size", minimum=0, step=1)
     self.x_ticks_pad = LabelledDoubleSpinBox(
         self,
         "X Tick Padding",
         minimum=-100,
         maximum=100,
         step=0.1
         )
     self.x_ticks_weight = LabelledCombobox(self, text="X Tick Weight", items=font_weights)
     self.x_ticks_rot = LabelledSpinBox(
         self,
         "X Tick Rotation",
         minimum=0,
         maximum=360,
         step=1
         )
     self.y_ticks_fn = FontComboBox(self, "Y Tick Font")
     self.y_ticks_fs = LabelledSpinBox(self, "Y Tick Font Size", minimum=0, step=1)
     self.y_ticks_pad = LabelledDoubleSpinBox(
         self,
         "Y Tick Padding",
         minimum=-100,
         maximum=100,
         step=0.1
         )
     self.y_ticks_weight = LabelledCombobox(self, text="Y Tick Weight", items=font_weights)
     self.y_ticks_rot = LabelledSpinBox(
         self,
         "Y Tick Rotation",
         minimum=0,
         maximum=360,
         step=1
         )
     self.res_label_color = ColourBox(self, text="Residue Label Colour")
     # layout
     self.layout().addWidget(self.x_label, 0, 0)
     self.layout().addWidget(self.y_label, 1, 0)
     self.layout().addWidget(self.mksize, 2, 0)
     self.layout().addWidget(self.color_grad, 3, 0)
     self.layout().addWidget(self.color_start, 4, 0)
     self.layout().addWidget(self.color_end, 5, 0)
     self.layout().addWidget(self.x_label_fn, 6, 0)
     self.layout().addWidget(self.x_label_fs, 7, 0)
     self.layout().addWidget(self.color_list, 8, 0)
     self.layout().addWidget(self.res_label_color, 8, 1)
     self.layout().addWidget(self.x_label_pad, 0, 1)
     self.layout().addWidget(self.x_label_weight, 1, 1)
     self.layout().addWidget(self.y_label_fn, 2, 1)
     self.layout().addWidget(self.y_label_fs, 3, 1)
     self.layout().addWidget(self.y_label_pad, 4, 1)
     self.layout().addWidget(self.y_label_weight, 5, 1)
     self.layout().addWidget(self.x_ticks_fn, 6, 1)
     self.layout().addWidget(self.x_ticks_fs, 7, 1)
     self.layout().addWidget(self.x_ticks_pad, 0, 2)
     self.layout().addWidget(self.x_ticks_weight, 1, 2)
     self.layout().addWidget(self.x_ticks_rot, 2, 2)
     self.layout().addWidget(self.y_ticks_fn, 3, 2)
     self.layout().addWidget(self.y_ticks_fs, 4, 2)
     self.layout().addWidget(self.y_ticks_pad, 5, 2)
     self.layout().addWidget(self.y_ticks_weight, 6, 2)
     self.layout().addWidget(self.y_ticks_rot, 7, 2)
     self.buttonBox = QDialogButtonBox(
         QDialogButtonBox.Ok |
         QDialogButtonBox.Cancel |
         QDialogButtonBox.RestoreDefaults
         )
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(QDialogButtonBox.RestoreDefaults).clicked.connect(self.get_defaults)
     self.layout().addWidget(self.buttonBox, 9, 0, 1, 2)
     self.get_values()
예제 #7
0
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(self,
                        parent,
                        title="Scatter Plot",
                        settings_key=["cs_scatter_settings"])
     self.cs_scatter_cols_page = LabelledSpinBox(self,
                                                 "Columns Per Page",
                                                 minimum=1,
                                                 step=1)
     self.cs_scatter_rows_page = LabelledSpinBox(self,
                                                 "Rows Per Page",
                                                 minimum=1,
                                                 step=1)
     self.cs_scatter_x_label = LabelledLineEdit(self, "X Label")
     self.cs_scatter_y_label = LabelledLineEdit(self, "Y Label")
     self.cs_scatter_mksize = LabelledSpinBox(self,
                                              "Mark Size",
                                              minimum=0,
                                              step=1)
     self.cs_scatter_scale = LabelledDoubleSpinBox(self,
                                                   "Scale",
                                                   minimum=0,
                                                   step=0.01)
     self.cs_scatter_mk_type = LabelledCombobox(self,
                                                text="Mark Type",
                                                items=['color', 'shape'])
     self.cs_scatter_mk_start_color = ColourBox(self,
                                                text="Mark Start Colour")
     self.cs_scatter_mk_end_color = ColourBox(self, text="Mark End Colour")
     self.cs_scatter_markers = LabelledLineEdit(self, "Sequential Markers")
     self.cs_scatter_mk_color = LabelledLineEdit(self, text="Mark Colours")
     self.cs_scatter_mk_missing_color = ColourBox(self,
                                                  "Missing Mark Colour")
     self.cs_scatter_mk_edgecolors = LabelledLineEdit(
         self, "Marker Edge Colours")
     self.cs_scatter_hide_missing = LabelledCheckbox(
         self, "Hide Missing Data Points")
     # layout
     self.layout().addWidget(self.cs_scatter_cols_page, 0, 0)
     self.layout().addWidget(self.cs_scatter_rows_page, 1, 0)
     self.layout().addWidget(self.cs_scatter_x_label, 2, 0)
     self.layout().addWidget(self.cs_scatter_y_label, 3, 0)
     self.layout().addWidget(self.cs_scatter_mksize, 4, 0)
     self.layout().addWidget(self.cs_scatter_scale, 5, 0)
     self.layout().addWidget(self.cs_scatter_mk_type, 6, 0)
     self.layout().addWidget(self.cs_scatter_mk_start_color, 0, 1)
     self.layout().addWidget(self.cs_scatter_mk_end_color, 1, 1)
     self.layout().addWidget(self.cs_scatter_markers, 2, 1)
     self.layout().addWidget(self.cs_scatter_mk_color, 3, 1)
     self.layout().addWidget(self.cs_scatter_mk_edgecolors, 4, 1)
     self.layout().addWidget(self.cs_scatter_mk_missing_color, 5, 1)
     self.layout().addWidget(self.cs_scatter_hide_missing, 6, 1)
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                       | QDialogButtonBox.Cancel
                                       | QDialogButtonBox.RestoreDefaults)
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(
         QDialogButtonBox.RestoreDefaults).clicked.connect(
             self.get_defaults)
     self.layout().addWidget(self.buttonBox, 7, 0, 1, 2)
     self.get_values()
class GeneralResidueEvolution(BasePopup):
    """
    A popup for setting General Residue Evolution Plot specific settings in the
    Farseer-NMR configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(self,
                           parent,
                           title="Residue Evolution Plot",
                           settings_key=["revo_settings"])
        self.do_revo_fit = LabelledCheckbox(self,
                                            text="Fit Parameter Evolution")
        self.revo_subtitle_fn = FontComboBox(self, text="Subtitle Font")
        self.revo_subtitle_fs = LabelledSpinBox(self,
                                                text="Subtitle Font Size",
                                                minimum=0,
                                                step=1)
        self.revo_subtitle_pad = LabelledDoubleSpinBox(self,
                                                       text="Subtitle Padding",
                                                       minimum=-100,
                                                       maximum=100,
                                                       step=0.1)
        self.revo_subtitle_weight = LabelledCombobox(
            self, text="Subtitle Font Weight", items=font_weights)
        self.revo_x_label_fn = FontComboBox(self, text="X Label Font")
        self.revo_x_label_fs = LabelledSpinBox(self,
                                               text="X Label Font Size",
                                               minimum=0,
                                               step=1)
        self.revo_x_label_pad = LabelledDoubleSpinBox(self,
                                                      text="X Label Padding",
                                                      minimum=-100,
                                                      maximum=100,
                                                      step=0.1)
        self.revo_x_label_weight = LabelledCombobox(self,
                                                    text="X Label Font Weight",
                                                    items=font_weights)
        self.revo_y_label_fn = FontComboBox(self, text="Y Label Font Size")
        self.revo_y_label_fs = LabelledSpinBox(self,
                                               text="Y Label Font Size",
                                               minimum=0,
                                               step=1)
        self.revo_y_label_pad = LabelledSpinBox(self,
                                                text="Y Label Padding",
                                                minimum=-100,
                                                maximum=100,
                                                step=0.1)
        self.revo_y_label_weight = LabelledCombobox(self,
                                                    text="Y Label Font Weight",
                                                    items=font_weights)
        self.revo_x_ticks_fn = FontComboBox(self, text="X Tick Font")
        self.revo_x_ticks_fs = LabelledSpinBox(self,
                                               text="X Tick Font Size",
                                               minimum=0,
                                               step=1)
        self.revo_x_ticks_pad = LabelledDoubleSpinBox(self,
                                                      text="X Tick Padding",
                                                      minimum=-100,
                                                      maximum=100,
                                                      step=0.1)
        self.revo_x_ticks_weight = LabelledCombobox(self,
                                                    text="X Tick Font Weight",
                                                    items=font_weights)
        self.revo_x_ticks_rotation = LabelledDoubleSpinBox(
            self, text="X Tick Rotation", minimum=0, maximum=360, step=1)
        self.revo_y_ticks_fn = FontComboBox(self, text="Y Tick Font")
        self.revo_y_ticks_fs = LabelledSpinBox(self,
                                               text="Y Tick Font Size",
                                               minimum=0,
                                               step=1)
        self.revo_y_ticks_pad = LabelledDoubleSpinBox(self,
                                                      text="Y Tick Padding",
                                                      minimum=-100,
                                                      maximum=100,
                                                      step=0.1)
        self.revo_y_ticks_weight = LabelledCombobox(self,
                                                    text="Y Tick Font Weight",
                                                    items=font_weights)
        self.revo_y_ticks_rot = LabelledSpinBox(self,
                                                text="Y Tick Rotation",
                                                minimum=0,
                                                maximum=360,
                                                step=1)
        self.titration_x_values = LabelledLineEdit(self,
                                                   text="Titration X Values")
        # add widgets
        self.layout().addWidget(self.revo_subtitle_fn, 0, 0)
        self.layout().addWidget(self.revo_subtitle_fs, 1, 0)
        self.layout().addWidget(self.revo_subtitle_pad, 2, 0)
        self.layout().addWidget(self.revo_subtitle_weight, 3, 0)
        self.layout().addWidget(self.revo_x_label_fn, 4, 0)
        self.layout().addWidget(self.revo_x_label_fs, 5, 0)
        self.layout().addWidget(self.revo_x_label_pad, 6, 0)
        self.layout().addWidget(self.revo_x_label_weight, 7, 0)
        self.layout().addWidget(self.revo_y_label_fn, 8, 0)
        self.layout().addWidget(self.revo_y_label_fs, 9, 0)
        self.layout().addWidget(self.revo_y_label_pad, 10, 0)
        self.layout().addWidget(self.titration_x_values, 11, 0)
        self.layout().addWidget(self.revo_y_label_weight, 0, 1)
        self.layout().addWidget(self.revo_x_ticks_fn, 1, 1)
        self.layout().addWidget(self.revo_x_ticks_fs, 2, 1)
        self.layout().addWidget(self.revo_x_ticks_pad, 3, 1)
        self.layout().addWidget(self.revo_x_ticks_weight, 4, 1)
        self.layout().addWidget(self.revo_x_ticks_rotation, 5, 1)
        self.layout().addWidget(self.revo_y_ticks_fn, 6, 1)
        self.layout().addWidget(self.revo_y_ticks_fs, 7, 1)
        self.layout().addWidget(self.revo_y_ticks_pad, 8, 1)
        self.layout().addWidget(self.revo_y_ticks_weight, 9, 1)
        self.layout().addWidget(self.revo_y_ticks_rot, 10, 1)
        self.layout().addWidget(self.do_revo_fit, 11, 1)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.RestoreDefaults)
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(
            QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.get_defaults)
        self.layout().addWidget(self.buttonBox, 12, 0, 1, 2)
        self.get_values()

    def get_defaults(self):
        # checkbox
        self.do_revo_fit.checkBox.setChecked(
            self.defaults["perform_resevo_fitting"])
        # dropdown list
        self.revo_subtitle_fn.select(self.defaults["subtitle_fn"])
        self.revo_subtitle_weight.select(self.defaults["subtitle_weight"])
        self.revo_x_label_fn.select(self.defaults["x_label_fn"])
        self.revo_x_label_weight.select(self.defaults["x_label_weight"])
        self.revo_y_label_fn.select(self.defaults["y_label_fn"])
        self.revo_y_label_weight.select(self.defaults["y_label_weight"])
        self.revo_x_ticks_fn.select(self.defaults["x_ticks_fn"])
        self.revo_x_ticks_weight.select(self.defaults["x_ticks_weight"])
        self.revo_y_ticks_fn.select(self.defaults["y_ticks_fn"])
        self.revo_y_ticks_weight.select(self.defaults["y_ticks_weight"])
        # value
        self.revo_subtitle_fs.setValue(self.defaults["subtitle_fs"])
        self.revo_subtitle_pad.setValue(self.defaults["subtitle_pad"])
        self.revo_x_label_fs.setValue(self.defaults["x_label_fs"])
        self.revo_x_label_pad.setValue(self.defaults["x_label_pad"])
        self.revo_y_label_fs.setValue(self.defaults["y_label_fs"])
        self.revo_y_label_pad.setValue(self.defaults["y_label_pad"])
        self.revo_x_ticks_fs.setValue(self.defaults["x_ticks_fs"])
        self.revo_x_ticks_pad.setValue(self.defaults["x_ticks_pad"])
        self.revo_x_ticks_rotation.setValue(self.defaults["x_ticks_rot"])
        self.revo_y_ticks_fs.setValue(self.defaults["y_ticks_fs"])
        self.revo_y_ticks_pad.setValue(self.defaults["y_ticks_pad"])
        self.revo_y_ticks_rot.setValue(self.defaults["y_ticks_rot"])
        # text
        self.titration_x_values.field.setText(','.join(
            [str(x) for x in self.defaults["titration_x_values"]]))

    def set_values(self):
        # checkbox
        self.local_variables[
            "perform_resevo_fitting"] = self.do_revo_fit.isChecked()
        # text
        self.local_variables["subtitle_fn"] = str(
            self.revo_subtitle_fn.fields.currentText())
        self.local_variables["subtitle_weight"] = str(
            self.revo_subtitle_weight.fields.currentText())
        self.local_variables["x_label_fn"] = str(
            self.revo_x_label_fn.fields.currentText())
        self.local_variables["x_label_weight"] = str(
            self.revo_x_label_weight.fields.currentText())
        self.local_variables["y_label_fn"] = str(
            self.revo_y_label_fn.fields.currentText())
        self.local_variables["y_label_weight"] = str(
            self.revo_y_label_weight.fields.currentText())
        self.local_variables["x_ticks_fn"] = str(
            self.revo_x_ticks_fn.fields.currentText())
        self.local_variables["x_ticks_weight"] = str(
            self.revo_x_ticks_weight.fields.currentText())
        self.local_variables["y_ticks_fn"] = str(
            self.revo_y_ticks_fn.fields.currentText())
        self.local_variables["y_ticks_weight"] = str(
            self.revo_y_ticks_weight.fields.currentText())
        # value
        self.local_variables[
            "subtitle_fs"] = self.revo_subtitle_fs.field.value()
        self.local_variables[
            "subtitle_pad"] = self.revo_subtitle_pad.field.value()
        self.local_variables["x_label_fs"] = self.revo_x_label_fs.field.value()
        self.local_variables[
            "x_label_pad"] = self.revo_x_label_pad.field.value()
        self.local_variables["y_label_fs"] = self.revo_y_label_fs.field.value()
        self.local_variables[
            "y_label_pad"] = self.revo_y_label_pad.field.value()
        self.local_variables["x_ticks_fs"] = self.revo_x_ticks_fs.field.value()
        self.local_variables[
            "x_ticks_pad"] = self.revo_x_ticks_pad.field.value()
        self.local_variables[
            "x_ticks_rot"] = self.revo_x_ticks_rotation.field.value()
        self.local_variables["y_ticks_fs"] = self.revo_y_ticks_fs.field.value()
        self.local_variables[
            "y_ticks_pad"] = self.revo_y_ticks_pad.field.value()
        self.local_variables[
            "y_ticks_rot"] = self.revo_y_ticks_rot.field.value()
        # text string list
        self.local_variables["titration_x_values"] = \
            [float(x) for x in self.titration_x_values.field.text().split(',')]
        self.accept()

    def get_values(self):
        # check
        self.do_revo_fit.setChecked(
            self.local_variables["perform_resevo_fitting"])
        # dropdown
        self.revo_subtitle_fn.select(self.local_variables["subtitle_fn"])
        self.revo_subtitle_weight.select(
            self.local_variables["subtitle_weight"])
        self.revo_x_label_fn.select(self.local_variables["x_label_fn"])
        self.revo_x_label_weight.select(self.local_variables["x_label_weight"])
        self.revo_y_label_fn.select(self.local_variables["y_label_fn"])
        self.revo_y_label_weight.select(self.local_variables["y_label_weight"])
        self.revo_x_ticks_fn.select(self.local_variables["x_ticks_fn"])
        self.revo_x_ticks_weight.select(self.local_variables["x_ticks_weight"])
        self.revo_y_ticks_fn.select(self.local_variables["y_ticks_fn"])
        self.revo_y_ticks_weight.select(self.local_variables["y_ticks_weight"])
        #value
        self.revo_subtitle_fs.setValue(self.local_variables["subtitle_fs"])
        self.revo_subtitle_pad.setValue(self.local_variables["subtitle_pad"])
        self.revo_x_label_fs.setValue(self.local_variables["x_label_fs"])
        self.revo_x_label_pad.setValue(self.local_variables["x_label_pad"])
        self.revo_y_label_fs.setValue(self.local_variables["y_label_fs"])
        self.revo_y_label_pad.setValue(self.local_variables["y_label_pad"])
        self.revo_x_ticks_fs.setValue(self.local_variables["x_ticks_fs"])
        self.revo_x_ticks_pad.setValue(self.local_variables["x_ticks_pad"])
        self.revo_x_ticks_rotation.setValue(
            self.local_variables["x_ticks_rot"])
        self.revo_y_ticks_fs.setValue(self.local_variables["y_ticks_fs"])
        self.revo_y_ticks_pad.setValue(self.local_variables["y_ticks_pad"])
        self.revo_y_ticks_rot.setValue(self.local_variables["y_ticks_rot"])
        self.revo_y_ticks_rot.setValue(self.local_variables["y_ticks_rot"])
        # text list string
        self.titration_x_values.field.setText(','.join(
            [str(x) for x in self.local_variables["titration_x_values"]]))
예제 #9
0
class CompactBarPopup(BasePopup):
    """
    A popup for setting Compact Bar Plot specific settings in the Farseer-NMR
    configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(self, parent, "compact_bar_settings", "Compact Bar"
                           "Plot")
        self.bar_cols = LabelledSpinBox(self,
                                        text="Columns Per Page",
                                        minimum=1,
                                        step=1)
        self.bar_rows = LabelledSpinBox(self,
                                        text="Rows Per Page",
                                        minimum=1,
                                        step=1)
        self.x_tick_font = FontComboBox(self, "X Tick Font")
        self.x_tick_font_size = LabelledSpinBox(self,
                                                "X Tick Font Size",
                                                minimum=0,
                                                step=1)
        self.x_tick_rotation = LabelledSpinBox(self,
                                               "X Tick Rotation",
                                               minimum=0,
                                               maximum=360,
                                               step=1)
        self.x_tick_weight = LabelledCombobox(self,
                                              "X Tick Font Weight",
                                              items=font_weights)
        self.shade_unassigned_checkbox = LabelledCheckbox(
            self, "Shade Unassigned?")
        self.unassigned_shade_alpha = LabelledDoubleSpinBox(self,
                                                            "Unassigned Shade "
                                                            "Transparency",
                                                            minimum=0,
                                                            maximum=1,
                                                            step=0.1)
        self.layout().addWidget(self.bar_cols, 0, 0)
        self.layout().addWidget(self.bar_rows, 1, 0)
        self.layout().addWidget(self.x_tick_font_size, 2, 0)
        self.layout().addWidget(self.x_tick_font, 3, 0)
        self.layout().addWidget(self.x_tick_rotation, 4, 0)
        self.layout().addWidget(self.x_tick_weight, 5, 0)
        self.layout().addWidget(self.shade_unassigned_checkbox, 6, 0)
        self.layout().addWidget(self.unassigned_shade_alpha, 7, 0)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.RestoreDefaults)
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(
            QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.get_defaults)
        self.layout().addWidget(self.buttonBox, 8, 0)
        self.get_values()

    def get_defaults(self):
        # value
        self.bar_cols.setValue(self.defaults["cols_page"])
        self.bar_rows.setValue(self.defaults["rows_page"])
        self.x_tick_font_size.setValue(self.defaults["x_ticks_fs"])
        self.x_tick_rotation.setValue(self.defaults["x_ticks_rot"])
        self.unassigned_shade_alpha.setValue(
            self.defaults["unassigned_shade_alpha"])
        # drop down list
        self.x_tick_font.select(self.defaults["x_ticks_fn"])
        self.x_tick_weight.select(self.defaults["x_ticks_weight"])
        # check
        self.shade_unassigned_checkbox.setChecked(
            self.defaults["unassigned_shade"])

    def get_values(self):
        # value
        self.bar_cols.setValue(self.local_variables["cols_page"])
        self.bar_rows.setValue(self.local_variables["rows_page"])
        self.x_tick_font_size.setValue(self.local_variables["x_ticks_fs"])
        self.x_tick_rotation.setValue(self.local_variables["x_ticks_rot"])
        self.unassigned_shade_alpha.setValue(
            self.local_variables["unassigned_shade_alpha"])
        # drop down list
        self.x_tick_font.select(self.local_variables["x_ticks_fn"])
        self.x_tick_weight.select(self.local_variables["x_ticks_weight"])
        # checkbox
        self.shade_unassigned_checkbox.setChecked(
            self.local_variables["unassigned_shade"])

    def set_values(self):
        # value
        self.local_variables["cols_page"] = self.bar_cols.field.value()
        self.local_variables["rows_page"] = self.bar_rows.field.value()
        self.local_variables["x_ticks_fs"] = self.x_tick_font_size.field.value(
        )
        self.local_variables["x_ticks_rot"] = self.x_tick_rotation.field.value(
        )
        self.local_variables[
            "unassigned_shade_alpha"] = self.unassigned_shade_alpha.field.value(
            )
        # dropdown list
        self.local_variables["x_ticks_fn"] = str(
            self.x_tick_font.fields.currentText())
        self.local_variables["x_ticks_weight"] = str(
            self.x_tick_weight.fields.currentText())
        # check
        self.local_variables[
            "unassigned_shade"] = self.shade_unassigned_checkbox.isChecked()
        #
        self.accept()
예제 #10
0
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(self,
                        parent,
                        title="DPRE Plot",
                        settings_key=["DPRE_plot_settings"])
     self.DPRE_plot_rows = LabelledSpinBox(self,
                                           "Number of Rows",
                                           minimum=1,
                                           step=1)
     self.DPRE_plot_width = LabelledSpinBox(self, "Scale Factor for Width")
     self.DPRE_plot_y_label = LabelledLineEdit(self, "Y Label")
     self.DPRE_plot_y_label_fs = LabelledSpinBox(self,
                                                 "Y Label Font Size",
                                                 minimum=0,
                                                 step=1)
     self.DPRE_plot_ymax = LabelledDoubleSpinBox(self,
                                                 "Y Maximum",
                                                 minimum=0,
                                                 step=0.1)
     self.DPRE_plot_dpre_ms = LabelledSpinBox(self,
                                              "Marker Size",
                                              minimum=0,
                                              step=1)
     self.DPRE_plot_dpre_alpha = LabelledDoubleSpinBox(
         self, "Marker Transparency", minimum=0, maximum=1, step=0.1)
     self.DPRE_plot_smooth_lw = LabelledSpinBox(self,
                                                "Smoothed DPRE Line Width",
                                                minimum=0,
                                                step=1)
     self.DPRE_plot_ref_color = ColourBox(self, "Reference Data Colour")
     self.DPRE_plot_color_init = ColourBox(self, "Grad Start Colour")
     self.DPRE_plot_color_end = ColourBox(self, "Grad End Colour")
     self.DPRE_plot_x_ticks_fn = FontComboBox(self, "X Tick Font")
     self.DPRE_plot_x_ticks_fs = LabelledSpinBox(self,
                                                 "X Tick Font Size",
                                                 minimum=0,
                                                 step=1)
     self.DPRE_plot_x_ticks_pad = LabelledDoubleSpinBox(self,
                                                        "X Tick Padding",
                                                        minimum=-100,
                                                        maximum=100,
                                                        step=0.1)
     self.DPRE_plot_x_ticks_weight = LabelledCombobox(self,
                                                      text="X Font Weight",
                                                      items=font_weights)
     self.DPRE_plot_grid_color = ColourBox(self, "Grid Colour")
     self.DPRE_plot_res_highlight = LabelledCheckbox(
         self, "Highlight Residues?")
     self.DPRE_plot_res_highlight_list = LabelledLineEdit(
         self, "Residues to Highlight")
     self.DPRE_plot_shade = LabelledCheckbox(self, "Shade Residues?")
     self.DPRE_plot_regions = LabelledLineEdit(self, "Regions to Shade")
     self.DPRE_plot_rh_fs = LabelledSpinBox(self,
                                            "Highlight Font Size ",
                                            minimum=0,
                                            step=1)
     self.DPRE_plot_rh_y = LabelledDoubleSpinBox(self,
                                                 "Residue Label Scale",
                                                 minimum=0,
                                                 maximum=1,
                                                 step=0.01)
     self.layout().addWidget(self.DPRE_plot_rows, 0, 0)
     self.layout().addWidget(self.DPRE_plot_width, 1, 0)
     self.layout().addWidget(self.DPRE_plot_y_label, 2, 0)
     self.layout().addWidget(self.DPRE_plot_ref_color, 3, 0)
     self.layout().addWidget(self.DPRE_plot_color_init, 4, 0)
     self.layout().addWidget(self.DPRE_plot_color_end, 5, 0)
     self.layout().addWidget(self.DPRE_plot_x_ticks_fs, 6, 0)
     self.layout().addWidget(self.DPRE_plot_x_ticks_fn, 7, 0)
     self.layout().addWidget(self.DPRE_plot_x_ticks_pad, 8, 0)
     self.layout().addWidget(self.DPRE_plot_x_ticks_weight, 9, 0)
     self.layout().addWidget(self.DPRE_plot_grid_color, 10, 0)
     self.layout().addWidget(self.DPRE_plot_dpre_ms, 0, 1)
     self.layout().addWidget(self.DPRE_plot_dpre_alpha, 1, 1)
     self.layout().addWidget(self.DPRE_plot_y_label_fs, 2, 1)
     self.layout().addWidget(self.DPRE_plot_smooth_lw, 3, 1)
     self.layout().addWidget(self.DPRE_plot_res_highlight, 4, 1)
     self.layout().addWidget(self.DPRE_plot_res_highlight_list, 5, 1)
     self.layout().addWidget(self.DPRE_plot_shade, 6, 1)
     self.layout().addWidget(self.DPRE_plot_regions, 7, 1)
     self.layout().addWidget(self.DPRE_plot_rh_fs, 8, 1)
     self.layout().addWidget(self.DPRE_plot_rh_y, 9, 1)
     self.layout().addWidget(self.DPRE_plot_ymax, 10, 1)
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                       | QDialogButtonBox.Cancel
                                       | QDialogButtonBox.RestoreDefaults)
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(
         QDialogButtonBox.RestoreDefaults).clicked.connect(
             self.get_defaults)
     self.layout().addWidget(self.buttonBox, 11, 0, 2, 2)
     self.get_values()
예제 #11
0
class DeltaPREPlotPopup(BasePopup):
    """
    A popup for setting Delta PRE Plot specific settings in the
    Farseer-NMR configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(self,
                           parent,
                           title="DPRE Plot",
                           settings_key=["DPRE_plot_settings"])
        self.DPRE_plot_rows = LabelledSpinBox(self,
                                              "Number of Rows",
                                              minimum=1,
                                              step=1)
        self.DPRE_plot_width = LabelledSpinBox(self, "Scale Factor for Width")
        self.DPRE_plot_y_label = LabelledLineEdit(self, "Y Label")
        self.DPRE_plot_y_label_fs = LabelledSpinBox(self,
                                                    "Y Label Font Size",
                                                    minimum=0,
                                                    step=1)
        self.DPRE_plot_ymax = LabelledDoubleSpinBox(self,
                                                    "Y Maximum",
                                                    minimum=0,
                                                    step=0.1)
        self.DPRE_plot_dpre_ms = LabelledSpinBox(self,
                                                 "Marker Size",
                                                 minimum=0,
                                                 step=1)
        self.DPRE_plot_dpre_alpha = LabelledDoubleSpinBox(
            self, "Marker Transparency", minimum=0, maximum=1, step=0.1)
        self.DPRE_plot_smooth_lw = LabelledSpinBox(self,
                                                   "Smoothed DPRE Line Width",
                                                   minimum=0,
                                                   step=1)
        self.DPRE_plot_ref_color = ColourBox(self, "Reference Data Colour")
        self.DPRE_plot_color_init = ColourBox(self, "Grad Start Colour")
        self.DPRE_plot_color_end = ColourBox(self, "Grad End Colour")
        self.DPRE_plot_x_ticks_fn = FontComboBox(self, "X Tick Font")
        self.DPRE_plot_x_ticks_fs = LabelledSpinBox(self,
                                                    "X Tick Font Size",
                                                    minimum=0,
                                                    step=1)
        self.DPRE_plot_x_ticks_pad = LabelledDoubleSpinBox(self,
                                                           "X Tick Padding",
                                                           minimum=-100,
                                                           maximum=100,
                                                           step=0.1)
        self.DPRE_plot_x_ticks_weight = LabelledCombobox(self,
                                                         text="X Font Weight",
                                                         items=font_weights)
        self.DPRE_plot_grid_color = ColourBox(self, "Grid Colour")
        self.DPRE_plot_res_highlight = LabelledCheckbox(
            self, "Highlight Residues?")
        self.DPRE_plot_res_highlight_list = LabelledLineEdit(
            self, "Residues to Highlight")
        self.DPRE_plot_shade = LabelledCheckbox(self, "Shade Residues?")
        self.DPRE_plot_regions = LabelledLineEdit(self, "Regions to Shade")
        self.DPRE_plot_rh_fs = LabelledSpinBox(self,
                                               "Highlight Font Size ",
                                               minimum=0,
                                               step=1)
        self.DPRE_plot_rh_y = LabelledDoubleSpinBox(self,
                                                    "Residue Label Scale",
                                                    minimum=0,
                                                    maximum=1,
                                                    step=0.01)
        self.layout().addWidget(self.DPRE_plot_rows, 0, 0)
        self.layout().addWidget(self.DPRE_plot_width, 1, 0)
        self.layout().addWidget(self.DPRE_plot_y_label, 2, 0)
        self.layout().addWidget(self.DPRE_plot_ref_color, 3, 0)
        self.layout().addWidget(self.DPRE_plot_color_init, 4, 0)
        self.layout().addWidget(self.DPRE_plot_color_end, 5, 0)
        self.layout().addWidget(self.DPRE_plot_x_ticks_fs, 6, 0)
        self.layout().addWidget(self.DPRE_plot_x_ticks_fn, 7, 0)
        self.layout().addWidget(self.DPRE_plot_x_ticks_pad, 8, 0)
        self.layout().addWidget(self.DPRE_plot_x_ticks_weight, 9, 0)
        self.layout().addWidget(self.DPRE_plot_grid_color, 10, 0)
        self.layout().addWidget(self.DPRE_plot_dpre_ms, 0, 1)
        self.layout().addWidget(self.DPRE_plot_dpre_alpha, 1, 1)
        self.layout().addWidget(self.DPRE_plot_y_label_fs, 2, 1)
        self.layout().addWidget(self.DPRE_plot_smooth_lw, 3, 1)
        self.layout().addWidget(self.DPRE_plot_res_highlight, 4, 1)
        self.layout().addWidget(self.DPRE_plot_res_highlight_list, 5, 1)
        self.layout().addWidget(self.DPRE_plot_shade, 6, 1)
        self.layout().addWidget(self.DPRE_plot_regions, 7, 1)
        self.layout().addWidget(self.DPRE_plot_rh_fs, 8, 1)
        self.layout().addWidget(self.DPRE_plot_rh_y, 9, 1)
        self.layout().addWidget(self.DPRE_plot_ymax, 10, 1)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.RestoreDefaults)
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(
            QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.get_defaults)
        self.layout().addWidget(self.buttonBox, 11, 0, 2, 2)
        self.get_values()

    def set_ranges(self, field_value):
        ll = field_value.split(',')
        return [[int(x.split('-')[0]), int(x.split('-')[1])] for x in ll]

    def get_ranges(self, ranges):
        return ','.join(["%s-%s" % (x[0], x[1]) for x in ranges])

    def get_defaults(self):
        # value
        self.DPRE_plot_rows.setValue(self.defaults["rows"])
        self.DPRE_plot_width.setValue(self.defaults["width"])
        self.DPRE_plot_y_label_fs.setValue(self.defaults["y_label_fs"])
        self.DPRE_plot_dpre_ms.setValue(self.defaults["dpre_ms"])
        self.DPRE_plot_dpre_alpha.setValue(self.defaults["dpre_alpha"])
        self.DPRE_plot_smooth_lw.setValue(self.defaults["smooth_lw"])
        self.DPRE_plot_x_ticks_fs.setValue(self.defaults["x_ticks_fs"])
        self.DPRE_plot_x_ticks_pad.setValue(self.defaults["x_ticks_pad"])
        self.DPRE_plot_rh_fs.setValue(self.defaults["res_highlight_fs"])
        self.DPRE_plot_rh_y.setValue(self.defaults["res_highlight_y"])
        self.DPRE_plot_ymax.setValue(self.defaults["ymax"])
        # text
        self.DPRE_plot_y_label.setText(self.defaults["y_label"])
        self.DPRE_plot_regions.setText(
            self.get_ranges(self.defaults["shade_regions"]))
        # colour
        self.DPRE_plot_ref_color.get_colour(self.defaults["ref_color"])
        self.DPRE_plot_color_init.get_colour(self.defaults["color_init"])
        self.DPRE_plot_color_end.get_colour(self.defaults["color_end"])
        self.DPRE_plot_grid_color.get_colour(self.defaults["grid_color"])
        # dropdown
        self.DPRE_plot_x_ticks_fn.select(self.defaults["x_ticks_fn"])
        self.DPRE_plot_x_ticks_weight.select(self.defaults["x_ticks_weight"])
        # check
        self.DPRE_plot_shade.setChecked(self.defaults["shade"])
        self.DPRE_plot_res_highlight.setChecked(self.defaults["res_highlight"])
        # list
        self.DPRE_plot_res_highlight_list.field.setText(','.join(
            list(map(str, self.defaults["res_hl_list"]))))

    def set_values(self):
        # value
        self.local_variables["rows"] = self.DPRE_plot_rows.field.value()
        self.local_variables["width"] = self.DPRE_plot_width.field.value()
        self.local_variables[
            "y_label_fs"] = self.DPRE_plot_y_label_fs.field.value()
        self.local_variables["dpre_ms"] = self.DPRE_plot_dpre_ms.field.value()
        self.local_variables[
            "dpre_alpha"] = self.DPRE_plot_dpre_alpha.field.value()
        self.local_variables[
            "smooth_lw"] = self.DPRE_plot_smooth_lw.field.value()
        self.local_variables[
            "x_ticks_fs"] = self.DPRE_plot_x_ticks_fs.field.value()
        self.local_variables[
            "x_ticks_pad"] = self.DPRE_plot_x_ticks_pad.field.value()
        self.local_variables[
            "res_highlight_fs"] = self.DPRE_plot_rh_fs.field.value()
        self.local_variables[
            "res_highlight_y"] = self.DPRE_plot_rh_y.field.value()
        self.local_variables["ymax"] = self.DPRE_plot_ymax.field.value()
        # text
        self.local_variables["y_label"] = self.DPRE_plot_y_label.field.text()
        self.local_variables["shade_regions"] = self.set_ranges(
            self.DPRE_plot_regions.field.text())
        self.local_variables["res_hl_list"] = \
            list(map(int, self.DPRE_plot_res_highlight_list.field.text().split(',')))
        # dropdown
        self.local_variables[
            "ref_color"] = self.DPRE_plot_ref_color.fields.currentText()
        self.local_variables[
            "x_ticks_fn"] = self.DPRE_plot_x_ticks_fn.fields.currentText()
        self.local_variables[
            "x_ticks_weight"] = self.DPRE_plot_x_ticks_weight.fields.currentText(
            )
        # colour
        self.local_variables["color_init"] = colours[
            self.DPRE_plot_color_init.fields.currentText()]
        self.local_variables["color_end"] = colours[
            self.DPRE_plot_color_end.fields.currentText()]
        self.local_variables[
            "grid_color"] = self.DPRE_plot_grid_color.fields.currentText()
        # checkbox
        self.local_variables["shade"] = self.DPRE_plot_shade.isChecked()
        self.local_variables[
            "res_highlight"] = self.DPRE_plot_res_highlight.isChecked()
        self.accept()

    def get_values(self):
        # value
        self.DPRE_plot_rows.setValue(self.local_variables["rows"])
        self.DPRE_plot_width.setValue(self.local_variables["width"])
        self.DPRE_plot_y_label_fs.setValue(self.local_variables["y_label_fs"])
        self.DPRE_plot_dpre_ms.setValue(self.local_variables["dpre_ms"])
        self.DPRE_plot_dpre_alpha.setValue(self.local_variables["dpre_alpha"])
        self.DPRE_plot_smooth_lw.setValue(self.local_variables["smooth_lw"])
        self.DPRE_plot_x_ticks_fs.setValue(self.local_variables["x_ticks_fs"])
        self.DPRE_plot_x_ticks_pad.setValue(
            self.local_variables["x_ticks_pad"])
        self.DPRE_plot_rh_fs.setValue(self.local_variables["res_highlight_fs"])
        self.DPRE_plot_rh_y.setValue(self.local_variables["res_highlight_y"])
        self.DPRE_plot_ymax.setValue(self.local_variables["ymax"])
        # text
        self.DPRE_plot_y_label.setText(self.local_variables["y_label"])
        self.DPRE_plot_res_highlight_list.field.setText(','.join(
            list(map(str, self.local_variables["res_hl_list"]))))
        self.DPRE_plot_regions.setText(
            self.get_ranges(self.local_variables["shade_regions"]))
        # colour
        self.DPRE_plot_ref_color.get_colour(self.local_variables["ref_color"])
        self.DPRE_plot_color_init.get_colour(
            self.local_variables["color_init"])
        self.DPRE_plot_color_end.get_colour(self.local_variables["color_end"])
        self.DPRE_plot_grid_color.get_colour(
            self.local_variables["grid_color"])
        # dropdown
        self.DPRE_plot_x_ticks_fn.select(self.local_variables["x_ticks_fn"])
        self.DPRE_plot_x_ticks_weight.select(
            self.local_variables["x_ticks_weight"])
        # checked
        self.DPRE_plot_shade.setChecked(self.local_variables["shade"])
        self.DPRE_plot_res_highlight.setChecked(
            self.local_variables["res_highlight"])
예제 #12
0
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(self,
                        parent,
                        title="Series General Plot Settings",
                        settings_key=["series_plot_settings"])
     self.series_subtitle_groupbox = QGroupBox()
     self.series_subtitle_groupbox_layout = QVBoxLayout()
     self.series_subtitle_groupbox.setLayout(
         self.series_subtitle_groupbox_layout)
     self.series_subtitle_groupbox.setTitle("Subtitle Settings")
     self.series_subtitle_fn = FontComboBox(self, "Subtitle Font")
     self.series_subtitle_fs = LabelledSpinBox(self,
                                               "Subtitle Font Size",
                                               minimum=0,
                                               step=1)
     self.series_subtitle_pad = LabelledDoubleSpinBox(self,
                                                      "Subtitle Padding",
                                                      minimum=-100,
                                                      maximum=100,
                                                      step=0.1)
     self.series_subtitle_weight = LabelledCombobox(self,
                                                    text="Subtitle "
                                                    "Font Weight",
                                                    items=font_weights)
     self.series_x_label_groupbox = QGroupBox()
     self.series_x_label_groupbox_layout = QVBoxLayout()
     self.series_x_label_groupbox.setLayout(
         self.series_x_label_groupbox_layout)
     self.series_x_label_groupbox.setTitle("X Label Settings")
     self.series_x_label_fn = FontComboBox(self, "X Font Label")
     self.series_x_label_fs = LabelledSpinBox(self,
                                              "X Label Font Size",
                                              minimum=0,
                                              step=1)
     self.series_x_label_pad = LabelledDoubleSpinBox(self,
                                                     "X Label Padding",
                                                     minimum=-100,
                                                     maximum=100,
                                                     step=0.1)
     self.series_x_label_weight = LabelledCombobox(self,
                                                   text="X Label F"
                                                   "ont Weight",
                                                   items=font_weights)
     self.series_y_label_groupbox = QGroupBox()
     self.series_y_label_groupbox_layout = QVBoxLayout()
     self.series_y_label_groupbox.setLayout(
         self.series_y_label_groupbox_layout)
     self.series_y_label_groupbox.setTitle("Y Label Settings")
     self.series_y_tick_groupbox = QGroupBox()
     self.series_y_tick_groupbox_layout = QVBoxLayout()
     self.series_y_tick_groupbox.setLayout(
         self.series_y_tick_groupbox_layout)
     self.series_y_tick_groupbox.setTitle("Tick Settings")
     self.series_y_label_fn = FontComboBox(self, "Y Label Font")
     self.series_y_label_fs = LabelledSpinBox(self,
                                              "Y Label Font Size",
                                              minimum=0,
                                              step=1)
     self.series_y_label_pad = LabelledDoubleSpinBox(self,
                                                     "Y Label Padding",
                                                     minimum=-100,
                                                     maximum=100,
                                                     step=0.1)
     self.series_y_label_weight = LabelledCombobox(self,
                                                   text="Y Label "
                                                   "Font Weight",
                                                   items=font_weights)
     self.series_x_ticks_pad = LabelledDoubleSpinBox(self,
                                                     "X Tick Padding",
                                                     minimum=-100,
                                                     maximum=100,
                                                     step=0.1)
     self.series_x_ticks_len = LabelledDoubleSpinBox(self,
                                                     "X Tick Length",
                                                     minimum=0,
                                                     maximum=100,
                                                     step=0.1)
     self.series_y_ticks_fn = FontComboBox(self, "Y Tick Font")
     self.series_y_ticks_fs = LabelledSpinBox(self,
                                              "Y Tick Font Size",
                                              minimum=0,
                                              step=1)
     self.series_y_ticks_rot = LabelledSpinBox(self,
                                               "Y Tick Rotation",
                                               minimum=0,
                                               maximum=360,
                                               step=1)
     self.series_y_ticks_pad = LabelledDoubleSpinBox(self,
                                                     "Y Tick Padding",
                                                     minimum=-100,
                                                     maximum=100,
                                                     step=0.1)
     self.series_y_ticks_weight = LabelledCombobox(self,
                                                   text="Y Tick "
                                                   "Font Weight",
                                                   items=font_weights)
     self.series_y_ticks_len = LabelledDoubleSpinBox(self,
                                                     "Y Tick Length",
                                                     minimum=0,
                                                     maximum=100,
                                                     step=0.1)
     self.series_y_grid_flag = LabelledCheckbox(self, "Show Y Grid")
     self.series_y_grid_color = ColourBox(self, "Y Grid Colour")
     self.series_y_grid_linestyle = LabelledCombobox(
         self, text="Y Grid "
         "Line Style", items=['-', '--', '-.', ':'])
     self.series_y_grid_linewidth = LabelledDoubleSpinBox(
         self, "Y Grid Line "
         "Width")
     self.series_y_grid_alpha = LabelledDoubleSpinBox(self,
                                                      "Y Grid Transparency",
                                                      minimum=0,
                                                      maximum=1,
                                                      step=0.1)
     self.series_vspace = LabelledDoubleSpinBox(self,
                                                "Plot Vertical Spacing",
                                                minimum=-100,
                                                maximum=100,
                                                step=0.1)
     self.theo_pre_groupbox = QGroupBox()
     self.theo_pre_groupbox_layout = QVBoxLayout()
     self.theo_pre_groupbox.setLayout(self.theo_pre_groupbox_layout)
     self.theo_pre_groupbox.setTitle("Dedicated PRE Settings")
     self.theo_pre_color = ColourBox(self, "Theoretical PRE Line Colour")
     self.theo_pre_lw = LabelledDoubleSpinBox(self,
                                              "Theoretical PRE Line Width",
                                              minimum=0,
                                              step=0.1)
     self.tag_cartoon_color = ColourBox(self, "Tag Pin Colour")
     self.tag_cartoon_lw = LabelledDoubleSpinBox(self,
                                                 "Tag Pin Line Width",
                                                 minimum=0,
                                                 step=0.1)
     self.tag_cartoon_ls = LabelledCombobox(self,
                                            "Tag Pin Line Style",
                                            items=line_styles)
     self.theo_pre_groupbox.layout().addWidget(self.theo_pre_color)
     self.theo_pre_groupbox.layout().addWidget(self.theo_pre_lw)
     self.theo_pre_groupbox.layout().addWidget(self.tag_cartoon_color)
     self.theo_pre_groupbox.layout().addWidget(self.tag_cartoon_lw)
     self.theo_pre_groupbox.layout().addWidget(self.tag_cartoon_ls)
     self.series_subtitle_groupbox.layout().addWidget(
         self.series_subtitle_fn)
     self.series_subtitle_groupbox.layout().addWidget(
         self.series_subtitle_fs)
     self.series_subtitle_groupbox.layout().addWidget(
         self.series_subtitle_pad)
     self.series_subtitle_groupbox.layout().addWidget(
         self.series_subtitle_weight)
     self.series_x_label_groupbox.layout().addWidget(self.series_x_label_fn)
     self.series_x_label_groupbox.layout().addWidget(self.series_x_label_fs)
     self.series_x_label_groupbox.layout().addWidget(
         self.series_x_label_pad)
     self.series_x_label_groupbox.layout().addWidget(
         self.series_x_label_weight)
     self.layout().addWidget(self.series_subtitle_groupbox, 0, 0, 4, 1)
     self.layout().addWidget(self.series_x_label_groupbox, 0, 1, 4, 1)
     self.layout().addWidget(self.theo_pre_groupbox, 0, 2, 4, 1)
     self.series_y_label_groupbox.layout().addWidget(self.series_y_label_fn)
     self.series_y_label_groupbox.layout().addWidget(self.series_y_label_fs)
     self.series_y_label_groupbox.layout().addWidget(
         self.series_y_label_weight)
     self.series_y_label_groupbox.layout().addWidget(
         self.series_y_label_pad)
     self.layout().addWidget(self.series_y_label_groupbox, 4, 1, 4, 1)
     self.series_y_tick_groupbox.layout().addWidget(self.series_x_ticks_pad)
     self.series_y_tick_groupbox.layout().addWidget(self.series_x_ticks_len)
     self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_fn)
     self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_fs)
     self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_rot)
     self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_pad)
     self.series_y_label_groupbox.layout().addWidget(
         self.series_y_ticks_weight)
     self.series_y_label_groupbox.layout().addWidget(
         self.series_y_ticks_len)
     self.layout().addWidget(self.series_y_tick_groupbox, 4, 0, 4, 1)
     self.series_y_grid_groupbox = QGroupBox()
     self.series_y_grid_groupbox_layout = QVBoxLayout()
     self.series_y_grid_groupbox.setLayout(
         self.series_y_grid_groupbox_layout)
     self.series_y_grid_groupbox.setTitle("Y Grid Settings")
     self.series_y_grid_groupbox.layout().addWidget(self.series_y_grid_flag)
     self.series_y_grid_groupbox.layout().addWidget(
         self.series_y_grid_color)
     self.series_y_grid_groupbox.layout().addWidget(
         self.series_y_grid_linestyle)
     self.series_y_grid_groupbox.layout().addWidget(
         self.series_y_grid_linewidth)
     self.series_y_grid_groupbox.layout().addWidget(
         self.series_y_grid_alpha)
     self.series_y_grid_groupbox.layout().addWidget(self.series_vspace)
     self.layout().addWidget(self.series_y_grid_groupbox, 4, 2, 4, 1)
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                       | QDialogButtonBox.Cancel
                                       | QDialogButtonBox.RestoreDefaults)
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(
         QDialogButtonBox.RestoreDefaults).clicked.connect(
             self.get_defaults)
     self.layout().addWidget(self.buttonBox, 8, 2, 1, 1)
     self.get_values()
예제 #13
0
class SeriesPlotPopup(BasePopup):
    """
    A popup for setting Series Plot specific settings in the Farseer-NMR
    configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(self,
                           parent,
                           title="Series General Plot Settings",
                           settings_key=["series_plot_settings"])
        self.series_subtitle_groupbox = QGroupBox()
        self.series_subtitle_groupbox_layout = QVBoxLayout()
        self.series_subtitle_groupbox.setLayout(
            self.series_subtitle_groupbox_layout)
        self.series_subtitle_groupbox.setTitle("Subtitle Settings")
        self.series_subtitle_fn = FontComboBox(self, "Subtitle Font")
        self.series_subtitle_fs = LabelledSpinBox(self,
                                                  "Subtitle Font Size",
                                                  minimum=0,
                                                  step=1)
        self.series_subtitle_pad = LabelledDoubleSpinBox(self,
                                                         "Subtitle Padding",
                                                         minimum=-100,
                                                         maximum=100,
                                                         step=0.1)
        self.series_subtitle_weight = LabelledCombobox(self,
                                                       text="Subtitle "
                                                       "Font Weight",
                                                       items=font_weights)
        self.series_x_label_groupbox = QGroupBox()
        self.series_x_label_groupbox_layout = QVBoxLayout()
        self.series_x_label_groupbox.setLayout(
            self.series_x_label_groupbox_layout)
        self.series_x_label_groupbox.setTitle("X Label Settings")
        self.series_x_label_fn = FontComboBox(self, "X Font Label")
        self.series_x_label_fs = LabelledSpinBox(self,
                                                 "X Label Font Size",
                                                 minimum=0,
                                                 step=1)
        self.series_x_label_pad = LabelledDoubleSpinBox(self,
                                                        "X Label Padding",
                                                        minimum=-100,
                                                        maximum=100,
                                                        step=0.1)
        self.series_x_label_weight = LabelledCombobox(self,
                                                      text="X Label F"
                                                      "ont Weight",
                                                      items=font_weights)
        self.series_y_label_groupbox = QGroupBox()
        self.series_y_label_groupbox_layout = QVBoxLayout()
        self.series_y_label_groupbox.setLayout(
            self.series_y_label_groupbox_layout)
        self.series_y_label_groupbox.setTitle("Y Label Settings")
        self.series_y_tick_groupbox = QGroupBox()
        self.series_y_tick_groupbox_layout = QVBoxLayout()
        self.series_y_tick_groupbox.setLayout(
            self.series_y_tick_groupbox_layout)
        self.series_y_tick_groupbox.setTitle("Tick Settings")
        self.series_y_label_fn = FontComboBox(self, "Y Label Font")
        self.series_y_label_fs = LabelledSpinBox(self,
                                                 "Y Label Font Size",
                                                 minimum=0,
                                                 step=1)
        self.series_y_label_pad = LabelledDoubleSpinBox(self,
                                                        "Y Label Padding",
                                                        minimum=-100,
                                                        maximum=100,
                                                        step=0.1)
        self.series_y_label_weight = LabelledCombobox(self,
                                                      text="Y Label "
                                                      "Font Weight",
                                                      items=font_weights)
        self.series_x_ticks_pad = LabelledDoubleSpinBox(self,
                                                        "X Tick Padding",
                                                        minimum=-100,
                                                        maximum=100,
                                                        step=0.1)
        self.series_x_ticks_len = LabelledDoubleSpinBox(self,
                                                        "X Tick Length",
                                                        minimum=0,
                                                        maximum=100,
                                                        step=0.1)
        self.series_y_ticks_fn = FontComboBox(self, "Y Tick Font")
        self.series_y_ticks_fs = LabelledSpinBox(self,
                                                 "Y Tick Font Size",
                                                 minimum=0,
                                                 step=1)
        self.series_y_ticks_rot = LabelledSpinBox(self,
                                                  "Y Tick Rotation",
                                                  minimum=0,
                                                  maximum=360,
                                                  step=1)
        self.series_y_ticks_pad = LabelledDoubleSpinBox(self,
                                                        "Y Tick Padding",
                                                        minimum=-100,
                                                        maximum=100,
                                                        step=0.1)
        self.series_y_ticks_weight = LabelledCombobox(self,
                                                      text="Y Tick "
                                                      "Font Weight",
                                                      items=font_weights)
        self.series_y_ticks_len = LabelledDoubleSpinBox(self,
                                                        "Y Tick Length",
                                                        minimum=0,
                                                        maximum=100,
                                                        step=0.1)
        self.series_y_grid_flag = LabelledCheckbox(self, "Show Y Grid")
        self.series_y_grid_color = ColourBox(self, "Y Grid Colour")
        self.series_y_grid_linestyle = LabelledCombobox(
            self, text="Y Grid "
            "Line Style", items=['-', '--', '-.', ':'])
        self.series_y_grid_linewidth = LabelledDoubleSpinBox(
            self, "Y Grid Line "
            "Width")
        self.series_y_grid_alpha = LabelledDoubleSpinBox(self,
                                                         "Y Grid Transparency",
                                                         minimum=0,
                                                         maximum=1,
                                                         step=0.1)
        self.series_vspace = LabelledDoubleSpinBox(self,
                                                   "Plot Vertical Spacing",
                                                   minimum=-100,
                                                   maximum=100,
                                                   step=0.1)
        self.theo_pre_groupbox = QGroupBox()
        self.theo_pre_groupbox_layout = QVBoxLayout()
        self.theo_pre_groupbox.setLayout(self.theo_pre_groupbox_layout)
        self.theo_pre_groupbox.setTitle("Dedicated PRE Settings")
        self.theo_pre_color = ColourBox(self, "Theoretical PRE Line Colour")
        self.theo_pre_lw = LabelledDoubleSpinBox(self,
                                                 "Theoretical PRE Line Width",
                                                 minimum=0,
                                                 step=0.1)
        self.tag_cartoon_color = ColourBox(self, "Tag Pin Colour")
        self.tag_cartoon_lw = LabelledDoubleSpinBox(self,
                                                    "Tag Pin Line Width",
                                                    minimum=0,
                                                    step=0.1)
        self.tag_cartoon_ls = LabelledCombobox(self,
                                               "Tag Pin Line Style",
                                               items=line_styles)
        self.theo_pre_groupbox.layout().addWidget(self.theo_pre_color)
        self.theo_pre_groupbox.layout().addWidget(self.theo_pre_lw)
        self.theo_pre_groupbox.layout().addWidget(self.tag_cartoon_color)
        self.theo_pre_groupbox.layout().addWidget(self.tag_cartoon_lw)
        self.theo_pre_groupbox.layout().addWidget(self.tag_cartoon_ls)
        self.series_subtitle_groupbox.layout().addWidget(
            self.series_subtitle_fn)
        self.series_subtitle_groupbox.layout().addWidget(
            self.series_subtitle_fs)
        self.series_subtitle_groupbox.layout().addWidget(
            self.series_subtitle_pad)
        self.series_subtitle_groupbox.layout().addWidget(
            self.series_subtitle_weight)
        self.series_x_label_groupbox.layout().addWidget(self.series_x_label_fn)
        self.series_x_label_groupbox.layout().addWidget(self.series_x_label_fs)
        self.series_x_label_groupbox.layout().addWidget(
            self.series_x_label_pad)
        self.series_x_label_groupbox.layout().addWidget(
            self.series_x_label_weight)
        self.layout().addWidget(self.series_subtitle_groupbox, 0, 0, 4, 1)
        self.layout().addWidget(self.series_x_label_groupbox, 0, 1, 4, 1)
        self.layout().addWidget(self.theo_pre_groupbox, 0, 2, 4, 1)
        self.series_y_label_groupbox.layout().addWidget(self.series_y_label_fn)
        self.series_y_label_groupbox.layout().addWidget(self.series_y_label_fs)
        self.series_y_label_groupbox.layout().addWidget(
            self.series_y_label_weight)
        self.series_y_label_groupbox.layout().addWidget(
            self.series_y_label_pad)
        self.layout().addWidget(self.series_y_label_groupbox, 4, 1, 4, 1)
        self.series_y_tick_groupbox.layout().addWidget(self.series_x_ticks_pad)
        self.series_y_tick_groupbox.layout().addWidget(self.series_x_ticks_len)
        self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_fn)
        self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_fs)
        self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_rot)
        self.series_y_tick_groupbox.layout().addWidget(self.series_y_ticks_pad)
        self.series_y_label_groupbox.layout().addWidget(
            self.series_y_ticks_weight)
        self.series_y_label_groupbox.layout().addWidget(
            self.series_y_ticks_len)
        self.layout().addWidget(self.series_y_tick_groupbox, 4, 0, 4, 1)
        self.series_y_grid_groupbox = QGroupBox()
        self.series_y_grid_groupbox_layout = QVBoxLayout()
        self.series_y_grid_groupbox.setLayout(
            self.series_y_grid_groupbox_layout)
        self.series_y_grid_groupbox.setTitle("Y Grid Settings")
        self.series_y_grid_groupbox.layout().addWidget(self.series_y_grid_flag)
        self.series_y_grid_groupbox.layout().addWidget(
            self.series_y_grid_color)
        self.series_y_grid_groupbox.layout().addWidget(
            self.series_y_grid_linestyle)
        self.series_y_grid_groupbox.layout().addWidget(
            self.series_y_grid_linewidth)
        self.series_y_grid_groupbox.layout().addWidget(
            self.series_y_grid_alpha)
        self.series_y_grid_groupbox.layout().addWidget(self.series_vspace)
        self.layout().addWidget(self.series_y_grid_groupbox, 4, 2, 4, 1)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.RestoreDefaults)
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(
            QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.get_defaults)
        self.layout().addWidget(self.buttonBox, 8, 2, 1, 1)
        self.get_values()

    def get_defaults(self):
        # dropdown
        self.series_subtitle_fn.select(self.defaults["subtitle_fn"])
        self.series_subtitle_weight.select(self.defaults["subtitle_weight"])
        self.series_x_label_fn.select(self.defaults["x_label_fn"])
        self.series_x_label_weight.select(self.defaults["x_label_weight"])
        self.series_y_label_fn.select(self.defaults["y_label_fn"])
        self.series_y_label_weight.select(self.defaults["y_label_weight"])
        self.series_y_ticks_fn.select(self.defaults["y_ticks_fn"])
        self.series_y_ticks_weight.select(self.defaults["y_ticks_weight"])
        self.series_y_grid_linestyle.select(self.defaults["y_grid_linestyle"])
        self.tag_cartoon_ls.select(self.defaults["tag_cartoon_ls"])
        # value
        self.series_subtitle_fs.setValue(self.defaults["subtitle_fs"])
        self.series_subtitle_pad.setValue(self.defaults["subtitle_pad"])
        self.series_x_label_fs.setValue(self.defaults["x_label_fs"])
        self.series_x_label_pad.setValue(self.defaults["x_label_pad"])
        self.series_y_label_fs.setValue(self.defaults["y_label_fs"])
        self.series_y_label_pad.setValue(self.defaults["y_label_pad"])
        self.series_x_ticks_pad.setValue(self.defaults["x_ticks_pad"])
        self.series_x_ticks_len.setValue(self.defaults["x_ticks_len"])
        self.series_y_ticks_fs.setValue(self.defaults["y_ticks_fs"])
        self.series_y_ticks_rot.setValue(self.defaults["y_ticks_rot"])
        self.series_y_ticks_pad.setValue(self.defaults["y_ticks_pad"])
        self.series_y_ticks_len.setValue(self.defaults["y_ticks_len"])
        self.series_y_grid_linewidth.setValue(
            self.defaults["y_grid_linewidth"])
        self.series_y_grid_alpha.setValue(self.defaults["y_grid_alpha"])
        self.theo_pre_lw.setValue(self.defaults["theo_pre_lw"])
        self.tag_cartoon_lw.setValue(self.defaults["tag_cartoon_lw"])
        # checked
        self.series_y_grid_flag.setChecked(self.defaults["y_grid_flag"])
        # colour
        self.series_y_grid_color.get_colour(self.defaults["y_grid_color"])
        self.theo_pre_color.get_colour(self.defaults["theo_pre_color"])
        self.tag_cartoon_color.get_colour(self.defaults["tag_cartoon_color"])

    def set_values(self):
        # dropdown
        self.local_variables["subtitle_fn"] = str(
            self.series_subtitle_fn.fields.currentText())
        self.local_variables["subtitle_weight"] = str(
            self.series_subtitle_weight.fields.currentText())
        self.local_variables["x_label_fn"] = str(
            self.series_x_label_fn.fields.currentText())
        self.local_variables["x_label_weight"] = str(
            self.series_x_label_weight.fields.currentText())
        self.local_variables["y_label_fn"] = str(
            self.series_y_label_fn.fields.currentText())
        self.local_variables["y_label_weight"] = str(
            self.series_y_label_weight.fields.currentText())
        self.local_variables["y_ticks_fn"] = str(
            self.series_y_ticks_fn.fields.currentText())
        self.local_variables["y_ticks_weight"] = str(
            self.series_y_ticks_weight.fields.currentText())
        self.local_variables["y_grid_linestyle"] = str(
            self.series_y_grid_linestyle.fields.currentText())
        self.local_variables[
            "tag_cartoon_ls"] = self.tag_cartoon_ls.fields.currentText()
        # value
        self.local_variables[
            "subtitle_fs"] = self.series_subtitle_fs.field.value()
        self.local_variables[
            "subtitle_pad"] = self.series_subtitle_pad.field.value()
        self.local_variables[
            "x_label_fs"] = self.series_x_label_fs.field.value()
        self.local_variables[
            "x_label_pad"] = self.series_x_label_pad.field.value()
        self.local_variables[
            "y_label_fs"] = self.series_y_label_fs.field.value()
        self.local_variables[
            "y_label_pad"] = self.series_y_label_pad.field.value()
        self.local_variables[
            "x_ticks_pad"] = self.series_x_ticks_pad.field.value()
        self.local_variables[
            "x_ticks_len"] = self.series_x_ticks_len.field.value()
        self.local_variables[
            "y_ticks_fs"] = self.series_y_ticks_fs.field.value()
        self.local_variables[
            "y_ticks_rot"] = self.series_y_ticks_rot.field.value()
        self.local_variables[
            "y_ticks_pad"] = self.series_y_ticks_pad.field.value()
        self.local_variables[
            "y_ticks_len"] = self.series_y_ticks_len.field.value()
        self.local_variables[
            "y_grid_linewidth"] = self.series_y_grid_linewidth.field.value()
        self.local_variables[
            "y_grid_alpha"] = self.series_y_grid_alpha.field.value()
        self.local_variables["theo_pre_lw"] = self.theo_pre_lw.field.value()
        self.local_variables[
            "tag_cartoon_lw"] = self.tag_cartoon_lw.field.value()
        # colours
        self.local_variables["y_grid_color"] = str(
            self.series_y_grid_color.fields.currentText())
        self.local_variables[
            "theo_pre_color"] = self.theo_pre_color.fields.currentText()
        self.local_variables[
            "tag_cartoon_color"] = self.tag_cartoon_color.fields.currentText()
        # checked
        self.local_variables[
            "y_grid_flag"] = self.series_y_grid_flag.isChecked()
        self.accept()

    def get_values(self):
        # select
        self.series_subtitle_fn.select(self.local_variables["subtitle_fn"])
        self.series_subtitle_weight.select(
            self.local_variables["subtitle_weight"])
        self.series_x_label_fn.select(self.local_variables["x_label_fn"])
        self.series_x_label_weight.select(
            self.local_variables["x_label_weight"])
        self.series_y_label_fn.select(self.local_variables["y_label_fn"])
        self.series_y_label_weight.select(
            self.local_variables["y_label_weight"])
        self.series_y_ticks_fn.select(self.local_variables["y_ticks_fn"])
        self.series_y_ticks_weight.select(
            self.local_variables["y_ticks_weight"])
        self.series_y_grid_linestyle.select(
            self.local_variables["y_grid_linestyle"])
        self.tag_cartoon_ls.select(self.local_variables["tag_cartoon_ls"])
        # value
        self.series_subtitle_fs.setValue(self.local_variables["subtitle_fs"])
        self.series_subtitle_pad.setValue(self.local_variables["subtitle_pad"])
        self.series_x_label_fs.setValue(self.local_variables["x_label_fs"])
        self.series_x_label_pad.setValue(self.local_variables["x_label_pad"])
        self.series_y_label_fs.setValue(self.local_variables["y_label_fs"])
        self.series_y_label_pad.setValue(self.local_variables["y_label_pad"])
        self.series_x_ticks_pad.setValue(self.local_variables["x_ticks_pad"])
        self.series_x_ticks_len.setValue(self.local_variables["x_ticks_len"])
        self.series_y_ticks_fs.setValue(self.local_variables["y_ticks_fs"])
        self.series_y_ticks_rot.setValue(self.local_variables["y_ticks_rot"])
        self.series_y_ticks_pad.setValue(self.local_variables["y_ticks_pad"])
        self.series_y_ticks_len.setValue(self.local_variables["y_ticks_len"])
        self.series_y_grid_linewidth.setValue(
            self.local_variables["y_grid_linewidth"])
        self.series_y_grid_alpha.setValue(self.local_variables["y_grid_alpha"])
        self.theo_pre_lw.setValue(self.local_variables["theo_pre_lw"])
        self.tag_cartoon_lw.setValue(self.local_variables["tag_cartoon_lw"])
        # colour
        self.series_y_grid_color.get_colour(
            self.local_variables["y_grid_color"])
        self.theo_pre_color.get_colour(self.local_variables["theo_pre_color"])
        self.tag_cartoon_color.get_colour(
            self.local_variables["tag_cartoon_color"])
        # checked
        self.series_y_grid_flag.setChecked(self.local_variables["y_grid_flag"])
예제 #14
0
 def __init__(self, parent=None, gui_settings=None, footer=None):
     BaseWidget.__init__(self,
                         parent=parent,
                         gui_settings=gui_settings,
                         footer=footer)
     #
     grid = QGridLayout()
     grid2 = QGridLayout()
     self.setLayout(grid2)
     new_widget = QWidget(self)
     new_widget.setObjectName("SettingsWidget")
     new_widget.setLayout(grid)
     self.layout().addWidget(new_widget)
     #
     grid.setAlignment(QtCore.Qt.AlignTop)
     self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
     paths_group_box = QGroupBox()
     paths_groupbox_layout = QGridLayout()
     paths_groupbox_layout.setSpacing(2)
     paths_group_box.setLayout(paths_groupbox_layout)
     #
     self.spectrum_path = LabelledLineEdit(
         self,
         "Peaklists Dataset Folder",
         callback=self.set_spectrum_path_text)
     self.output_path = LabelledLineEdit(self,
                                         "Calculation Output Folder",
                                         callback=self.set_output_path)
     self.spectrum_path_browse = QPushButton("...", self)
     self.output_path_browse = QPushButton("...", self)
     self.spectrum_path_browse.clicked.connect(self.set_spectrum_path)
     self.output_path_browse.clicked.connect(self.set_output_path)
     # layout
     paths_group_box.layout().addWidget(self.spectrum_path, 0, 0, 1, 12)
     paths_group_box.layout().addWidget(self.output_path, 1, 0, 1, 12)
     paths_group_box.layout().addWidget(self.spectrum_path_browse, 0, 13, 1,
                                        1)
     paths_group_box.layout().addWidget(self.output_path_browse, 1, 13, 1,
                                        1)
     # boxes
     self.ext_bar_checkbox = LabelledCheckbox(self, "Extended Bar")
     self.comp_bar_checkbox = LabelledCheckbox(self, "Compact Bar")
     self.vert_bar_checkbox = LabelledCheckbox(self, "Vertical Bar")
     self.res_evo_checkbox = LabelledCheckbox(self, "Residue Evolution")
     self.scatter_checkbox = LabelledCheckbox(self, "CS Scatter")
     self.dpre_checkbox = LabelledCheckbox(self, "Delta PRE Plot")
     self.heat_map_checkbox = LabelledCheckbox(self, "Heat Map")
     self.scatter_flower_checkbox = LabelledCheckbox(
         self, " CS Scatter Flower")
     self.tplot_button = QPushButton("General Settings", self)
     self.tplot_button.clicked.connect(
         partial(self.show_popup, SeriesPlotPopup))
     self.revo_button = QPushButton("General Evolution Settings", self)
     self.revo_button.clicked.connect(
         partial(self.show_popup, GeneralResidueEvolution))
     self.bar_button = QPushButton("Bar Settings", self)
     self.bar_button.clicked.connect(partial(self.show_popup, BarPlotPopup))
     self.ext_bar_button = QPushButton("Settings", self)
     self.ext_bar_button.clicked.connect(
         partial(self.show_popup, ExtendedBarPopup))
     self.comp_bar_button = QPushButton("Settings", self)
     self.comp_bar_button.clicked.connect(
         partial(self.show_popup, CompactBarPopup))
     self.vert_bar_button = QPushButton("Settings", self)
     self.vert_bar_button.clicked.connect(
         partial(self.show_popup, VerticalBarPopup))
     self.res_evo_button = QPushButton("Settings", self)
     self.res_evo_button.clicked.connect(
         partial(self.show_popup, ResidueEvolutionPopup))
     self.scatter_button = QPushButton("Settings", self)
     self.scatter_button.clicked.connect(
         partial(self.show_popup, ScatterPlotPopup))
     self.scatter_flower_button = QPushButton("Settings", self)
     self.scatter_flower_button.clicked.connect(
         partial(self.show_popup, ScatterFlowerPlotPopup))
     self.heat_map_button = QPushButton("Settings", self)
     self.heat_map_button.clicked.connect(
         partial(self.show_popup, HeatMapPopup))
     self.dpre_button = QPushButton("Settings", self)
     self.dpre_button.clicked.connect(
         partial(self.show_popup, DeltaPREPlotPopup))
     self.fasta_button = QPushButton("Select FASTA Files", self)
     self.fasta_button.clicked.connect(
         partial(self.show_popup, FastaSelectionPopup))
     self.has_sidechains_checkbox = LabelledCheckbox(
         self, "Are Sidechain Peaks Present?")
     self.use_sidechains_checkbox = LabelledCheckbox(
         self, "Analyse Sidechains?")
     self.perform_comparisons_checkbox = LabelledCheckbox(
         self, "Perform Comparisons?")
     self.apply_fasta_checkbox = LabelledCheckbox(
         self, "Apply FASTA?", callback=self.activate_fasta)
     self.fasta_start = LabelledSpinBox(self,
                                        "Fasta start",
                                        maximum=10000,
                                        step=1)
     self.expand_missing_yy = LabelledCheckbox(
         self, "Search missing residues along Y axis?")
     self.expand_missing_zz = LabelledCheckbox(
         self, "Search missing residues along Z axis?")
     self.figure_width = LabelledDoubleSpinBox(self,
                                               "Figure Width",
                                               minimum=0.1,
                                               maximum=100,
                                               step=0.1)
     self.figure_height = LabelledDoubleSpinBox(self,
                                                "Figure Height",
                                                minimum=0.1,
                                                maximum=100,
                                                step=0.1)
     self.figure_dpi = LabelledSpinBox(self,
                                       "Figure DPI",
                                       minimum=0,
                                       maximum=10000,
                                       step=10)
     self.figure_format = LabelledCombobox(
         self, "Figure Format", items=['pdf', 'png', 'ps', 'svg'])
     sidechains_groupbox = QGroupBox()
     sidechains_groupbox.setTitle("Sidechains")
     sidechains_groupbox_layout = QVBoxLayout()
     sidechains_groupbox.setLayout(sidechains_groupbox_layout)
     sidechains_groupbox.layout().addWidget(self.has_sidechains_checkbox)
     sidechains_groupbox.layout().addWidget(self.use_sidechains_checkbox)
     fasta_groupbox = QGroupBox()
     fasta_groupbox.setTitle("FASTA")
     fasta_groupbox_layout = QGridLayout()
     fasta_groupbox.setLayout(fasta_groupbox_layout)
     fasta_groupbox.layout().addWidget(self.apply_fasta_checkbox, 0, 0)
     fasta_groupbox.layout().addWidget(self.fasta_start, 0, 1)
     fasta_groupbox.layout().addWidget(self.fasta_button, 1, 0, 1, 2)
     self.x_checkbox = LabelledCheckbox(self, "Along X Axis")
     self.y_checkbox = LabelledCheckbox(self, "Along Y Axis")
     self.z_checkbox = LabelledCheckbox(self, "Along Z Axis")
     series_groupbox = QGroupBox()
     series_groupbox.setTitle("Experimental Series Analysis")
     series_groupbox_layout = QVBoxLayout()
     series_groupbox.setLayout(series_groupbox_layout)
     series_groupbox.layout().addWidget(self.x_checkbox)
     series_groupbox.layout().addWidget(self.y_checkbox)
     series_groupbox.layout().addWidget(self.z_checkbox)
     series_groupbox.layout().addWidget(self.perform_comparisons_checkbox)
     figure_groupbox = QGroupBox()
     figure_groupbox.setTitle("Figure")
     figure_groupbox_layout = QVBoxLayout()
     figure_groupbox.setLayout(figure_groupbox_layout)
     figure_groupbox.layout().addWidget(self.figure_width)
     figure_groupbox.layout().addWidget(self.figure_height)
     figure_groupbox.layout().addWidget(self.figure_dpi)
     figure_groupbox.layout().addWidget(self.figure_format)
     self.cs_correction = LabelledCheckbox(self, "CS Correction?")
     self.cs_correction_res_ref = LabelledSpinBox(self,
                                                  text="Correction Residue")
     cs_norm_groupbox = QGroupBox()
     cs_norm_groupbox.setTitle("Chemical Shift Normalisation")
     cs_groupbox_layout = QVBoxLayout()
     cs_norm_groupbox.setLayout(cs_groupbox_layout)
     cs_norm_groupbox.layout().addWidget(self.cs_correction)
     cs_norm_groupbox.layout().addWidget(self.cs_correction_res_ref)
     missing_analysis_groupbox = QGroupBox()
     missing_analysis_groupbox.setTitle(
         "Search missing residues across axes")
     missing_analysis_groupbox_layout = QVBoxLayout()
     missing_analysis_groupbox.setLayout(missing_analysis_groupbox_layout)
     missing_analysis_groupbox.layout().addWidget(self.expand_missing_yy)
     missing_analysis_groupbox.layout().addWidget(self.expand_missing_zz)
     cs_groupbox = QGroupBox()
     cs_groupbox.setTitle("CSP Specific")
     cs_groupbox_layout = QVBoxLayout()
     cs_groupbox.setLayout(cs_groupbox_layout)
     self.csp_alpha = LabelledDoubleSpinBox(self,
                                            text="CSP Alpha",
                                            minimum=0.01,
                                            maximum=1,
                                            step=0.01)
     self.csp_missing = LabelledCombobox(self,
                                         text="Show Missing Residues",
                                         items=['prev', 'full', 'zero'])
     self.csp_exceptions = QPushButton("Alpha by residue", self)
     self.csp_exceptions.clicked.connect(
         partial(self.show_popup, CSPExceptionsPopup))
     cs_groupbox.layout().addWidget(self.csp_alpha)
     cs_groupbox.layout().addWidget(self.csp_missing)
     cs_groupbox.layout().addWidget(self.csp_exceptions)
     restraint_groupbox = QGroupBox()
     restraint_groupbox.setTitle("Parameter Calculation")
     restraint_groupbox_layout = QGridLayout()
     restraint_groupbox.setLayout(restraint_groupbox_layout)
     self.plot_F1_data = LabelledCheckbox(self, text="F1 data")
     self.plot_F2_data = LabelledCheckbox(self, text="F2 data")
     self.plot_CSP = LabelledCheckbox(self, text="CSPs")
     self.plot_height_ratio = LabelledCheckbox(self,
                                               text="Height Ratio",
                                               callback=self.activate_pre)
     self.plot_volume_ratio = LabelledCheckbox(self,
                                               text="Volume Ratio",
                                               callback=self.activate_pre)
     self.plot_F1_y_label = LabelledLineEdit(self, text='')
     self.plot_F2_y_label = LabelledLineEdit(self, text='')
     self.plot_CSP_y_label = LabelledLineEdit(self, text='')
     self.plot_height_y_label = LabelledLineEdit(self, text='')
     self.plot_volume_y_label = LabelledLineEdit(self, text='')
     self.plot_F1_calccol = LabelledLineEdit(self, text="")
     self.plot_F2_calccol = LabelledLineEdit(self, text="")
     self.plot_CSP_calccol = LabelledLineEdit(self, text="")
     self.plot_height_calccol = LabelledLineEdit(self, text="")
     self.plot_volume_calccol = LabelledLineEdit(self, text="")
     self.plot_F1_y_scale = LabelledDoubleSpinBox(self,
                                                  text="",
                                                  minimum=0,
                                                  step=0.1)
     self.plot_F2_y_scale = LabelledDoubleSpinBox(self,
                                                  text="",
                                                  minimum=0,
                                                  step=0.1)
     self.plot_CSP_y_scale = LabelledDoubleSpinBox(self,
                                                   text="",
                                                   minimum=0,
                                                   step=0.1)
     self.plot_height_y_scale = LabelledDoubleSpinBox(self,
                                                      text="",
                                                      minimum=0,
                                                      step=0.1)
     self.plot_volume_y_scale = LabelledDoubleSpinBox(self,
                                                      text="",
                                                      minimum=0,
                                                      step=0.1)
     restraint_label = QLabel("Y Axis Label")
     axis_label = QLabel("Parameter Name")
     scale_label = QLabel("Y Axis Scale")
     restraint_label.setAlignment(QtCore.Qt.AlignHCenter)
     axis_label.setAlignment(QtCore.Qt.AlignHCenter)
     scale_label.setAlignment(QtCore.Qt.AlignHCenter)
     restraint_groupbox.layout().addWidget(restraint_label, 0, 2)
     restraint_groupbox.layout().addWidget(axis_label, 0, 1)
     restraint_groupbox.layout().addWidget(scale_label, 0, 3)
     restraint_groupbox.layout().addWidget(self.plot_F1_data, 1, 0)
     restraint_groupbox.layout().addWidget(self.plot_F2_data, 2, 0)
     restraint_groupbox.layout().addWidget(self.plot_CSP, 3, 0)
     restraint_groupbox.layout().addWidget(self.plot_height_ratio, 4, 0)
     restraint_groupbox.layout().addWidget(self.plot_volume_ratio, 5, 0)
     restraint_groupbox.layout().addWidget(self.plot_F1_y_label, 1, 2)
     restraint_groupbox.layout().addWidget(self.plot_F2_y_label, 2, 2)
     restraint_groupbox.layout().addWidget(self.plot_CSP_y_label, 3, 2)
     restraint_groupbox.layout().addWidget(self.plot_height_y_label, 4, 2)
     restraint_groupbox.layout().addWidget(self.plot_volume_y_label, 5, 2)
     restraint_groupbox.layout().addWidget(self.plot_F1_calccol, 1, 1)
     restraint_groupbox.layout().addWidget(self.plot_F2_calccol, 2, 1)
     restraint_groupbox.layout().addWidget(self.plot_CSP_calccol, 3, 1)
     restraint_groupbox.layout().addWidget(self.plot_height_calccol, 4, 1)
     restraint_groupbox.layout().addWidget(self.plot_volume_calccol, 5, 1)
     restraint_groupbox.layout().addWidget(self.plot_F1_y_scale, 1, 3)
     restraint_groupbox.layout().addWidget(self.plot_F2_y_scale, 2, 3)
     restraint_groupbox.layout().addWidget(self.plot_CSP_y_scale, 3, 3)
     restraint_groupbox.layout().addWidget(self.plot_height_y_scale, 4, 3)
     restraint_groupbox.layout().addWidget(self.plot_volume_y_scale, 5, 3)
     pre_groupbox = QGroupBox()
     pre_groupbox.setTitle("PRE Analysis")
     pre_groupbox_layout = QGridLayout()
     pre_groupbox.setLayout(pre_groupbox_layout)
     self.do_pre_checkbox = LabelledCheckbox(self, "Do PRE Analysis")
     self.do_pre_checkbox.setEnabled(False)
     self.heat_map_checkbox.setEnabled(False)
     self.dpre_checkbox.setEnabled(False)
     self.pre_settings = QPushButton("PRE Settings", self)
     self.pre_settings.clicked.connect(
         partial(self.show_popup, PreAnalysisPopup))
     self.pretheo_button = QPushButton("Select theo. PRE Files", self)
     self.pretheo_button.clicked.connect(
         partial(self.show_popup, PRETheoreticalSelectionPopup))
     pre_groupbox.layout().addWidget(self.do_pre_checkbox, 0, 0)
     pre_groupbox.layout().addWidget(self.pre_settings, 0, 1)
     pre_groupbox.layout().addWidget(self.dpre_checkbox, 1, 0)
     pre_groupbox.layout().addWidget(self.dpre_button, 1, 1)
     pre_groupbox.layout().addWidget(self.heat_map_checkbox, 2, 0)
     pre_groupbox.layout().addWidget(self.heat_map_button, 2, 1)
     pre_groupbox.layout().addWidget(self.pretheo_button)
     series_plotting_groupbox = QGroupBox()
     series_plotting_groupbox.setTitle("Series Plotting")
     series_plotting_groupbox_layout = QGridLayout()
     series_plotting_groupbox.setLayout(series_plotting_groupbox_layout)
     series_plotting_groupbox.layout().addWidget(self.tplot_button, 0, 0, 1,
                                                 1)
     series_plotting_groupbox.layout().addWidget(self.bar_button, 0, 1, 1,
                                                 1)
     series_plotting_groupbox.layout().addWidget(self.ext_bar_checkbox, 1,
                                                 0, 1, 1)
     series_plotting_groupbox.layout().addWidget(self.ext_bar_button, 1, 1,
                                                 1, 1)
     series_plotting_groupbox.layout().addWidget(self.comp_bar_checkbox, 2,
                                                 0, 1, 1)
     series_plotting_groupbox.layout().addWidget(self.comp_bar_button, 2, 1,
                                                 1, 1)
     series_plotting_groupbox.layout().addWidget(self.vert_bar_checkbox, 3,
                                                 0, 1, 1)
     series_plotting_groupbox.layout().addWidget(self.vert_bar_button, 3, 1,
                                                 1, 1)
     res_evo_groupbox = QGroupBox()
     res_evo_groupbox.setTitle("Residue Evolution Plot")
     res_evo_groupbox_layout = QGridLayout()
     res_evo_groupbox.setLayout(res_evo_groupbox_layout)
     res_evo_groupbox.layout().addWidget(self.revo_button, 0, 0, 1, 2)
     res_evo_groupbox.layout().addWidget(self.res_evo_checkbox, 1, 0, 1, 1)
     res_evo_groupbox.layout().addWidget(self.res_evo_button, 1, 1, 1, 1)
     res_evo_groupbox.layout().addWidget(self.scatter_checkbox, 2, 0, 1, 1)
     res_evo_groupbox.layout().addWidget(self.scatter_button, 2, 1, 1, 1)
     res_evo_groupbox.layout().addWidget(self.scatter_flower_checkbox, 3, 0,
                                         1, 1)
     res_evo_groupbox.layout().addWidget(self.scatter_flower_button, 3, 1,
                                         1, 1)
     grid.layout().addWidget(paths_group_box, 0, 0, 3, 16)
     grid.layout().addWidget(fasta_groupbox, 7, 4, 4, 4)
     grid.layout().addWidget(sidechains_groupbox, 3, 4, 4, 4)
     grid.layout().addWidget(cs_norm_groupbox, 7, 0, 4, 4)
     grid.layout().addWidget(missing_analysis_groupbox, 3, 0, 4, 4)
     grid.layout().addWidget(series_groupbox, 3, 8, 6, 4)
     grid.layout().addWidget(figure_groupbox, 3, 12, 6, 4)
     grid.layout().addWidget(figure_groupbox, 3, 12, 6, 4)
     grid.layout().addWidget(restraint_groupbox, 11, 0, 10, 8)
     grid.layout().addWidget(cs_groupbox, 9, 8, 5, 4)
     grid.layout().addWidget(pre_groupbox, 9, 12, 5, 4)
     grid.layout().addWidget(series_plotting_groupbox, 14, 8, 7, 4)
     grid.layout().addWidget(res_evo_groupbox, 14, 12, 7, 4)
     grid.layout().addWidget(self.tab_footer, 21, 0, 2, 16)
     #
     self.load_variables()
예제 #15
0
class Settings(BaseWidget):
    def __init__(self, parent=None, gui_settings=None, footer=None):
        BaseWidget.__init__(self,
                            parent=parent,
                            gui_settings=gui_settings,
                            footer=footer)
        #
        grid = QGridLayout()
        grid2 = QGridLayout()
        self.setLayout(grid2)
        new_widget = QWidget(self)
        new_widget.setObjectName("SettingsWidget")
        new_widget.setLayout(grid)
        self.layout().addWidget(new_widget)
        #
        grid.setAlignment(QtCore.Qt.AlignTop)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        paths_group_box = QGroupBox()
        paths_groupbox_layout = QGridLayout()
        paths_groupbox_layout.setSpacing(2)
        paths_group_box.setLayout(paths_groupbox_layout)
        #
        self.spectrum_path = LabelledLineEdit(
            self,
            "Peaklists Dataset Folder",
            callback=self.set_spectrum_path_text)
        self.output_path = LabelledLineEdit(self,
                                            "Calculation Output Folder",
                                            callback=self.set_output_path)
        self.spectrum_path_browse = QPushButton("...", self)
        self.output_path_browse = QPushButton("...", self)
        self.spectrum_path_browse.clicked.connect(self.set_spectrum_path)
        self.output_path_browse.clicked.connect(self.set_output_path)
        # layout
        paths_group_box.layout().addWidget(self.spectrum_path, 0, 0, 1, 12)
        paths_group_box.layout().addWidget(self.output_path, 1, 0, 1, 12)
        paths_group_box.layout().addWidget(self.spectrum_path_browse, 0, 13, 1,
                                           1)
        paths_group_box.layout().addWidget(self.output_path_browse, 1, 13, 1,
                                           1)
        # boxes
        self.ext_bar_checkbox = LabelledCheckbox(self, "Extended Bar")
        self.comp_bar_checkbox = LabelledCheckbox(self, "Compact Bar")
        self.vert_bar_checkbox = LabelledCheckbox(self, "Vertical Bar")
        self.res_evo_checkbox = LabelledCheckbox(self, "Residue Evolution")
        self.scatter_checkbox = LabelledCheckbox(self, "CS Scatter")
        self.dpre_checkbox = LabelledCheckbox(self, "Delta PRE Plot")
        self.heat_map_checkbox = LabelledCheckbox(self, "Heat Map")
        self.scatter_flower_checkbox = LabelledCheckbox(
            self, " CS Scatter Flower")
        self.tplot_button = QPushButton("General Settings", self)
        self.tplot_button.clicked.connect(
            partial(self.show_popup, SeriesPlotPopup))
        self.revo_button = QPushButton("General Evolution Settings", self)
        self.revo_button.clicked.connect(
            partial(self.show_popup, GeneralResidueEvolution))
        self.bar_button = QPushButton("Bar Settings", self)
        self.bar_button.clicked.connect(partial(self.show_popup, BarPlotPopup))
        self.ext_bar_button = QPushButton("Settings", self)
        self.ext_bar_button.clicked.connect(
            partial(self.show_popup, ExtendedBarPopup))
        self.comp_bar_button = QPushButton("Settings", self)
        self.comp_bar_button.clicked.connect(
            partial(self.show_popup, CompactBarPopup))
        self.vert_bar_button = QPushButton("Settings", self)
        self.vert_bar_button.clicked.connect(
            partial(self.show_popup, VerticalBarPopup))
        self.res_evo_button = QPushButton("Settings", self)
        self.res_evo_button.clicked.connect(
            partial(self.show_popup, ResidueEvolutionPopup))
        self.scatter_button = QPushButton("Settings", self)
        self.scatter_button.clicked.connect(
            partial(self.show_popup, ScatterPlotPopup))
        self.scatter_flower_button = QPushButton("Settings", self)
        self.scatter_flower_button.clicked.connect(
            partial(self.show_popup, ScatterFlowerPlotPopup))
        self.heat_map_button = QPushButton("Settings", self)
        self.heat_map_button.clicked.connect(
            partial(self.show_popup, HeatMapPopup))
        self.dpre_button = QPushButton("Settings", self)
        self.dpre_button.clicked.connect(
            partial(self.show_popup, DeltaPREPlotPopup))
        self.fasta_button = QPushButton("Select FASTA Files", self)
        self.fasta_button.clicked.connect(
            partial(self.show_popup, FastaSelectionPopup))
        self.has_sidechains_checkbox = LabelledCheckbox(
            self, "Are Sidechain Peaks Present?")
        self.use_sidechains_checkbox = LabelledCheckbox(
            self, "Analyse Sidechains?")
        self.perform_comparisons_checkbox = LabelledCheckbox(
            self, "Perform Comparisons?")
        self.apply_fasta_checkbox = LabelledCheckbox(
            self, "Apply FASTA?", callback=self.activate_fasta)
        self.fasta_start = LabelledSpinBox(self,
                                           "Fasta start",
                                           maximum=10000,
                                           step=1)
        self.expand_missing_yy = LabelledCheckbox(
            self, "Search missing residues along Y axis?")
        self.expand_missing_zz = LabelledCheckbox(
            self, "Search missing residues along Z axis?")
        self.figure_width = LabelledDoubleSpinBox(self,
                                                  "Figure Width",
                                                  minimum=0.1,
                                                  maximum=100,
                                                  step=0.1)
        self.figure_height = LabelledDoubleSpinBox(self,
                                                   "Figure Height",
                                                   minimum=0.1,
                                                   maximum=100,
                                                   step=0.1)
        self.figure_dpi = LabelledSpinBox(self,
                                          "Figure DPI",
                                          minimum=0,
                                          maximum=10000,
                                          step=10)
        self.figure_format = LabelledCombobox(
            self, "Figure Format", items=['pdf', 'png', 'ps', 'svg'])
        sidechains_groupbox = QGroupBox()
        sidechains_groupbox.setTitle("Sidechains")
        sidechains_groupbox_layout = QVBoxLayout()
        sidechains_groupbox.setLayout(sidechains_groupbox_layout)
        sidechains_groupbox.layout().addWidget(self.has_sidechains_checkbox)
        sidechains_groupbox.layout().addWidget(self.use_sidechains_checkbox)
        fasta_groupbox = QGroupBox()
        fasta_groupbox.setTitle("FASTA")
        fasta_groupbox_layout = QGridLayout()
        fasta_groupbox.setLayout(fasta_groupbox_layout)
        fasta_groupbox.layout().addWidget(self.apply_fasta_checkbox, 0, 0)
        fasta_groupbox.layout().addWidget(self.fasta_start, 0, 1)
        fasta_groupbox.layout().addWidget(self.fasta_button, 1, 0, 1, 2)
        self.x_checkbox = LabelledCheckbox(self, "Along X Axis")
        self.y_checkbox = LabelledCheckbox(self, "Along Y Axis")
        self.z_checkbox = LabelledCheckbox(self, "Along Z Axis")
        series_groupbox = QGroupBox()
        series_groupbox.setTitle("Experimental Series Analysis")
        series_groupbox_layout = QVBoxLayout()
        series_groupbox.setLayout(series_groupbox_layout)
        series_groupbox.layout().addWidget(self.x_checkbox)
        series_groupbox.layout().addWidget(self.y_checkbox)
        series_groupbox.layout().addWidget(self.z_checkbox)
        series_groupbox.layout().addWidget(self.perform_comparisons_checkbox)
        figure_groupbox = QGroupBox()
        figure_groupbox.setTitle("Figure")
        figure_groupbox_layout = QVBoxLayout()
        figure_groupbox.setLayout(figure_groupbox_layout)
        figure_groupbox.layout().addWidget(self.figure_width)
        figure_groupbox.layout().addWidget(self.figure_height)
        figure_groupbox.layout().addWidget(self.figure_dpi)
        figure_groupbox.layout().addWidget(self.figure_format)
        self.cs_correction = LabelledCheckbox(self, "CS Correction?")
        self.cs_correction_res_ref = LabelledSpinBox(self,
                                                     text="Correction Residue")
        cs_norm_groupbox = QGroupBox()
        cs_norm_groupbox.setTitle("Chemical Shift Normalisation")
        cs_groupbox_layout = QVBoxLayout()
        cs_norm_groupbox.setLayout(cs_groupbox_layout)
        cs_norm_groupbox.layout().addWidget(self.cs_correction)
        cs_norm_groupbox.layout().addWidget(self.cs_correction_res_ref)
        missing_analysis_groupbox = QGroupBox()
        missing_analysis_groupbox.setTitle(
            "Search missing residues across axes")
        missing_analysis_groupbox_layout = QVBoxLayout()
        missing_analysis_groupbox.setLayout(missing_analysis_groupbox_layout)
        missing_analysis_groupbox.layout().addWidget(self.expand_missing_yy)
        missing_analysis_groupbox.layout().addWidget(self.expand_missing_zz)
        cs_groupbox = QGroupBox()
        cs_groupbox.setTitle("CSP Specific")
        cs_groupbox_layout = QVBoxLayout()
        cs_groupbox.setLayout(cs_groupbox_layout)
        self.csp_alpha = LabelledDoubleSpinBox(self,
                                               text="CSP Alpha",
                                               minimum=0.01,
                                               maximum=1,
                                               step=0.01)
        self.csp_missing = LabelledCombobox(self,
                                            text="Show Missing Residues",
                                            items=['prev', 'full', 'zero'])
        self.csp_exceptions = QPushButton("Alpha by residue", self)
        self.csp_exceptions.clicked.connect(
            partial(self.show_popup, CSPExceptionsPopup))
        cs_groupbox.layout().addWidget(self.csp_alpha)
        cs_groupbox.layout().addWidget(self.csp_missing)
        cs_groupbox.layout().addWidget(self.csp_exceptions)
        restraint_groupbox = QGroupBox()
        restraint_groupbox.setTitle("Parameter Calculation")
        restraint_groupbox_layout = QGridLayout()
        restraint_groupbox.setLayout(restraint_groupbox_layout)
        self.plot_F1_data = LabelledCheckbox(self, text="F1 data")
        self.plot_F2_data = LabelledCheckbox(self, text="F2 data")
        self.plot_CSP = LabelledCheckbox(self, text="CSPs")
        self.plot_height_ratio = LabelledCheckbox(self,
                                                  text="Height Ratio",
                                                  callback=self.activate_pre)
        self.plot_volume_ratio = LabelledCheckbox(self,
                                                  text="Volume Ratio",
                                                  callback=self.activate_pre)
        self.plot_F1_y_label = LabelledLineEdit(self, text='')
        self.plot_F2_y_label = LabelledLineEdit(self, text='')
        self.plot_CSP_y_label = LabelledLineEdit(self, text='')
        self.plot_height_y_label = LabelledLineEdit(self, text='')
        self.plot_volume_y_label = LabelledLineEdit(self, text='')
        self.plot_F1_calccol = LabelledLineEdit(self, text="")
        self.plot_F2_calccol = LabelledLineEdit(self, text="")
        self.plot_CSP_calccol = LabelledLineEdit(self, text="")
        self.plot_height_calccol = LabelledLineEdit(self, text="")
        self.plot_volume_calccol = LabelledLineEdit(self, text="")
        self.plot_F1_y_scale = LabelledDoubleSpinBox(self,
                                                     text="",
                                                     minimum=0,
                                                     step=0.1)
        self.plot_F2_y_scale = LabelledDoubleSpinBox(self,
                                                     text="",
                                                     minimum=0,
                                                     step=0.1)
        self.plot_CSP_y_scale = LabelledDoubleSpinBox(self,
                                                      text="",
                                                      minimum=0,
                                                      step=0.1)
        self.plot_height_y_scale = LabelledDoubleSpinBox(self,
                                                         text="",
                                                         minimum=0,
                                                         step=0.1)
        self.plot_volume_y_scale = LabelledDoubleSpinBox(self,
                                                         text="",
                                                         minimum=0,
                                                         step=0.1)
        restraint_label = QLabel("Y Axis Label")
        axis_label = QLabel("Parameter Name")
        scale_label = QLabel("Y Axis Scale")
        restraint_label.setAlignment(QtCore.Qt.AlignHCenter)
        axis_label.setAlignment(QtCore.Qt.AlignHCenter)
        scale_label.setAlignment(QtCore.Qt.AlignHCenter)
        restraint_groupbox.layout().addWidget(restraint_label, 0, 2)
        restraint_groupbox.layout().addWidget(axis_label, 0, 1)
        restraint_groupbox.layout().addWidget(scale_label, 0, 3)
        restraint_groupbox.layout().addWidget(self.plot_F1_data, 1, 0)
        restraint_groupbox.layout().addWidget(self.plot_F2_data, 2, 0)
        restraint_groupbox.layout().addWidget(self.plot_CSP, 3, 0)
        restraint_groupbox.layout().addWidget(self.plot_height_ratio, 4, 0)
        restraint_groupbox.layout().addWidget(self.plot_volume_ratio, 5, 0)
        restraint_groupbox.layout().addWidget(self.plot_F1_y_label, 1, 2)
        restraint_groupbox.layout().addWidget(self.plot_F2_y_label, 2, 2)
        restraint_groupbox.layout().addWidget(self.plot_CSP_y_label, 3, 2)
        restraint_groupbox.layout().addWidget(self.plot_height_y_label, 4, 2)
        restraint_groupbox.layout().addWidget(self.plot_volume_y_label, 5, 2)
        restraint_groupbox.layout().addWidget(self.plot_F1_calccol, 1, 1)
        restraint_groupbox.layout().addWidget(self.plot_F2_calccol, 2, 1)
        restraint_groupbox.layout().addWidget(self.plot_CSP_calccol, 3, 1)
        restraint_groupbox.layout().addWidget(self.plot_height_calccol, 4, 1)
        restraint_groupbox.layout().addWidget(self.plot_volume_calccol, 5, 1)
        restraint_groupbox.layout().addWidget(self.plot_F1_y_scale, 1, 3)
        restraint_groupbox.layout().addWidget(self.plot_F2_y_scale, 2, 3)
        restraint_groupbox.layout().addWidget(self.plot_CSP_y_scale, 3, 3)
        restraint_groupbox.layout().addWidget(self.plot_height_y_scale, 4, 3)
        restraint_groupbox.layout().addWidget(self.plot_volume_y_scale, 5, 3)
        pre_groupbox = QGroupBox()
        pre_groupbox.setTitle("PRE Analysis")
        pre_groupbox_layout = QGridLayout()
        pre_groupbox.setLayout(pre_groupbox_layout)
        self.do_pre_checkbox = LabelledCheckbox(self, "Do PRE Analysis")
        self.do_pre_checkbox.setEnabled(False)
        self.heat_map_checkbox.setEnabled(False)
        self.dpre_checkbox.setEnabled(False)
        self.pre_settings = QPushButton("PRE Settings", self)
        self.pre_settings.clicked.connect(
            partial(self.show_popup, PreAnalysisPopup))
        self.pretheo_button = QPushButton("Select theo. PRE Files", self)
        self.pretheo_button.clicked.connect(
            partial(self.show_popup, PRETheoreticalSelectionPopup))
        pre_groupbox.layout().addWidget(self.do_pre_checkbox, 0, 0)
        pre_groupbox.layout().addWidget(self.pre_settings, 0, 1)
        pre_groupbox.layout().addWidget(self.dpre_checkbox, 1, 0)
        pre_groupbox.layout().addWidget(self.dpre_button, 1, 1)
        pre_groupbox.layout().addWidget(self.heat_map_checkbox, 2, 0)
        pre_groupbox.layout().addWidget(self.heat_map_button, 2, 1)
        pre_groupbox.layout().addWidget(self.pretheo_button)
        series_plotting_groupbox = QGroupBox()
        series_plotting_groupbox.setTitle("Series Plotting")
        series_plotting_groupbox_layout = QGridLayout()
        series_plotting_groupbox.setLayout(series_plotting_groupbox_layout)
        series_plotting_groupbox.layout().addWidget(self.tplot_button, 0, 0, 1,
                                                    1)
        series_plotting_groupbox.layout().addWidget(self.bar_button, 0, 1, 1,
                                                    1)
        series_plotting_groupbox.layout().addWidget(self.ext_bar_checkbox, 1,
                                                    0, 1, 1)
        series_plotting_groupbox.layout().addWidget(self.ext_bar_button, 1, 1,
                                                    1, 1)
        series_plotting_groupbox.layout().addWidget(self.comp_bar_checkbox, 2,
                                                    0, 1, 1)
        series_plotting_groupbox.layout().addWidget(self.comp_bar_button, 2, 1,
                                                    1, 1)
        series_plotting_groupbox.layout().addWidget(self.vert_bar_checkbox, 3,
                                                    0, 1, 1)
        series_plotting_groupbox.layout().addWidget(self.vert_bar_button, 3, 1,
                                                    1, 1)
        res_evo_groupbox = QGroupBox()
        res_evo_groupbox.setTitle("Residue Evolution Plot")
        res_evo_groupbox_layout = QGridLayout()
        res_evo_groupbox.setLayout(res_evo_groupbox_layout)
        res_evo_groupbox.layout().addWidget(self.revo_button, 0, 0, 1, 2)
        res_evo_groupbox.layout().addWidget(self.res_evo_checkbox, 1, 0, 1, 1)
        res_evo_groupbox.layout().addWidget(self.res_evo_button, 1, 1, 1, 1)
        res_evo_groupbox.layout().addWidget(self.scatter_checkbox, 2, 0, 1, 1)
        res_evo_groupbox.layout().addWidget(self.scatter_button, 2, 1, 1, 1)
        res_evo_groupbox.layout().addWidget(self.scatter_flower_checkbox, 3, 0,
                                            1, 1)
        res_evo_groupbox.layout().addWidget(self.scatter_flower_button, 3, 1,
                                            1, 1)
        grid.layout().addWidget(paths_group_box, 0, 0, 3, 16)
        grid.layout().addWidget(fasta_groupbox, 7, 4, 4, 4)
        grid.layout().addWidget(sidechains_groupbox, 3, 4, 4, 4)
        grid.layout().addWidget(cs_norm_groupbox, 7, 0, 4, 4)
        grid.layout().addWidget(missing_analysis_groupbox, 3, 0, 4, 4)
        grid.layout().addWidget(series_groupbox, 3, 8, 6, 4)
        grid.layout().addWidget(figure_groupbox, 3, 12, 6, 4)
        grid.layout().addWidget(figure_groupbox, 3, 12, 6, 4)
        grid.layout().addWidget(restraint_groupbox, 11, 0, 10, 8)
        grid.layout().addWidget(cs_groupbox, 9, 8, 5, 4)
        grid.layout().addWidget(pre_groupbox, 9, 12, 5, 4)
        grid.layout().addWidget(series_plotting_groupbox, 14, 8, 7, 4)
        grid.layout().addWidget(res_evo_groupbox, 14, 12, 7, 4)
        grid.layout().addWidget(self.tab_footer, 21, 0, 2, 16)
        #
        self.load_variables()

    def activate_fasta(self, value):
        self.variables["fasta_settings"]["applyFASTA"] = value
        print(self.variables["fasta_settings"]["applyFASTA"])

    def activate_pre(self):
        if self.plot_height_ratio.isChecked(
        ) or self.plot_volume_ratio.isChecked():
            self.do_pre_checkbox.setEnabled(True)
            self.dpre_checkbox.setEnabled(True)
            self.heat_map_checkbox.setEnabled(True)

        else:
            self.do_pre_checkbox.setEnabled(False)
            self.dpre_checkbox.setEnabled(False)
            self.heat_map_checkbox.setEnabled(False)

    def set_spectrum_path_text(self, path=None):
        self.spectrum_path.setText(path)
        self.variables["general_settings"]["spectra_path"] = path
        self.parent().parent().parent().load_peak_lists(path)

    def set_output_path_text(self, path=None):
        self.output_path.setText(path)
        self.variables["general_settings"]["output_path"] = path

    def set_spectrum_path(self, path=None):
        if not path:
            path = str(
                QFileDialog.getExistingDirectory(None, 'Select Directory',
                                                 os.getcwd()))

        self.set_spectrum_path_text(path)

    def set_output_path(self, path=None):
        if not path:
            path = str(
                QFileDialog.getExistingDirectory(None, 'Select Directory',
                                                 os.getcwd()))

        self.output_path.setText(path)
        self.variables["general_settings"]["output_path"] = path

    def load_config(self):
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Warning)
        msg.setText("Load Configuration")
        msg.setInformativeText("This will overwrite all existing "
                               "settings and data points!")
        msg.setWindowTitle("Reset Experimental Series")
        msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
        retval = msg.exec_()

        if retval == QMessageBox.Ok:
            self.variables = self.parent().parent().parent().load_config()
            self.load_variables()

        else:
            return

    def save_config(self):
        general = self.variables["general_settings"]
        fitting = self.variables["fitting_settings"]
        cs = self.variables["cs_settings"]
        csp = self.variables["csp_settings"]
        fasta = self.variables["fasta_settings"]
        plots_f1 = self.variables["PosF1_settings"]
        plots_f2 = self.variables["PosF2_settings"]
        plots_height = self.variables["Height_ratio_settings"]
        plots_volume = self.variables["Volume_ratio_settings"]

        # General Settings

        general["spectra_path"] = self.spectrum_path.field.text()
        general["output_path"] = self.output_path.field.text()
        general["has_sidechains"] = self.has_sidechains_checkbox.isChecked()
        general["use_sidechains"] = self.use_sidechains_checkbox.isChecked()
        general["fig_height"] = self.figure_height.field.value()
        general["fig_width"] = self.figure_width.field.value()
        general["fig_dpi"] = self.figure_dpi.field.value()
        general["fig_file_type"] = self.figure_format.fields.currentText()

        # Fitting Settings
        fitting["expand_missing_yy"] = self.expand_missing_yy.isChecked()
        fitting["expand_missing_zz"] = self.expand_missing_zz.isChecked()
        fitting[
            "perform_comparisons"] = self.perform_comparisons_checkbox.isChecked(
            )
        fitting["do_along_x"] = self.x_checkbox.isChecked()
        fitting["do_along_y"] = self.y_checkbox.isChecked()
        fitting["do_along_z"] = self.z_checkbox.isChecked()

        # CS Settings
        cs["perform_cs_correction"] = self.cs_correction.isChecked()
        cs["cs_correction_res_ref"] = self.cs_correction_res_ref.field.value()

        # CSP Settings
        csp["csp_res4alpha"] = round(self.csp_alpha.field.value(), 2)
        csp["cs_missing"] = self.csp_missing.fields.currentText()

        # FASTA Settings
        fasta["applyFASTA"] = self.apply_fasta_checkbox.checkBox.isChecked()
        fasta["FASTAstart"] = self.fasta_start.field.value()

        self.variables["pre_settings"][
            "apply_PRE_analysis"] = self.do_pre_checkbox.isChecked()

        # Plot F1 Settings
        plots_f1["calcs_PosF1_delta"] = self.plot_F1_data.isChecked()
        plots_f1["yy_label_PosF1_delta"] = self.plot_F1_y_label.field.text()
        plots_f1["yy_scale_PosF1_delta"] = self.plot_F1_y_scale.field.value()
        plots_f1["calccol_name_PosF1_delta"] = self.plot_F1_calccol.field.text(
        )

        # Plot F2 Settings
        plots_f2["calcs_PosF2_delta"] = self.plot_F2_data.isChecked()
        plots_f2["yy_label_PosF2_delta"] = self.plot_F2_y_label.field.text()
        plots_f2["yy_scale_PosF2_delta"] = self.plot_F2_y_scale.field.value()
        plots_f2["calccol_name_PosF2_delta"] = self.plot_F2_calccol.field.text(
        )

        # Plot CSP Settings
        csp["calcs_CSP"] = self.plot_CSP.isChecked()
        csp["yy_label_CSP"] = self.plot_CSP_y_label.field.text()
        csp["yy_scale_CSP"] = self.plot_CSP_y_scale.field.value()
        csp["calccol_name_CSP"] = self.plot_CSP_calccol.field.text()

        # Plot Height Settings
        plots_height["calcs_Height_ratio"] = self.plot_height_ratio.isChecked()
        plots_height[
            "yy_label_Height_ratio"] = self.plot_height_y_label.field.text()
        plots_height[
            "yy_scale_Height_ratio"] = self.plot_height_y_scale.field.value()
        plots_height[
            "calccol_name_Height_ratio"] = self.plot_height_calccol.field.text(
            )

        # Plot Volume Settings
        plots_volume["calcs_Volume_ratio"] = self.plot_volume_ratio.isChecked()
        plots_volume[
            "yy_label_Volume_ratio"] = self.plot_volume_y_label.field.text()
        plots_volume[
            "yy_scale_Volume_ratio"] = self.plot_volume_y_scale.field.value()
        plots_volume[
            "calccol_name_Volume_ratio"] = self.plot_volume_calccol.field.text(
            )

        # Plot Booleans
        self.variables["plotting_flags"][
            "do_ext_bar"] = self.ext_bar_checkbox.isChecked()
        self.variables["plotting_flags"][
            "do_comp_bar"] = self.comp_bar_checkbox.isChecked()
        self.variables["plotting_flags"][
            "do_vert_bar"] = self.vert_bar_checkbox.isChecked()
        self.variables["plotting_flags"][
            "do_res_evo"] = self.res_evo_checkbox.isChecked()
        self.variables["plotting_flags"][
            "do_cs_scatter"] = self.scatter_checkbox.isChecked()
        self.variables["plotting_flags"]["do_cs_scatter_flower"] = \
            self.scatter_flower_checkbox.isChecked()
        self.variables["plotting_flags"][
            "do_heat_map"] = self.heat_map_checkbox.isChecked()
        self.variables["plotting_flags"][
            "do_DPRE_plot"] = self.dpre_checkbox.isChecked()

    def run_farseer_calculation(self):
        self.parent().parent().parent().run_farseer_calculation()

    def load_variables(self):
        general = self.variables["general_settings"]
        fitting = self.variables["fitting_settings"]
        cs = self.variables["cs_settings"]
        csp = self.variables["csp_settings"]
        fasta = self.variables["fasta_settings"]
        plots_f1 = self.variables["PosF1_settings"]
        plots_f2 = self.variables["PosF2_settings"]
        plots_height = self.variables["Height_ratio_settings"]
        plots_volume = self.variables["Volume_ratio_settings"]

        # General Settings
        if os.path.exists(general["spectra_path"]):
            self.spectrum_path.field.setText(general["spectra_path"])
        else:
            self.spectrum_path.field.setText(os.getcwd())

        if os.path.exists(general["output_path"]):
            self.output_path.field.setText(general["output_path"])

        else:
            self.output_path.field.setText(os.getcwd())

        self.has_sidechains_checkbox.setChecked(general["has_sidechains"])
        self.use_sidechains_checkbox.setChecked(general["use_sidechains"])
        self.figure_height.setValue(general["fig_height"])
        self.figure_width.setValue(general["fig_width"])
        self.figure_dpi.setValue(general["fig_dpi"])
        self.figure_format.select(general["fig_file_type"])

        # Fitting Settings
        self.expand_missing_yy.setChecked(fitting["expand_missing_yy"])
        self.expand_missing_zz.setChecked(fitting["expand_missing_zz"])
        self.perform_comparisons_checkbox.setChecked(
            fitting["perform_comparisons"])
        self.x_checkbox.setChecked(fitting["do_along_x"])
        self.y_checkbox.setChecked(fitting["do_along_y"])
        self.z_checkbox.setChecked(fitting["do_along_z"])

        # CS Settings
        self.cs_correction.setChecked(cs["perform_cs_correction"])
        self.cs_correction_res_ref.setValue(cs["cs_correction_res_ref"])

        # CSP Settings
        self.csp_alpha.setValue(csp["csp_res4alpha"])
        self.csp_missing.select(csp["cs_missing"])

        # FASTA Settings
        self.apply_fasta_checkbox.checkBox.setChecked(fasta["applyFASTA"])
        self.fasta_start.setValue(fasta["FASTAstart"])

        # PRE settings
        self.do_pre_checkbox.setChecked(
            self.variables["pre_settings"]["apply_PRE_analysis"])

        # Plot F1 Settings
        self.plot_F1_data.setChecked(plots_f1["calcs_PosF1_delta"])
        self.plot_F1_y_label.field.setText(plots_f1["yy_label_PosF1_delta"])
        self.plot_F1_y_scale.setValue(plots_f1["yy_scale_PosF1_delta"])
        self.plot_F1_calccol.field.setText(
            plots_f1["calccol_name_PosF1_delta"])

        # Plot F2 Settings
        self.plot_F2_data.setChecked(plots_f2["calcs_PosF2_delta"])
        self.plot_F2_y_label.field.setText(plots_f2["yy_label_PosF2_delta"])
        self.plot_F2_y_scale.setValue(plots_f2["yy_scale_PosF2_delta"])
        self.plot_F2_calccol.field.setText(
            plots_f2["calccol_name_PosF2_delta"])

        # Plot CSP Settings
        self.plot_CSP.setChecked(csp["calcs_CSP"])
        self.plot_CSP_y_label.field.setText(csp["yy_label_CSP"])
        self.plot_CSP_y_scale.setValue(csp["yy_scale_CSP"])
        self.plot_CSP_calccol.field.setText(csp["calccol_name_CSP"])

        # Plot Height Settings
        self.plot_height_ratio.setChecked(plots_height["calcs_Height_ratio"])
        self.plot_height_y_label.field.setText(
            plots_height["yy_label_Height_ratio"])
        self.plot_height_y_scale.setValue(
            plots_height["yy_scale_Height_ratio"])
        self.plot_height_calccol.field.setText(
            plots_height["calccol_name_Height_ratio"])

        # Plot Volume Settings
        self.plot_volume_ratio.setChecked(plots_volume["calcs_Volume_ratio"])
        self.plot_volume_y_label.field.setText(
            plots_volume["yy_label_Volume_ratio"])
        self.plot_volume_y_scale.setValue(
            plots_volume["yy_scale_Volume_ratio"])
        self.plot_volume_calccol.field.setText(
            plots_volume["calccol_name_Volume_ratio"])

        # Plot Booleans
        self.ext_bar_checkbox.setChecked(
            self.variables["plotting_flags"]["do_ext_bar"])
        self.comp_bar_checkbox.setChecked(
            self.variables["plotting_flags"]["do_comp_bar"])
        self.vert_bar_checkbox.setChecked(
            self.variables["plotting_flags"]["do_vert_bar"])
        self.res_evo_checkbox.setChecked(
            self.variables["plotting_flags"]["do_res_evo"])
        self.scatter_checkbox.setChecked(
            self.variables["plotting_flags"]["do_cs_scatter"])
        self.scatter_flower_checkbox.setChecked(
            self.variables["plotting_flags"]["do_cs_scatter_flower"])
        self.heat_map_checkbox.setChecked(
            self.variables["plotting_flags"]["do_heat_map"])
        self.dpre_checkbox.setChecked(
            self.variables["plotting_flags"]["do_DPRE_plot"])

    def show_popup(self, popup):
        popup(self).launch()
예제 #16
0
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(self,
                        parent,
                        title="Residue Evolution Plot",
                        settings_key=["res_evo_settings"])
     self.res_evo_cols = LabelledSpinBox(self,
                                         text="Columns Per Page",
                                         minimum=1,
                                         step=1)
     self.res_evo_rows = LabelledSpinBox(self,
                                         text="Rows Per Page",
                                         minimum=1,
                                         step=1)
     self.res_evo_set_x_values = LabelledCheckbox(
         self, "Use User Defined X Values?")
     self.res_evo_x_ticks_nbins = LabelledSpinBox(self,
                                                  text="Number of Ticks",
                                                  minimum=1,
                                                  step=1)
     self.res_evo_x_label = LabelledLineEdit(self, text="X Label")
     self.res_evo_plot_line_style = LabelledCombobox(
         self, text="Plot Line Style", items=["-", "--", "-.", ":"])
     self.res_evo_plot_line_width = LabelledSpinBox(self,
                                                    "Line Width",
                                                    minimum=0,
                                                    step=1)
     self.res_evo_line_color = ColourBox(self, text="Line Colour")
     self.res_evo_plot_marker_style = LabelledCombobox(
         self, text="Marker Style", items=["-", "--", "-.", ":", "o"])
     self.res_evo_plot_marker_size = LabelledSpinBox(self,
                                                     "Marker Size",
                                                     minimum=0,
                                                     step=1)
     self.res_evo_marker_color = ColourBox(self, text="Marker Colour")
     self.res_evo_plot_fill_between = LabelledCheckbox(
         self, text="Draw Data Shade")
     self.res_evo_plot_fill_colour = ColourBox(self, text="Shade Colour")
     self.res_evo_fill_alpha = LabelledDoubleSpinBox(
         self, text="Shade Transparency", minimum=0, maximum=1, step=0.1)
     self.res_evo_fit_line_colour = ColourBox(self, text="Fit Line Colour")
     self.res_evo_fit_line_width = LabelledSpinBox(self,
                                                   text="Fit Line Width",
                                                   minimum=0,
                                                   step=1)
     self.res_evo_fit_line_style = LabelledCombobox(
         self, text="Fit Line Style", items=["-", "--", "-.", ":", "o"])
     self.layout().addWidget(self.res_evo_cols, 0, 0)
     self.layout().addWidget(self.res_evo_rows, 1, 0)
     self.layout().addWidget(self.res_evo_set_x_values, 2, 0)
     self.layout().addWidget(self.res_evo_x_ticks_nbins, 3, 0)
     self.layout().addWidget(self.res_evo_x_label, 4, 0)
     self.layout().addWidget(self.res_evo_plot_line_style, 5, 0)
     self.layout().addWidget(self.res_evo_plot_line_width, 6, 0)
     self.layout().addWidget(self.res_evo_line_color, 7, 0)
     self.layout().addWidget(self.res_evo_plot_marker_style, 0, 1)
     self.layout().addWidget(self.res_evo_plot_marker_size, 1, 1)
     self.layout().addWidget(self.res_evo_marker_color, 2, 1)
     self.layout().addWidget(self.res_evo_plot_fill_between, 3, 1)
     self.layout().addWidget(self.res_evo_plot_fill_colour, 4, 1)
     self.layout().addWidget(self.res_evo_fill_alpha, 5, 1)
     self.layout().addWidget(self.res_evo_fit_line_colour, 6, 1)
     self.layout().addWidget(self.res_evo_fit_line_width, 7, 1)
     self.layout().addWidget(self.res_evo_fit_line_style, 8, 1)
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                       | QDialogButtonBox.Cancel
                                       | QDialogButtonBox.RestoreDefaults)
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(
         QDialogButtonBox.RestoreDefaults).clicked.connect(
             self.get_defaults)
     self.layout().addWidget(self.buttonBox, 9, 0, 1, 2)
     self.get_values()
예제 #17
0
 def __init__(self, parent, text=None):
     LabelledCombobox.__init__(self, parent, text, fonts)
class ScatterFlowerPlotPopup(BasePopup):
    """
    A popup for setting Scatter Flower Plot specific settings in the
    Farseer-NMR configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(
            self,
            parent,
            title="Scatter Flower Plot",
            settings_key=["cs_scatter_flower_settings"]
            )
        self.x_label = LabelledLineEdit(self, "X Label")
        self.y_label = LabelledLineEdit(self, "Y Label")
        self.mksize = LabelledSpinBox(self, "Mark Size", minimum=0, step=1)
        self.color_grad = LabelledCheckbox(self, "Colour Gradient")
        self.color_start = ColourBox(self, text="Mark Start Colour")
        self.color_end = ColourBox(self, text="Mark End Colour")
        self.color_list = LabelledLineEdit(self, "Colour List")
        self.x_label_fn = FontComboBox(self, "X Label Font")
        self.x_label_fs = LabelledSpinBox(self, "X Label Font Size", minimum=0, step=1)
        self.x_label_pad = LabelledDoubleSpinBox(
            self,
            "X Label Padding",
            minimum=-100,
            maximum=100,
            step=0.1
            )
        self.x_label_weight = LabelledCombobox(self, text="X Label Font Weight", items=font_weights)
        self.y_label_fn = FontComboBox(self, "Y Label Font")
        self.y_label_fs = LabelledSpinBox(self, "Y Label Font Size", minimum=0, step=1)
        self.y_label_pad = LabelledDoubleSpinBox(
            self,
            "Y Label Padding",
            minimum=-100,
            maximum=100,
            step=0.1
            )
        self.y_label_weight = LabelledCombobox(
            self,
            text="Y Label Font Weight",
            items=font_weights
            )
        self.x_ticks_fn = FontComboBox(self, "X Tick Font")
        self.x_ticks_fs = LabelledSpinBox(self, "X Tick Font Size", minimum=0, step=1)
        self.x_ticks_pad = LabelledDoubleSpinBox(
            self,
            "X Tick Padding",
            minimum=-100,
            maximum=100,
            step=0.1
            )
        self.x_ticks_weight = LabelledCombobox(self, text="X Tick Weight", items=font_weights)
        self.x_ticks_rot = LabelledSpinBox(
            self,
            "X Tick Rotation",
            minimum=0,
            maximum=360,
            step=1
            )
        self.y_ticks_fn = FontComboBox(self, "Y Tick Font")
        self.y_ticks_fs = LabelledSpinBox(self, "Y Tick Font Size", minimum=0, step=1)
        self.y_ticks_pad = LabelledDoubleSpinBox(
            self,
            "Y Tick Padding",
            minimum=-100,
            maximum=100,
            step=0.1
            )
        self.y_ticks_weight = LabelledCombobox(self, text="Y Tick Weight", items=font_weights)
        self.y_ticks_rot = LabelledSpinBox(
            self,
            "Y Tick Rotation",
            minimum=0,
            maximum=360,
            step=1
            )
        self.res_label_color = ColourBox(self, text="Residue Label Colour")
        # layout
        self.layout().addWidget(self.x_label, 0, 0)
        self.layout().addWidget(self.y_label, 1, 0)
        self.layout().addWidget(self.mksize, 2, 0)
        self.layout().addWidget(self.color_grad, 3, 0)
        self.layout().addWidget(self.color_start, 4, 0)
        self.layout().addWidget(self.color_end, 5, 0)
        self.layout().addWidget(self.x_label_fn, 6, 0)
        self.layout().addWidget(self.x_label_fs, 7, 0)
        self.layout().addWidget(self.color_list, 8, 0)
        self.layout().addWidget(self.res_label_color, 8, 1)
        self.layout().addWidget(self.x_label_pad, 0, 1)
        self.layout().addWidget(self.x_label_weight, 1, 1)
        self.layout().addWidget(self.y_label_fn, 2, 1)
        self.layout().addWidget(self.y_label_fs, 3, 1)
        self.layout().addWidget(self.y_label_pad, 4, 1)
        self.layout().addWidget(self.y_label_weight, 5, 1)
        self.layout().addWidget(self.x_ticks_fn, 6, 1)
        self.layout().addWidget(self.x_ticks_fs, 7, 1)
        self.layout().addWidget(self.x_ticks_pad, 0, 2)
        self.layout().addWidget(self.x_ticks_weight, 1, 2)
        self.layout().addWidget(self.x_ticks_rot, 2, 2)
        self.layout().addWidget(self.y_ticks_fn, 3, 2)
        self.layout().addWidget(self.y_ticks_fs, 4, 2)
        self.layout().addWidget(self.y_ticks_pad, 5, 2)
        self.layout().addWidget(self.y_ticks_weight, 6, 2)
        self.layout().addWidget(self.y_ticks_rot, 7, 2)
        self.buttonBox = QDialogButtonBox(
            QDialogButtonBox.Ok |
            QDialogButtonBox.Cancel |
            QDialogButtonBox.RestoreDefaults
            )
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(QDialogButtonBox.RestoreDefaults).clicked.connect(self.get_defaults)
        self.layout().addWidget(self.buttonBox, 9, 0, 1, 2)
        self.get_values()

    def get_defaults(self):
        # text
        self.x_label.field.setText(self.defaults["x_label"])
        self.y_label.field.setText(self.defaults["y_label"])
        self.color_list.field.setText(','.join(self.defaults["color_list"]))
        # value
        self.mksize.setValue(self.defaults["mksize"])
        self.x_label_fs.setValue(self.defaults["x_label_fs"])
        self.x_label_pad.setValue(self.defaults["x_label_pad"])
        self.y_label_fs.setValue(self.defaults["y_label_fs"])
        self.y_label_pad.setValue(self.defaults["y_label_pad"])
        self.x_ticks_fs.setValue(self.defaults["x_ticks_fs"])
        self.x_ticks_pad.setValue(self.defaults["x_ticks_pad"])
        self.x_ticks_rot.setValue(self.defaults["x_ticks_rot"])
        self.y_ticks_fs.setValue(self.defaults["y_ticks_fs"])
        self.y_ticks_pad.setValue(self.defaults["y_ticks_pad"])
        self.y_ticks_rot.setValue(self.defaults["y_ticks_rot"])
        # colour
        self.color_start.get_colour(self.defaults["mk_start_color"])
        self.color_end.get_colour(self.defaults["mk_end_color"])
        self.res_label_color.get_colour(self.defaults["res_label_color"])
        # chceked
        self.color_grad.setChecked(self.defaults["color_grad"])
        # dropdown
        self.x_label_fn.select(self.defaults["x_label_fn"])
        self.x_label_weight.select(self.defaults["x_label_weight"])
        self.y_label_fn.select(self.defaults["y_label_fn"])
        self.y_label_weight.select(self.defaults["y_label_weight"])
        self.x_ticks_fn.select(self.defaults["x_ticks_fn"])
        self.x_ticks_weight.select(self.defaults["x_ticks_weight"])
        self.y_ticks_fn.select(self.defaults["y_ticks_fn"])
        self.y_ticks_weight.select(self.defaults["y_ticks_weight"])

    def set_values(self):
        # text
        self.local_variables["x_label"] = self.x_label.field.text()
        self.local_variables["y_label"] = self.y_label.field.text()
        self.local_variables["x_label_fn"] = self.x_label_fn.fields.currentText()
        self.local_variables["x_label_weight"] = self.x_label_weight.fields.currentText()
        self.local_variables["y_label_fn"] = self.y_label_fn.fields.currentText()
        self.local_variables["y_label_weight"] = self.y_label_weight.fields.currentText()
        self.local_variables["x_label_fn"] = self.x_label_fn.fields.currentText()
        self.local_variables["x_label_weight"] = self.x_label_weight.fields.currentText()
        self.local_variables["x_ticks_fn"] = self.x_ticks_fn.fields.currentText()
        self.local_variables["x_ticks_weight"] = self.x_ticks_weight.fields.currentText()
        self.local_variables["y_ticks_fn"] = self.y_ticks_fn.fields.currentText()
        self.local_variables["y_ticks_weight"] = self.y_ticks_weight.fields.currentText()
        # value
        self.local_variables["mksize"] = self.mksize.field.value()
        self.local_variables["x_label_fs"] = self.x_label_fs.field.value()
        self.local_variables["x_label_pad"] = self.x_label_pad.field.value()
        self.local_variables["y_label_fs"] = self.y_label_fs.field.value()
        self.local_variables["y_label_pad"] = self.y_label_pad.field.value()
        self.local_variables["x_label_fs"] = self.x_label_fs.field.value()
        self.local_variables["x_label_pad"] = self.x_label_pad.field.value()
        self.local_variables["x_ticks_fs"] = self.x_ticks_fs.field.value()
        self.local_variables["x_ticks_pad"] = self.x_ticks_pad.field.value()
        self.local_variables["x_ticks_rot"] = self.x_ticks_rot.field.value()
        self.local_variables["y_ticks_fs"] = self.y_ticks_fs.field.value()
        self.local_variables["y_ticks_pad"] = self.y_ticks_pad.field.value()
        self.local_variables["y_ticks_rot"] = self.y_ticks_rot.field.value()
        # check
        self.local_variables["color_grad"] = self.color_grad.isChecked()
        # colours
        self.local_variables["mk_start_color"] = colours[self.color_start.fields.currentText()]
        self.local_variables["mk_end_color"] = colours[self.color_end.fields.currentText()]
        self.local_variables["res_label_color"] = self.res_label_color.fields.currentText()
        self.local_variables["color_list"] = \
            [x.translate(translator) for x in self.color_list.field.text().split(',')]
        self.accept()

    def get_values(self):
        # text
        self.x_label.field.setText(self.local_variables["x_label"])
        self.y_label.field.setText(self.local_variables["y_label"])
        self.color_list.field.setText(','.join(self.local_variables["color_list"]))
        # value
        self.mksize.setValue(self.local_variables["mksize"])
        self.x_label_fs.setValue(self.local_variables["x_label_fs"])
        self.x_label_pad.setValue(self.local_variables["x_label_pad"])
        self.y_label_fs.setValue(self.local_variables["y_label_fs"])
        self.y_label_pad.setValue(self.local_variables["y_label_pad"])
        self.x_ticks_fs.setValue(self.local_variables["x_ticks_fs"])
        self.x_ticks_pad.setValue(self.local_variables["x_ticks_pad"])
        self.x_ticks_rot.setValue(self.local_variables["x_ticks_rot"])
        self.y_ticks_fs.setValue(self.local_variables["y_ticks_fs"])
        self.y_ticks_pad.setValue(self.local_variables["y_ticks_pad"])
        self.y_ticks_rot.setValue(self.local_variables["y_ticks_rot"])
        # checked
        self.color_grad.setChecked(self.local_variables["color_grad"])
        # colours
        self.color_start.get_colour(self.local_variables["mk_start_color"])
        self.color_end.get_colour(self.local_variables["mk_end_color"])
        self.res_label_color.get_colour(self.local_variables["res_label_color"])
        # dropdown
        self.x_label_fn.select(self.local_variables["x_label_fn"])
        self.x_label_weight.select(self.local_variables["x_label_weight"])
        self.y_label_fn.select(self.local_variables["y_label_fn"])
        self.y_label_weight.select(self.local_variables["y_label_weight"])
        self.x_ticks_fn.select(self.local_variables["x_ticks_fn"])
        self.x_ticks_weight.select(self.local_variables["x_ticks_weight"])
        self.y_ticks_fn.select(self.local_variables["y_ticks_fn"])
        self.y_ticks_weight.select(self.local_variables["y_ticks_weight"])
 def __init__(self, parent=None, **kw):
     BasePopup.__init__(self,
                        parent,
                        title="Residue Evolution Plot",
                        settings_key=["revo_settings"])
     self.do_revo_fit = LabelledCheckbox(self,
                                         text="Fit Parameter Evolution")
     self.revo_subtitle_fn = FontComboBox(self, text="Subtitle Font")
     self.revo_subtitle_fs = LabelledSpinBox(self,
                                             text="Subtitle Font Size",
                                             minimum=0,
                                             step=1)
     self.revo_subtitle_pad = LabelledDoubleSpinBox(self,
                                                    text="Subtitle Padding",
                                                    minimum=-100,
                                                    maximum=100,
                                                    step=0.1)
     self.revo_subtitle_weight = LabelledCombobox(
         self, text="Subtitle Font Weight", items=font_weights)
     self.revo_x_label_fn = FontComboBox(self, text="X Label Font")
     self.revo_x_label_fs = LabelledSpinBox(self,
                                            text="X Label Font Size",
                                            minimum=0,
                                            step=1)
     self.revo_x_label_pad = LabelledDoubleSpinBox(self,
                                                   text="X Label Padding",
                                                   minimum=-100,
                                                   maximum=100,
                                                   step=0.1)
     self.revo_x_label_weight = LabelledCombobox(self,
                                                 text="X Label Font Weight",
                                                 items=font_weights)
     self.revo_y_label_fn = FontComboBox(self, text="Y Label Font Size")
     self.revo_y_label_fs = LabelledSpinBox(self,
                                            text="Y Label Font Size",
                                            minimum=0,
                                            step=1)
     self.revo_y_label_pad = LabelledSpinBox(self,
                                             text="Y Label Padding",
                                             minimum=-100,
                                             maximum=100,
                                             step=0.1)
     self.revo_y_label_weight = LabelledCombobox(self,
                                                 text="Y Label Font Weight",
                                                 items=font_weights)
     self.revo_x_ticks_fn = FontComboBox(self, text="X Tick Font")
     self.revo_x_ticks_fs = LabelledSpinBox(self,
                                            text="X Tick Font Size",
                                            minimum=0,
                                            step=1)
     self.revo_x_ticks_pad = LabelledDoubleSpinBox(self,
                                                   text="X Tick Padding",
                                                   minimum=-100,
                                                   maximum=100,
                                                   step=0.1)
     self.revo_x_ticks_weight = LabelledCombobox(self,
                                                 text="X Tick Font Weight",
                                                 items=font_weights)
     self.revo_x_ticks_rotation = LabelledDoubleSpinBox(
         self, text="X Tick Rotation", minimum=0, maximum=360, step=1)
     self.revo_y_ticks_fn = FontComboBox(self, text="Y Tick Font")
     self.revo_y_ticks_fs = LabelledSpinBox(self,
                                            text="Y Tick Font Size",
                                            minimum=0,
                                            step=1)
     self.revo_y_ticks_pad = LabelledDoubleSpinBox(self,
                                                   text="Y Tick Padding",
                                                   minimum=-100,
                                                   maximum=100,
                                                   step=0.1)
     self.revo_y_ticks_weight = LabelledCombobox(self,
                                                 text="Y Tick Font Weight",
                                                 items=font_weights)
     self.revo_y_ticks_rot = LabelledSpinBox(self,
                                             text="Y Tick Rotation",
                                             minimum=0,
                                             maximum=360,
                                             step=1)
     self.titration_x_values = LabelledLineEdit(self,
                                                text="Titration X Values")
     # add widgets
     self.layout().addWidget(self.revo_subtitle_fn, 0, 0)
     self.layout().addWidget(self.revo_subtitle_fs, 1, 0)
     self.layout().addWidget(self.revo_subtitle_pad, 2, 0)
     self.layout().addWidget(self.revo_subtitle_weight, 3, 0)
     self.layout().addWidget(self.revo_x_label_fn, 4, 0)
     self.layout().addWidget(self.revo_x_label_fs, 5, 0)
     self.layout().addWidget(self.revo_x_label_pad, 6, 0)
     self.layout().addWidget(self.revo_x_label_weight, 7, 0)
     self.layout().addWidget(self.revo_y_label_fn, 8, 0)
     self.layout().addWidget(self.revo_y_label_fs, 9, 0)
     self.layout().addWidget(self.revo_y_label_pad, 10, 0)
     self.layout().addWidget(self.titration_x_values, 11, 0)
     self.layout().addWidget(self.revo_y_label_weight, 0, 1)
     self.layout().addWidget(self.revo_x_ticks_fn, 1, 1)
     self.layout().addWidget(self.revo_x_ticks_fs, 2, 1)
     self.layout().addWidget(self.revo_x_ticks_pad, 3, 1)
     self.layout().addWidget(self.revo_x_ticks_weight, 4, 1)
     self.layout().addWidget(self.revo_x_ticks_rotation, 5, 1)
     self.layout().addWidget(self.revo_y_ticks_fn, 6, 1)
     self.layout().addWidget(self.revo_y_ticks_fs, 7, 1)
     self.layout().addWidget(self.revo_y_ticks_pad, 8, 1)
     self.layout().addWidget(self.revo_y_ticks_weight, 9, 1)
     self.layout().addWidget(self.revo_y_ticks_rot, 10, 1)
     self.layout().addWidget(self.do_revo_fit, 11, 1)
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                       | QDialogButtonBox.Cancel
                                       | QDialogButtonBox.RestoreDefaults)
     self.buttonBox.accepted.connect(self.set_values)
     self.buttonBox.rejected.connect(self.reject)
     self.buttonBox.button(
         QDialogButtonBox.RestoreDefaults).clicked.connect(
             self.get_defaults)
     self.layout().addWidget(self.buttonBox, 12, 0, 1, 2)
     self.get_values()
예제 #20
0
class ScatterPlotPopup(BasePopup):
    """
    A popup for setting Scatter Plot specific settings in the Farseer-NMR
    configuration.

    Parameters:
        parent(QWidget): parent widget for popup.

    Methods:
        .get_defaults()
        .get_values()
        .set_values()
    """
    def __init__(self, parent=None, **kw):
        BasePopup.__init__(self,
                           parent,
                           title="Scatter Plot",
                           settings_key=["cs_scatter_settings"])
        self.cs_scatter_cols_page = LabelledSpinBox(self,
                                                    "Columns Per Page",
                                                    minimum=1,
                                                    step=1)
        self.cs_scatter_rows_page = LabelledSpinBox(self,
                                                    "Rows Per Page",
                                                    minimum=1,
                                                    step=1)
        self.cs_scatter_x_label = LabelledLineEdit(self, "X Label")
        self.cs_scatter_y_label = LabelledLineEdit(self, "Y Label")
        self.cs_scatter_mksize = LabelledSpinBox(self,
                                                 "Mark Size",
                                                 minimum=0,
                                                 step=1)
        self.cs_scatter_scale = LabelledDoubleSpinBox(self,
                                                      "Scale",
                                                      minimum=0,
                                                      step=0.01)
        self.cs_scatter_mk_type = LabelledCombobox(self,
                                                   text="Mark Type",
                                                   items=['color', 'shape'])
        self.cs_scatter_mk_start_color = ColourBox(self,
                                                   text="Mark Start Colour")
        self.cs_scatter_mk_end_color = ColourBox(self, text="Mark End Colour")
        self.cs_scatter_markers = LabelledLineEdit(self, "Sequential Markers")
        self.cs_scatter_mk_color = LabelledLineEdit(self, text="Mark Colours")
        self.cs_scatter_mk_missing_color = ColourBox(self,
                                                     "Missing Mark Colour")
        self.cs_scatter_mk_edgecolors = LabelledLineEdit(
            self, "Marker Edge Colours")
        self.cs_scatter_hide_missing = LabelledCheckbox(
            self, "Hide Missing Data Points")
        # layout
        self.layout().addWidget(self.cs_scatter_cols_page, 0, 0)
        self.layout().addWidget(self.cs_scatter_rows_page, 1, 0)
        self.layout().addWidget(self.cs_scatter_x_label, 2, 0)
        self.layout().addWidget(self.cs_scatter_y_label, 3, 0)
        self.layout().addWidget(self.cs_scatter_mksize, 4, 0)
        self.layout().addWidget(self.cs_scatter_scale, 5, 0)
        self.layout().addWidget(self.cs_scatter_mk_type, 6, 0)
        self.layout().addWidget(self.cs_scatter_mk_start_color, 0, 1)
        self.layout().addWidget(self.cs_scatter_mk_end_color, 1, 1)
        self.layout().addWidget(self.cs_scatter_markers, 2, 1)
        self.layout().addWidget(self.cs_scatter_mk_color, 3, 1)
        self.layout().addWidget(self.cs_scatter_mk_edgecolors, 4, 1)
        self.layout().addWidget(self.cs_scatter_mk_missing_color, 5, 1)
        self.layout().addWidget(self.cs_scatter_hide_missing, 6, 1)
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                          | QDialogButtonBox.Cancel
                                          | QDialogButtonBox.RestoreDefaults)
        self.buttonBox.accepted.connect(self.set_values)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.button(
            QDialogButtonBox.RestoreDefaults).clicked.connect(
                self.get_defaults)
        self.layout().addWidget(self.buttonBox, 7, 0, 1, 2)
        self.get_values()

    def get_defaults(self):
        # value
        self.cs_scatter_cols_page.setValue(self.defaults["cols_page"])
        self.cs_scatter_rows_page.setValue(self.defaults["rows_page"])
        self.cs_scatter_mksize.setValue(self.defaults["mksize"])
        self.cs_scatter_scale.setValue(self.defaults["scale"])
        # text
        self.cs_scatter_x_label.field.setText(self.defaults["x_label"])
        self.cs_scatter_y_label.field.setText(self.defaults["y_label"])
        self.cs_scatter_markers.field.setText(','.join(
            self.defaults["markers"]))
        self.cs_scatter_mk_color.field.setText(','.join(
            self.defaults["mk_color"]))
        self.cs_scatter_mk_edgecolors.field.setText(','.join(
            self.defaults["mk_edgecolors"]))
        # dropdown
        self.cs_scatter_mk_type.select(self.defaults["mk_type"])
        # colour
        self.cs_scatter_mk_start_color.get_colour(
            self.defaults["mk_start_color"])
        self.cs_scatter_mk_end_color.get_colour(self.defaults["mk_end_color"])
        self.cs_scatter_mk_missing_color.get_colour(
            self.defaults["mk_missing_color"])
        # check
        self.cs_scatter_hide_missing.setChecked(self.defaults["hide_missing"])

    def set_values(self):
        # value
        self.local_variables[
            "cols_page"] = self.cs_scatter_cols_page.field.value()
        self.local_variables[
            "rows_page"] = self.cs_scatter_rows_page.field.value()
        self.local_variables["mksize"] = self.cs_scatter_mksize.field.value()
        self.local_variables["scale"] = self.cs_scatter_scale.field.value()
        # text
        self.local_variables["x_label"] = self.cs_scatter_x_label.field.text()
        self.local_variables["y_label"] = self.cs_scatter_y_label.field.text()
        self.local_variables["markers"] = \
            [x.strip().strip("'") for x in self.cs_scatter_markers.field.text().split(',')]
        # dropdown
        self.local_variables[
            "mk_type"] = self.cs_scatter_mk_type.fields.currentText()
        # colour
        self.local_variables["mk_start_color"] = \
            colours[self.cs_scatter_mk_start_color.fields.currentText()]
        self.local_variables["mk_end_color"] = \
            colours[self.cs_scatter_mk_end_color.fields.currentText()]
        self.local_variables["mk_color"] = \
            [x.translate(translator) for x in self.cs_scatter_mk_color.field.text().split(',')]
        self.local_variables["mk_edgecolors"] = \
            [x.translate(translator) for x in self.cs_scatter_mk_edgecolors.field.text().split(',')]
        self.local_variables[
            "mk_missing_color"] = self.cs_scatter_mk_missing_color.fields.currentText(
            )
        # checked
        self.local_variables[
            "hide_missing"] = self.cs_scatter_hide_missing.isChecked()
        self.accept()

    def get_values(self):
        # values
        self.cs_scatter_cols_page.setValue(self.local_variables["cols_page"])
        self.cs_scatter_rows_page.setValue(self.local_variables["rows_page"])
        self.cs_scatter_mksize.setValue(self.local_variables["mksize"])
        self.cs_scatter_scale.setValue(self.local_variables["scale"])
        # text
        self.cs_scatter_x_label.field.setText(self.local_variables["x_label"])
        self.cs_scatter_y_label.field.setText(self.local_variables["y_label"])
        self.cs_scatter_markers.field.setText(','.join(
            self.local_variables["markers"]))
        self.cs_scatter_mk_color.field.setText(','.join(
            self.local_variables["mk_color"]))
        self.cs_scatter_mk_edgecolors.field.setText(','.join(
            self.local_variables["mk_edgecolors"]))
        # dropdown
        self.cs_scatter_mk_type.select(self.local_variables["mk_type"])
        # colours
        self.cs_scatter_mk_start_color.get_colour(
            self.local_variables["mk_start_color"])
        self.cs_scatter_mk_end_color.get_colour(
            self.local_variables["mk_end_color"])
        self.cs_scatter_mk_missing_color.get_colour(
            self.local_variables["mk_missing_color"])
        # check
        self.cs_scatter_hide_missing.setChecked(
            self.local_variables["hide_missing"])