gui: add scrolling
This commit is contained in:
@@ -9,6 +9,7 @@ from PyQt5 import QtWidgets, QtGui, QtCore
|
|||||||
|
|
||||||
|
|
||||||
ALACRITTY_CONFIG = os.path.expanduser("~/.config/alacritty/alacritty.yml")
|
ALACRITTY_CONFIG = os.path.expanduser("~/.config/alacritty/alacritty.yml")
|
||||||
|
NAME = 'Alacritty Config'
|
||||||
|
|
||||||
|
|
||||||
class ColorSelect(QtWidgets.QPushButton):
|
class ColorSelect(QtWidgets.QPushButton):
|
||||||
@@ -93,7 +94,7 @@ class ConfigWidget(QtWidgets.QWidget):
|
|||||||
self.widgets = {}
|
self.widgets = {}
|
||||||
|
|
||||||
def prettify(self, s):
|
def prettify(self, s):
|
||||||
return ' '.join(x.capitalize() for x in s.split('_') if x)
|
return ' '.join(x.capitalize() for x in s.split('_'))
|
||||||
|
|
||||||
def render_item(self, layout, name, widget):
|
def render_item(self, layout, name, widget):
|
||||||
sub_layout = QtWidgets.QHBoxLayout()
|
sub_layout = QtWidgets.QHBoxLayout()
|
||||||
@@ -350,6 +351,26 @@ class Window(ConfigWidget):
|
|||||||
self.render_state()
|
self.render_state()
|
||||||
|
|
||||||
|
|
||||||
|
class Scrolling(ConfigWidget):
|
||||||
|
def __init__(self, config):
|
||||||
|
super().__init__()
|
||||||
|
history = QtWidgets.QSpinBox(config.get('history'))
|
||||||
|
multiplier = QtWidgets.QSpinBox(config.get('multiplier'))
|
||||||
|
faux_multiplier = QtWidgets.QSpinBox(config.get('faux_multiplier'))
|
||||||
|
autoscroll = QtWidgets.QCheckBox()
|
||||||
|
autoscroll.setChecked(config.get('autoscroll', False))
|
||||||
|
|
||||||
|
self.widgets = {
|
||||||
|
'history': history,
|
||||||
|
'multiplier': multiplier,
|
||||||
|
'faux_multiplier': faux_multiplier,
|
||||||
|
'faux_multiplier': faux_multiplier,
|
||||||
|
'autoscroll': autoscroll,
|
||||||
|
}
|
||||||
|
|
||||||
|
self.render_state()
|
||||||
|
|
||||||
|
|
||||||
class Config(QtWidgets.QWidget):
|
class Config(QtWidgets.QWidget):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
@@ -357,18 +378,20 @@ class Config(QtWidgets.QWidget):
|
|||||||
self.config = config
|
self.config = config
|
||||||
self.add_tabs(config)
|
self.add_tabs(config)
|
||||||
self.add_buttons()
|
self.add_buttons()
|
||||||
|
self.setWindowTitle(NAME)
|
||||||
self.setLayout(self.layout)
|
self.setLayout(self.layout)
|
||||||
|
|
||||||
def add_tabs(self, config):
|
def add_tabs(self, config):
|
||||||
self.tabs = QtWidgets.QTabWidget()
|
self.tabs = QtWidgets.QTabWidget()
|
||||||
|
|
||||||
self.tabs.addTab(Window(config.get('window')), "Window")
|
self.tabs.addTab(Window(config.get('window', {})), "Window")
|
||||||
self.tabs.addTab(Font(config.get('font')), "Font")
|
self.tabs.addTab(Font(config.get('font', {})), "Font")
|
||||||
self.tabs.addTab(Debug(config.get('debug')), "Debug")
|
self.tabs.addTab(Debug(config.get('debug', {})), "Debug")
|
||||||
self.tabs.addTab(Env(config.get('env')), "Env")
|
self.tabs.addTab(Env(config.get('env', {})), "Env")
|
||||||
self.tabs.addTab(Selection(config.get('selection')), "Selection")
|
self.tabs.addTab(Selection(config.get('selection', {})), "Selection")
|
||||||
self.tabs.addTab(Shell(config.get('shell')), "Shell")
|
self.tabs.addTab(Shell(config.get('shell', {})), "Shell")
|
||||||
self.tabs.addTab(Colors(config.get('colors')), "Colors")
|
self.tabs.addTab(Colors(config.get('colors', {})), "Colors")
|
||||||
|
self.tabs.addTab(Scrolling(config.get('scrolling', {})), "Scrolling")
|
||||||
|
|
||||||
self.layout.addWidget(self.tabs)
|
self.layout.addWidget(self.tabs)
|
||||||
|
|
||||||
@@ -402,7 +425,8 @@ class Config(QtWidgets.QWidget):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QtWidgets.QApplication([])
|
app = QtWidgets.QApplication([NAME])
|
||||||
|
app.setApplicationName(NAME)
|
||||||
with open(ALACRITTY_CONFIG) as f:
|
with open(ALACRITTY_CONFIG) as f:
|
||||||
config = yaml.safe_load(f.read())
|
config = yaml.safe_load(f.read())
|
||||||
conf = Config(config)
|
conf = Config(config)
|
||||||
|
Reference in New Issue
Block a user