gui: add general config

This commit is contained in:
2019-07-07 14:34:40 +02:00
parent 0dc601f265
commit ff0d722b0b

View File

@@ -19,11 +19,9 @@ NAME = 'Alacritty Config'
# TODO # TODO
# General
# visual bell # visual bell
# cursor # cursor
# mouse # mouse
# mouse_bindings
def delete_layout_items(layout): def delete_layout_items(layout):
@@ -489,6 +487,46 @@ class ConfigWidget(QtWidgets.QWidget):
return self.widgets_to_state(self.widgets) 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): class Debug(ConfigWidget):
log_levels = ['None', 'Error', 'Warn', 'Info', 'Debug', 'Trace'] log_levels = ['None', 'Error', 'Warn', 'Info', 'Debug', 'Trace']
def __init__(self, config): def __init__(self, config):
@@ -821,6 +859,7 @@ class Config(QtWidgets.QWidget):
def add_tabs(self): def add_tabs(self):
self.tabs = QtWidgets.QTabWidget() self.tabs = QtWidgets.QTabWidget()
self.tabs.addTab(General(self.config), "General")
self.tabs.addTab(Window(self.config.get('window', {})), "Window") self.tabs.addTab(Window(self.config.get('window', {})), "Window")
self.tabs.setTabToolTip(0, "Window") self.tabs.setTabToolTip(0, "Window")
self.tabs.addTab(Font(self.config.get('font', {})), "Font") self.tabs.addTab(Font(self.config.get('font', {})), "Font")
@@ -866,7 +905,10 @@ class Config(QtWidgets.QWidget):
if type(old) == list: if type(old) == list:
state[title].extend(e for e in tab.gather_state() if e not in old) state[title].extend(e for e in tab.gather_state() if e not in old)
else: 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 return state