Exemplo n.º 1
0
def iterate_widget_items_flat(widget) -> Iterator[QTreeWidgetItem]:
    """ Creates an item generator in flat hierachy of all TreeWidget items """
    it = QTreeWidgetItemIterator(widget)

    while it.value():
        yield it.value()
        it += 1
Exemplo n.º 2
0
 def unmark_all(self):
     """Iterate over all nodes of the tree and unmarks them."""
     self.iterator = QTreeWidgetItemIterator(self.tree_primary,
                                             QTreeWidgetItemIterator.All)
     while self.iterator.value():
         item = self.iterator.value()
         item.setCheckState(0, QtCore.Qt.Unchecked)
         self.iterator += 1
Exemplo n.º 3
0
 def read_list(tree: QTreeWidget, remove: bool):
     iterator = QTreeWidgetItemIterator(tree)
     items = []
     while iterator.value():
         item = iterator.value()
         items.append([item.text(0), item.text(1), item.data(2, 2)])
         if remove:
             tree.takeTopLevelItem(tree.indexOfTopLevelItem(item))
         iterator += 1
     return items
Exemplo n.º 4
0
 def update_selected_secondary(self):
     """Iterate over all nodes of the tree and save selected items names to list"""
     self.selected_secondary = []
     self.iterator = QTreeWidgetItemIterator(self.tree_secondary,
                                             QTreeWidgetItemIterator.All)
     while self.iterator.value():
         item = self.iterator.value()
         if item.checkState(
                 0) == 2:  # full-box checked, add item to dictionary
             self.selected_secondary.append(item.text(0))
         self.iterator += 1
Exemplo n.º 5
0
 def to_secondary(self):
     self.iterator = QTreeWidgetItemIterator(self.tree_primary,
                                             QTreeWidgetItemIterator.All)
     selected = []
     while self.iterator.value():
         item = self.iterator.value()
         if item.checkState(0) == 2:  # full-box checked
             selected.append(item.text(0))
         self.iterator += 1
     for var in selected:
         move_to_secondary(self, var)
    def iter_tree_widget(a_root):
        # sonet_log(SonetLogType.INFO, 'SonetCanvasQt.iter_tree_widget')

        iterator = QTreeWidgetItemIterator(a_root)
        while True:
            item = iterator.value()
            if item is not None:
                yield item
                iterator += 1
            else:
                break
Exemplo n.º 7
0
    def testCase(self):
        treeWidget = QTreeWidget()
        treeWidget.setColumnCount(1)
        items = []
        for i in range(10):
            items.append(QTreeWidgetItem(None, ["item: %i" % i]))

        treeWidget.insertTopLevelItems(0, items);
        _iter = QTreeWidgetItemIterator(treeWidget)
        index = 0
        while(_iter.value()):
            item = _iter.value()
            self.assert_(item is items[index])
            index += 1
            _iter += 1
Exemplo n.º 8
0
    def testCase(self):
        treeWidget = QTreeWidget()
        treeWidget.setColumnCount(1)
        items = []
        for i in range(10):
            items.append(QTreeWidgetItem(None, ["item: %i" % i]))

        treeWidget.insertTopLevelItems(0, items);
        _iter = QTreeWidgetItemIterator(treeWidget)
        index = 0
        while(_iter.value()):
            item = _iter.value()
            self.assertTrue(item is items[index])
            index += 1
            _iter += 1
Exemplo n.º 9
0
    def getSelectedStruct(self):
        chStruct = {}
        rootIter = QTreeWidgetItemIterator(self,
                                           QTreeWidgetItemIterator.HasChildren)
        while rootIter.value():
            item = rootIter.value()
            if (item.checkState(0) == Qt.CheckState.Checked
                    or item.checkState(0) == Qt.CheckState.PartiallyChecked):
                if item.parent().text(0) not in chStruct.keys():
                    chStruct[item.parent().text(0)] = {}
                chList = []
                for ch in range(item.childCount()):
                    if item.child(ch).checkState(0) == Qt.CheckState.Checked:
                        chList.append(item.child(ch).text(0))
                chStruct[item.parent().text(0)][item.text(0)] = chList
            rootIter += 1

        return chStruct
Exemplo n.º 10
0
    def addItem(self, group, row, colList):
        rootIter = QTreeWidgetItemIterator(self,
                                           QTreeWidgetItemIterator.HasChildren)
        gparent = None
        while (rootIter.value()):
            item = rootIter.value()
            if item.text(0) == group and rootIter.value().parent() is None:
                gparent = item
                break
            rootIter += 1

        parent = QTreeWidgetItem(gparent)
        parent.setText(0, row)
        parent.setFlags(parent.flags() | Qt.ItemIsTristate
                        | Qt.ItemIsUserCheckable)
        for k in colList:
            child = QTreeWidgetItem(parent)
            child.setFlags(child.flags())
            child.setText(0, k)
            child.setCheckState(0, Qt.Unchecked)
Exemplo n.º 11
0
    def testWidgetIterator(self):
        treeWidget = QTreeWidget()
        treeWidget.setColumnCount(1)
        items = []
        for i in range(10):
            items.append(QTreeWidgetItem(None, ['item: %d' % i]))
        treeWidget.insertTopLevelItems(0, items)

        index = 0
        for it in QTreeWidgetItemIterator(treeWidget):
            self.assertEqual(it.value().text(0), 'item: %d' % index)
            index += 1
Exemplo n.º 12
0
 def changeSignalColor(self):
     ws = self.wsSelector.currentItem().text()
     signal = self.clickedItem.text(0)
     
     channels = []
     sIter = QTreeWidgetItemIterator(self.clickedItem)
     sIter += 1              # First children
     while(sIter.value()):
         if sIter.value().parent() is self.clickedItem:
             channels.append(sIter.value().text(0))
             sIter += 1
         else:
             break
     
     sData = self.chartData[ws].getDataFromStructure({signal : channels}, inv=True)[signal]
     sColor = sData[0][4]
     newColor = QColorDialog().getColor(QColor(sColor), self)
     if newColor.isValid():
         for sD in sData:
             sD[4] = newColor.name()
         self._updateSignalColor(signal, newColor.name())
         self.signalColorChanged.emit(ws, signal)
Exemplo n.º 13
0
 def SignalSelected(self):
     sStruct = {}
     chIter = QTreeWidgetItemIterator(self.curSelect,
                                     QTreeWidgetItemIterator.Checked)
     if not chIter.value().parent():     #Skip signal 
         chIter += 1
     while (chIter.value()
            and chIter.value().parent() is self.curSelect
            and chIter.value().checkState(0) == Qt.Checked):
         chItem = chIter.value()
         sStruct[chItem.text(0)] = None
         chIter += 1
     ws = self.wsSelector.currentItem().text()
     signal = self.curSelect.text(0)    
     self.newSignalSelected.emit(ws, signal, sStruct)
Exemplo n.º 14
0
    def removeItem(self, itParent, itName):
        rootIter = QTreeWidgetItemIterator(self,
                                           QTreeWidgetItemIterator.HasChildren)

        while (rootIter.value()):
            item = rootIter.value()
            if (item.text(0) == itName
                    and rootIter.value().parent() is not None
                    and rootIter.value().parent().text(0) == itParent):
                item.parent().removeChild(item)
                del item
                self.update()
                self.repaint()
                break
            rootIter += 1
Exemplo n.º 15
0
 def create_widgets(self):
     ostans = ostanha.ostans.keys()
     self.form.ostanBox.addItems(ostans)
     self.set_citys_of_current_ostan()
     # self.setA()
     iterator = QTreeWidgetItemIterator(self.form.x_treeWidget)
     i = 0
     while iterator.value():
         item = iterator.value()
         iterator += 1
         if i == 2:
             self.form.x_treeWidget.setCurrentItem(item, 0)
             break
         i += 1
     iterator = QTreeWidgetItemIterator(self.form.y_treeWidget)
     i = 0
     while iterator.value():
         item = iterator.value()
         iterator += 1
         if i == 2:
             self.form.y_treeWidget.setCurrentItem(item, 0)
             break
         i += 1
Exemplo n.º 16
0
    def _updateSignalColor(self, signalName, newColor):
        chIter = QTreeWidgetItemIterator(self.chSelector,
                                        QTreeWidgetItemIterator.Checked)
        while chIter.value():
            if chIter.value().text(0) == signalName:
                sColor = QColor(newColor)
                sColor.setAlpha(100)
                chIter.value().setBackgroundColor(0, sColor)
            chIter += 1

        sIter = QTreeWidgetItemIterator(self.sSelector)
        while sIter.value():
            if sIter.value().text(0) == signalName:
                sColor = QColor(newColor)
                sColor.setAlpha(100)
                sGradient = QLinearGradient(0, 0, 100, 10)
                sGradient.setColorAt(0, sColor)
                sGradient.setColorAt(1, Qt.white)
                sBrush = QBrush(sGradient)
                sBrush.setStyle(Qt.LinearGradientPattern)
                sBrush.setColor(sColor)
                sIter.value().setBackground(0, sBrush)
                if sIter.value() is self.curSelect:
                    self.prevBackGround = sIter.value().background(0)
            sIter += 1

        self.changeCurrentSelect(self.curSelect)
Exemplo n.º 17
0
    def sort_tree_months_and_years(self):
        #sort the months in ascendend order in the year and sort the years in ascendend order
        tree_item_gastos_list = self.ui.tw_esquerdo.findItems(
            gv.gastos, Qt.MatchExactly, 0)  # get a list of QTreeWidgetItem
        tree_item_gastos_list[0].sortChildren(0, Qt.AscendingOrder)

        # step 1: convert months to int:
        it1 = QTreeWidgetItemIterator(tree_item_gastos_list[0])
        it1 += 1  # start after 'gastos'
        while (it1.value()):
            try:
                int(it1.value().text(0))
            except ValueError:
                it1.value().setText(
                    0, gv.Meses_Sort_toLetter[it1.value().text(0)])
            it1 += 1

        # step 2: sort months:
        it2 = QTreeWidgetItemIterator(tree_item_gastos_list[0])
        it2 += 1  # start after 'gastos'
        while (it2.value()):
            try:
                int(it2.value().text(0))
                it2.value().sortChildren(0, Qt.AscendingOrder)
            except ValueError:
                pass  # do nothing
            it2 += 1

        # step 3: convert months bach to str:
        it3 = QTreeWidgetItemIterator(tree_item_gastos_list[0])
        it3 += 1  # start after 'gastos'
        while (it3.value()):
            try:
                int(it3.value().text(0))
            except ValueError:
                it3.value().setText(0,
                                    gv.Meses_Sort_toMonth[it3.value().text(0)])
            it3 += 1
Exemplo n.º 18
0
    def ChannelSelected(self):
        dChecked = []
        sIter = QTreeWidgetItemIterator(self.sSelector, QTreeWidgetItemIterator.Checked)
        while sIter.value():
            if not sIter.value().parent():
                dChecked.append(sIter.value().text(0))
            sIter += 1

        gIter = QTreeWidgetItemIterator(self.gSelector, QTreeWidgetItemIterator.Checked)
        while gIter.value():
            if not gIter.value().parent():
                dChecked.append(gIter.value().text(0))
            gIter += 1


        
        chStruct = {}
        sIter = QTreeWidgetItemIterator(self.curSelect,
                                        QTreeWidgetItemIterator.Checked)
        while (sIter.value()
               and sIter.value().parent() is self.curSelect
               and sIter.value().checkState(0) == Qt.Checked):
            sItem = sIter.value()
            dataName = sItem.text(0)
            if dataName in dChecked:
                chStruct[sItem.text(0)] = None
            sIter += 1
        group = self.wsSelector.currentItem().text()
        channel = self.curSelect.text(0)
        self.newChannelSelected.emit(group, channel, chStruct)
Exemplo n.º 19
0
class Application(QMainWindow):
    def __init__(self, filename):
        super().__init__()

        self.resize(1200, 900)
        self.setWindowTitle('PandasVIS')

        # Initialize GUI elements
        self.init_gui()
        self.max_fig = False

        # Opens file (if argument was passed)
        if filename is not None:
            self.open_file()

        # Creates temp folder for temporary files
        self.temp_dir = os.path.join(os.getcwd(), 'temp')
        if not os.path.exists(self.temp_dir):
            os.makedirs(self.temp_dir, exist_ok=True)

        self.init_console()
        self.console.push_vars({'self': self})
        self.load_modules()
        self.show()

    def init_gui(self):
        """Initiates GUI elements."""
        mainMenu = self.menuBar()
        # File menu
        fileMenu = mainMenu.addMenu('File')
        # Adding actions to file menu
        action_open_file = QAction('Open File', self)
        fileMenu.addAction(action_open_file)
        action_open_file.triggered.connect(lambda: self.open_file(None))

        self.toolsMenu = mainMenu.addMenu('Tools')
        self.tabularMenu = self.toolsMenu.addMenu('Tabular')
        self.timeseriesMenu = self.toolsMenu.addMenu('Time Series')

        helpMenu = mainMenu.addMenu('Help')
        action_about = QAction('About', self)
        helpMenu.addAction(action_about)
        action_about.triggered.connect(self.about)

        # Left panels ----------------------------------------------------------
        self.bt_markall = QPushButton('Mark all')
        self.bt_markall.clicked.connect(self.mark_all)
        self.bt_unmarkall = QPushButton('Unmark all')
        self.bt_unmarkall.clicked.connect(self.unmark_all)
        self.bt_test = QPushButton(' ')
        self.bt_test.clicked.connect(self.test)

        self.tree_primary = QTreeCustomPrimary(parent=self)
        self.tree_primary.setAlternatingRowColors(True)
        self.tree_primary.setHeaderLabels(['Primary Variables', 'type'])
        self.tree_primary.setToolTip(
            "Columns of the Dataframe. Can be accessed\n"
            "in the console with the variable 'df'")
        self.tree_primary.itemClicked.connect(self.update_selected_primary)

        self.bt_toprimary = QPushButton('To primary')
        self.bt_toprimary.clicked.connect(self.to_primary)
        self.bt_tosecondary = QPushButton('To secondary')
        self.bt_tosecondary.clicked.connect(self.to_secondary)
        self.hbox_l1 = QHBoxLayout()
        self.hbox_l1.addWidget(self.bt_toprimary)
        self.hbox_l1.addWidget(self.bt_tosecondary)

        self.tree_secondary = QTreeCustomSecondary(parent=self)
        self.tree_secondary.setAlternatingRowColors(True)
        self.tree_secondary.setHeaderLabels(['Secondary Variables', 'type'])
        self.tree_secondary.setToolTip(
            "Secondary variables, can be added to the Dataframe.\n"
            "Can be accessed in the console with the variable \n"
            "'secondary_vars'")
        self.tree_secondary.itemClicked.connect(self.update_selected_secondary)

        self.df = pd.DataFrame(np.random.rand(100, 5),
                               columns=['a', 'b', 'c', 'd', 'e'])
        names = ['aa', 'bb', 'cc']
        nm = [names[ind % 3] for ind in np.arange(100)]
        self.df['name'] = nm
        names_2 = ['abcd', 'ab789', 'another_class', 'yet_another', 'dfg65']
        nm_2 = [names_2[ind % 5] for ind in np.arange(100)]
        self.df['name_2'] = nm_2
        self.primary_names = list(self.df.keys())
        self.secondary_vars = {'var 3': np.zeros(100), 'var 4': np.zeros(100)}
        self.secondary_names = list(self.secondary_vars.keys())
        self.init_trees()

        self.vbox1 = QVBoxLayout()
        self.vbox1.addLayout(self.hbox_l1)
        self.vbox1.addWidget(self.tree_secondary)
        self.wbox1 = QWidget()
        self.wbox1.setLayout(self.vbox1)
        self.vsplit1 = QSplitter(Qt.Vertical)
        self.vsplit1.addWidget(self.tree_primary)
        self.vsplit1.addWidget(self.wbox1)

        self.grid_left1 = QGridLayout()
        self.grid_left1.setColumnStretch(5, 1)
        self.grid_left1.addWidget(self.bt_markall, 0, 0, 1, 2)
        self.grid_left1.addWidget(self.bt_unmarkall, 0, 2, 1, 2)
        self.grid_left1.addWidget(self.bt_test, 0, 4, 1, 1)
        self.grid_left1.addWidget(self.vsplit1, 1, 0, 1, 6)
        self.left_widget = QWidget()
        self.left_widget.setLayout(self.grid_left1)

        # Center panels -------------------------------------------------------
        # Top tabs
        self.tabs_top = QTabWidget()
        self.tab0 = QWidget()
        self.tabs_top.addTab(self.tab0, "Tools")

        # Bottom tabs
        self.tabs_bottom = QTabWidget()
        self.console = ConsoleWidget(par=self)
        self.console.setToolTip(
            "df --> Dataframe with Primary variables\n"
            "secondary_vars --> Dictionary with Secondary variables")
        self.logger = QTextEdit()
        self.logger.setReadOnly(True)
        self.tabs_bottom.addTab(self.console, "Console")
        self.tabs_bottom.addTab(self.logger, "Logger")

        self.righ_widget = QSplitter(Qt.Vertical)
        self.righ_widget.addWidget(self.tabs_top)
        self.righ_widget.addWidget(self.tabs_bottom)

        # Window layout --------------------------------------------------------
        self.hbox = QSplitter(Qt.Horizontal)
        self.hbox.addWidget(self.left_widget)  # add left panel
        self.hbox.addWidget(self.righ_widget)  # add centre panel
        self.setCentralWidget(self.hbox)

    def test(self):
        pass

    def load_modules(self):
        # Main tools tab buttons layout
        self.tools_grid = QGridLayout()
        self.tools_grid.setColumnStretch(3, 1)
        self.lbl_tabular = QLabel("Tabular")
        self.tools_grid.addWidget(self.lbl_tabular, 0, 0, 1, 2)
        # modules and lambdas lists
        self.instances_list = []
        self.modules_list = load_all_modules()
        self.lambdas_list = [(lambda a: lambda: self.instantiate_module(a))(o)
                             for o in self.modules_list]
        for i, module in enumerate(self.modules_list):
            # Populates Menu bar
            action = QAction(module.menu_name, self)
            action.triggered.connect(self.lambdas_list[i])
            if module.menu_parent == 'None':
                self.toolsMenu.addAction(action)
            if module.menu_parent == 'Tabular':
                self.tabularMenu.addAction(action)
            elif module.menu_parent == 'Time Series':
                self.timeseriesMenu.addAction(action)
            # Populates buttons tab
            btn = QPushButton(module.menu_name)
            btn.clicked.connect(self.lambdas_list[i])
            self.tools_grid.addWidget(btn, 1, i, 1, 1)
        self.tools_grid.addWidget(QWidget(), 1, i + 1, 1, 1)
        self.tools_grid.addWidget(QWidget(), 2, 0, 1, 1)
        self.tools_grid.setRowStretch(3, 1)
        self.tab0.setLayout(self.tools_grid)

    def instantiate_module(self, module):
        """Instantiates a chosen module class."""
        obj = module(self)
        # Check how many instances of same class already exist
        nInst = sum(
            [item.menu_name == obj.menu_name for item in self.instances_list])
        obj.name += '_' + str(nInst)
        obj.run()
        self.instances_list.append(obj)

    def open_file(self, filename):
        ''' Open file and store it as a Pandas Dataframe.'''
        if filename is None:
            filename, ftype = QFileDialog.getOpenFileName(
                None, 'Open file', '', "(*.csv)")
        if ftype == '(*.csv)':
            self.file_path = filename
            self.setWindowTitle(
                'PandasVIS - ' +
                os.path.split(os.path.abspath(self.file_path))[1])
            # Load primary variables
            self.df = pd.read_csv(self.file_path)
            self.primary_names = self.df.keys().tolist()
            # Reset secondary variables
            self.secondary_vars = {
                'var 3': np.zeros(100),
                'var 4': np.zeros(100)
            }
            self.secondary_names = list(self.secondary_vars.keys())
            # Reset GUI
            self.init_trees()
            self.init_console()

    def init_trees(self):
        ''' Draw hierarchical tree of fields in NWB file '''
        self.tree_primary.clear()
        self.tree_secondary.clear()
        for var1 in self.primary_names:  # primary variables list
            parent = QTreeWidgetItem(self.tree_primary,
                                     [var1, str(self.df[var1].dtype)])
            parent.setFlags(parent.flags() | QtCore.Qt.ItemIsTristate
                            | QtCore.Qt.ItemIsUserCheckable)
            parent.setCheckState(0, QtCore.Qt.Checked)
        for var2 in self.secondary_names:  # secondary variables list
            parent = QTreeWidgetItem(
                self.tree_secondary,
                [var2, str(self.secondary_vars[var2].dtype)])
            parent.setFlags(parent.flags() | QtCore.Qt.ItemIsTristate
                            | QtCore.Qt.ItemIsUserCheckable)
            parent.setCheckState(0, QtCore.Qt.Checked)

    def init_console(self):
        ''' Initialize commands on console '''
        self.console._execute("import pandas as pd", True)
        self.console._execute("import numpy as np", True)
        self.console._execute("import matplotlib.pyplot as plt", True)
        self.console.push_vars({'df': self.df})
        self.console.push_vars({'secondary_vars': self.secondary_vars})
        self.console.clear()
        self.console.print_text('df --> Dataframe with Primary variables\n')
        self.console.print_text(
            'secondary_vars --> Dictionary with Secondary variables\n\n')

    def new_tab_top(self, object, title):
        """Opens new tab."""
        self.tabs_top.addTab(object, title)
        nTabs = self.tabs_top.children()[0].count()
        self.tabs_top.setCurrentIndex(nTabs - 1)

    def new_tab_bottom(self, tab_object, title):
        """Opens new tab."""
        self.tabs_bottom.addTab(tab_object, title)

    def close_tab_top(self, object):
        """Closes tab and removes associated objects"""
        name = object.name
        # Closes all child Threads
        object.close_threads()
        # Removes tab
        curr_ind = self.tabs_top.children()[0].currentIndex()
        self.tabs_top.removeTab(curr_ind)
        # Removes specific object instance from list
        self.instances_list.remove(object)
        # Deletes object form memory
        object.deleteLater()
        self.write_to_logger(name + ' deleted!')

    def write_to_logger(self, txt):
        time = datetime.datetime.now().time().strftime("%H:%M:%S")
        full_txt = "[" + time + "]    " + txt
        self.logger.append(full_txt)

    def toggle_max_figure(self):
        if self.max_fig:
            self.left_widget.setMaximumWidth(1000)
            self.left_widget.resize(self.left_widget.sizeHint())
            self.tabs_bottom.setMaximumHeight(1000)
            self.tabs_bottom.resize(self.tabs_bottom.sizeHint())
            self.max_fig = False
        else:
            self.left_widget.setMaximumWidth(0)
            self.tabs_bottom.setMaximumHeight(0)
            self.max_fig = True

    def mark_all(self):
        """Iterate over all nodes of the tree and marks them."""
        self.iterator = QTreeWidgetItemIterator(self.tree_primary,
                                                QTreeWidgetItemIterator.All)
        while self.iterator.value():
            item = self.iterator.value()
            item.setCheckState(0, QtCore.Qt.Checked)
            self.iterator += 1

    def unmark_all(self):
        """Iterate over all nodes of the tree and unmarks them."""
        self.iterator = QTreeWidgetItemIterator(self.tree_primary,
                                                QTreeWidgetItemIterator.All)
        while self.iterator.value():
            item = self.iterator.value()
            item.setCheckState(0, QtCore.Qt.Unchecked)
            self.iterator += 1

    def update_selected_primary(self):
        """Iterate over all nodes of the tree and save selected items names to list"""
        self.selected_primary = []
        self.iterator = QTreeWidgetItemIterator(self.tree_primary,
                                                QTreeWidgetItemIterator.All)
        while self.iterator.value():
            item = self.iterator.value()
            if item.checkState(
                    0) == 2:  # full-box checked, add item to dictionary
                self.selected_primary.append(item.text(0))
            self.iterator += 1

    def update_selected_secondary(self):
        """Iterate over all nodes of the tree and save selected items names to list"""
        self.selected_secondary = []
        self.iterator = QTreeWidgetItemIterator(self.tree_secondary,
                                                QTreeWidgetItemIterator.All)
        while self.iterator.value():
            item = self.iterator.value()
            if item.checkState(
                    0) == 2:  # full-box checked, add item to dictionary
                self.selected_secondary.append(item.text(0))
            self.iterator += 1

    def to_primary(self):
        self.iterator = QTreeWidgetItemIterator(self.tree_secondary,
                                                QTreeWidgetItemIterator.All)
        selected = []
        while self.iterator.value():
            item = self.iterator.value()
            if item.checkState(0) == 2:  # full-box checked
                selected.append(item.text(0))
            self.iterator += 1
        for var in selected:
            move_to_primary(self, var)

    def to_secondary(self):
        self.iterator = QTreeWidgetItemIterator(self.tree_primary,
                                                QTreeWidgetItemIterator.All)
        selected = []
        while self.iterator.value():
            item = self.iterator.value()
            if item.checkState(0) == 2:  # full-box checked
                selected.append(item.text(0))
            self.iterator += 1
        for var in selected:
            move_to_secondary(self, var)

    def insert_from_file():
        filename, ftype = QFileDialog.getOpenFileName(None, 'Open file', '',
                                                      "(*.csv)")
        if ftype == '(*.csv)':
            self.file_path = filename
            # Load primary variables
            df_new = pd.read_csv(self.file_path)
            self.primary_names = self.df.keys().tolist()

    def closeEvent(self, event):
        """Before exiting, deletes temporary files."""
        shutil.rmtree(self.temp_dir, ignore_errors=False, onerror=None)
        event.accept()

    def about(self):
        """About dialog."""
        msg = QMessageBox()
        msg.setWindowTitle("About PandasVIS")
        msg.setIcon(QMessageBox.Information)
        msg.setText(
            "Version: 1.0.0 \n"
            "Data exploration GUI, with Data Science and Machine Learning embedded tools.\n "
        )
        msg.setInformativeText(
            "<a href='https://github.com/luiztauffer/pandasVIS'>PandasVIS Github page</a>"
        )
        msg.setStandardButtons(QMessageBox.Ok)
        msg.exec_()