<commit_before>"""The properites panel"""

import plow.client as pc

from plow.gui.manifest import QtCore, QtGui
from plow.gui.panels import Panel
from plow.gui.event import EventManager
from plow.gui.form import PlowForm

class PropertiesPanel(Panel):

    def __init__(self, name="Properties", parent=None):
        Panel.__init__(self, name, "Properties", parent)

        self.setWidget(PropertiesWidget(self.attrs, self))
        self.setWindowTitle(name)

        EventManager.bind("JOB_OF_INTEREST", self.__handleJobOfInterestEvent)

    def init(self):
        pass

    def openConfigDialog(self):
        pass

    def refresh(self):
        self.widget().refresh()

    def __handleJobOfInterestEvent(self, *args, **kwargs):

        job = pc.get_job(args[0])

        widgets = [ {
            "title": "Job",
            "children": [
                {
                    "title": "Name",
                    "widget": "text",
                    "value": job.name,
                    "readOnly": True
                },
                {
                    "title": "Progress",
                    "widget": "jobProgressBar",
                    "value": job.totals
                },
                {
                    "title": "Min Cores",
                    "value": job.minCores,
                    "readOnly": True,
                },
                {
                    "title": "Totals",
                    "children": [
                        {
                            "title": "Running",
                            "value": job.totals.running,
                            "readOnly": True,
                        },
                        {
                            "title": "Succeeded",
                            "value": job.totals.succeeded,
                            "readOnly": True,
                        },
                        {
                            "title": "Depend",
                            "value": job.totals.depend,
                            "readOnly": True,
                        },
                        {
                            "title": "Dead",
                            "value": job.totals.dead,
                            "readOnly": True,       
                        },
                                        {
                            "title": "Waiting",
                            "value": job.totals.waiting,
                            "readOnly": True,
                        }
                    ]
                }
            ]
        }]

        form = PlowForm(widgets)
        self.widget().setWidget(form)


class PropertiesWidget(QtGui.QWidget):
    def __init__(self, attrs, parent=None):
        QtGui.QWidget.__init__(self, parent)
        QtGui.QVBoxLayout(self)
        self.__attrs = attrs
        self.__scroll = QtGui.QScrollArea(self)
        self.__scroll.setWidgetResizable(True)
        self.__scroll.setFocusPolicy(QtCore.Qt.NoFocus)
        self.layout().addWidget(self.__scroll)


    def setWidget(self, widget):
        self.__scroll.setWidget(widget)
<commit_msg>Cool new job properties layout.<commit_after>"""The properites panel"""

import plow.client as pc

from plow.gui.manifest import QtCore, QtGui
from plow.gui.panels import Panel
from plow.gui.event import EventManager
from plow.gui.form import PlowForm

class PropertiesPanel(Panel):

    def __init__(self, name="Properties", parent=None):
        Panel.__init__(self, name, "Properties", parent)

        self.setWidget(PropertiesWidget(self.attrs, self))
        self.setWindowTitle(name)

        EventManager.bind("JOB_OF_INTEREST", self.__handleJobOfInterestEvent)

    def init(self):
        pass

    def openConfigDialog(self):
        pass

    def refresh(self):
        self.widget().refresh()

    def __handleJobOfInterestEvent(self, *args, **kwargs):

        job = pc.get_job(args[0])

        widgets = [ {
                "title": "Job Status",
                "children": [
                    {
                        "title": "Name",
                        "widget": "text",
                        "value": job.name,
                        "readOnly": True
                    },
                    {
                        "title": "State",
                        "widget": "jobState",
                        "value": job.state
                    },
                    {
                        "title": "Progress",
                        "widget": "jobProgressBar",
                        "value": job.totals
                    }
                ]
            },
            {
                "title": "Core Totals",
                "children": [
                    {
                        "title": "Min Cores",
                        "value": job.minCores,
                    },
                    {
                        "title": "Max Cores",
                        "value": job.maxCores,
                    },
                    {
                        "title": "Run Cores",
                        "value": job.runCores,
                        "readOnly": True,
                    }
                ]
            },
            {
                "title": "Task Totals",
                "children": [
                    {
                        "title": "Running",
                        "value": job.totals.running,
                        "readOnly": True,
                    },
                    {
                        "title": "Succeeded",
                        "value": job.totals.succeeded,
                        "readOnly": True,
                    },
                    {
                        "title": "Depend",
                        "value": job.totals.depend,
                        "readOnly": True,
                    },
                    {
                        "title": "Dead",
                        "value": job.totals.dead,
                        "readOnly": True,       
                    },
                                    {
                        "title": "Waiting",
                        "value": job.totals.waiting,
                        "readOnly": True,
                    }
                ]
            }
        ]

        form = PlowForm(widgets)
        self.widget().setWidget(form)


class PropertiesWidget(QtGui.QWidget):
    def __init__(self, attrs, parent=None):
        QtGui.QWidget.__init__(self, parent)
        QtGui.QVBoxLayout(self)
        self.__attrs = attrs
        self.__scroll = QtGui.QScrollArea(self)
        self.__scroll.setWidgetResizable(True)
        self.__scroll.setFocusPolicy(QtCore.Qt.NoFocus)
        self.layout().addWidget(self.__scroll)


    def setWidget(self, widget):
        self.__scroll.setWidget(widget)

{'fraction_non_alphanumeric': 0.1055350553505535, 'fraction_numerical': 0.0002952029520295203, 'mean_word_length': 0.9778166958552248, 'pattern_counts': {'":': 67, '<': 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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '505722', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1582, 'n_words': 296}