From ff0d722b0b1d3ce1912c733ad2eaf50ad16c87b3 Mon Sep 17 00:00:00 2001 From: hellerve Date: Sun, 7 Jul 2019 14:34:40 +0200 Subject: [PATCH] gui: add general config --- alacritty_config_gui.py | 48 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/alacritty_config_gui.py b/alacritty_config_gui.py index 40cdf57..2d26272 100644 --- a/alacritty_config_gui.py +++ b/alacritty_config_gui.py @@ -19,11 +19,9 @@ NAME = 'Alacritty Config' # TODO -# General # visual bell # cursor # mouse -# mouse_bindings def delete_layout_items(layout): @@ -489,6 +487,46 @@ class ConfigWidget(QtWidgets.QWidget): return self.widgets_to_state(self.widgets) +class General(ConfigWidget): + cursor_style_options = ['Block', 'Underline', 'Beam'] + + def __init__(self, config): + super().__init__() + self.widgets['background_opacity'] = QtWidgets.QDoubleSpinBox() + self.widgets['background_opacity'].setValue(config.get('background_opacity')) + self.widgets['cursor_style'] = QtWidgets.QComboBox() + for option in self.cursor_style_options: + self.widgets['cursor_style'].addItem(option) + self.widgets['cursor_style'] = config.get('cursor_style') + self.widgets['custom_cursor_colors'] = QtWidgets.QCheckBox() + self.widgets['custom_cursor_colors'].setChecked( + config.get('custom_cursor_colors', False) + ) + self.widgets['draw_bold_text_with_bright_colors'] = QtWidgets.QCheckBox() + self.widgets['draw_bold_text_with_bright_colors'].setChecked( + config.get('draw_bold_text_with_bright_colors', False) + ) + self.widgets['dynamic_title'] = QtWidgets.QCheckBox() + self.widgets['dynamic_title'].setChecked( + config.get('dynamic_title', False) + ) + self.widgets['hide_cursor_when_typing'] = QtWidgets.QCheckBox() + self.widgets['hide_cursor_when_typing'].setChecked( + config.get('hide_cursor_when_typing', False) + ) + self.widgets['live_config_reload'] = QtWidgets.QCheckBox() + self.widgets['live_config_reload'].setChecked( + config.get('live_config_reload', False) + ) + self.widgets['tabspaces'] = QtWidgets.QSpinBox() + self.widgets['tabspaces'].setValue(config.get('tabspaces')) + self.widgets['unfocused_hollow_cursor'] = QtWidgets.QCheckBox() + self.widgets['unfocused_hollow_cursor'].setChecked( + config.get('unfocused_hollow_cursor', False) + ) + self.render_state() + + class Debug(ConfigWidget): log_levels = ['None', 'Error', 'Warn', 'Info', 'Debug', 'Trace'] def __init__(self, config): @@ -821,6 +859,7 @@ class Config(QtWidgets.QWidget): def add_tabs(self): self.tabs = QtWidgets.QTabWidget() + self.tabs.addTab(General(self.config), "General") self.tabs.addTab(Window(self.config.get('window', {})), "Window") self.tabs.setTabToolTip(0, "Window") self.tabs.addTab(Font(self.config.get('font', {})), "Font") @@ -866,7 +905,10 @@ class Config(QtWidgets.QWidget): if type(old) == list: state[title].extend(e for e in tab.gather_state() if e not in old) else: - state[title] = {**state.get(title, {}), **tab.gather_state()} + if title == 'general': + state = {**state, **tab.gather_state()} + else: + state[title] = {**state.get(title, {}), **tab.gather_state()} return state