Skip to content
Snippets Groups Projects
Commit d0ee3674 authored by Daniel Brötzmann's avatar Daniel Brötzmann
Browse files

Settings: Add color setting

parent 24d89658
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,7 @@ class SettingKind(IntEnum): ...@@ -58,6 +58,7 @@ class SettingKind(IntEnum):
CHANGEPASSWORD = 11 CHANGEPASSWORD = 11
COMBO = 12 COMBO = 12
CHATSTATE_COMBO = 13 CHATSTATE_COMBO = 13
COLOR = 14
@unique @unique
......
...@@ -88,6 +88,7 @@ def __init__(self, account, extend=None): ...@@ -88,6 +88,7 @@ def __init__(self, account, extend=None):
SettingKind.SPIN: SpinSetting, SettingKind.SPIN: SpinSetting,
SettingKind.DIALOG: DialogSetting, SettingKind.DIALOG: DialogSetting,
SettingKind.ENTRY: EntrySetting, SettingKind.ENTRY: EntrySetting,
SettingKind.COLOR: ColorSetting,
SettingKind.ACTION: ActionSetting, SettingKind.ACTION: ActionSetting,
SettingKind.LOGIN: LoginSetting, SettingKind.LOGIN: LoginSetting,
SettingKind.FILECHOOSER: FileChooserSetting, SettingKind.FILECHOOSER: FileChooserSetting,
...@@ -98,7 +99,7 @@ def __init__(self, account, extend=None): ...@@ -98,7 +99,7 @@ def __init__(self, account, extend=None):
SettingKind.CHANGEPASSWORD: ChangePasswordSetting, SettingKind.CHANGEPASSWORD: ChangePasswordSetting,
SettingKind.COMBO: ComboSetting, SettingKind.COMBO: ComboSetting,
SettingKind.CHATSTATE_COMBO: ChatstateComboSetting, SettingKind.CHATSTATE_COMBO: ChatstateComboSetting,
} }
if extend is not None: if extend is not None:
for setting, callback in extend: for setting, callback in extend:
...@@ -336,6 +337,36 @@ def on_row_activated(self): ...@@ -336,6 +337,36 @@ def on_row_activated(self):
self.entry.grab_focus() self.entry.grab_focus()
class ColorSetting(GenericSetting):
__gproperties__ = {
"setting-value": (str, 'Color Value', '', '',
GObject.ParamFlags.READWRITE),
}
def __init__(self, *args):
GenericSetting.__init__(self, *args)
rgba = Gdk.RGBA()
rgba.parse(self.setting_value)
self.color_button = Gtk.ColorButton()
self.color_button.set_rgba(rgba)
self.color_button.connect('color-set', self.on_color_set)
self.color_button.set_valign(Gtk.Align.CENTER)
self.color_button.set_halign(Gtk.Align.END)
self.setting_box.pack_end(self.color_button, True, True, 0)
self.show_all()
def on_color_set(self, button):
rgba = button.get_rgba()
self.set_value(rgba.to_string())
def on_row_activated(self):
self.color_button.grab_focus()
class DialogSetting(GenericSetting): class DialogSetting(GenericSetting):
__gproperties__ = { __gproperties__ = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment