Пример #1
0
    def __init__(self, fig, view=None, parent=None):
        self.fig = fig
        if not view:
            self.view = AxesTabWidgetView(parent)
        else:
            self.view = view

        # Store a copy of the current view props. This allows us to tell if any
        # properties have been changed by the user; especially solving issues
        # with x and y axis limits interfering with figure autoscaling
        self.current_view_props = {}

        self.current_axis = "x"

        # Dictionary mapping ax name to Axes object
        self.axes_names_dict = get_axes_names_dict(self.fig)
        # Add axes names to "select axes" combo box
        self.populate_select_axes_combo_box()
        # Display top axes' properties in input fields
        self.update_view()

        # Signals
        self.view.select_axes_combo_box.currentIndexChanged.connect(
            self.update_view)
        self.view.axis_button_group.buttonClicked.connect(self.axis_changed)
        self.view.apply_all_button.clicked.connect(self.apply_all_properties)
        self.view.show_minor_ticks_check_box.toggled.connect(
            self.show_minor_ticks_checked)
Пример #2
0
    def __init__(self,
                 fig,
                 view=None,
                 parent=None,
                 success_callback=None,
                 error_callback=None):
        self.fig = fig
        if not view:
            self.view = AxesTabWidgetView(parent)
        else:
            self.view = view
        self.success_callback = success_callback
        self.error_callback = error_callback

        # Store a copy of the current view props.
        self.current_view_props = {}

        self.current_axis = "x"

        # Dictionary mapping ax name to Axes object
        self.axes_names_dict = get_axes_names_dict(self.fig)
        # Add axes names to "select axes" combo box
        self.populate_select_axes_combo_box()
        # Display top axes' properties in input fields
        self.update_view()

        # Signals
        self.view.select_axes_combo_box.currentIndexChanged.connect(
            self.update_view)
        self.view.axis_tab_bar.currentChanged.connect(self.axis_changed)
        self.view.show_minor_ticks_check_box.toggled.connect(
            self.show_minor_ticks_checked)
        self.view.autoscale.toggled.connect(self.autoscale_changed)
        if self.success_callback and self.error_callback:
            self.view.apply_all_button.clicked.connect(
                self._apply_all_properties_with_errors)
        else:
            self.view.apply_all_button.clicked.connect(
                self.apply_all_properties)