Exemplo n.º 1
0
    def _initialize_widgets(self):
        #
        self.setWindowIcon(Icon('genicam_logo_i.png'))

        #
        self.setWindowTitle('GenICam.Harvester')
        self.setFont(get_system_font())

        #
        self.statusBar().showMessage('')
        self.statusBar().setFont(get_system_font())

        #
        self._initialize_gui_toolbar(self._observer_widgets)

        #
        self.setCentralWidget(self.canvas.native)

        #
        self.resize(800, 600)

        # Place it in the center.
        rectangle = self.frameGeometry()
        coordinate = QDesktopWidget().availableGeometry().center()
        rectangle.moveCenter(coordinate)
        self.move(rectangle.topLeft())
Exemplo n.º 2
0
    def __init__(self, text):
        #
        super().__init__(text)

        self.setReadOnly(True)
        self.setFont(get_system_font())
        self.setStyleSheet('background: rgb(0, 0, 0, 0%)')
        self.setFrame(False)
Exemplo n.º 3
0
    def __init__(self, text):
        #
        super().__init__(text)

        self.setReadOnly(True)
        self.setFont(get_system_font())
        self.setStyleSheet('background: rgb(0, 0, 0, 0%)')
        self.setLineWrapMode(True)
        self.setFrameStyle(QFrame.NoFrame)
        self.setAlignment(Qt.AlignCenter)
Exemplo n.º 4
0
    def createEditor(self, parent: QWidget, QStyleOptionViewItem,
                     proxy_index: QModelIndex):

        # Get the actual source.
        src_index = self._proxy.mapToSource(proxy_index)

        # If it's the column #0, then immediately return.
        if src_index.column() == 0:
            return None

        tree_item = src_index.internalPointer()
        feature = tree_item.own_data[0]
        interface_type = feature.node.principal_interface_type

        if interface_type == EInterfaceType.intfIInteger:
            w = QSpinBox(parent)
            w.setRange(feature.min, feature.max)
            w.setSingleStep(feature.inc)
            w.setValue(feature.value)
        elif interface_type == EInterfaceType.intfICommand:
            w = QPushButton(parent)
            w.setText('Execute')
            w.clicked.connect(lambda: self.on_button_clicked(proxy_index))
        elif interface_type == EInterfaceType.intfIBoolean:
            w = QComboBox(parent)
            boolean_ints = {'False': 0, 'True': 1}
            w.addItem('False')
            w.addItem('True')
            proxy_index = boolean_ints[
                'True'] if feature.value else boolean_ints['False']
            w.setCurrentIndex(proxy_index)
        elif interface_type == EInterfaceType.intfIEnumeration:
            w = QComboBox(parent)
            for item in feature.entries:
                w.addItem(item.symbolic)
            w.setCurrentText(feature.value)
        elif interface_type == EInterfaceType.intfIString:
            w = QLineEdit(parent)
            w.setText(feature.value)
        elif interface_type == EInterfaceType.intfIFloat:
            w = QLineEdit(parent)
            w.setText(str(feature.value))
        else:
            return None

        #
        w.setFont(get_system_font())

        return w
Exemplo n.º 5
0
    def __init__(self, parent=None):
        #
        super().__init__(parent)

        #
        self.setWindowTitle('About Harvester')

        #
        layout_main = QVBoxLayout()
        layout_textual_info = QVBoxLayout()
        layout_image = QHBoxLayout()

        #
        self._button_acknowledgements = QPushButton()
        self._button_acknowledgements.setText('Acknowledgements')
        self._button_acknowledgements.setFont(get_system_font())
        self._button_acknowledgements.clicked.connect(
            self._handle_open_dialog
        )

        #
        text_version = TransparentLineEdit(
            'Version: ' + __version__
        )
        text_copyright = TransparentLineEdit('Copyright (c) 2018 EMVA')

        layout_textual_info.addWidget(text_version)
        layout_textual_info.addWidget(text_copyright)

        #
        image = DecoratedDialog()
        image.setFixedWidth(640)
        image.setFixedHeight(480)

        #
        layout_image.addWidget(image)

        #
        layout_main.addLayout(layout_image)
        layout_main.addLayout(layout_textual_info)
        layout_main.addWidget(self._button_acknowledgements)

        #
        self.setLayout(layout_main)

        #
        self._acknowledgements = Acknowledgements(self)
        self._acknowledgements.setModal(True)
    def __init__(self, node_map, parent=None):
        #
        super().__init__(parent=parent)

        #
        self.setWindowTitle('Attribute Controller')

        #
        self._view = QTreeView()
        self._view.setFont(get_system_font())

        #
        self._node_map = node_map
        self._model = FeatureTreeModel(node_map=self._node_map, )

        #
        self._proxy = FilterProxyModel()
        self._proxy.setSourceModel(self._model)
        self._proxy.setDynamicSortFilter(False)

        #
        self._delegate = FeatureEditDelegate(proxy=self._proxy)
        self._view.setModel(self._proxy)
        self._view.setItemDelegate(self._delegate)
        self._view.setUniformRowHeights(True)

        #
        unit = 260
        for i in range(2):
            self._view.setColumnWidth(i, unit)

        w, h = 700, 600
        self._view.setGeometry(100, 100, w, h)

        self.setCentralWidget(self._view)
        self.setGeometry(100, 100, unit * 2, 640)

        self._combo_box_visibility = None
        self._line_edit_search_box = None

        #
        self._setup_toolbars()
Exemplo n.º 7
0
    def __init__(self, parent=None):
        #
        super().__init__(parent=parent)

        #
        self.setWindowTitle('Acknowledgements')

        #
        layout = QVBoxLayout(self)

        #
        content = 'Cover Drawing:\n'
        content += '\n'
        content += 'Pieter Bruegel the Elder, The Harvesters\n'
        content += 'Copyright (c) 2000–2018 The Metropolitan Museum of Arts'
        content += '\n\n'
        content += 'Open Source Libraries/Resources:\n'
        content += '\n'
        content += 'VisPy (BSD)\n'
        content += 'Copyright (c) 2013-2018 VisPy developers\n'
        content += 'http://vispy.org/'
        content += '\n\n'
        content += 'PyQt5 (GPL)\n'
        content += 'Copyright (c) 2018 Riverbank Computing Limited\n'
        content += 'https://www.riverbankcomputing.com/'
        content += '\n\n'
        content += 'Icons8 (Creative Commons Attribution-NoDerivs 3.0 Unported)\n'
        content += 'Copyright (c) Icons8 LLC\n'
        content += 'https://icons8.comn'
        content += '\n\n'
        content += 'Versioneer (Public Domain, CC0-1.0)\n'
        content += 'Copyright (c) 2018 Brian Warner\n'
        content += 'https://github.com/warner/python-versioneer'

        self._text = QPlainTextEdit(content)
        self._text.setReadOnly(True)
        self._text.setFont(get_system_font())
        self._text.setLineWrapMode(True)
        self._text.setFixedWidth(480)

        layout.addWidget(self._text)
        self.setLayout(layout)
    def _setup_toolbars(self):
        #
        group_filter = self.addToolBar('Node Visibility')
        group_manipulation = self.addToolBar('Node Tree Manipulation')

        #
        label_visibility = QLabel()
        label_visibility.setText('Visibility')
        label_visibility.setFont(get_system_font())

        #
        self._combo_box_visibility = QComboBox()
        self._combo_box_visibility.setSizeAdjustPolicy(
            QComboBox.AdjustToContents)

        #
        items = ('Beginner', 'Expert', 'Guru', 'All')
        for item in items:
            self._combo_box_visibility.addItem(item)

        shortcut_key = 'Ctrl+v'
        shortcut = QShortcut(QKeySequence(shortcut_key), self)

        def show_popup():
            self._combo_box_visibility.showPopup()

        shortcut.activated.connect(show_popup)

        self._combo_box_visibility.setToolTip(
            compose_tooltip('Filter the nodes to show', shortcut_key))
        self._combo_box_visibility.setFont(get_system_font())
        self._combo_box_visibility.currentIndexChanged.connect(
            self._invalidate_feature_tree_by_visibility)

        #
        button_expand_all = ActionExpandAll(icon='expand.png',
                                            title='Expand All',
                                            parent=self,
                                            action=self.action_on_expand_all)
        shortcut_key = 'Ctrl+e'
        button_expand_all.setToolTip(
            compose_tooltip('Expand the node tree', shortcut_key))
        button_expand_all.setShortcut(shortcut_key)
        button_expand_all.toggle()

        #
        button_collapse_all = ActionCollapseAll(
            icon='collapse.png',
            title='Collapse All',
            parent=self,
            action=self.action_on_collapse_all)
        shortcut_key = 'Ctrl+c'
        button_collapse_all.setToolTip(
            compose_tooltip('Collapse the node tree', shortcut_key))
        button_collapse_all.setShortcut(shortcut_key)
        button_collapse_all.toggle()

        #
        label_search = QLabel()
        label_search.setText('RegEx Search')
        label_search.setFont(get_system_font())

        #
        self._line_edit_search_box = QLineEdit()
        self._line_edit_search_box.setFont(get_system_font())
        self._line_edit_search_box.textEdited.connect(
            self._invalidate_feature_tree_by_keyword)

        #
        group_filter.addWidget(label_visibility)
        group_filter.addWidget(self._combo_box_visibility)
        group_filter.addWidget(label_search)
        group_filter.addWidget(self._line_edit_search_box)
        group_filter.setStyleSheet('QToolBar{spacing:6px;}')

        #
        group_manipulation.addAction(button_expand_all)
        group_manipulation.addAction(button_collapse_all)

        #
        group_manipulation.actionTriggered[QAction].connect(
            self.on_button_clicked_action)

        #
        self._combo_box_visibility.setCurrentIndex(
            self._visibility_dict['Expert'])
Exemplo n.º 9
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.setFont(get_system_font())