Пример #1
0
    def __init__(self, name, default_position='bottom', 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
        :param ui_manager: pass a dictionary where buttons from this panel will be added
        """
        Panel.__init__(self, name, default_position, parent, folded)
        inner = QtWidgets.QWidget()
        inner.setMinimumWidth(160)
        inner.setMaximumWidth(220)
        inner.setMaximumHeight(140)
        self.watchlist = ['forest_changed', 'view_mode_changed', 'edit_mode_changed',
                          'palette_changed']

        #inner.setMinimumHeight(120)
        #inner.setMaximumHeight(150)
        #inner.preferred_size = QtCore.QSize(220, 120)

        layout = QtWidgets.QVBoxLayout()
        self.node_frames = {}

        for key in classes.node_types_order:
            nd = classes.node_info[key]
            frame = DraggableNodeFrame(key, nd['name'], parent=inner)
            self.node_frames[key] = frame
            layout.addWidget(frame)

        layout.setContentsMargins(2, 4, 6, 2)

        inner.setLayout(layout)
        self.setWidget(inner)
        self.widget().setAutoFillBackground(True)
        self.finish_init()
Пример #2
0
 def __init__(self, name, default_position='bottom', 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
     :param ui_manager: pass a dictionary where buttons from this panel will be added
     """
     Panel.__init__(self, name, default_position, parent, folded)
     inner = QtWidgets.QWidget()
     inner.setContentsMargins(4, 4, 4, 4)
     self.setContentsMargins(0, 0, 0, 0)
     layout = QtWidgets.QVBoxLayout()
     self.browser = QtWidgets.QTextBrowser()
     layout.setContentsMargins(0, 0, 0, 0)
     self.browser.setContentsMargins(0, 0, 0, 0)
     f = qt_prefs.get_font(UI_FONT)
     point_size = f.pointSize()
     if point_size < 14:
         point_size = 12
     self.browser.setStyleSheet('font-size: %spx;' % point_size)
     self.browser.setMinimumWidth(200)
     self.browser.setFrameStyle(QtWidgets.QFrame.NoFrame)
     p = self.browser.palette()
     p.setColor(QtGui.QPalette.Base, ctrl.cm.transparent)
     self.browser.setPalette(p)
     layout.addWidget(self.browser)
     inner.setLayout(layout)
     self.setWidget(inner)
     self.watchlist = ['ui_font_changed']
     self.set_text(HelpPanel.default_text)
     self.finish_init()
     ctrl.graph_view.activateWindow()
     ctrl.graph_view.setFocus()
Пример #3
0
 def __init__(self, name, default_position='bottom', 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
     :param ui_manager: pass a dictionary where buttons from this panel will be added
     """
     Panel.__init__(self, name, default_position, parent, folded)
     inner = self.widget()
     inner.setContentsMargins(4, 4, 4, 4)
     layout = self.vlayout
     self.browser = QtWidgets.QTextBrowser(parent=inner)
     layout.setContentsMargins(0, 0, 0, 0)
     self.browser.setContentsMargins(0, 0, 0, 0)
     self.preferred_size = QtCore.QSize(220, 260)
     self.preferred_floating_size = QtCore.QSize(260, 320)
     self.browser.setFrameStyle(QtWidgets.QFrame.NoFrame)
     p = self.browser.palette()
     p.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)
     self.browser.setPalette(p)
     layout.addWidget(self.browser)
     self.set_text(HelpPanel.default_text)
     self.finish_init()
     ctrl.graph_view.activateWindow()
     ctrl.graph_view.setFocus()
Пример #4
0
    def __init__(self, name, default_position='bottom', 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
        :param ui_manager: pass a dictionary where buttons from this panel will be added
        """
        Panel.__init__(self, name, default_position, parent, folded)
        inner = self.widget()
        self.preferred_size = QtCore.QSize(220, 40)
        inner.setAutoFillBackground(True)

        layout = self.vlayout
        hlayout = box_row(layout)

        self.selector = SelectionBox(inner, action='set_visualization').to_layout(hlayout)
        for key, item in []:
            self.selector.addItem('%s (%s)' % (key, item.shortcut), key)

        self.toggle_options = PanelButton(pixmap=qt_prefs.settings_pixmap,
                                          tooltip='Visualization settings',
                                          parent=inner, size=20,
                                          action='toggle_panel_%s' % g.VIS_OPTIONS
                                          ).to_layout(hlayout, align=QtCore.Qt.AlignRight)
        self.toggle_options.setFixedSize(26, 26)
        self.toggle_options.setCheckable(True)
        ctrl.main.forest_changed.connect(self.update_treeset_counter)
        self.finish_init()
Пример #5
0
 def __init__(self, name, default_position='bottom', 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
     :param ui_manager: pass a dictionary where buttons from this panel will be added
     """
     Panel.__init__(self, name, default_position, parent, folded)
     inner = QtWidgets.QWidget()
     inner.setContentsMargins(4, 4, 4, 4)
     self.setContentsMargins(0, 0, 0, 0)
     layout = QtWidgets.QVBoxLayout()
     self.browser = QtWidgets.QTextBrowser()
     layout.setContentsMargins(0, 0, 0, 0)
     self.browser.setContentsMargins(0, 0, 0, 0)
     f = qt_prefs.get_font(UI_FONT)
     point_size = f.pointSize()
     if point_size < 14:
         point_size = 12
     self.browser.setStyleSheet('font-size: %spx;' % point_size)
     self.browser.setMinimumWidth(200)
     self.browser.setFrameStyle(QtWidgets.QFrame.NoFrame)
     p = self.browser.palette()
     p.setColor(QtGui.QPalette.Base, QtCore.Qt.transparent)
     self.browser.setPalette(p)
     layout.addWidget(self.browser)
     inner.setLayout(layout)
     self.setWidget(inner)
     self.watchlist = ['ui_font_changed']
     self.set_text(HelpPanel.default_text)
     self.finish_init()
     ctrl.graph_view.activateWindow()
     ctrl.graph_view.setFocus()
Пример #6
0
    def __init__(self,
                 name,
                 default_position='float',
                 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)
        self.camera = None
        self.aspect = 1.333333333
        self.camera_width = 320
        layout = QtWidgets.QVBoxLayout()
        widget = QtWidgets.QWidget()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
        self.viewfinder = QtMultimediaWidgets.QCameraViewfinder()
        layout.addWidget(self.viewfinder)
        widget.setLayout(layout)
        self.activate_camera()
        self.setWidget(widget)
        self.finish_init()
        self.releaseMouse()
Пример #7
0
    def __init__(self,
                 name,
                 default_position='bottom',
                 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.QTextBrowser()
        layout = QtWidgets.QVBoxLayout()
        inner.setMinimumHeight(48)
        inner.preferred_size = QtCore.QSize(940, 64)
        f = qt_prefs.get_font(g.CONSOLE_FONT)
        inner.setStyleSheet('font-family: "%s"; font-size: %spx;' %
                            (f.family(), f.pointSize()))
        inner.setAutoFillBackground(True)
        inner.sizeHint = self.sizeHint
        inner.setFocusPolicy(QtCore.Qt.NoFocus)
        self.resize_grip = QtWidgets.QSizeGrip(self)
        self.resize_grip.hide()
        self.setAllowedAreas(QtCore.Qt.TopDockWidgetArea
                             | QtCore.Qt.BottomDockWidgetArea)
        self.watchlist = ['ui_font_changed']

        layout.addWidget(self.resize_grip, 0, QtCore.Qt.AlignRight)
        inner.setLayout(layout)

        self.preferred_size = inner.preferred_size
        self.setWidget(inner)
        self.finish_init()
        log.log_handler.set_widget(inner)
Пример #8
0
    def __init__(self, name, default_position='bottom', 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.QTextBrowser()
        layout = QtWidgets.QVBoxLayout()
        inner.setMinimumHeight(48)
        inner.preferred_size = QtCore.QSize(940, 64)
        f = qt_prefs.get_font(g.CONSOLE_FONT)
        inner.setStyleSheet('font-family: "%s"; font-size: %spx;' % (f.family(), f.pointSize()))
        inner.setAutoFillBackground(True)
        inner.sizeHint = self.sizeHint
        inner.setFocusPolicy(QtCore.Qt.NoFocus)
        self.resize_grip = QtWidgets.QSizeGrip(self)
        self.resize_grip.hide()
        self.setAllowedAreas(QtCore.Qt.TopDockWidgetArea | QtCore.Qt.BottomDockWidgetArea)
        self.watchlist = ['ui_font_changed']

        layout.addWidget(self.resize_grip, 0, QtCore.Qt.AlignRight)
        inner.setLayout(layout)

        self.preferred_size = inner.preferred_size
        self.setWidget(inner)
        self.finish_init()
        log.log_handler.set_widget(inner)
Пример #9
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 = self.widget()
        self.preferred_size = QtCore.QSize(200, 70)
        inner.setAutoFillBackground(True)
        layout = self.vlayout
        hlayout = box_row(layout)

        self.selector = SelectionBox(inner, action='set_visualization').to_layout(hlayout)
        self.selector.add_items([(key, '%s (%s)' % (key, item.shortcut)) for key, item in
                                 VISUALIZATIONS.items()])

        self.toggle_options = PanelButton(pixmap=qt_prefs.settings_pixmap,
                                          action='toggle_panel',
                                          parent=inner,
                                          size=20).to_layout(hlayout, align=QtCore.Qt.AlignRight)
        self.toggle_options.setFixedSize(26, 26)
        self.toggle_options.setCheckable(True)
        self.toggle_options.data = 'VisualizationOptionsPanel'

        ctrl.main.visualisation_changed.connect(self.update_visualisation)
        self.finish_init()
Пример #10
0
    def __init__(self, name, default_position='bottom', 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
        :param ui_manager: pass a dictionary where buttons from this panel will be added
        """
        Panel.__init__(self, name, default_position, parent, folded)
        ctrl.main.forest_changed.connect(self.prepare_input)
        layout = self.vlayout
        widget = self.widget()

        tt = 'Sentence to parse'
        self.input_text = KatajaTextarea(widget, tooltip=tt).to_layout(layout)
        self.preferred_size = QtCore.QSize(220, 96)
        self.preferred_floating_size = QtCore.QSize(220, 200)

        self.derive_button = PushButtonBase(parent=widget, text='Derive again',
                                            action='derive_from_input').to_layout(layout)
        widget.setAutoFillBackground(True)
        self.finish_init()
        self.prepare_input()
        ctrl.graph_view.activateWindow()
        ctrl.graph_view.setFocus()
Пример #11
0
 def __init__(self, name, default_position='bottom', 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
     :param ui_manager: pass a dictionary where buttons from this panel will be added
     """
     Panel.__init__(self, name, default_position, parent, folded)
     inner = QtWidgets.QWidget()
     layout = QtWidgets.QVBoxLayout()
     f = qt_prefs.get_font(CONSOLE_FONT)
     self.lextext = QtWidgets.QPlainTextEdit()
     self.setStyleSheet(stylesheet % (f.family(), f.pointSize()))
     self.watchlist = ['forest_changed', 'ui_font_changed']
     layout.addWidget(self.lextext)
     self.sentence_text = QtWidgets.QLineEdit()
     layout.addWidget(self.sentence_text)
     self.semantics_text = QtWidgets.QLineEdit()
     layout.addWidget(self.semantics_text)
     self.info = QtWidgets.QLabel('info text here')
     self.derive_button = text_button(ctrl.ui, layout, text='Derive again',
                                      action='derive_from_lexicon')
     layout.addWidget(self.derive_button)
     layout.addWidget(self.info)
     inner.setLayout(layout)
     self.setWidget(inner)
     self.widget().setAutoFillBackground(True)
     self.prepare_lexicon()
     self.finish_init()
     ctrl.graph_view.activateWindow()
     ctrl.graph_view.setFocus()
Пример #12
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()
        #inner.preferred_size = QtCore.QSize(220, 130)
        inner.setMinimumSize(160, 130)
        inner.setMaximumSize(220, 400)
        inner.setMinimumWidth(160)

        layout = QtWidgets.QVBoxLayout()
        self.selector = SelectionBox(self)
        self.selector.add_items([(table_dict[item], item) for item in table_names])
        self.selector.activated.connect(self.change_symbol_set)
        self.selector.setFocusPolicy(QtCore.Qt.TabFocus)
        layout.addWidget(self.selector)
        self.symlist = QtWidgets.QListWidget()
        self.symlist.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
         QtWidgets.QSizePolicy.Expanding)
        self.symlist.setSpacing(8)
        self.symlist.setMouseTracking(True)
        self.symlist.setFocusPolicy(QtCore.Qt.NoFocus)
        self.symlist.setViewMode(QtWidgets.QListWidget.IconMode)
        f = qt_prefs.get_font(g.MAIN_FONT)
        self.symlist.setStyleSheet('font-family: "%s"; font-size: %spx;' % (
            f.family(), int(f.pointSize() * 1.5)))
        self.symlist.itemEntered.connect(self.item_entered)
        self.symlist.itemClicked.connect(self.item_clicked)
        layout.addWidget(self.symlist)
        hlayout = box_row(layout)
        self.info = QtWidgets.QLabel('')
        hlayout.addWidget(self.info)
        self.resize_grip = QtWidgets.QSizeGrip(self)
        self.resize_grip.hide()
        hlayout.addWidget(self.resize_grip, 0, QtCore.Qt.AlignRight)
        inner.setLayout(layout)
        self.tables = {}
        keys = list(latex_to_unicode.keys())
        for name in table_names:
            self.tables[name] = []
        keys.sort()
        for key in keys:
            char, description, table_key = latex_to_unicode[key]
            self.tables[table_key].append(key)
        self.tables['greek'] = greek_letters
        self.tables['arrows'] = arrows
        self.tables['more arrows'] = more_arrows
        self.tables['common'] = common
        # self.tables['arrows'] = arrows
        self.prepare_symbols('common')
        self.setWidget(inner)
        self.finish_init()
Пример #13
0
 def finish_init(self):
     """ Do initializations that need to be done after the subclass __init__
     has completed. e.g. hide this from view, which can have odd results
     for measurements for elements and layouts if it is called before
     setting them up. Subclass __init__:s must call finish_init at the end!
     :return:
     """
     Panel.finish_init(self)
     self.update_panel()
     self.show()
Пример #14
0
 def finish_init(self):
     """ Do initializations that need to be done after the subclass __init__
     has completed. e.g. hide this from view, which can have odd results
     for measurements for elements and layouts if it is called before
     setting them up. Subclass __init__:s must call finish_init at the end!
     :return:
     """
     Panel.finish_init(self)
     self.update_panel()
     self.show()
Пример #15
0
 def __init__(self, name, default_position='float', 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)
     self.preferred_size = QtCore.QSize(220, 48)
     ctrl.main.palette_changed.connect(self.update_available_themes)
     ctrl.main.color_themes_changed.connect(self.update_available_themes)
     color_theme_fragment(self, self.widget(), self.vlayout)
     self.finish_init()
Пример #16
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()
Пример #17
0
    def __init__(self,
                 name,
                 default_position='bottom',
                 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
        :param ui_manager: pass a dictionary where buttons from this panel will be added
        """
        Panel.__init__(self, name, default_position, parent, folded)
        inner = QtWidgets.QWidget()
        inner.setMinimumHeight(40)
        inner.setMaximumHeight(50)
        inner.preferred_size = QtCore.QSize(220, 40)
        inner.sizeHint = self.sizeHint

        layout = QtWidgets.QVBoxLayout()
        hlayout = QtWidgets.QHBoxLayout()
        hlayout.setContentsMargins(0, 0, 0, 0)

        selector = SelectionBox(self)
        self.selector = selector
        for key, item in []:
            selector.addItem('%s (%s)' % (key, item.shortcut), key)

        self.ui_manager.connect_element_to_action(selector,
                                                  'set_visualization')
        hlayout.addWidget(selector)
        self.toggle_options = PanelButton(pixmap=qt_prefs.settings_pixmap,
                                          tooltip='Visualization settings',
                                          parent=self,
                                          size=20)
        self.toggle_options.setFixedSize(26, 26)
        self.toggle_options.setCheckable(True)
        ctrl.ui.connect_element_to_action(self.toggle_options,
                                          'toggle_panel_%s' % g.VIS_OPTIONS)
        hlayout.addWidget(self.toggle_options, 1, QtCore.Qt.AlignRight)

        layout.addLayout(hlayout)
        inner.setLayout(layout)
        self.watchlist = ['forest_changed']
        self.preferred_size = inner.preferred_size
        self.setWidget(inner)
        self.widget().setAutoFillBackground(True)
        self.finish_init()
Пример #18
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()
Пример #19
0
    def __init__(self, name, default_position='float', 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)
        layout = QtWidgets.QVBoxLayout()
        widget = QtWidgets.QWidget(self)
        widget.setMinimumWidth(160)
        widget.setMaximumWidth(220)
        widget.setMaximumHeight(60)
        self.watchlist = ['color_themes_changed', 'palette_changed']
        color_theme_fragment(self, layout)
        widget.setLayout(layout)

        self.setWidget(widget)
        self.finish_init()
Пример #20
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, foldable=False)
        widget = self.widget()
        self.semantics_visible = EyeButton(action='toggle_semantics_view', width=26, height=20)
        self.push_to_title(self.semantics_visible)
        layout = self.vlayout
        tt = 'Optional semantic data. Use depends on plugin.'
        self.semantics_text = KatajaTextarea(widget, tooltip=tt).to_layout(layout, with_label='Semantics')
        self.semantics_text.setMaximumHeight(36)

        inner = self.widget()
        inner.setAutoFillBackground(True)
        self.finish_init()
Пример #21
0
    def __init__(self,
                 name,
                 default_position='bottom',
                 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
        :param ui_manager: pass a dictionary where buttons from this panel will be added
        """
        Panel.__init__(self, name, default_position, parent, folded)
        inner = QtWidgets.QWidget()
        inner.setMinimumWidth(160)
        inner.setMaximumWidth(220)
        inner.setMaximumHeight(140)
        self.watchlist = [
            'forest_changed', 'view_mode_changed', 'edit_mode_changed',
            'palette_changed'
        ]

        #inner.setMinimumHeight(120)
        #inner.setMaximumHeight(150)
        #inner.preferred_size = QtCore.QSize(220, 120)

        layout = QtWidgets.QVBoxLayout()
        self.node_frames = {}

        for key in classes.node_types_order:
            nd = classes.node_info[key]
            frame = DraggableNodeFrame(key, nd['name'], parent=inner)
            self.node_frames[key] = frame
            layout.addWidget(frame)

        layout.setContentsMargins(2, 4, 6, 2)

        inner.setLayout(layout)
        self.setWidget(inner)
        self.widget().setAutoFillBackground(True)
        self.finish_init()
Пример #22
0
    def __init__(self, name, default_position="bottom", 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
        :param ui_manager: pass a dictionary where buttons from this panel will be added
        """
        Panel.__init__(self, name, default_position, parent, folded)
        inner = QtWidgets.QWidget()
        inner.setMinimumHeight(40)
        inner.setMaximumHeight(50)
        inner.preferred_size = QtCore.QSize(220, 40)
        inner.sizeHint = self.sizeHint

        layout = QtWidgets.QVBoxLayout()
        hlayout = QtWidgets.QHBoxLayout()
        hlayout.setContentsMargins(0, 0, 0, 0)

        selector = SelectionBox(self)
        self.selector = selector
        for key, item in []:
            selector.addItem("%s (%s)" % (key, item.shortcut), key)

        self.ui_manager.connect_element_to_action(selector, "set_visualization")
        hlayout.addWidget(selector)
        self.toggle_options = PanelButton(
            pixmap=qt_prefs.settings_pixmap, tooltip="Visualization settings", parent=self, size=20
        )
        self.toggle_options.setFixedSize(26, 26)
        self.toggle_options.setCheckable(True)
        ctrl.ui.connect_element_to_action(self.toggle_options, "toggle_panel_%s" % g.VIS_OPTIONS)
        hlayout.addWidget(self.toggle_options, 1, QtCore.Qt.AlignRight)

        layout.addLayout(hlayout)
        inner.setLayout(layout)
        self.watchlist = ["forest_changed"]
        self.preferred_size = inner.preferred_size
        self.setWidget(inner)
        self.widget().setAutoFillBackground(True)
        self.finish_init()
Пример #23
0
    def __init__(self, name, default_position='bottom', 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)
        title_widget = self.titleBarWidget()
        tlayout = title_widget.layout()
        levels = [(50, 'CRITICAL'), (40, 'ERROR'), (30, 'WARNING'), (20, 'INFO'), (10, 'DEBUG')]
        tlayout.addStretch(2)

        # self.command_edit = CommandEdit(title_widget)
        # tlayout.addWidget(self.command_edit)
        # tlayout.addStretch(1)
        # self.command_edit.setStyleSheet(ss)

        log_levels = SelectionBox(parent=title_widget, data=levels,
                                  action='set_log_level', mini=True).to_layout(tlayout, with_label='log level:')
        log_levels.setMinimumWidth(72)
        clear_log = PanelButton(parent=title_widget, action='clear_log', pixmap=qt_prefs.trash_icon).to_layout(tlayout)
        clear_log.setFlat(False)
        clear_log.setMaximumHeight(20)
        widget = self.widget()
        self.preferred_floating_size = QtCore.QSize(480, 480)
        self.log_browser = QtWidgets.QTextBrowser(parent=widget)
        self.vlayout.setContentsMargins(0, 0, 0, 0)
        self.vlayout.addWidget(self.log_browser)
        self.preferred_size = QtCore.QSize(940, 160)
        f = qt_prefs.get_font(g.CONSOLE_FONT)
        ss = f'font-family: "{f.family()}"; font-size: {f.pointSize()}px;'
        self.log_browser.setStyleSheet(ss)
        self.log_browser.setAutoFillBackground(True)
        self.log_browser.setFocusPolicy(QtCore.Qt.NoFocus)
        self.resize_grip = QtWidgets.QSizeGrip(widget)
        self.resize_grip.hide()
        self.setAllowedAreas(QtCore.Qt.TopDockWidgetArea | QtCore.Qt.BottomDockWidgetArea)
        self.vlayout.addWidget(self.resize_grip, 0, QtCore.Qt.AlignRight)
        self.finish_init()
        log.log_handler.set_widget(self.log_browser)
Пример #24
0
    def __init__(self, name, node_type, 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)
        widget = self.widget()
        ctrl.main.palette_changed.connect(self.update_colors)
        self.node_type = node_type
        node_type_name = classes.node_info[node_type]['name'].lower()
        color_key = ctrl.ui.get_active_node_setting('color_key', node_type=node_type)

        action_name = 'add_%s_node' % node_type_name
        self.add_button = PanelButton(parent=widget, pixmap=qt_prefs.add_icon,
                                      action=action_name, size=20,
                                      color_key=color_key)
        self.add_button.data = node_type
        self.prefix_for_title(self.add_button)

        self.node_type_visible = EyeButton(action='toggle_%s_visibility' % node_type_name,
                                           height=20, width=26)
        self.push_to_title(self.node_type_visible)

        self.font_selector = FontSelector(parent=widget,
                                          action='select_%s_font' % node_type_name)
        self.push_to_title(self.font_selector)

        self.node_color_selector = ColorSelector(parent=widget,
                                                 action='change_%s_color' % node_type_name)
        self.push_to_title(self.node_color_selector)

        f = ctrl.ui.get_active_node_setting('font_id', node_type=node_type)
        self.update_title_font(f)

        widget.setContentsMargins(0, 0, 0, 0)
        self.vlayout.setContentsMargins(4, 4, 4, 8)
        self.finish_init()
Пример #25
0
 def __init__(self, name, default_position='right', parent=None, folded=True):
     """
     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, foldable=False)
     widget = self.widget()
     self.scope_selector = SelectionBox(parent=widget, data=choices_when_not_selection,
                                        action='set_editing_scope')
     self.was_selection = False
     self.scope_selector.setMaximumWidth(128)
     self.push_to_title(self.scope_selector)
     self.reset_button = PanelButton(parent=widget, text='reset', action='reset_settings')
     self.reset_button.setMinimumHeight(14)
     self.reset_button.setMaximumHeight(14)
     self.push_to_title(self.reset_button)
     widget.setAutoFillBackground(True)
     self.finish_init()
Пример #26
0
 def __init__(self,
              name,
              default_position='bottom',
              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
     :param ui_manager: pass a dictionary where buttons from this panel will be added
     """
     Panel.__init__(self, name, default_position, parent, folded)
     inner = QtWidgets.QWidget()
     layout = QtWidgets.QVBoxLayout()
     f = qt_prefs.get_font(CONSOLE_FONT)
     self.lextext = QtWidgets.QPlainTextEdit()
     self.setStyleSheet(stylesheet % (f.family(), f.pointSize()))
     self.watchlist = ['forest_changed', 'ui_font_changed']
     layout.addWidget(self.lextext)
     self.sentence_text = QtWidgets.QLineEdit()
     layout.addWidget(self.sentence_text)
     self.semantics_text = QtWidgets.QLineEdit()
     layout.addWidget(self.semantics_text)
     self.info = QtWidgets.QLabel('info text here')
     self.derive_button = text_button(ctrl.ui,
                                      layout,
                                      text='Derive again',
                                      action='derive_from_lexicon')
     layout.addWidget(self.derive_button)
     layout.addWidget(self.info)
     inner.setLayout(layout)
     self.setWidget(inner)
     self.widget().setAutoFillBackground(True)
     self.prepare_lexicon()
     self.finish_init()
     ctrl.graph_view.activateWindow()
     ctrl.graph_view.setFocus()
Пример #27
0
    def __init__(self, name, default_position="float", 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)
        self.camera = None
        self.aspect = 1.333333333
        self.camera_width = 320
        layout = QtWidgets.QVBoxLayout()
        widget = QtWidgets.QWidget()
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
        self.viewfinder = QtMultimediaWidgets.QCameraViewfinder()
        layout.addWidget(self.viewfinder)
        widget.setLayout(layout)
        self.activate_camera()
        self.setWidget(widget)
        self.finish_init()
        self.releaseMouse()
Пример #28
0
 def show(self):
     """ Tick check box in EDGES panel """
     dp = self.ui_manager.get_panel('StylePanel')
     if dp:
         dp.edge_options.setChecked(True)
     Panel.show(self)
Пример #29
0
 def close(self):
     """ Untick check box in EDGES panel """
     dp = self.ui_manager.get_panel('StylePanel')
     if dp:
         dp.edge_options.setChecked(False)
     Panel.close(self)
Пример #30
0
 def initial_position(self, next_to=''):
     """
     :return:
     """
     return Panel.initial_position(self, next_to=next_to or 'StylePanel')
Пример #31
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)
        self.selected_role = 'content1'
        self.selected_hsv = ctrl.cm.get(self.selected_role).getHsvF()[:3]
        self.match_contrast = 65
        ctrl.main.palette_changed.connect(self.update_themes_and_colors)
        ctrl.main.color_themes_changed.connect(self.update_themes_and_colors)
        self.try_to_match = True
        self._updating = True
        # ### Color wheel
        layout = self.vlayout
        widget = self.widget()
        self.preferred_size = QtCore.QSize(220, 300)
        # From ColorThemePanel
        color_theme_fragment(self, widget, layout)

        the_rest = [f'accent{i}' for i in range(1, 9)] + [f'custom{i}' for i in range(1, 10)]

        self.editable_colors = ['content1', 'background1'] + the_rest
        self.all_colors = ['content1', 'content2', 'content3', 'background1', 'background2'] + \
                          the_rest

        self.role_label = QtWidgets.QLabel("Picking color for role: ")
        self.role_selector = QtWidgets.QComboBox(parent=widget)
        self.role_selector.addItems(self.editable_colors)
        self.role_selector.currentTextChanged.connect(self.set_color_role)
        hlayout = box_row(layout)
        hlayout.addWidget(self.role_label)
        hlayout.addWidget(self.role_selector)

        self.color_name = QtWidgets.QLabel(ctrl.cm.get_color_name(self.selected_hsv), widget)
        layout.addWidget(self.color_name)

        self.color_wheel = ColorWheelInner(widget)
        self.color_wheel.suggested_size = 200
        layout.addWidget(self.color_wheel)

        layout.addSpacing(8)
        hlayout = box_row(layout)
        self.h_spinner = spinner(self, hlayout, self.h_changed, label='H:', vmax=360, wrapping=True)
        self.s_spinner = spinner(self, hlayout, self.s_changed, label='S:', vmax=255)
        self.v_spinner = spinner(self, hlayout, self.v_changed, label='V:', vmax=255)
        hlayout = box_row(layout)
        self.r_spinner = spinner(self, hlayout, self.r_changed, label='R:', vmax=255)
        self.g_spinner = spinner(self, hlayout, self.g_changed, label='G:', vmax=255)
        self.b_spinner = spinner(self, hlayout, self.b_changed, label='B:', vmax=255)

        hlayout = box_row(layout)
        match_help = "When adjusting 'content1' or 'background1', try to find contrasting colors " \
                     "for other roles."
        self.match_l = QtWidgets.QLabel("Auto-match palette:")
        self.match_l.setToolTip(match_help)
        self.match_l.setParent(self.widget())
        self.match_cb = KatajaCheckBox()
        self.match_cb.setToolTip(match_help)
        self.match_cb.setParent(widget)
        self.match_cb.setChecked(self.try_to_match)
        self.match_cb.stateChanged.connect(self.set_palette_matching)
        self.match_l.setBuddy(self.match_cb)
        hlayout.addWidget(self.match_l)
        hlayout.addWidget(self.match_cb)
        chelp = "Contrast for auto-matched palettes"
        self.contrast_label = QtWidgets.QLabel("Contrast:")
        self.contrast_label.setToolTip(chelp)
        self.contrast_label.setParent(widget)
        hlayout.addWidget(self.contrast_label)
        self.contrast_spin = spinner(self, hlayout, self.contrast_changed, vmin=30, vmax=99)
        self.contrast_spin.setToolTip(chelp)
        self.contrast_spin.setValue(self.match_contrast)
        self._updating = False
        self.finish_init()
Пример #32
0
 def initial_position(self, next_to=''):
     """
     :return:
     """
     return Panel.initial_position(self, next_to=next_to or 'VisualizationPanel')
Пример #33
0
 def initial_position(self, next_to=''):
     """
     :return:
     """
     return Panel.initial_position(self,
                                   next_to=next_to or 'VisualizationPanel')
Пример #34
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()
        inner.preferred_size = QtCore.QSize(200, 70)
        inner.setMaximumWidth(220)
        inner.setMaximumHeight(80)
        inner.sizeHint = self.sizeHint

        layout = QtWidgets.QVBoxLayout()
        hlayout = QtWidgets.QHBoxLayout()

        self.selector = SelectionBox(self)
        self.selector.add_items([('%s (%s)' % (key, item.shortcut), key) for key, item in
                                 VISUALIZATIONS.items()])

        self.ui_manager.connect_element_to_action(self.selector, 'set_visualization')
        hlayout.addWidget(self.selector)
        self.toggle_options = PanelButton(pixmap=qt_prefs.settings_pixmap,
                                          parent=self, size=20)
        self.toggle_options.setFixedSize(26, 26)
        self.toggle_options.setCheckable(True)
        ctrl.ui.connect_element_to_action(self.toggle_options,
                                          'toggle_panel_VisualizationOptionsPanel')
        hlayout.addWidget(self.toggle_options, 1, QtCore.Qt.AlignRight)

        layout.addLayout(hlayout)

        hlayout = QtWidgets.QHBoxLayout()
        w = 36
        b1 = PanelButton(pixmap=qt_prefs.shape_icon_plain, parent=self, size=24)
        b1.setFixedWidth(w)
        b1.setCheckable(True)
        ctrl.ui.connect_element_to_action(b1, 'set_no_frame_node_shape')
        hlayout.addWidget(b1)
        b2 = PanelButton(pixmap=qt_prefs.shape_icon_scope, parent=self, size=24)
        b2.setFixedWidth(w)
        b2.setCheckable(True)
        ctrl.ui.connect_element_to_action(b2, 'set_scopebox_node_shape')
        hlayout.addWidget(b2)
        b3 = PanelButton(pixmap=qt_prefs.shape_icon_brackets, parent=self, size=24)
        b3.setFixedWidth(w)
        b3.setCheckable(True)
        ctrl.ui.connect_element_to_action(b3, 'set_bracketed_node_shape')
        hlayout.addWidget(b3)
        b4 = PanelButton(pixmap=qt_prefs.shape_icon_box, parent=self, size=24)
        b4.setFixedWidth(w)
        b4.setCheckable(True)
        ctrl.ui.connect_element_to_action(b4, 'set_box_node_shape')
        hlayout.addWidget(b4)
        b5 = PanelButton(pixmap=qt_prefs.shape_icon_card, parent=self, size=24)
        b5.setFixedWidth(w)
        b5.setCheckable(True)
        ctrl.ui.connect_element_to_action(b5, 'set_card_node_shape')
        hlayout.addWidget(b5)
        layout.addLayout(hlayout)
        #layout.setContentsMargins(0, 0, 0, 0)
        inner.setLayout(layout)
        self.watchlist = ['visualization']
        self.preferred_size = inner.preferred_size
        self.setWidget(inner)
        inner.setAutoFillBackground(True)
        self.finish_init()
Пример #35
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)
        self.selected_role = 'content1'
        self.selected_hsv = ctrl.cm.get(self.selected_role).getHsvF()[:3]
        self.match_contrast = 65
        self.watchlist = ['palette_changed', 'color_themes_changed']
        self.try_to_match = True
        self._updating = True
        # ### Color wheel
        layout = QtWidgets.QVBoxLayout()
        widget = QtWidgets.QWidget(self)
        widget.preferred_size = QtCore.QSize(220, 300)
        # From ColorThemePanel
        color_theme_fragment(self, layout)

        the_rest = [f'accent{i}' for i in range(1, 9)
                    ] + [f'custom{i}' for i in range(1, 10)]

        self.editable_colors = ['content1', 'background1'] + the_rest
        self.all_colors = ['content1', 'content2', 'content3', 'background1', 'background2'] + \
                          the_rest

        self.role_label = QtWidgets.QLabel("Picking color for role: ")
        self.role_selector = QtWidgets.QComboBox(parent=self)
        self.role_selector.addItems(self.editable_colors)
        self.role_selector.currentTextChanged.connect(self.set_color_role)
        hlayout = QtWidgets.QHBoxLayout()
        hlayout.addWidget(self.role_label)
        hlayout.addWidget(self.role_selector)
        layout.addLayout(hlayout)
        self.color_name = QtWidgets.QLabel(
            ctrl.cm.get_color_name(self.selected_hsv), self)
        layout.addWidget(self.color_name)

        self.color_wheel = ColorWheelInner(widget)
        self.color_wheel.suggested_size = 200
        layout.addWidget(self.color_wheel)

        layout.addSpacing(8)
        hlayout = QtWidgets.QHBoxLayout()
        self.h_spinner = spinner(self,
                                 hlayout,
                                 self.h_changed,
                                 label='H:',
                                 vmax=360,
                                 wrapping=True)
        self.s_spinner = spinner(self,
                                 hlayout,
                                 self.s_changed,
                                 label='S:',
                                 vmax=255)
        self.v_spinner = spinner(self,
                                 hlayout,
                                 self.v_changed,
                                 label='V:',
                                 vmax=255)
        layout.addLayout(hlayout)
        hlayout = QtWidgets.QHBoxLayout()
        self.r_spinner = spinner(self,
                                 hlayout,
                                 self.r_changed,
                                 label='R:',
                                 vmax=255)
        self.g_spinner = spinner(self,
                                 hlayout,
                                 self.g_changed,
                                 label='G:',
                                 vmax=255)
        self.b_spinner = spinner(self,
                                 hlayout,
                                 self.b_changed,
                                 label='B:',
                                 vmax=255)
        layout.addLayout(hlayout)

        hlayout = QtWidgets.QHBoxLayout()
        match_help = "When adjusting 'content1' or 'background1', try to find contrasting colors " \
                     "for other roles."
        self.match_l = QtWidgets.QLabel("Auto-match palette:")
        self.match_l.setToolTip(match_help)
        self.match_l.setParent(self)
        self.match_cb = QtWidgets.QCheckBox()
        self.match_cb.setToolTip(match_help)
        self.match_cb.setParent(self)
        self.match_cb.setChecked(self.try_to_match)
        self.match_cb.stateChanged.connect(self.set_palette_matching)
        self.match_l.setBuddy(self.match_cb)
        hlayout.addWidget(self.match_l)
        hlayout.addWidget(self.match_cb)
        chelp = "Contrast for auto-matched palettes"
        self.contrast_label = QtWidgets.QLabel("Contrast:")
        self.contrast_label.setToolTip(chelp)
        self.contrast_label.setParent(self)
        hlayout.addWidget(self.contrast_label)
        self.contrast_spin = spinner(self,
                                     hlayout,
                                     self.contrast_changed,
                                     vmin=30,
                                     vmax=99)
        self.contrast_spin.setToolTip(chelp)
        self.contrast_spin.setValue(self.match_contrast)

        layout.addLayout(hlayout)
        widget.setLayout(layout)
        self.setWidget(widget)
        self._updating = False
        self.finish_init()
Пример #36
0
 def close(self):
     """ Raise button in VISUALIZATION panel """
     vp = self.ui_manager.get_panel('VisualizationPanel')
     if vp:
         vp.toggle_options.setChecked(False)
     Panel.close(self)
Пример #37
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()
Пример #38
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()
Пример #39
0
    def __init__(self, name, default_position='bottom', 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()
        inner.setMaximumHeight(140)
        inner.setMinimumWidth(160)
        inner.setMaximumWidth(220)
        self.watchlist = ['forest_changed']
        layout = QtWidgets.QGridLayout()

        label = QtWidgets.QLabel('Tree set', self)
        layout.addWidget(label, 0, 0, 1, 1)

        treeset_counter = QtWidgets.QLabel('0/0', self)
        layout.addWidget(treeset_counter, 0, 1, 1, 1)
        self.treeset_counter = treeset_counter

        prev_tree = TwoColorButton(qt_prefs.left_arrow, '', self)
        prev_tree.setMinimumWidth(72)
        layout.addWidget(prev_tree, 1, 0, 1, 1)
        self.prev_tree = prev_tree
        ui = self.ui_manager
        ui.connect_element_to_action(prev_tree, 'previous_forest')

        next_tree = TwoColorButton(qt_prefs.right_arrow, '', self)
        next_tree.setMinimumWidth(72)
        layout.addWidget(next_tree, 1, 1, 1, 1)
        self.next_tree = next_tree
        ui.connect_element_to_action(next_tree, 'next_forest')

        new_tree = text_button(ui, layout, text='New forest', action='new_forest', x=0, y=3)

        self.der_label = QtWidgets.QLabel('Derivation step', self)
        layout.addWidget(self.der_label, 2, 0, 1, 1)

        derivation_counter = QtWidgets.QLabel('0/0', self)
        layout.addWidget(derivation_counter, 2, 1, 1, 1)
        self.derivation_counter = derivation_counter

        prev_der = TwoColorButton(qt_prefs.left_arrow, '', self)
        prev_der.setMaximumHeight(20)
        layout.addWidget(prev_der, 3, 0, 1, 1)
        self.prev_der = prev_der
        ui.connect_element_to_action(prev_der, 'prev_derivation_step')

        next_der = TwoColorButton(qt_prefs.right_arrow, '', self)
        next_der.setMaximumHeight(20)
        layout.addWidget(next_der, 3, 1, 1, 1)
        self.next_der = next_der
        ui.connect_element_to_action(next_der, 'next_derivation_step')
        inner.setLayout(layout)
        if False: #ctrl.forest.supports_derivation:
            self.der_label.hide()
            self.derivation_counter.hide()
            self.next_der.hide()
            self.prev_der.hide()
        self.setWidget(inner)
        self.widget().setAutoFillBackground(True)
        self.finish_init()
Пример #40
0
 def closeEvent(self, event):
     self.camera.stop()
     Panel.closeEvent(self, event)
Пример #41
0
 def hideEvent(self, event):
     self.camera.stop()
     Panel.hideEvent(self, event)
Пример #42
0
 def show(self):
     """ Depress button in VISUALIZATION panel """
     vp = self.ui_manager.get_panel('VisualizationPanel')
     if vp:
         vp.toggle_options.setChecked(True)
     Panel.show(self)
Пример #43
0
 def closeEvent(self, event):
     self.camera.stop()
     Panel.closeEvent(self, event)
Пример #44
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()
Пример #45
0
 def showEvent(self, event):
     self.camera.start()
     Panel.showEvent(self, event)
Пример #46
0
 def finish_init(self):
     Panel.finish_init(self)
     self.update_panel()
     self.show()
Пример #47
0
 def showEvent(self, event):
     self.camera.start()
     Panel.showEvent(self, event)
Пример #48
0
 def show(self):
     """ Depress button in VISUALIZATION panel """
     vp = self.ui_manager.get_panel('VisualizationPanel')
     if vp:
         vp.toggle_options.setChecked(True)
     Panel.show(self)
Пример #49
0
 def hideEvent(self, event):
     self.camera.stop()
     Panel.hideEvent(self, event)
Пример #50
0
 def close(self):
     """ Raise button in VISUALIZATION panel """
     vp = self.ui_manager.get_panel('VisualizationPanel')
     if vp:
         vp.toggle_options.setChecked(False)
     Panel.close(self)
Пример #51
0
    def __init__(self,
                 name,
                 default_position='bottom',
                 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()
        inner.setMaximumHeight(140)
        inner.setMinimumWidth(160)
        inner.setMaximumWidth(220)
        self.watchlist = ['forest_changed']
        layout = QtWidgets.QGridLayout()

        label = QtWidgets.QLabel('Tree set', self)
        layout.addWidget(label, 0, 0, 1, 1)

        treeset_counter = QtWidgets.QLabel('0/0', self)
        layout.addWidget(treeset_counter, 0, 1, 1, 1)
        self.treeset_counter = treeset_counter

        action = ctrl.ui.get_action('previous_forest')
        prev_tree = TwoColorButton(qt_prefs.left_arrow, action.k_shortcut,
                                   self)
        prev_tree.setMinimumWidth(72)
        layout.addWidget(prev_tree, 1, 0, 1, 1)
        self.prev_tree = prev_tree
        ui = self.ui_manager
        ui.connect_element_to_action(prev_tree, action.k_action_uid)

        action = ctrl.ui.get_action('next_forest')
        next_tree = TwoColorButton(qt_prefs.right_arrow, action.k_shortcut,
                                   self)
        next_tree.setMinimumWidth(72)
        layout.addWidget(next_tree, 1, 1, 1, 1)
        self.next_tree = next_tree
        ui.connect_element_to_action(next_tree, action.k_action_uid)

        new_tree = text_button(ui,
                               layout,
                               text='New forest',
                               action='new_forest',
                               x=0,
                               y=3)

        self.der_label = QtWidgets.QLabel('Derivation step', self)
        layout.addWidget(self.der_label, 2, 0, 1, 1)

        derivation_counter = QtWidgets.QLabel('0/0', self)
        layout.addWidget(derivation_counter, 2, 1, 1, 1)
        self.derivation_counter = derivation_counter

        action = ctrl.ui.get_action('prev_derivation_step')
        prev_der = TwoColorButton(qt_prefs.left_arrow, action.k_shortcut, self)
        prev_der.setMaximumHeight(20)
        layout.addWidget(prev_der, 3, 0, 1, 1)
        self.prev_der = prev_der
        ui.connect_element_to_action(prev_der, action.k_action_uid)

        action = ctrl.ui.get_action('next_derivation_step')
        next_der = TwoColorButton(qt_prefs.right_arrow, action.k_shortcut,
                                  self)
        next_der.setMaximumHeight(20)
        layout.addWidget(next_der, 3, 1, 1, 1)
        self.next_der = next_der
        ui.connect_element_to_action(next_der, action.k_action_uid)
        inner.setLayout(layout)
        if False:  #ctrl.forest.supports_derivation:
            self.der_label.hide()
            self.derivation_counter.hide()
            self.next_der.hide()
            self.prev_der.hide()
        self.setWidget(inner)
        self.widget().setAutoFillBackground(True)
        self.finish_init()
Пример #52
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()
        #inner.preferred_size = QtCore.QSize(220, 130)
        inner.setMinimumSize(160, 130)
        inner.setMaximumSize(220, 400)
        inner.setMinimumWidth(160)

        layout = QtWidgets.QVBoxLayout()
        self.selector = SelectionBox(self)
        self.selector.add_items([(table_dict[item], item)
                                 for item in table_names])
        self.selector.activated.connect(self.change_symbol_set)
        self.selector.setFocusPolicy(QtCore.Qt.TabFocus)
        layout.addWidget(self.selector)
        self.symlist = QtWidgets.QListWidget()
        self.symlist.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Expanding)
        self.symlist.setSpacing(8)
        self.symlist.setMouseTracking(True)
        self.symlist.setFocusPolicy(QtCore.Qt.NoFocus)
        self.symlist.setViewMode(QtWidgets.QListWidget.IconMode)
        f = qt_prefs.get_font(g.MAIN_FONT)
        self.symlist.setStyleSheet('font-family: "%s"; font-size: %spx;' %
                                   (f.family(), int(f.pointSize() * 1.5)))
        self.symlist.itemEntered.connect(self.item_entered)
        self.symlist.itemClicked.connect(self.item_clicked)
        layout.addWidget(self.symlist)
        hlayout = box_row(layout)
        self.info = QtWidgets.QLabel('')
        hlayout.addWidget(self.info)
        self.resize_grip = QtWidgets.QSizeGrip(self)
        self.resize_grip.hide()
        hlayout.addWidget(self.resize_grip, 0, QtCore.Qt.AlignRight)
        inner.setLayout(layout)
        self.tables = {}
        keys = list(latex_to_unicode.keys())
        for name in table_names:
            self.tables[name] = []
        keys.sort()
        for key in keys:
            char, description, table_key = latex_to_unicode[key]
            self.tables[table_key].append(key)
        self.tables['greek'] = greek_letters
        self.tables['arrows'] = arrows
        self.tables['more arrows'] = more_arrows
        self.tables['common'] = common
        # self.tables['arrows'] = arrows
        self.prepare_symbols('common')
        self.setWidget(inner)
        self.finish_init()
Пример #53
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()
        inner.preferred_size = QtCore.QSize(200, 70)
        inner.setMaximumWidth(220)
        inner.setMaximumHeight(80)
        inner.sizeHint = self.sizeHint

        layout = QtWidgets.QVBoxLayout()
        hlayout = QtWidgets.QHBoxLayout()

        self.selector = SelectionBox(self)
        self.selector.add_items([('%s (%s)' % (key, item.shortcut), key)
                                 for key, item in VISUALIZATIONS.items()])

        self.ui_manager.connect_element_to_action(self.selector,
                                                  'set_visualization')
        hlayout.addWidget(self.selector)
        self.toggle_options = PanelButton(pixmap=qt_prefs.settings_pixmap,
                                          parent=self,
                                          size=20)
        self.toggle_options.setFixedSize(26, 26)
        self.toggle_options.setCheckable(True)
        ctrl.ui.connect_element_to_action(
            self.toggle_options, 'toggle_panel_VisualizationOptionsPanel')
        hlayout.addWidget(self.toggle_options, 1, QtCore.Qt.AlignRight)

        layout.addLayout(hlayout)

        hlayout = QtWidgets.QHBoxLayout()
        w = 36
        b1 = PanelButton(pixmap=qt_prefs.shape_icon_plain,
                         parent=self,
                         size=24)
        b1.setFixedWidth(w)
        b1.setCheckable(True)
        ctrl.ui.connect_element_to_action(b1, 'set_no_frame_node_shape')
        hlayout.addWidget(b1)
        b2 = PanelButton(pixmap=qt_prefs.shape_icon_scope,
                         parent=self,
                         size=24)
        b2.setFixedWidth(w)
        b2.setCheckable(True)
        ctrl.ui.connect_element_to_action(b2, 'set_scopebox_node_shape')
        hlayout.addWidget(b2)
        b3 = PanelButton(pixmap=qt_prefs.shape_icon_brackets,
                         parent=self,
                         size=24)
        b3.setFixedWidth(w)
        b3.setCheckable(True)
        ctrl.ui.connect_element_to_action(b3, 'set_bracketed_node_shape')
        hlayout.addWidget(b3)
        b4 = PanelButton(pixmap=qt_prefs.shape_icon_box, parent=self, size=24)
        b4.setFixedWidth(w)
        b4.setCheckable(True)
        ctrl.ui.connect_element_to_action(b4, 'set_box_node_shape')
        hlayout.addWidget(b4)
        b5 = PanelButton(pixmap=qt_prefs.shape_icon_card, parent=self, size=24)
        b5.setFixedWidth(w)
        b5.setCheckable(True)
        ctrl.ui.connect_element_to_action(b5, 'set_card_node_shape')
        hlayout.addWidget(b5)
        layout.addLayout(hlayout)
        #layout.setContentsMargins(0, 0, 0, 0)
        inner.setLayout(layout)
        self.watchlist = ['visualization']
        self.preferred_size = inner.preferred_size
        self.setWidget(inner)
        inner.setAutoFillBackground(True)
        self.finish_init()
Пример #54
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)
        layout = self.vlayout
        widget = self.widget()
        self.active_node_type = g.CONSTITUENT_NODE
        self.shape_selector = None

        ctrl.main.selection_changed.connect(self.update_panel)
        ctrl.main.scope_changed.connect(self.update_panel)

        spac = 8
        hlayout = box_row(layout)

        self.edge_type_selector = SelectionBox(parent=widget, data=[],
                                               action='set_edge_type_for_editing'
                                           ).to_layout(hlayout, with_label='Style for')
        self.edge_type_selector.setFixedWidth(148)

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

        hlayout = box_row(layout)
        self.shape_selector = ShapeSelector(parent=widget,
                                            action='change_edge_shape',
                                            ).to_layout(hlayout, with_label='Shape')
        self.shape_selector.for_edge_type = self.active_edge_type

        self.edge_color_selector = ColorSelector(parent=widget,
                                                 action='change_edge_color',
                                                 role='edge').to_layout(hlayout, with_label='Color')
        # Line thickness
        hlayout = box_row(layout)
        self.fill_button = KatajaCheckBox(parent=widget,
                                          action='edge_shape_fill'
                                          ).to_layout(hlayout, with_label='Fill')

        self.line_button = KatajaCheckBox(parent=widget,
                                          action='edge_shape_line'
                                          ).to_layout(hlayout, with_label='Outline')
        self.thickness_spinbox = KatajaDecimalSpinbox(parent=widget,
                                                      range_min=0.0,
                                                      range_max=10.0,
                                                      step=0.1,
                                                      action='edge_thickness',
                                                      suffix=' px'
                                                      ).to_layout(hlayout, with_label='Thickness')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)

        hlayout = box_row(layout)
        self.arrowhead_start_button = KatajaCheckBox(parent=widget,
                                                     action='edge_arrowhead_start'
                                                     ).to_layout(hlayout,
                                                                 with_label='Arrowheads at start')
        self.arrowhead_end_button = KatajaCheckBox(parent=widget,
                                                   action='edge_arrowhead_end'
                                                   ).to_layout(hlayout, with_label='at end')
        layout.addWidget(hdivider())
        layout.addSpacing(spac)
        # Curvature
        hlayout = box_row(layout)
        hlayout.addWidget(QtWidgets.QLabel('Curvature'))
        hlayout.setAlignment(QtCore.Qt.AlignRight)
        self.arc_rel_dx_spinbox = KatajaSpinbox(parent=widget, range_min=-200, range_max=200,
                                                action='change_edge_relative_curvature_x',
                                                suffix='%'
                                                ).to_layout(hlayout, with_label='X')
        self.arc_rel_dy_spinbox = KatajaSpinbox(parent=widget, range_min=-200, range_max=200,
                                                action='change_edge_relative_curvature_y',
                                                suffix='%'
                                                ).to_layout(hlayout, with_label='Y')

        hlayout = box_row(layout)
        hlayout.setAlignment(QtCore.Qt.AlignRight)
        self.arc_fixed_dx_spinbox = KatajaSpinbox(parent=widget, range_min=-200, range_max=200,
                                                  action='change_edge_fixed_curvature_x',
                                                  suffix=' px'
                                                  ).to_layout(hlayout, with_label='X')

        self.arc_fixed_dy_spinbox = KatajaSpinbox(parent=widget, range_min=-200, range_max=200,
                                                  action='change_edge_fixed_curvature_y',
                                                  suffix=' px'
                                                  ).to_layout(hlayout, with_label='Y')

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

        hlayout = box_row(layout)
        self.reset_all = PanelButton(parent=widget, text='Reset edge settings',
                                     action='reset_edge_settings').to_layout(hlayout)
        self.reset_all.setMaximumHeight(20)

        self.reset_adjustment = PanelButton(parent=widget,
                                            text='Reset curves',
                                            action='reset_control_points').to_layout(hlayout)
        self.reset_adjustment.setMaximumHeight(20)
        self.finish_init()