예제 #1
0
    def create_layouts(self):
        """Create signals."""
        self.layout_main = QtWidgets.QVBoxLayout()
        self.layout_command_size = QtWidgets.QHBoxLayout()
        self.layout_lang_new_commands = QtWidgets.QHBoxLayout()
        self.layout_stack_root = QtWidgets.QHBoxLayout()

        self.layout_lang_new_commands.addWidget(self.label_lang_new_commands)
        self.layout_lang_new_commands.addWidget(self.combo_lang_new_commands)

        self.layout_stack_root.addWidget(self.label_stack_root)
        self.layout_stack_root.addWidget(self.input_stack_root)
        self.layout_stack_root.addWidget(self.button_stack_root)
        self.layout_stack_root.addWidget(self.button_reveal_stack_root)

        self.layout_command_size.addWidget(self.label_command_size)
        self.layout_command_size.addWidget(self.combo_command_size)

        self.layout_main.addWidget(QHLine())
        self.layout_main.addWidget(self.check_tooltips)
        self.layout_main.addWidget(self.check_command_tooltips)
        self.layout_main.addWidget(self.check_auto_clear_command)
        self.layout_main.addWidget(self.check_auto_close_script)
        self.layout_main.addWidget(self.check_auto_close_command)
        self.layout_main.addLayout(self.layout_command_size)
        self.layout_main.addLayout(self.layout_lang_new_commands)
        self.layout_main.addLayout(self.layout_stack_root)
        self.layout_main.addWidget(self.button_clear_history)
        self.layout_main.addStretch()
        self.layout_main.addWidget(self.button_close)

        helper.set_style_sheet(self)
        self.setLayout(self.layout_main)
예제 #2
0
    def create_layouts(self):
        """Create layouts."""
        self.help_layout_top = QtWidgets.QHBoxLayout()
        self.help_layout_info = QtWidgets.QVBoxLayout()
        self.help_layout_widgets = QtWidgets.QVBoxLayout()
        self.help_layout_push = QtWidgets.QHBoxLayout()
        self.help_layout_top.addWidget(self.help_img)
        self.help_layout_info.addWidget(self.help_info)
        self.help_layout_info.addWidget(self.help_lic)
        self.help_layout_info.addWidget(self.push_uninstall)
        self.help_layout_top.addLayout(self.help_layout_info)
        self.help_layout_widgets.addLayout(self.help_layout_top)
        self.help_layout_widgets.addWidget(self.help_push_web)
        self.help_layout_widgets.addLayout(self.help_layout_push)
        self.help_layout_widgets.addStretch()
        self.help_group = QtWidgets.QGroupBox()
        self.help_group.setLayout(self.help_layout_widgets)
        self.help_layout_main = QtWidgets.QVBoxLayout()

        self.help_layout_main.addWidget(self.help_group)
        self.help_layout_main.addWidget(self.help_push_close)

        self.setLayout(self.help_layout_main)
        self.help_push_close.setFocus()
        helper.set_style_sheet(self)
        self.help_info.setFocus()
    def execute_command(self):
        """Execute the input command and clear the command input when set.

        When the command has been executed successfully, it will be added to
        the history. If the command has some errors, then the input command
        turns red.

        """
        command = self.view.input_command.text()
        language = self.view.button_language.text()

        if not command:
            return

        try:
            helper.execute(language, command)
        except ValueError:
            self.view.input_command.setProperty("style", "red")
            helper.set_style_sheet(self.view)
            return

        self.settings = helper.add_to_history(command)

        self.view.input_command.setProperty("style", "")
        helper.set_style_sheet(self.view)

        if self.settings["auto_clear_command"]:
            self.view.input_command.setText("")

        auto_close_command = self.settings["auto_close_command"]
        floating = self.view.floating
        if all([auto_close_command, floating]):
            self.view.close()
예제 #4
0
    def create_layouts(self):
        """Create layouts."""
        self.layout_main = QtWidgets.QHBoxLayout()

        self.layout_main.addWidget(self.input_stack_name)
        self.layout_main.addWidget(self.button_create)

        helper.set_style_sheet(self)
        self.setLayout(self.layout_main)
        self.button_create.setFocus()
예제 #5
0
    def create_layouts(self):
        """Create layouts."""
        self.layout_main = QtWidgets.QVBoxLayout()
        self.layout_top = QtWidgets.QHBoxLayout()

        self.layout_main.addLayout(self.layout_top)
        self.layout_main.addWidget(self.text_command)
        self.layout_main.addWidget(self.button_save)

        self.layout_top.addWidget(self.input_name, 7)
        self.layout_top.addWidget(self.combo_language, 1)
        self.layout_top.addWidget(self.button_icon, 1)
        self.layout_top.addWidget(self.button_color, 1)

        self.setLayout(self.layout_main)
        helper.set_style_sheet(self)
        self.text_command.setFocus()
예제 #6
0
    def create_layouts(self):
        """Create layouts."""
        self.layout_main = QtWidgets.QVBoxLayout()

        row = 0
        column = 0
        for icon in self.icons:
            self.table.setCellWidget(row, column, icon)

            column += 1
            if column > 3:
                column = 0
                row += 1

        self.layout_main.addWidget(self.table)
        self.layout_main.addWidget(self.button_cancel)

        self.setLayout(self.layout_main)
        helper.set_style_sheet(self)
예제 #7
0
    def create_layouts(self):
        """Create layouts."""
        self.layout_top = QtWidgets.QHBoxLayout()
        self.layout_main = QtWidgets.QVBoxLayout()
        self.layout_bottom = QtWidgets.QHBoxLayout()

        self.layout_main.addLayout(self.layout_top)
        self.layout_main.addWidget(self.scripts_table)
        self.layout_main.addLayout(self.layout_bottom)

        self.layout_main.addWidget(self.settings_panel)

        self.layout_top.addWidget(self.combo_stack)
        self.layout_top.addStretch()
        self.layout_top.addWidget(self.button_toggle_command)
        self.layout_top.addWidget(self.button_refresh)
        self.layout_top.addWidget(self.button_settings)

        self.layout_bottom.addWidget(self.button_language, 1)
        self.layout_bottom.addWidget(self.input_command, 9)

        helper.set_style_sheet(self)
        self.setLayout(self.layout_main)
예제 #8
0
def ask_dialog(message,
               process_label="ok",
               color_process="actionButton",
               cancel_label="cancel"):
    """Create and show ask dialog.

    Args:
        message (str): Message to display.
        process_label (str): Label of process button.
        color_process (str): Color of process button in the format:
            "r,g,b,a"; if set to "actionButton" then this button will become a
            blue button like all actionButton QPushWidgets.
        cancel_label (str): Label of reject button.

    Returns:
        Bool: True if clicked process button, otherwise False.

    """
    msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning,
                                    "QMessageBox.warning()", message,
                                    QtWidgets.QMessageBox.NoButton, None)
    msg_box.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
    msg_box.setObjectName("ask_dialog")
    helper.set_style_sheet(msg_box)
    msg_box.raise_()
    process_button = msg_box.addButton(process_label,
                                       QtWidgets.QMessageBox.AcceptRole)
    if color_process != "":
        if color_process == "actionButton":
            color_process = "51, 204, 255, 100"

        style = "QPushButton {background-color: rgba(%s)}" % color_process
        process_button.setStyleSheet(style)
    process_button.clearFocus()
    msg_box.setFocus()
    msg_box.addButton(cancel_label, QtWidgets.QMessageBox.RejectRole)
    return msg_box.exec_() == QtWidgets.QMessageBox.AcceptRole