Python PyQt5.QtGui.QStandardItem() Examples

The following are code examples for showing how to use PyQt5.QtGui.QStandardItem(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: python-aptly-gui   Author: chnyda   File: package_promotion.py    GNU General Public License v3.0 6 votes vote down vote up
def recreate_package_box(self):
        self.model.removeRows(0, self.model.rowCount())
        component = self.component_box.currentText()
        publish = self.source_publish_box.currentText()

        # empty sometimes?
        if not component:
            return

        packages = self.data_manager.get_package_from_publish_component(publish, component)

        for package in packages:
            item = QStandardItem(package)
            item.setCheckable(True)
            item.setCheckState(Qt.Checked)
            self.model.appendRow(item)
        self.package_label.setModel(self.model) 
Example 2
Project: python-aptly-gui   Author: chnyda   File: snapshot_tab.py    GNU General Public License v3.0 6 votes vote down vote up
def recreate_package_box(self):
        self.model.removeRows(0, self.model.rowCount())
        component = self.component_box.currentText()
        current_publish = self.publish_box.currentText()

        if not component:
            return

        packages = self.data_manager.get_package_from_publish_component(current_publish, component)

        for package in packages:
            item = QStandardItem(package)
            item.setCheckable(True)
            item.setCheckState(Qt.Checked)
            self.model.appendRow(item)
        self.package_label.setModel(self.model) 
Example 3
Project: Lector   Author: BasioMeusPuga   File: dockwidgets.py    GNU General Public License v3.0 6 votes vote down vote up
def generate_annotation_model(self):
        # TODO
        # Annotation previews will require creation of a
        # QStyledItemDelegate

        saved_annotations = self.parent.main_window.settings['annotations']
        if not saved_annotations:
            return

        # Create annotation model
        for i in saved_annotations:
            item = QtGui.QStandardItem()
            item.setText(i['name'])
            item.setData(i, QtCore.Qt.UserRole)
            self.parent.annotationModel.appendRow(item)
        self.annotationListView.setModel(self.parent.annotationModel) 
Example 4
Project: eddy   Author: obdasystems   File: ontology_explorer.py    GNU General Public License v3.0 6 votes vote down vote up
def doAddNode(self, diagram, node):
        """
        Add a node in the tree view.
        :type diagram: QGraphicsScene
        :type node: AbstractItem
        """
        if node.type() in self.items:
            parent = self.parentFor(node)
            if not parent:
                parent = QtGui.QStandardItem(self.parentKey(node))
                parent.setIcon(self.iconFor(node))
                self.model.appendRow(parent)
            child = QtGui.QStandardItem(self.childKey(diagram, node))
            child.setData(node)
            # CHECK FOR DUPLICATE NODES
            children = [parent.child(i) for i in range(parent.rowCount())]
            if not any([child.text() == c.text() for c in children]):
                parent.appendRow(child)
            # APPLY FILTERS AND SORT
            if self.sender() != self.plugin:
                self.proxy.invalidateFilter()
                self.proxy.sort(0, QtCore.Qt.AscendingOrder) 
Example 5
Project: eddy   Author: obdasystems   File: Explanation_explorer.py    GNU General Public License v3.0 6 votes vote down vote up
def doAddNodeOREdge(self, diagram, node_or_edge , q_item):

        icon = None

        if 'eddy.core.items.nodes' in str(type(node_or_edge)):
            button_name =str(node_or_edge.id)+':'+str(node_or_edge.text())
            icon = self.iconFor(node_or_edge)
        elif 'eddy.core.items.edges' in str(type(node_or_edge)):
            button_name = str(node_or_edge.id)+':'+str(node_or_edge.type()).replace('Item.','')

        node_or_edge_to_append = QtGui.QStandardItem(button_name)

        if icon is not None:
            node_or_edge_to_append.setIcon(icon)

        node_or_edge_to_append.setData(node_or_edge)
        q_item.appendRow(node_or_edge_to_append) 
Example 6
Project: eddy   Author: obdasystems   File: Explanation_explorer.py    GNU General Public License v3.0 6 votes vote down vote up
def doAddNode(self, diagram, node):
        """
        Add a node in the tree view.
        :type diagram: QGraphicsScene
        :type node: AbstractItem
        """
        if node.type() in {Item.ConceptNode, Item.RoleNode, Item.AttributeNode, Item.IndividualNode}:
        #if (('AttributeNode' in str(type(node))) or ('ConceptNode' in str(type(node))) or ('IndividualNode' in str(type(node))) or ('RoleNode' in str(type(node)))):
            parent = self.parentFor(node)
            if not parent:
                parent = QtGui.QStandardItem(self.parentKey(node))
                parent.setIcon(self.iconFor(node))
                self.model.appendRow(parent)
                self.proxy.sort(0, QtCore.Qt.AscendingOrder)
            child = QtGui.QStandardItem(self.childKey(diagram, node))
            child.setData(node)
            parent.appendRow(child)
            self.proxy.sort(0, QtCore.Qt.AscendingOrder) 
Example 7
Project: eddy   Author: obdasystems   File: Unsatisfiable_Entity_Explorer.py    GNU General Public License v3.0 6 votes vote down vote up
def doAddExplanation(self, node, explanation):

        if explanation is not None and len(explanation)>0:
            exp_to_add = QtGui.QStandardItem()
            exp_to_add.setText('<Explanation(s)> \n**(click to open Explanation Explorer)')

            font = QtGui.QFont()
            font.setBold(True)
            font.setItalic(True)
            font.setUnderline(True)

            exp_to_add.setFont(font)

            exp_to_add.setData(explanation)
            parent = self.parentFor(node)
            parent.appendRow(exp_to_add) 
Example 8
Project: eddy   Author: obdasystems   File: Unsatisfiable_Entity_Explorer.py    GNU General Public License v3.0 6 votes vote down vote up
def parentFor(self, node):
        """
        Search the parent element of the given node.
        :type node: AbstractNode
        :rtype: QtGui.QStandardItem
        """
        #print('parentFor(self, node)')
        #print('node',node)
        for i in self.model.findItems(self.parentKey(node), QtCore.Qt.MatchExactly):
            #print('i',i)
            #n = i.child(0).data()
            if (i.text() == node.text()) or (i.text() == node.text().replace('\n', '')):
                return i
            #if str(type(n)) != '<class \'list\'>':
            #if node.type() is n.type():
                #return i
        return None 
Example 9
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def add_subsubsubsection(self, dict_to_add):
        """ Add a subsubsubsection to the model."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        subsection = idx.model().itemFromIndex(idx)
        for key3 in dict_to_add:
            subsubsection = QtGui.QStandardItem(key3)
            for key4 in dict_to_add[key3]:
                subsubsubsection = QtGui.QStandardItem(key4)
                for val in dict_to_add[key3][key4]:
                    value = dict_to_add[key3][key4][val]
                    child0 = QtGui.QStandardItem(val)
                    child1 = QtGui.QStandardItem(str(value))
                    subsubsubsection.appendRow([child0, child1])
                subsubsection.appendRow(subsubsubsection)
            subsection.appendRow(subsubsection)
        self.update_tab_text() 
Example 10
Project: r2dwarf   Author: iGio90   File: e_vars_list.py    GNU General Public License v3.0 5 votes vote down vote up
def on_vars_refresh(self, data):
        import json
        e_vars = json.loads(data[0])
        for key in e_vars:
            var_name = QStandardItem(key)
            var_value = QStandardItem(str(e_vars[key]))
            var_value.setEditable(True)

            self.e_list_model.appendRow([var_name, var_value]) 
Example 11
Project: pywerami   Author: ondrolexa   File: mainapp.py    GNU General Public License v3.0 5 votes vote down vote up
def import_data(self, filename=None):
        if not filename:
            filename = QtWidgets.QFileDialog.getOpenFileName(self, "Import data file", ".", "Perple_X Table (*.tab *.TAB);;TCInvestigator (*.tci *.TCI)")[0]
        if filename:
            if filename.lower().endswith('.tab'):
                self.data = GridData.from_tab(filename)
            elif filename.lower().endswith('.tci'):
                self.data = GridData.from_tci(filename)
            else:
                raise Exception('Unsupported file format')
            # populate listview and setup properties
            self.datafilename = filename
            self.ready = True
            self.project = None
            self.changed = True
            self.props = {}
            self._model = QtGui.QStandardItemModel(self.listView)
            for var in self.data.dep:
                item = QtGui.QStandardItem(var)
                item.setCheckable(True)
                self._model.appendRow(item)
                self.default_var_props(var)

            self.listView.setModel(self._model)
            self.listView.show()

            # connect listview signals
            self.varSel = self.listView.selectionModel()
            try: elf.varSel.selectionChanged.disconnect()
            except Exception: pass
            self.varSel.selectionChanged.connect(self.on_var_changed)
            try: self._model.itemChanged.disconnect()
            except Exception: pass
            self._model.itemChanged.connect(self.plot)

            # all done focus
            self.action3D.setChecked(False) # no 3d on import
            self.varSel.setCurrentIndex(self._model.index(0, 0), QtCore.QItemSelectionModel.ClearAndSelect | QtCore.QItemSelectionModel.Rows)
            self.listView.setFocus()
            self.plot()
            self.statusbar.showMessage("Data from {} imported".format(self.data.label), 5000) 
Example 12
Project: Pesterchum   Author: henry232323   File: pesterchum.py    MIT License 5 votes vote down vote up
def add_friend(self, user):
        '''Called when the ADD [CHUM] button is clicked and the dialog is answered
        Add the user to self.friends, get the users color (probably doesnt have)
        Add a new item to gui.chumsTree Widget
        Set the icon by default to'''
        self.userlist[user] = self.getColor(user)
        self.friends[user] = self.getColor(user)
        treeitem = QStandardItem(user)
        treeitem.setText(user)
        treeitem.setIcon(QIcon(self.theme["path"] + "/offline.png"))
        self.gui.friendsModel.appendRow(treeitem)
        self.gui.friendsItems[user] = treeitem
        self.getFriendMood(user) 
Example 13
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def remove(self):
        selected = self.blockedList.selectedItems()
        if selected:
            item = selected[0]
            index = self.blockedList.indexFromItem(item)
            self.blockedList.takeItem(index.row())
            user = item.text()
            self.app.blocked.remove(user)
            if user in self.app.friends.keys():
                treeitem = QStandardItem(user)
                treeitem.setText(user)
                treeitem.setIcon(QIcon(self.app.theme["path"] + "/offline.png"))
                self.app.gui.friendsModel.appendRow(treeitem) 
Example 14
Project: cct   Author: awacha   File: logviewer.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def setupUi(self, Form):
        Ui_Form.setupUi(self, Form)
        Form.logModel = LogModel()
        Form.logTreeView.setModel(Form.logModel)
        Form.logLevelModel = QtGui.QStandardItemModel()
        Form.logLevelModel.setColumnCount(2)
        Form.filterLevelComboBox.setModel(Form.logLevelModel)
        for i in range(256):
            name = logging.getLevelName(i)
            if not name.startswith('Level '):
                Form.logLevelModel.appendRow([QtGui.QStandardItem(name), QtGui.QStandardItem(str(i))])
        Form.filterLevelComboBox.currentTextChanged.connect(Form.filterLevelChanged)
        Form.keptMessagesSpinBox.valueChanged.connect(Form.keptMessagesChanged) 
Example 15
Project: python-aptly-gui   Author: chnyda   File: repository_tab.py    GNU General Public License v3.0 5 votes vote down vote up
def update_list(self):
        self.model.removeRows(0, self.model.rowCount())
        current_repo = self.repo_box.currentText()
        if current_repo == "":
            return

        if self.data_manager.repo_dict[current_repo]:
            for package in self.data_manager.repo_dict[current_repo]:
                item = QStandardItem(package)
                item.setCheckable(True)
                item.setCheckState(Qt.Unchecked)
                self.model.appendRow(item)
            self.package_label.setModel(self.model) 
Example 16
Project: python-aptly-gui   Author: chnyda   File: component_promotion.py    GNU General Public License v3.0 5 votes vote down vote up
def recreate_package_box(self):
        self.model.removeRows(0, self.model.rowCount())
        current_publish = self.data_manager.get_publish(self.source_publish_box.currentText())
        components = current_publish.components.keys()

        for component in components:
            item = QStandardItem(component)
            item.setCheckable(True)
            item.setCheckState(Qt.Checked)
            self.model.appendRow(item)
        self.package_label.setModel(self.model) 
Example 17
Project: Lector   Author: BasioMeusPuga   File: widgets.py    GNU General Public License v3.0 5 votes vote down vote up
def generate_toc_model(self):
        # The toc list is:
        # 0: Level
        # 1: Title
        # 2: Chapter content / page number
        # pprint it out to get a better idea of structure

        toc = self.metadata['toc']
        parent_list = []
        for i in toc:
            item = QtGui.QStandardItem()
            item.setText(i[1])
            item.setData(i[2], QtCore.Qt.UserRole)
            item.setData(i[1], QtCore.Qt.UserRole + 1)

            current_level = i[0]
            if current_level == 1:
                self.tocModel.appendRow(item)
                parent_list.clear()
                parent_list.append(item)
            else:
                parent_list[current_level - 2].appendRow(item)
                try:
                    next_level = toc[toc.index(i) + 1][0]
                    if next_level > current_level:
                        parent_list.append(item)

                    if next_level < current_level:
                        level_difference = current_level - next_level
                        parent_list = parent_list[:-level_difference]
                except IndexError:
                    pass

        # This is needed to be able to have the toc Combobox
        # jump to the correct position in the book when it is
        # first opened
        self.main_window.bookToolBar.tocBox.setModel(self.tocModel)
        self.main_window.bookToolBar.tocTreeView.expandAll() 
Example 18
Project: Lector   Author: BasioMeusPuga   File: annotations.py    GNU General Public License v3.0 5 votes vote down vote up
def ok_pressed(self):
        annotation_name = self.nameEdit.text()
        if annotation_name == '':
            self.nameEdit.setText('Why do you like bugs? WHY?')
            return

        annotation_components = {}
        if self.foregroundCheck.isChecked():
            annotation_components['foregroundColor'] = self.foregroundColor
        if self.highlightCheck.isChecked():
            annotation_components['highlightColor'] = self.highlightColor
        if self.boldCheck.isChecked():
            annotation_components['bold'] = True
        if self.italicCheck.isChecked():
            annotation_components['italic'] = True
        if self.underlineCheck.isChecked():
            annotation_components['underline'] = (
                self.underlineType.currentText(), self.underlineColor)

        self.current_annotation = {
            'name': annotation_name,
            'applicable_to': 'text',
            'type': 'text_markup',
            'components': annotation_components}

        if self.modelIndex:
            self.parent.annotationModel.setData(
                self.modelIndex, annotation_name, QtCore.Qt.DisplayRole)
            self.parent.annotationModel.setData(
                self.modelIndex, self.current_annotation, QtCore.Qt.UserRole)
        else:  # New annotation
            new_annotation_item = QtGui.QStandardItem()
            new_annotation_item.setText(annotation_name)
            new_annotation_item.setData(self.current_annotation, QtCore.Qt.UserRole)
            self.parent.annotationModel.appendRow(new_annotation_item)

        self.hide() 
Example 19
Project: Lector   Author: BasioMeusPuga   File: settingsdialog.py    GNU General Public License v3.0 5 votes vote down vote up
def generate_annotations(self):
        saved_annotations = self.main_window.settings['annotations']

        for i in saved_annotations:
            item = QtGui.QStandardItem()
            item.setText(i['name'])
            item.setData(i, QtCore.Qt.UserRole)
            self.annotationModel.appendRow(item)

        self.annotationsList.setModel(self.annotationModel) 
Example 20
Project: eddy   Author: obdasystems   File: description.py    GNU General Public License v3.0 5 votes vote down vote up
def doAddNode(self, node):
        """
        Add a node in the list view.
        :type node: AbstractItem
        """
        if node.type() in self.nodeTypes:
            item = QtGui.QStandardItem(self.nodeKey(node))
            item.setData(node)
            item.setIcon(self.iconFor(node))
            self.model.appendRow(item)
            self.proxy.sort(0, QtCore.Qt.AscendingOrder) 
Example 21
Project: eddy   Author: obdasystems   File: ontology_explorer.py    GNU General Public License v3.0 5 votes vote down vote up
def childFor(self, parent, diagram, node):
        """
        Search the item representing this node among parent children.
        :type parent: QtGui.QStandardItem
        :type diagram: Diagram
        :type node: AbstractNode
        """
        key = self.childKey(diagram, node)
        for i in range(parent.rowCount()):
            child = parent.child(i)
            if child.text() == key:
                return child
        return None 
Example 22
Project: eddy   Author: obdasystems   File: ontology_explorer.py    GNU General Public License v3.0 5 votes vote down vote up
def parentFor(self, node):
        """
        Search the parent element of the given node.
        :type node: AbstractNode
        :rtype: QtGui.QStandardItem
        """
        for i in self.model.findItems(self.parentKey(node), QtCore.Qt.MatchExactly):
            n = i.child(0).data()
            if node.type() is n.type():
                return i
        return None 
Example 23
Project: eddy   Author: obdasystems   File: Explanation_explorer.py    GNU General Public License v3.0 5 votes vote down vote up
def doAddExplanation(self,explanation_number):

        explanation_number_to_add = QtGui.QStandardItem('Explanation - '+explanation_number)
        explanation_number_to_add.setData(explanation_number)
        self.model.appendRow(explanation_number_to_add)
        self.proxy.sort(0, QtCore.Qt.AscendingOrder) 
Example 24
Project: eddy   Author: obdasystems   File: Explanation_explorer.py    GNU General Public License v3.0 5 votes vote down vote up
def doAddAxiom(self, q_item, axiom):

        axiom_to_add = QtGui.QStandardItem(axiom)
        axiom_to_add.setData(axiom)
        q_item.appendRow(axiom_to_add)
        self.proxy.sort(0, QtCore.Qt.AscendingOrder) 
Example 25
Project: eddy   Author: obdasystems   File: Explanation_explorer.py    GNU General Public License v3.0 5 votes vote down vote up
def childFor(self, parent, diagram, node):
        """
        Search the item representing this node among parent children.
        :type parent: QtGui.QStandardItem
        :type diagram: Diagram
        :type node: AbstractNode
        """
        key = self.childKey(diagram, node)
        for i in range(parent.rowCount()):
            child = parent.child(i)
            if child.text() == key:
                return child
        return None 
Example 26
Project: eddy   Author: obdasystems   File: Unsatisfiable_Entity_Explorer.py    GNU General Public License v3.0 5 votes vote down vote up
def doAddExplanation_old(self, node, explanation):

        if explanation is not None:
            exp_to_add = QtGui.QStandardItem(explanation)
            exp_to_add.setData(explanation)
            parent = self.parentFor(node)
            parent.appendRow(exp_to_add) 
Example 27
Project: eddy   Author: obdasystems   File: Unsatisfiable_Entity_Explorer.py    GNU General Public License v3.0 5 votes vote down vote up
def childFor(self, parent, diagram, node):
        """
        Search the item representing this node among parent children.
        :type parent: QtGui.QStandardItem
        :type diagram: Diagram
        :type node: AbstractNode
        """
        key = self.childKey(diagram, node)
        for i in range(parent.rowCount()):
            child = parent.child(i)
            if child.text() == key:
                return child
        return None 
Example 28
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def get_model_from_data(self):
        """ Build the data model."""
        self.model.setHorizontalHeaderLabels(['Parameter', 'Value'])
        self.model.itemChanged.connect(self.handleItemChanged)
        # there must be some way to do this recursively
        self.sections = {}
        for key1 in self.cfg:
            if not self.cfg[key1]:
                continue
            if key1 in ["Files", "Global", "Output"]:
                self.sections[key1] = QtGui.QStandardItem(key1)
                for key2 in self.cfg[key1]:
                    val = self.cfg[key1][key2]
                    val = self.parse_cfg_values(key2, val, ['"', "'"])
                    child0 = QtGui.QStandardItem(key2)
                    child1 = QtGui.QStandardItem(val)
                    self.sections[key1].appendRow([child0, child1])
                self.model.appendRow(self.sections[key1])
            elif key1 in ["Variables"]:
                self.sections[key1] = QtGui.QStandardItem(key1)
                for key2 in self.cfg[key1]:
                    parent2 = QtGui.QStandardItem(key2)
                    for key3 in self.cfg[key1][key2]:
                        parent3 = QtGui.QStandardItem(key3)
                        for key4 in self.cfg[key1][key2][key3]:
                            val = self.cfg[key1][key2][key3][key4]
                            val = self.parse_cfg_values(key4, val, ['"', "'"])
                            child0 = QtGui.QStandardItem(key4)
                            child1 = QtGui.QStandardItem(val)
                            parent3.appendRow([child0, child1])
                        parent2.appendRow(parent3)
                    self.sections[key1].appendRow(parent2)
                self.model.appendRow(self.sections[key1]) 
Example 29
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_attribute(self):
        """ Add a variable attribute to a variable in the [Variables] section."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        selected_item = idx.model().itemFromIndex(idx)
        # get the new children
        child0 = QtGui.QStandardItem("New attribute")
        child1 = QtGui.QStandardItem("")
        # add them to the parent
        selected_item.appendRow([child0, child1])
        # add an asterisk to the tab text to indicate the tab contents have changed
        self.update_tab_text() 
Example 30
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_global(self):
        """ Add a new entry to the [Global] section."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        selected_item = idx.model().itemFromIndex(idx)
        # get the new children
        child0 = QtGui.QStandardItem("New item")
        child1 = QtGui.QStandardItem("")
        selected_item.appendRow([child0, child1])
        # update the tab text with an asterix if required
        self.update_tab_text() 
Example 31
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_subsection(self, section, dict_to_add):
        for key in dict_to_add:
            val = str(dict_to_add[key])
            child0 = QtGui.QStandardItem(key)
            child1 = QtGui.QStandardItem(val)
            section.appendRow([child0, child1]) 
Example 32
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_subsubsection(self, subsection, dict_to_add):
        """ Add a subsubsection to the model."""
        for key in dict_to_add:
            subsubsection = QtGui.QStandardItem(key)
            self.add_subsection(subsubsection, dict_to_add[key])
            subsection.appendRow(subsubsection) 
Example 33
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_excludedaterange(self):
        """ Add another date range to the ExcludeDates QC check."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        selected_item = idx.model().itemFromIndex(idx)
        # get the children
        child0 = QtGui.QStandardItem(str(selected_item.rowCount()))
        child1 = QtGui.QStandardItem("YYYY-mm-dd HH:MM, YYYY-mm-dd HH:MM")
        # add them
        selected_item.appendRow([child0, child1])
        self.update_tab_text() 
Example 34
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_file_path(self):
        """ Add file_path to the 'Files' section."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        parent = idx.model().itemFromIndex(idx)
        child0 = QtGui.QStandardItem("file_path")
        child1 = QtGui.QStandardItem("Right click to browse")
        parent.appendRow([child0, child1])
        # add an asterisk to the tab text to indicate the tab contents have changed
        self.update_tab_text() 
Example 35
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_in_filename(self):
        """ Add in_filename to the 'Files' section."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        parent = idx.model().itemFromIndex(idx)
        child0 = QtGui.QStandardItem("in_filename")
        child1 = QtGui.QStandardItem("Right click to browse")
        parent.appendRow([child0, child1])
        # add an asterisk to the tab text to indicate the tab contents have changed
        self.update_tab_text() 
Example 36
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_irga_check(self):
        """ Add IRGA check to Options section."""
        new_options = {"IRGA_Check": "Yes"}
        for key in new_options:
            value = new_options[key]
            child0 = QtGui.QStandardItem(key)
            child1 = QtGui.QStandardItem(value)
            self.sections["Options"].appendRow([child0, child1])
        self.update_tab_text() 
Example 37
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_linearrange(self):
        """ Add another date range to the Linear QC check."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        selected_item = idx.model().itemFromIndex(idx)
        # get the children
        child0 = QtGui.QStandardItem(str(selected_item.rowCount()))
        child1 = QtGui.QStandardItem("YYYY-mm-dd HH:MM, YYYY-mm-dd HH:MM, 1.0, 0.0")
        # add them
        selected_item.appendRow([child0, child1])
        self.update_tab_text() 
Example 38
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_options_section(self):
        """ Add an Options section."""
        self.sections["Options"] = QtGui.QStandardItem("Options")
        new_options = {"irga_type": "Li-7500A"}
        for key in new_options:
            value = new_options[key]
            child0 = QtGui.QStandardItem(key)
            child1 = QtGui.QStandardItem(value)
            self.sections["Options"].appendRow([child0, child1])
        self.model.insertRow(self.section_headings.index("Variables"), self.sections["Options"])
        self.update_tab_text() 
Example 39
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_out_filename(self):
        """ Add out_filename to the 'Files' section."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        parent = idx.model().itemFromIndex(idx)
        child0 = QtGui.QStandardItem("out_filename")
        child1 = QtGui.QStandardItem("Right click to browse")
        parent.appendRow([child0, child1])
        # add an asterisk to the tab text to indicate the tab contents have changed
        self.update_tab_text() 
Example 40
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_plot_path(self):
        """ Add plot_path to the 'Files' section."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        parent = idx.model().itemFromIndex(idx)
        child0 = QtGui.QStandardItem("plot_path")
        child1 = QtGui.QStandardItem("Right click to browse")
        parent.appendRow([child0, child1])
        # add an asterisk to the tab text to indicate the tab contents have changed
        self.update_tab_text() 
Example 41
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_qc_check(self, selected_item, new_qc):
        for key1 in new_qc:
            parent = QtGui.QStandardItem(key1)
            for key in new_qc[key1]:
                val = str(new_qc[key1][key])
                child0 = QtGui.QStandardItem(key)
                child1 = QtGui.QStandardItem(val)
                parent.appendRow([child0, child1])
            selected_item.appendRow(parent)
        self.update_tab_text() 
Example 42
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_scatterplot(self):
        """ Add a new scatter plot to the 'Plots' section."""
        new_plot = {"Type":"xy", "XSeries":"", "YSeries":""}
        parent = QtGui.QStandardItem("New scatter plot")
        for key in new_plot:
            val = new_plot[key]
            child0 = QtGui.QStandardItem(key)
            child1 = QtGui.QStandardItem(str(val))
            parent.appendRow([child0, child1])
        self.sections["Plots"].appendRow(parent)
        self.update_tab_text() 
Example 43
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_subsection(self, section, dict_to_add):
        for key in dict_to_add:
            val = str(dict_to_add[key])
            child0 = QtGui.QStandardItem(key)
            child1 = QtGui.QStandardItem(val)
            section.appendRow([child0, child1]) 
Example 44
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_subsubsection(self, subsection, dict_to_add):
        """ Add a subsubsection to the model."""
        for key in dict_to_add:
            subsubsection = QtGui.QStandardItem(key)
            self.add_subsection(subsubsection, dict_to_add[key])
            subsection.appendRow(subsubsection) 
Example 45
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_timeseries(self):
        """ Add a new time series to the 'Plots' section."""
        new_plot = {"Variables":""}
        parent = QtGui.QStandardItem("New time series")
        for key in new_plot:
            value = new_plot[key]
            child0 = QtGui.QStandardItem(key)
            child1 = QtGui.QStandardItem(str(value))
            parent.appendRow([child0, child1])
        self.sections["Plots"].appendRow(parent)
        self.update_tab_text() 
Example 46
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_uppercheckrange(self):
        """ Add another date range to the UpperCheck QC check."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        selected_item = idx.model().itemFromIndex(idx)
        # get the children
        child0 = QtGui.QStandardItem(str(selected_item.rowCount()))
        child1 = QtGui.QStandardItem("YYYY-mm-dd HH:MM,<start_value>,YYYY-mm-dd HH:MM,<end_value>")
        # add them
        selected_item.appendRow([child0, child1])
        self.update_tab_text() 
Example 47
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_variable(self):
        """ Add a new variable to the 'Variables' section."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        parent = idx.model().itemFromIndex(idx)
        new_var_qc = {"RangeCheck":{"Lower":0, "Upper": 1}}
        subsection = QtGui.QStandardItem("New variable")
        self.add_subsubsection(subsection, new_var_qc)
        parent.appendRow(subsection)
        # add an asterisk to the tab text to indicate the tab contents have changed
        self.update_tab_text() 
Example 48
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_2dcoordrotation(self):
        """ Add 2DCoordRotation to the [Options] section."""
        child0 = QtGui.QStandardItem("2DCoordRotation")
        child1 = QtGui.QStandardItem("Yes")
        self.sections["Options"].appendRow([child0, child1])
        self.update_tab_text() 
Example 49
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_applyfcstorage_to_options(self):
        """ Add storage term to Fc to the [Options] section."""
        child0 = QtGui.QStandardItem("ApplyFcStorage")
        child1 = QtGui.QStandardItem("Yes")
        self.sections["Options"].appendRow([child0, child1])
        self.update_tab_text() 
Example 50
Project: PyFluxPro   Author: OzFlux   File: pfp_gui.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_applyfcstorage_to_variable(self):
        """ Add apply Fc storage instruction to a variable."""
        # get the index of the selected item
        idx = self.view.selectedIndexes()[0]
        # get the selected item from the index
        selected_item = idx.model().itemFromIndex(idx)
        parent = QtGui.QStandardItem("ApplyFcStorage")
        child0 = QtGui.QStandardItem("Source")
        child1 = QtGui.QStandardItem("")
        parent.appendRow([child0, child1])
        selected_item.appendRow(parent)
        self.update_tab_text()