gui: support everything
This commit is contained in:
@@ -20,10 +20,6 @@ NAME = 'Alacritty Config'
|
||||
MODIFIERS = ['None', 'Command', 'Control', 'Option', 'Super', 'Shift', 'Alt']
|
||||
|
||||
|
||||
# TODO
|
||||
# visual bell
|
||||
|
||||
|
||||
def delete_layout_items(layout):
|
||||
while layout.count():
|
||||
item = layout.takeAt(0)
|
||||
@@ -182,6 +178,11 @@ class Spoiler(QtWidgets.QWidget):
|
||||
|
||||
|
||||
class CommandWidget(QtWidgets.QLineEdit):
|
||||
def __init__(self, value):
|
||||
super().__init__()
|
||||
if value:
|
||||
self.setText('{}{}'.format(value['program'], ''.join(value['args'])))
|
||||
|
||||
def value(self):
|
||||
res = self.text().split(' ')
|
||||
return {'program': res[0], 'args': res[1:]}
|
||||
@@ -222,7 +223,7 @@ class KeyBindingDialog(QtWidgets.QDialog):
|
||||
self.chars = QtWidgets.QLineEdit()
|
||||
self.tabs.addTab(self.chars, 'Chars')
|
||||
|
||||
self.command = CommandWidget('')
|
||||
self.command = CommandWidget(None)
|
||||
self.tabs.addTab(self.command, 'Command')
|
||||
|
||||
self.layout.addWidget(self.tabs)
|
||||
@@ -861,23 +862,21 @@ class Mouse(ConfigWidget):
|
||||
hide_when_typing = QtWidgets.QCheckBox()
|
||||
hide_when_typing.setChecked(config.get('hide_when_typing', False))
|
||||
|
||||
launcher = CommandWidget(config.get('url', {}).get('launcher', ''))
|
||||
launcher = CommandWidget(config.get('url', {}).get('launcher'))
|
||||
|
||||
modifiers = QtWidgets.QComboBox()
|
||||
for modifier in MODIFIERS:
|
||||
modifiers.addItem(modifier)
|
||||
dec = config.get('modifiers')
|
||||
if dec in MODIFIERS:
|
||||
modifiers.setCurrentIndex(self.modifier_options.index(dec))
|
||||
else:
|
||||
modifiers.setCurrentIndex(0)
|
||||
modifiers.setCurrentIndex(MODIFIERS.index(dec))
|
||||
|
||||
self.widgets = {
|
||||
'hide_when_typing': hide_when_typing,
|
||||
'url': {
|
||||
'launcher': launcher
|
||||
},
|
||||
'launcher': launcher,
|
||||
'modifiers': modifiers,
|
||||
},
|
||||
'double_click': {
|
||||
'threshold': double_threshold,
|
||||
},
|
||||
@@ -889,6 +888,32 @@ class Mouse(ConfigWidget):
|
||||
self.render_state()
|
||||
|
||||
|
||||
class VisualBell(ConfigWidget):
|
||||
animation_options = [
|
||||
'Ease', 'EaseOut', 'EaseOutSine', 'EaseOutQuad', 'EaseOutCubic',
|
||||
'EaseOutQuart', 'EaseOutQuint', 'EaseOutExpo', 'EaseOutCirc', 'Linear',
|
||||
]
|
||||
def __init__(self, config):
|
||||
super().__init__()
|
||||
duration = QtWidgets.QSpinBox()
|
||||
duration.setMaximum(10000)
|
||||
duration.setValue(config.get('duration'))
|
||||
|
||||
animation = QtWidgets.QComboBox()
|
||||
for a in self.animation_options:
|
||||
animation.addItem(a)
|
||||
dec = config.get('animation')
|
||||
if dec in self.animation_options:
|
||||
animation.setCurrentIndex(self.animation_options.index(dec))
|
||||
|
||||
self.widgets = {
|
||||
'duration': duration,
|
||||
'animation': animation,
|
||||
}
|
||||
|
||||
self.render_state()
|
||||
|
||||
|
||||
class Config(QtWidgets.QWidget):
|
||||
def __init__(self, config, dry=False):
|
||||
super().__init__()
|
||||
@@ -932,6 +957,8 @@ class Config(QtWidgets.QWidget):
|
||||
self.tabs.setTabToolTip(10, 'Mouse Bindings')
|
||||
self.tabs.addTab(Mouse(self.config.get('mouse', {})), 'Mouse')
|
||||
self.tabs.setTabToolTip(11, 'Mouse')
|
||||
self.tabs.addTab(VisualBell(self.config.get('visual_bell', {})), 'Visual Bell')
|
||||
self.tabs.setTabToolTip(12, 'Visual Bell')
|
||||
|
||||
self.layout.addWidget(self.tabs)
|
||||
|
||||
|
Reference in New Issue
Block a user