Esempio n. 1
0
    def __init__(self, name, default_position='right', parent=None, folded=False):
        """
        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)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        layout = QtWidgets.QVBoxLayout()
        self.setMaximumWidth(220)
        self.setMaximumHeight(140)
        self._nodes_in_selection = []
        self._edges_in_selection = []
        self.cached_node_types = set()

        self.watchlist = ['selection_changed', 'forest_changed']
        # Other items may be temporarily added, they are defined as
        # class.variables
        ui = self.ui_manager
        # hlayout = box_row(layout)
        #
        # styles_data = []
        # current_style_i = 0
        # for i, value in enumerate(prefs.available_styles):
        #     if value == ctrl.settings.get('style'):
        #         current_style_i = i
        #     styles_data.append((value, value))
        # self.overall_style_box = selector(ui, self, hlayout,
        #                                   data=styles_data,
        #                                   action='change_master_style')
        # self.overall_style_box.setCurrentIndex(current_style_i)
        # #self.custom_overall_style = text_button(ui, hlayout,
        # #                                        text='customize',
        # #                                        action='customize_master_style',
        # #                                        checkable=True)
        # self.overall_style_box.hide()
        self.style_widgets = QtWidgets.QWidget(inner)
        sw_layout = QtWidgets.QVBoxLayout()
        sw_layout.setContentsMargins(0, 0, 0, 0)
        hlayout = box_row(sw_layout)
        self.scope_selector = selector(ui, self.style_widgets, hlayout,
                                       data=[],
                                       action='style_scope',
                                       label='Style for')
        self.scope_selector.setMinimumWidth(96)
        vline = QtWidgets.QFrame()
        vline.setFrameShape(QtWidgets.QFrame.VLine)
        hlayout.addWidget(vline)
        self.style_reset = mini_button(ui, self.style_widgets, hlayout,
                                       text='reset',
                                       action='reset_style_in_scope')
        hlayout = box_row(sw_layout)

        self.node_color_selector = color_selector(ui, self.style_widgets, hlayout,
                                                  action='change_node_color', role='node',
                                                  label='Node color')
        self.font_selector = font_selector(ui, self.style_widgets, hlayout,
                                           action='select_font',
                                           label='font')

        hlayout = box_row(sw_layout)
        self.shape_selector = shape_selector(ui, self.style_widgets, hlayout,
                                             action='change_edge_shape',
                                             label='Edge style')

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

        self.edge_options = icon_button(ui, self.style_widgets, hlayout,
                                        icon=qt_prefs.settings_icon,
                                        text='More edge options',
                                        action='toggle_panel_LineOptionsPanel',
                                        checkable=True)

        self.style_widgets.setLayout(sw_layout)
        layout.addWidget(self.style_widgets)
        inner.setLayout(layout)
        inner.setBackgroundRole(QtGui.QPalette.AlternateBase)
        #self.style_widgets.hide()
        self.setWidget(inner)

        self.finish_init()
Esempio n. 2
0
    def __init__(self,
                 name,
                 default_position='right',
                 parent=None,
                 folded=False):
        """
        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)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                           QtWidgets.QSizePolicy.Preferred)
        layout = QtWidgets.QVBoxLayout()
        self.setMaximumWidth(220)
        self.setMaximumHeight(140)
        self._nodes_in_selection = []
        self._edges_in_selection = []
        self.cached_node_types = set()

        self.watchlist = ['selection_changed', 'forest_changed']
        # Other items may be temporarily added, they are defined as
        # class.variables
        ui = self.ui_manager
        # hlayout = box_row(layout)
        #
        # styles_data = []
        # current_style_i = 0
        # for i, value in enumerate(prefs.available_styles):
        #     if value == ctrl.settings.get('style'):
        #         current_style_i = i
        #     styles_data.append((value, value))
        # self.overall_style_box = selector(ui, self, hlayout,
        #                                   data=styles_data,
        #                                   action='change_master_style')
        # self.overall_style_box.setCurrentIndex(current_style_i)
        # #self.custom_overall_style = text_button(ui, hlayout,
        # #                                        text='customize',
        # #                                        action='customize_master_style',
        # #                                        checkable=True)
        # self.overall_style_box.hide()
        self.style_widgets = QtWidgets.QWidget(inner)
        sw_layout = QtWidgets.QVBoxLayout()
        sw_layout.setContentsMargins(0, 0, 0, 0)
        hlayout = box_row(sw_layout)
        self.scope_selector = selector(ui,
                                       self.style_widgets,
                                       hlayout,
                                       data=[],
                                       action='style_scope',
                                       label='Style for')
        self.scope_selector.setMinimumWidth(96)
        vline = QtWidgets.QFrame()
        vline.setFrameShape(QtWidgets.QFrame.VLine)
        hlayout.addWidget(vline)
        self.style_reset = mini_button(ui,
                                       self.style_widgets,
                                       hlayout,
                                       text='reset',
                                       action='reset_style_in_scope')
        hlayout = box_row(sw_layout)

        self.node_color_selector = color_selector(ui,
                                                  self.style_widgets,
                                                  hlayout,
                                                  action='change_node_color',
                                                  role='node',
                                                  label='Node color')
        self.font_selector = font_selector(ui,
                                           self.style_widgets,
                                           hlayout,
                                           action='select_font',
                                           label='font')

        hlayout = box_row(sw_layout)
        self.shape_selector = shape_selector(ui,
                                             self.style_widgets,
                                             hlayout,
                                             action='change_edge_shape',
                                             label='Edge style')

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

        self.edge_options = icon_button(ui,
                                        self.style_widgets,
                                        hlayout,
                                        icon=qt_prefs.settings_icon,
                                        text='More edge options',
                                        action='toggle_panel_LineOptionsPanel',
                                        checkable=True)

        self.style_widgets.setLayout(sw_layout)
        layout.addWidget(self.style_widgets)
        inner.setLayout(layout)
        inner.setBackgroundRole(QtGui.QPalette.AlternateBase)
        #self.style_widgets.hide()
        self.setWidget(inner)

        self.finish_init()
Esempio 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()
Esempio 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()