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()
Example #2
0
    def __init__(self, key, name, parent=None):
        QtWidgets.QFrame.__init__(self, parent)
        self.setBackgroundRole(QtGui.QPalette.AlternateBase)
        self.setAutoFillBackground(True)

        hlayout = QtWidgets.QHBoxLayout()
        hlayout.setContentsMargins(0, 0, 0, 0)
        color_key = ctrl.settings.get_node_setting('color_id', node_type=key)
        font_key = ctrl.settings.get_node_setting('font_id', node_type=key)

        self.key = key
        self.setPalette(ctrl.cm.palette_from_key(color_key))
        f = qt_prefs.get_font(font_key)
        self.setStyleSheet('font-family: "%s"; font-size: %spx;' % (f.family(), f.pointSize()))
        self.add_button = icon_button(ctrl.ui, self, hlayout,
                                      icon=qt_prefs.add_icon,
                                      text='Add ' + name,
                                      action='add_node',
                                      size=24,
                                      color_key=color_key,
                                      tooltip_suffix=name)
        self.add_button.data = key
        self.label = label(self, hlayout, text=name)
        self.label.setBuddy(self.add_button)

        self.conf_button = icon_button(ctrl.ui, self, hlayout,
                                       icon=qt_prefs.settings_pixmap,
                                       text='Modify %s behavior' % name,
                                       size=20,
                                       align=QtCore.Qt.AlignRight)
        self.setLayout(hlayout)
Example #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)
        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()
Example #4
0
    def __init__(self, name, panel):
        """

        :param name:
        :param parent:
        :param use_title:
        :return:
        """
        QtWidgets.QWidget.__init__(self, parent=panel)
        # self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum))
        self.panel = panel
        self.preferred_size = QtCore.QSize(220, 22)
        self._watched = False
        self.setBackgroundRole(QtGui.QPalette.Base)
        self.setAutoFillBackground(True)
        self.setMinimumSize(self.preferred_size)
        self.setContentsMargins(0, 0, 0, 0)
        layout = QtWidgets.QHBoxLayout()
        layout.setContentsMargins(0, 2, 0, 2)
        layout.setSpacing(0)
        layout.minimumSize = self.sizeHint
        ui = self.panel.ui_manager

        mini_icon_button(ui,
                         self,
                         layout,
                         icon=qt_prefs.close_icon,
                         text='Close panel',
                         action='toggle_panel_' + self.panel.ui_type)

        self.pin_button = mini_icon_button(ui,
                                           self,
                                           layout,
                                           icon=qt_prefs.pin_drop_icon,
                                           text='Dock this panel',
                                           action='pin_panel')
        self.fold_button = mini_icon_button(ui,
                                            self,
                                            layout,
                                            icon=qt_prefs.fold_icon,
                                            text='Minimize this panel',
                                            action='toggle_fold_panel')
        layout.addSpacing(8)
        self.title = label(self, layout, name)
        self.setLayout(layout)
Example #5
0
    def __init__(self, name, panel):
        """

        :param name:
        :param parent:
        :param use_title:
        :return:
        """
        QtWidgets.QWidget.__init__(self, parent=panel)
        # self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum))
        self.panel = panel
        self.preferred_size = QtCore.QSize(220, 22)
        self._watched = False
        self.setBackgroundRole(QtGui.QPalette.Base)
        self.setAutoFillBackground(True)
        self.setMinimumSize(self.preferred_size)
        self.setContentsMargins(0, 0, 0, 0)
        layout = QtWidgets.QHBoxLayout()
        layout.setContentsMargins(0, 2, 0, 2)
        layout.setSpacing(0)
        layout.minimumSize = self.sizeHint
        ui = self.panel.ui_manager

        mini_icon_button(ui, self, layout,
                         icon=qt_prefs.close_icon,
                         text='Close panel',
                         action='toggle_panel_' + self.panel.ui_type)

        self.pin_button = mini_icon_button(ui, self, layout,
                                           icon=qt_prefs.pin_drop_icon,
                                           text='Dock this panel',
                                           action='pin_panel')
        self.fold_button = mini_icon_button(ui, self, layout,
                                            icon=qt_prefs.fold_icon,
                                            text='Minimize this panel',
                                            action='toggle_fold_panel')
        layout.addSpacing(8)
        self.title = label(self, layout, name)
        self.setLayout(layout)
Example #6
0
    def __init__(self, key, name, parent=None):
        QtWidgets.QFrame.__init__(self, parent)
        self.setBackgroundRole(QtGui.QPalette.AlternateBase)
        self.setAutoFillBackground(True)

        hlayout = QtWidgets.QHBoxLayout()
        hlayout.setContentsMargins(0, 0, 0, 0)
        color_key = ctrl.settings.get_node_setting('color_id', node_type=key)
        font_key = ctrl.settings.get_node_setting('font_id', node_type=key)

        self.key = key
        self.setPalette(ctrl.cm.palette_from_key(color_key))
        f = qt_prefs.get_font(font_key)
        self.setStyleSheet('font-family: "%s"; font-size: %spx;' %
                           (f.family(), f.pointSize()))
        self.add_button = icon_button(ctrl.ui,
                                      self,
                                      hlayout,
                                      icon=qt_prefs.add_icon,
                                      text='Add ' + name,
                                      action='add_node',
                                      size=24,
                                      color_key=color_key,
                                      tooltip_suffix=name)
        self.add_button.data = key
        self.label = label(self, hlayout, text=name)
        self.label.setBuddy(self.add_button)

        self.conf_button = icon_button(ctrl.ui,
                                       self,
                                       hlayout,
                                       icon=qt_prefs.settings_pixmap,
                                       text='Modify %s behavior' % name,
                                       size=20,
                                       align=QtCore.Qt.AlignRight)
        self.setLayout(hlayout)