Exemplo n.º 1
0
    def __init__(self, tool):
        QWidget.__init__(self)
        self.tool = tool

        self.layout = QBoxLayout(QBoxLayout.TopToBottom)

        self.sliders = [
            slider.Slider(self.tool, "Short term TDP",
                          "Maximal TDP in the short term", 1, 1, 150, 5),
            slider.Slider(self.tool, "Long term TDP",
                          "Maximal TDP in the long term", 1, 1, 150, 5)
        ]

        self.slider_grid = slider.SliderGrid(self.tool, self.sliders)
        self.layout.addWidget(self.slider_grid)

        self.duration_controls = PowerDurationControls(self.tool)
        duration_group = QGroupBox("Override power limit durations")
        duration_group.setCheckable(True)
        duration_group.setToolTip(
            """If checked, allows you to alter short term and long term package power limit durations.
This is used for Turbo Boost.""")
        duration_group.setLayout(self.duration_controls.layout())
        self.layout.addWidget(duration_group)

        self.setLayout(self.layout)
Exemplo n.º 2
0
 def _create_options(self, layout, options):
     for name, option in options:
         if isinstance(option, ModelerOption):
             layout.addRow(self._determine_label(option),
                           self._determine_field(option))
         elif isinstance(option, ModelerOptionsGroup):
             group = QGroupBox(name)
             group.setToolTip(option.description)
             g_layout = QFormLayout()
             g_layout.setRowWrapPolicy(QFormLayout.WrapLongRows)
             self._create_options(g_layout, option.items())
             group.setLayout(g_layout)
             layout.addRow(group)
Exemplo n.º 3
0
    def __init__(self, parent=None):
        super(Window, self).__init__(parent)
        self.setGeometry(0, 0, 600, 800)
        self.setWindowTitle(f"Bug report - v. {VERSION}")
        self.central_widget = QWidget()
        self.setCentralWidget(self.central_widget)
        self.central_layout = QVBoxLayout()
        self.central_widget.setLayout(self.central_layout)
        self.scroll_area = QScrollArea(widgetResizable=True)
        self.central_layout.addWidget(self.scroll_area)
        self.scroll_widget = QWidget()
        self.scroll_area.setWidget(self.scroll_widget)

        self.layout = QVBoxLayout()
        self.scroll_widget.setLayout(self.layout)

        env_ver_layout = QHBoxLayout()
        version_box = QGroupBox("Version")
        version_layout = QVBoxLayout()
        version_box.setLayout(version_layout)
        self.version = QLineEdit()
        version_layout.addWidget(self.version)
        env_ver_layout.addWidget(version_box)
        version_box.setToolTip(
            f"Name the current version where the bug occurred, e.g. V.{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}"
        )

        env_box = QGroupBox("Environment")
        env_layout = QVBoxLayout()
        env_box.setLayout(env_layout)
        self.environment = QLineEdit()
        env_layout.addWidget(self.environment)
        env_ver_layout.addWidget(env_box)
        env_box.setToolTip(
            "Specify the environment of work, e.g. OS, hardware version, current configuration..."
        )

        self.layout.addLayout(env_ver_layout)

        desc_box = QGroupBox("Description")
        desc_layout = QVBoxLayout()
        desc_box.setLayout(desc_layout)
        self.description = QPlainTextEdit()
        desc_layout.addWidget(self.description)
        desc_box.setToolTip("Describe your problem, what is going on?")
        self.layout.addWidget(desc_box)

        res_box = QGroupBox("Results")
        res_layout = QHBoxLayout()
        self.results = dict()
        result_help = {
            OBTAINED_STR: "What you got",
            EXPECTED_STR: "What you were supposed to get"
        }
        for res in RESULTS_LST:
            box = QGroupBox(res)
            lay = QVBoxLayout()
            box.setLayout(lay)
            box.setToolTip(result_help[res])
            self.results[res] = QPlainTextEdit()
            lay.addWidget(self.results[res])
            res_layout.addWidget(box)
        res_box.setLayout(res_layout)
        self.layout.addWidget(res_box)

        proto_box = QGroupBox("Protocol")
        proto_layout = QVBoxLayout()
        self.protocol = QPlainTextEdit("1.")
        proto_layout.addWidget(self.protocol)
        proto_box.setLayout(proto_layout)
        proto_box.setToolTip("Describe the steps to reproduce the bug")
        self.layout.addWidget(proto_box)

        stack_box = QGroupBox("Stacktrace (if any)")
        stack_layout = QVBoxLayout()
        self.stacktrace = QPlainTextEdit()
        stack_layout.addWidget(self.stacktrace)
        stack_box.setLayout(stack_layout)
        stack_box.setToolTip("If you have a Stacktrace, it is welcomed here")
        self.layout.addWidget(stack_box)

        impact_box = QGroupBox("Impact")
        impact_layout = QHBoxLayout()
        self.impact = dict()
        prio_help = {
            SEVERITY_STR:
            "How severe this bug is (low: a little bit annoying, high: everything is broken)",
            REPRODUCIBILITY_STR:
            "How often this bug occurs "
            "(low: almost never or in a very specific condition, high: always)"
        }
        for imp in IMPACT_LST:
            box = QGroupBox(imp)
            lay = QVBoxLayout()
            box.setLayout(lay)
            box.setToolTip(prio_help[imp])
            self.impact[imp] = QComboBox()
            self.impact[imp].addItems(IMPACT_ITEMS)
            self.impact[imp].currentTextChanged.connect(
                lambda: self.set_priority())
            lay.addWidget(self.impact[imp])
            impact_layout.addWidget(box)
        impact_box.setLayout(impact_layout)
        self.layout.addWidget(impact_box)

        prio_box = QGroupBox("Priority")
        prio_layout = QVBoxLayout()
        self.priority = QComboBox()
        self.priority.addItems(PRIORITY_ITEMS)
        prio_layout.addWidget(self.priority)
        prio_box.setLayout(prio_layout)
        prio_box.setToolTip(
            "Is set automatically but can be overridden if needed")
        self.layout.addWidget(prio_box)

        file_box = QGroupBox("Attachments")
        file_layout = QHBoxLayout()
        self.attachment = QLineEdit()
        file_layout.addWidget(self.attachment)
        file_button = QPushButton("...")
        file_button.clicked.connect(lambda: self.browse_file())
        file_layout.addWidget(file_button)
        file_box.setLayout(file_layout)
        file_box.setToolTip("If you need to add a file")
        self.layout.addWidget(file_box)

        generate_box = QGroupBox("Generate")
        generate_layout = QHBoxLayout()
        gen_report_button = QPushButton("Generate Report")
        gen_report_button.clicked.connect(self.save_report)
        generate_layout.addWidget(gen_report_button)
        gen_email_button = QPushButton("Generate email")
        gen_email_button.clicked.connect(self.enter_address)
        generate_layout.addWidget(gen_email_button)
        generate_box.setLayout(generate_layout)
        self.central_layout.addWidget(generate_box)