<commit_before># -*- coding: utf-8 -*-

#pyqt
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import pyqtSignal

#std
import os

#own
class PostProcessor(QtGui.QMainWindow):

    resultsChanged = pyqtSignal()
    figuresChanged = pyqtSignal()

    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.setWindowTitle('Postprocessing')
        self.setWindowIcon(QtGui.QIcon('data/postprocessing.png'))
        self.mainFrame = QtGui.QWidget(self)
        self.resize(700, 400)

        #toolbar
        self.toolBar = QtGui.QToolBar('file control')
        self.toolBar.setIconSize(QtCore.QSize(24,24))
        self.addToolBar(self.toolBar)

        self.actLoad= QtGui.QAction(self)
        self.actLoad.setText('load result file')
        self.actLoad.setIcon(QtGui.QIcon('data/load.png'))
        self.actLoad.setDisabled(False)
        self.actLoad.triggered.connect(self.loadResultFilesClicked)
        
        self.actReloadMethods= QtGui.QAction(self)
        self.actReloadMethods.setText('reload methods')
        self.actReloadMethods.setIcon(QtGui.QIcon('data/reload.png'))
        self.actReloadMethods.setDisabled(False)
        self.actReloadMethods.triggered.connect(self.updateMethodList)

        self.toolBar.addAction(self.actLoad)
        self.toolBar.addAction(self.actReloadMethods)

        #main window
        self.grid = QtGui.QGridLayout(self.mainFrame)

        self.methodList = QtGui.QListWidget(self)
        self.methodList.itemDoubleClicked.connect(self.runPostprocessor)
        self.updateMethodList()
        
        self.resultList = QtGui.QListWidget(self)
        #self.resultList.itemDoubleClicked.connect(self.runPostprocessor)
        self.resultsChanged.connect(self.updateResultList)
        self.results = []

        #self.spacer = QtGui.QSpacerItem(300, 300)

        self.figureList = QtGui.QListWidget(self)
        self.figureList.itemDoubleClicked.connect(self.figureDoubleClicked)
        self.figuresChanged.connect(self.updateFigureList)
        
        self.plotView = QtGui.QGraphicsView()
        self.current_figures = []

        
        self.grid.addWidget(QtGui.QLabel('result files:'), 0, 0)
        self.grid.addWidget(self.resultList, 1, 0)
        self.grid.addWidget(QtGui.QLabel('postprocessors:'), 2, 0)
        self.grid.addWidget(self.methodList, 3, 0)
        self.grid.addWidget(QtGui.QLabel('figures:'), 4, 0)
        self.grid.addWidget(self.figureList, 5, 0)
        self.grid.addWidget(QtGui.QLabel('selected figure:'), 0, 1)

        self.mainFrame.setLayout(self.grid)
        self.setCentralWidget(self.mainFrame)

        #statusbar
        self.statusBar = QtGui.QStatusBar(self)
        self.setStatusBar(self.statusBar)
        #self.statusBar.setMessage('no datset loaded')


        #load test results
        filePath = os.path.join(os.pardir, 'results', '20141222-143449_test-linear.bbr')
        self._loadResultFile(filePath)
    
    def loadResultFilesClicked(self):
        path = os.path.join('../results/')
        dialog = QtGui.QFileDialog(self)
        dialog.setFileMode(QtGui.QFileDialog.ExistingFiles)
        dialog.setDirectory(path)
        dialog.setNameFilter("BallBeam Result files (*.bbr)")

        files = None
        if(dialog.exec_()):
            files = dialog.selectedFiles()

        if files:
            for selectedFile in files:
                self._loadResultFile(selectedFile)


    def _loadResultFile(self, fileName):
        '''
        loads a result file
        '''
        with open(fileName, 'r') as f:<commit_msg>new resut file dummy<commit_after># -*- coding: utf-8 -*-

#pyqt
from PyQt4 import QtCore, QtGui
from PyQt4.QtCore import pyqtSignal

#std
import os

#own
class PostProcessor(QtGui.QMainWindow):

    resultsChanged = pyqtSignal()
    figuresChanged = pyqtSignal()

    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.setWindowTitle('Postprocessing')
        self.setWindowIcon(QtGui.QIcon('data/postprocessing.png'))
        self.mainFrame = QtGui.QWidget(self)
        self.resize(700, 400)

        #toolbar
        self.toolBar = QtGui.QToolBar('file control')
        self.toolBar.setIconSize(QtCore.QSize(24,24))
        self.addToolBar(self.toolBar)

        self.actLoad= QtGui.QAction(self)
        self.actLoad.setText('load result file')
        self.actLoad.setIcon(QtGui.QIcon('data/load.png'))
        self.actLoad.setDisabled(False)
        self.actLoad.triggered.connect(self.loadResultFilesClicked)
        
        self.actReloadMethods= QtGui.QAction(self)
        self.actReloadMethods.setText('reload methods')
        self.actReloadMethods.setIcon(QtGui.QIcon('data/reload.png'))
        self.actReloadMethods.setDisabled(False)
        self.actReloadMethods.triggered.connect(self.updateMethodList)

        self.toolBar.addAction(self.actLoad)
        self.toolBar.addAction(self.actReloadMethods)

        #main window
        self.grid = QtGui.QGridLayout(self.mainFrame)

        self.methodList = QtGui.QListWidget(self)
        self.methodList.itemDoubleClicked.connect(self.runPostprocessor)
        self.updateMethodList()
        
        self.resultList = QtGui.QListWidget(self)
        #self.resultList.itemDoubleClicked.connect(self.runPostprocessor)
        self.resultsChanged.connect(self.updateResultList)
        self.results = []

        #self.spacer = QtGui.QSpacerItem(300, 300)

        self.figureList = QtGui.QListWidget(self)
        self.figureList.itemDoubleClicked.connect(self.figureDoubleClicked)
        self.figuresChanged.connect(self.updateFigureList)
        
        self.plotView = QtGui.QGraphicsView()
        self.current_figures = []

        
        self.grid.addWidget(QtGui.QLabel('result files:'), 0, 0)
        self.grid.addWidget(self.resultList, 1, 0)
        self.grid.addWidget(QtGui.QLabel('postprocessors:'), 2, 0)
        self.grid.addWidget(self.methodList, 3, 0)
        self.grid.addWidget(QtGui.QLabel('figures:'), 4, 0)
        self.grid.addWidget(self.figureList, 5, 0)
        self.grid.addWidget(QtGui.QLabel('selected figure:'), 0, 1)

        self.mainFrame.setLayout(self.grid)
        self.setCentralWidget(self.mainFrame)

        #statusbar
        self.statusBar = QtGui.QStatusBar(self)
        self.setStatusBar(self.statusBar)
        #self.statusBar.setMessage('no datset loaded')


        #load test results
        filePath = os.path.join(os.pardir, 'results', 'test.bbr')
        self._loadResultFile(filePath)
    
    def loadResultFilesClicked(self):
        path = os.path.join('../results/')
        dialog = QtGui.QFileDialog(self)
        dialog.setFileMode(QtGui.QFileDialog.ExistingFiles)
        dialog.setDirectory(path)
        dialog.setNameFilter("BallBeam Result files (*.bbr)")

        files = None
        if(dialog.exec_()):
            files = dialog.selectedFiles()

        if files:
            for selectedFile in files:
                self._loadResultFile(selectedFile)


    def _loadResultFile(self, fileName):
        '''
        loads a result file
        '''
        with open(fileName, 'r') as f:
{'fraction_non_alphanumeric': 0.11411830357142858, 'fraction_numerical': 0.011160714285714286, 'mean_word_length': 2.7222222222222223, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2209244', 'n_tokens_mistral': 2311, 'n_tokens_neox': 2206, 'n_words': 314}