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

from .vendor.Qt import QtWidgets, QtCore
from . import partition
from .gui import partition_setting_ui


class SettingDialog(QtWidgets.QDialog, partition_setting_ui.Ui_Form):
    def __init__(self, parent, data):
        super(SettingDialog, self).__init__(parent)
        self.setupUi(self)
        self.setWindowTitle("Partition Setting")

        # ダイアログのOK/キャンセルボタン
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)

        self._data_input(data)
        self._preview_partition_drawing()

        # コールバック関数の設定
        func = self._redraw_ui
        self.spinbox_label_font_size.valueChanged.connect(func)

        self.spinbox_line_length.valueChanged.connect(func)
        self.spinbox_line_width.valueChanged.connect(func)

        self.checkbox_use_label.stateChanged.connect(func)
        self.combo_style.currentIndexChanged.connect(func)

        '''
        テキストエリアに日本語を入力中（IME未確定状態）にMayaがクラッシュする場合があった。
        textChanged.connect をやめ、例えば focusOut や エンターキー押下を発火条件にすることで対応
        '''
        # self.line_label.textChanged.connect(func)

        def _focus_out(event):
            self._redraw_ui()

        def _key_press(event, widget=None):
            QtWidgets.QLineEdit.keyPressEvent(widget, event)

            key = event.key()
            print key
            if (key == QtCore.Qt.Key_Enter) or (key == QtCore.Qt.Key_Return):
                self._redraw_ui()

        self.line_label.focusOutEvent = _focus_out
        self.line_label.keyPressEvent = functools.partial(_key_press, widget=self.line_label)
        self.line_label.setToolTip('It will be reflected in the preview when focus is out.')


        self.button_color.clicked.connect(self._select_color)

    def _redraw_ui(self):
        self._preview_partition_drawing()

    def _select_color(self):<commit_msg>２行あいていた部分を修正<commit_after>## -*- coding: utf-8 -*-
import functools

from .vendor.Qt import QtWidgets, QtCore
from . import partition
from .gui import partition_setting_ui


class SettingDialog(QtWidgets.QDialog, partition_setting_ui.Ui_Form):
    def __init__(self, parent, data):
        super(SettingDialog, self).__init__(parent)
        self.setupUi(self)
        self.setWindowTitle("Partition Setting")

        # ダイアログのOK/キャンセルボタン
        self.buttonbox.accepted.connect(self.accept)
        self.buttonbox.rejected.connect(self.reject)

        self._data_input(data)
        self._preview_partition_drawing()

        # コールバック関数の設定
        func = self._redraw_ui
        self.spinbox_label_font_size.valueChanged.connect(func)

        self.spinbox_line_length.valueChanged.connect(func)
        self.spinbox_line_width.valueChanged.connect(func)

        self.checkbox_use_label.stateChanged.connect(func)
        self.combo_style.currentIndexChanged.connect(func)

        '''
        テキストエリアに日本語を入力中（IME未確定状態）にMayaがクラッシュする場合があった。
        textChanged.connect をやめ、例えば focusOut や エンターキー押下を発火条件にすることで対応
        '''
        # self.line_label.textChanged.connect(func)

        def _focus_out(event):
            self._redraw_ui()

        def _key_press(event, widget=None):
            QtWidgets.QLineEdit.keyPressEvent(widget, event)

            key = event.key()
            print key
            if (key == QtCore.Qt.Key_Enter) or (key == QtCore.Qt.Key_Return):
                self._redraw_ui()

        self.line_label.focusOutEvent = _focus_out
        self.line_label.keyPressEvent = functools.partial(_key_press, widget=self.line_label)
        self.line_label.setToolTip('It will be reflected in the preview when focus is out.')

        self.button_color.clicked.connect(self._select_color)

    def _redraw_ui(self):
        self._preview_partition_drawing()

    def _select_color(self):
{'fraction_non_alphanumeric': 0.09319371727748692, 'fraction_numerical': 0.0007853403141361257, 'mean_word_length': 2.883130081300813, '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': '1205922', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1281, 'n_words': 179}