Commit 6fd939de authored by Daniel Brötzmann's avatar Daniel Brötzmann

WorkspaceDialog: Improvements

parent 73b4ef66
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="preview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -21,8 +21,10 @@
<child>
<object class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can-focus">True</property>
<property name="halign">center</property>
<property name="activates-default">True</property>
<property name="xalign">0.5</property>
<signal name="notify::text" handler="_on_text_changed" swapped="no"/>
</object>
<packing>
......@@ -34,10 +36,10 @@
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Choose a color or select an image</property>
<property name="wrap">True</property>
<property name="max_width_chars">40</property>
<property name="max-width-chars">40</property>
<style>
<class name="dim-label"/>
</style>
......@@ -49,36 +51,60 @@
</packing>
</child>
<child>
<object class="GtkStackSwitcher">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="stack">style_stack</property>
<property name="spacing">6</property>
<child>
<object class="GtkSwitch" id="image_switch">
<property name="visible">True</property>
<property name="can-focus">True</property>
<signal name="notify::active" handler="_on_image_switch_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Use Image</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkStack" id="style_stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="transition_duration">100</property>
<property name="transition_type">slide-left-right</property>
<property name="can-focus">False</property>
<property name="transition-duration">100</property>
<property name="transition-type">slide-left-right</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="margin_top">6</property>
<property name="margin-top">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Color</property>
<style>
......@@ -94,8 +120,8 @@
<child>
<object class="GtkColorButton" id="color_chooser">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="valign">center</property>
<signal name="color-set" handler="_on_color_set" swapped="no"/>
</object>
......@@ -114,45 +140,10 @@
<child>
<object class="GtkBox" id="image_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkSwitch" id="use_image">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Use Image instead of Color</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
......@@ -173,14 +164,14 @@
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="use-underline">True</property>
<signal name="clicked" handler="_on_cancel" swapped="no"/>
</object>
<packing>
......@@ -193,9 +184,10 @@
<object class="GtkButton" id="save_button">
<property name="label" translatable="yes">_Save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
<signal name="clicked" handler="_on_save" swapped="no"/>
<style>
<class name="suggested-action"/>
......@@ -204,7 +196,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
......@@ -212,7 +204,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
<property name="position">7</property>
</packing>
</child>
......
......@@ -34,7 +34,7 @@ def __init__(self, workspace_id=None):
self.set_application(app.app)
self.set_position(Gtk.WindowPosition.CENTER)
self.set_show_menubar(False)
self.set_title(_('Workspace'))
self.set_title(_('Workspace Settings'))
self.set_type_hint(Gdk.WindowTypeHint.DIALOG)
self.set_size_request(350, -1)
......@@ -62,6 +62,7 @@ def __init__(self, workspace_id=None):
self._ui.entry.set_text(name)
self._ui.color_chooser.set_rgba(rgba)
self._update_avatar()
self._ui.save_button.grab_default()
self._ui.connect_signals(self)
......@@ -82,6 +83,12 @@ def _on_text_changed(self, entry, _param):
self._ui.save_button.set_sensitive(bool(entry.get_text()))
self._update_avatar()
def _on_image_switch_toggled(self, switch, *args):
if switch.get_active():
self._ui.style_stack.set_visible_child_name('image')
else:
self._ui.style_stack.set_visible_child_name('color')
def _update_avatar(self):
name = self._ui.entry.get_text()
rgba = self._ui.color_chooser.get_rgba()
......@@ -106,8 +113,9 @@ def _get_avatar_data(self):
def _on_save(self, _button):
name = self._ui.entry.get_text()
rgba = self._ui.color_chooser.get_rgba()
# avatar = self._get_avatar_data()
# use_image = self._ui.use_image.get_active()
# use_image = self._ui.image_switch.get_active()
# if use_image:
# avatar = self._get_avatar_data()
if self._workspace_id is not None:
app.settings.set_workspace_setting(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment