gui sexification

This commit is contained in:
Patrick Ulbrich
2013-08-04 13:28:37 +02:00
parent 8d23b2b811
commit a9b97643fd
3 changed files with 87 additions and 68 deletions

View File

@@ -24,7 +24,7 @@
import os
import xdg.BaseDirectory as bd
from gi.repository import GLib, GdkPixbuf, Gtk, GObject
from gi.repository import GLib, GdkPixbuf, Gdk, Gtk, GObject
from common.dist_cfg import PACKAGE_NAME, APP_VERSION
from common.i18n import _
@@ -57,6 +57,7 @@ class ConfigWindow:
self._window = builder.get_object("config_window")
self._window.set_icon(GdkPixbuf.Pixbuf.new_from_file_at_size(get_data_file("mailnag.svg"), 48, 48));
self._load_stylesheet('config_window.css')
self._cfg = read_cfg()
self.daemon_enabled = False
@@ -135,6 +136,14 @@ class ConfigWindow:
self._window.show()
def _load_stylesheet(self, stylesheet):
provider = Gtk.CssProvider()
provider.load_from_path(get_data_file(stylesheet))
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
def _load_config(self):
self._switch_daemon_enabled.set_active(bool(int(self._cfg.get('core', 'autostart'))))

6
data/config_window.css Normal file
View File

@@ -0,0 +1,6 @@
GtkEventBox {
background-image: linear-gradient(to bottom,
@theme_bg_color,
shade(@theme_bg_color, 1.06)
90%);
}

View File

@@ -1,31 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkListStore" id="liststore_accounts">
<columns>
<!-- column-name account_obj -->
<column type="PyObject"/>
<!-- column-name account_enabled -->
<column type="gboolean"/>
<!-- column-name account_name -->
<column type="gchararray"/>
</columns>
<signal name="row-deleted" handler="liststore_accounts_row_deleted" swapped="no"/>
<signal name="row-inserted" handler="liststore_accounts_row_inserted" swapped="no"/>
</object>
<object class="GtkListStore" id="liststore_plugins">
<columns>
<!-- column-name plugin_obj -->
<column type="PyObject"/>
<!-- column-name plugin_enabled -->
<column type="gboolean"/>
<!-- column-name plugin_name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="config_window">
<property name="width_request">400</property>
<property name="height_request">360</property>
<property name="height_request">380</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Mailnag Configuration</property>
<property name="resizable">False</property>
@@ -41,8 +19,8 @@
<property name="can_focus">False</property>
<property name="margin_left">18</property>
<property name="margin_right">18</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="homogeneous">True</property>
<style>
<class name="linked"/>
@@ -103,20 +81,44 @@
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<child>
<object class="GtkBox" id="box2">
<object class="GtkEventBox" id="eventbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkBox" id="box5">
<object class="GtkBox" id="box2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkImage" id="image_logo">
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage" id="image_logo">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_app_desc">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">APP_DESC</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -125,10 +127,12 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label_app_desc">
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">APP_DESC</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">&lt;a href="https://github.com/pulb/mailnag"&gt;Mailnag&lt;/a&gt; - An extendable mail notification daemon.
Copyright (c) 2011 - 2013 Patrick Ulbrich
and contributors.</property>
<property name="use_markup">True</property>
</object>
<packing>
@@ -137,39 +141,19 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_daemon_enabled">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">&lt;a href="https://github.com/pulb/mailnag"&gt;Mailnag&lt;/a&gt; - An extendable mail notification daemon.
Copyright (c) 2011 - 2013 Patrick Ulbrich
and contributors.</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="switch_daemon_enabled">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
@@ -180,7 +164,6 @@ and contributors.</property>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
@@ -276,7 +259,6 @@ and contributors.</property>
<object class="GtkBox" id="box9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">12</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
@@ -353,4 +335,26 @@ and contributors.</property>
</object>
</child>
</object>
<object class="GtkListStore" id="liststore_accounts">
<columns>
<!-- column-name account_obj -->
<column type="PyObject"/>
<!-- column-name account_enabled -->
<column type="gboolean"/>
<!-- column-name account_name -->
<column type="gchararray"/>
</columns>
<signal name="row-deleted" handler="liststore_accounts_row_deleted" swapped="no"/>
<signal name="row-inserted" handler="liststore_accounts_row_inserted" swapped="no"/>
</object>
<object class="GtkListStore" id="liststore_plugins">
<columns>
<!-- column-name plugin_obj -->
<column type="PyObject"/>
<!-- column-name plugin_enabled -->
<column type="gboolean"/>
<!-- column-name plugin_name -->
<column type="gchararray"/>
</columns>
</object>
</interface>