Exemplo n.º 1
0
    def __init__(self,
                 name,
                 default_position='float',
                 parent=None,
                 folded=False):
        """
        BUild all advanced line options. Then in update filter what to show based on the line type.

        All of the panel constructors follow the same format so that the construction can be automated:
        :param name: Title of the panel and the key for accessing it
        :param default_position: 'bottom', 'right'...
        :param parent: self.main
        """
        Panel.__init__(self, name, default_position, parent, folded)
        self.watchlist = ['view_mode_changed']
        inner = QtWidgets.QWidget(self)
        layout = QtWidgets.QVBoxLayout()
        layout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                  QtWidgets.QSizePolicy.MinimumExpanding))
        self.setMaximumWidth(220)
        self.setMaximumHeight(140)

        hlayout = box_row(layout)
        layout.addLayout(hlayout)
        ui = self.ui_manager
        self.show_node_labels = checkbox(ui, inner, hlayout,
                                         'Show node labels',
                                         'toggle_show_node_label')
        grid = QtWidgets.QGridLayout()
        grid.setContentsMargins(0, 0, 0, 0)

        label(self, grid, 'Show projections', 0, 0)
        self.highlighter_button = checkbox(ui, inner, grid, 'with highlighter',
                                           'toggle_highlighter_projection', 1,
                                           0)
        self.strong_lines_button = checkbox(ui, inner, grid,
                                            'with stronger lines',
                                            'toggle_strong_lines_projection',
                                            1, 1)
        self.colorize_button = checkbox(ui, inner, grid,
                                        'with colorized lines',
                                        'toggle_colorized_projection', 1, 2)

        layout.addLayout(grid)
        inner.setLayout(layout)
        self.setWidget(inner)
        self.finish_init()
Exemplo n.º 2
0
    def __init__(self, name, default_position='float', parent=None, folded=False):
        """
        BUild all advanced line options. Then in update filter what to show based on the line type.

        All of the panel constructors follow the same format so that the construction can be automated:
        :param name: Title of the panel and the key for accessing it
        :param default_position: 'bottom', 'right'...
        :param parent: self.main
        """
        Panel.__init__(self, name, default_position, parent, folded)
        self.watchlist = ['view_mode_changed']
        inner = QtWidgets.QWidget(self)
        layout = QtWidgets.QVBoxLayout()
        layout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        self.setMaximumWidth(220)
        self.setMaximumHeight(140)

        hlayout = box_row(layout)
        layout.addLayout(hlayout)
        ui = self.ui_manager
        self.show_node_labels = checkbox(ui, inner, hlayout, 'Show node labels',
                                         'toggle_show_node_label')
        grid = QtWidgets.QGridLayout()
        grid.setContentsMargins(0, 0, 0, 0)

        label(self, grid, 'Show projections', 0, 0)
        self.highlighter_button = checkbox(ui, inner, grid,
                                              'with highlighter',
                                              'toggle_highlighter_projection',
                                              1, 0)
        self.strong_lines_button = checkbox(ui, inner, grid,
                                               'with stronger lines',
                                               'toggle_strong_lines_projection',
                                               1, 1)
        self.colorize_button = checkbox(ui, inner, grid,
                                           'with colorized lines',
                                           'toggle_colorized_projection',
                                           1, 2)

        layout.addLayout(grid)
        inner.setLayout(layout)
        self.setWidget(inner)
        self.finish_init()
Exemplo n.º 3
0
    def __init__(self,
                 name,
                 default_position='float',
                 parent=None,
                 folded=False):
        """
        BUild all advanced line options. Then in update filter what to show based on the line type.

        All of the panel constructors follow the same format so that the construction can be automated:
        :param name: Title of the panel and the key for accessing it
        :param default_position: 'bottom', 'right'...
        :param parent: self.main
        """
        Panel.__init__(self, name, default_position, parent, folded)
        inner = QtWidgets.QWidget(self)
        layout = QtWidgets.QVBoxLayout()
        layout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.setSizePolicy(
            QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                  QtWidgets.QSizePolicy.MinimumExpanding))
        self.setMaximumWidth(220)
        self.setMaximumHeight(160)
        self.watchlist = ['scope_changed', 'selection_changed']

        spac = 8
        ui = self.ui_manager
        hlayout = box_row(layout)

        self.scope_selector = selector(ui,
                                       self,
                                       hlayout,
                                       data=[],
                                       action='style_scope',
                                       label='Style for')
        self.scope_selector.setMinimumWidth(96)

        layout.addWidget(hdivider())
        layout.addSpacing(spac)

        hlayout = box_row(layout)
        self.shape_selector = shape_selector(ui,
                                             self,
                                             hlayout,
                                             action='change_edge_shape',
                                             label='Shape')

        self.edge_color_selector = color_selector(ui,
                                                  self,
                                                  hlayout,
                                                  action='change_edge_color',
                                                  label='Color',
                                                  role='edge')

        # Line thickness
        hlayout = box_row(layout)
        self.fill_button = checkbox(ui,
                                    self,
                                    hlayout,
                                    label='Fill',
                                    action='edge_shape_fill')

        self.line_button = checkbox(ui,
                                    self,
                                    hlayout,
                                    label='Outline',
                                    action='edge_shape_line')
        self.thickness_spinbox = decimal_spinbox(ui,
                                                 self,
                                                 hlayout,
                                                 label='Thickness',
                                                 range_min=0.0,
                                                 range_max=10.0,
                                                 step=0.1,
                                                 action='edge_thickness',
                                                 suffix=' px')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)

        hlayout = box_row(layout)
        self.arrowhead_start_button = checkbox(ui,
                                               self,
                                               hlayout,
                                               label='Arrowheads at start',
                                               action='edge_arrowhead_start')
        self.arrowhead_end_button = checkbox(ui,
                                             self,
                                             hlayout,
                                             label='at end',
                                             action='edge_arrowhead_end')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)
        # Curvature

        hlayout = box_row(layout)
        curve_modes = QtWidgets.QButtonGroup()
        self.relative_arc_button = radiobutton(
            ui,
            self,
            hlayout,
            label='Relative curve',
            action='edge_curvature_relative',
            group=curve_modes)
        self.arc_rel_dx_spinbox = spinbox(
            ui,
            self,
            hlayout,
            label='X',
            range_min=-200,
            range_max=200,
            action='change_edge_relative_curvature_x',
            suffix='%')
        self.arc_rel_dy_spinbox = spinbox(
            ui,
            self,
            hlayout,
            label='Y',
            range_min=-200,
            range_max=200,
            action='change_edge_relative_curvature_y',
            suffix='%')

        hlayout = box_row(layout)
        self.fixed_arc_button = radiobutton(ui,
                                            self,
                                            hlayout,
                                            label='Fixed curve',
                                            action='edge_curvature_fixed',
                                            group=curve_modes)
        self.arc_fixed_dx_spinbox = spinbox(
            ui,
            self,
            hlayout,
            label='X',
            range_min=-200,
            range_max=200,
            action='change_edge_fixed_curvature_x',
            suffix=' px')
        self.arc_fixed_dy_spinbox = spinbox(
            ui,
            self,
            hlayout,
            label='Y',
            range_min=-200,
            range_max=200,
            action='change_edge_fixed_curvature_y',
            suffix=' px')
        self.arc_reference_buttons = QtWidgets.QButtonGroup(self)
        self.arc_reference_buttons.addButton(self.fixed_arc_button)
        self.arc_reference_buttons.addButton(self.relative_arc_button)

        # Leaf size
        hlayout = box_row(layout)
        self.leaf_x_spinbox = decimal_spinbox(ui,
                                              self,
                                              hlayout,
                                              label='Brush spread X',
                                              range_min=-20.0,
                                              range_max=20.0,
                                              step=0.5,
                                              action='leaf_shape_x',
                                              suffix=' px')
        self.leaf_y_spinbox = decimal_spinbox(ui,
                                              self,
                                              hlayout,
                                              label='Y',
                                              range_min=-20.0,
                                              range_max=20.0,
                                              step=0.5,
                                              action='leaf_shape_y',
                                              suffix=' px')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)

        hlayout = box_row(layout)
        self.reset_all = mini_button(ui,
                                     self,
                                     hlayout,
                                     text='Reset edge settings',
                                     action='reset_edge_settings',
                                     width=-1)
        self.reset_adjustment = mini_button(ui,
                                            self,
                                            hlayout,
                                            text='Reset curves',
                                            action='reset_control_points',
                                            width=-1)
        inner.setLayout(layout)
        self.setWidget(inner)
        self.finish_init()
Exemplo n.º 4
0
    def __init__(self, name, default_position='float', parent=None, folded=False):
        """
        BUild all advanced line options. Then in update filter what to show based on the line type.

        All of the panel constructors follow the same format so that the construction can be automated:
        :param name: Title of the panel and the key for accessing it
        :param default_position: 'bottom', 'right'...
        :param parent: self.main
        """
        Panel.__init__(self, name, default_position, parent, folded)
        inner = QtWidgets.QWidget(self)
        layout = QtWidgets.QVBoxLayout()
        layout.setSizeConstraint(QtWidgets.QLayout.SetMinimumSize)
        self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                                 QtWidgets.QSizePolicy.MinimumExpanding))
        self.setMaximumWidth(220)
        self.setMaximumHeight(160)
        self.watchlist = ['scope_changed', 'selection_changed']

        spac = 8
        ui = self.ui_manager
        hlayout = box_row(layout)

        self.scope_selector = selector(ui, self, hlayout,
                                       data=[],
                                       action='style_scope',
                                       label='Style for')
        self.scope_selector.setMinimumWidth(96)

        layout.addWidget(hdivider())
        layout.addSpacing(spac)

        hlayout = box_row(layout)
        self.shape_selector = shape_selector(ui, self, hlayout,
                                             action='change_edge_shape',
                                             label='Shape')

        self.edge_color_selector = color_selector(ui, self, hlayout,
                                                  action='change_edge_color',
                                                  label='Color', role='edge')

        # Line thickness
        hlayout = box_row(layout)
        self.fill_button = checkbox(ui, self, hlayout, label='Fill',
                                    action='edge_shape_fill')

        self.line_button = checkbox(ui, self, hlayout, label='Outline',
                                    action='edge_shape_line')
        self.thickness_spinbox = decimal_spinbox(ui, self, hlayout,
                                                 label='Thickness', range_min=0.0, range_max=10.0,
                                                 step=0.1, action='edge_thickness', suffix=' px')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)

        hlayout = box_row(layout)
        self.arrowhead_start_button = checkbox(ui, self, hlayout, label='Arrowheads at start',
                                               action='edge_arrowhead_start')
        self.arrowhead_end_button = checkbox(ui, self, hlayout, label='at end',
                                             action='edge_arrowhead_end')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)
        # Curvature

        hlayout = box_row(layout)
        curve_modes = QtWidgets.QButtonGroup()
        self.relative_arc_button = radiobutton(ui, self, hlayout, label='Relative curve',
                                               action='edge_curvature_relative', group=curve_modes)
        self.arc_rel_dx_spinbox = spinbox(ui, self, hlayout,
                                          label='X', range_min=-200, range_max=200,
                                          action='change_edge_relative_curvature_x',
                                          suffix='%')
        self.arc_rel_dy_spinbox = spinbox(ui, self, hlayout,
                                          label='Y', range_min=-200, range_max=200,
                                          action='change_edge_relative_curvature_y',
                                          suffix='%')

        hlayout = box_row(layout)
        self.fixed_arc_button = radiobutton(ui, self, hlayout, label='Fixed curve',
                                            action='edge_curvature_fixed', group=curve_modes)
        self.arc_fixed_dx_spinbox = spinbox(ui, self, hlayout,
                                            label='X', range_min=-200, range_max=200,
                                            action='change_edge_fixed_curvature_x',
                                            suffix=' px')
        self.arc_fixed_dy_spinbox = spinbox(ui, self, hlayout,
                                            label='Y', range_min=-200, range_max=200,
                                            action='change_edge_fixed_curvature_y',
                                            suffix=' px')
        self.arc_reference_buttons = QtWidgets.QButtonGroup(self)
        self.arc_reference_buttons.addButton(self.fixed_arc_button)
        self.arc_reference_buttons.addButton(self.relative_arc_button)


        # Leaf size
        hlayout = box_row(layout)
        self.leaf_x_spinbox = decimal_spinbox(ui, self, hlayout, label='Brush spread X',
                                              range_min=-20.0,
                                              range_max=20.0,
                                              step=0.5,
                                              action='leaf_shape_x', suffix=' px')
        self.leaf_y_spinbox = decimal_spinbox(ui, self, hlayout, label='Y',
                                              range_min=-20.0,
                                              range_max=20.0,
                                              step=0.5,
                                              action='leaf_shape_y', suffix=' px')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)

        hlayout = box_row(layout)
        self.reset_all = mini_button(ui, self, hlayout, text='Reset edge settings',
                                     action='reset_edge_settings', width=-1)
        self.reset_adjustment = mini_button(ui, self, hlayout,
                                            text='Reset curves',
                                            action='reset_control_points', width=-1)
        inner.setLayout(layout)
        self.setWidget(inner)
        self.finish_init()