* src/GrampsCfg.py: update for selectable colors
* src/PeopleModel.py: update for selectable colors * data/gramps.schemas.in: update for selectable colors svn: r6629
This commit is contained in:
parent
683a291155
commit
556eb3aa75
@ -1,6 +1,9 @@
|
|||||||
2006-05-12 Don Allingham <don@gramps-project.org>
|
2006-05-12 Don Allingham <don@gramps-project.org>
|
||||||
* src/GrampsWidgets.py: fix MonitoredDataType initialization
|
* src/GrampsWidgets.py: fix MonitoredDataType initialization
|
||||||
* plugins/BookReport.py: append "file://" properly
|
* plugins/BookReport.py: append "file://" properly
|
||||||
|
* src/GrampsCfg.py: update for selectable colors
|
||||||
|
* src/PeopleModel.py: update for selectable colors
|
||||||
|
* data/gramps.schemas.in: update for selectable colors
|
||||||
|
|
||||||
2006-05-12 Alex Roitman <shura@gramps-project.org>
|
2006-05-12 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/Filters/Makefile.am (pkgdata_PYTHON): Add new files.
|
* src/Filters/Makefile.am (pkgdata_PYTHON): Add new files.
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<applyto>/apps/gramps/preferences/todo-color</applyto>
|
<applyto>/apps/gramps/preferences/todo-color</applyto>
|
||||||
<owner>gramps</owner>
|
<owner>gramps</owner>
|
||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default>#FF0000</default>
|
<default>#00FF00</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Color used to highlight TODO items in a list</short>
|
<short>Color used to highlight TODO items in a list</short>
|
||||||
<long>Color used to highlight TODO items in a list</long>
|
<long>Color used to highlight TODO items in a list</long>
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<applyto>/apps/gramps/preferences/custom-marker-color</applyto>
|
<applyto>/apps/gramps/preferences/custom-marker-color</applyto>
|
||||||
<owner>gramps</owner>
|
<owner>gramps</owner>
|
||||||
<type>string</type>
|
<type>string</type>
|
||||||
<default>#00FF00</default>
|
<default>#0000FF</default>
|
||||||
<locale name="C">
|
<locale name="C">
|
||||||
<short>Color used to highlight custom marker items in a list</short>
|
<short>Color used to highlight custom marker items in a list</short>
|
||||||
<long>Color used to highlight custom marker items in a list</long>
|
<long>Color used to highlight custom marker items in a list</long>
|
||||||
|
@ -112,6 +112,8 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
|||||||
MarkupLabel("<b>%s</b>" % _('Warnings')))
|
MarkupLabel("<b>%s</b>" % _('Warnings')))
|
||||||
panel.append_page(self.add_researcher_panel(),
|
panel.append_page(self.add_researcher_panel(),
|
||||||
MarkupLabel("<b>%s</b>" % _('Researcher')))
|
MarkupLabel("<b>%s</b>" % _('Researcher')))
|
||||||
|
panel.append_page(self.add_color_panel(),
|
||||||
|
MarkupLabel("<b>%s</b>" % _('Marker Colors')))
|
||||||
|
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
self.show()
|
self.show()
|
||||||
@ -164,6 +166,17 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
return table
|
return table
|
||||||
|
|
||||||
|
def add_color_panel(self):
|
||||||
|
table = gtk.Table(3,8)
|
||||||
|
table.set_border_width(12)
|
||||||
|
table.set_col_spacings(6)
|
||||||
|
table.set_row_spacings(6)
|
||||||
|
|
||||||
|
self.add_color(table, _("Complete"), 0, Config.COMPLETE_COLOR)
|
||||||
|
self.add_color(table, _("ToDo"), 1, Config.TODO_COLOR)
|
||||||
|
self.add_color(table, _("Custom"), 2, Config.CUSTOM_MARKER_COLOR)
|
||||||
|
return table
|
||||||
|
|
||||||
def add_formats_panel(self):
|
def add_formats_panel(self):
|
||||||
table = gtk.Table(3,8)
|
table = gtk.Table(3,8)
|
||||||
table.set_border_width(12)
|
table.set_border_width(12)
|
||||||
@ -250,9 +263,25 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
|||||||
table.attach(lwidget, 0, 1, index, index+1, yoptions=0)
|
table.attach(lwidget, 0, 1, index, index+1, yoptions=0)
|
||||||
table.attach(entry, 1, 3, index, index+1, yoptions=0)
|
table.attach(entry, 1, 3, index, index+1, yoptions=0)
|
||||||
|
|
||||||
|
def add_color(self, table, label, index, constant):
|
||||||
|
lwidget = BasicLabel("%s: " % label)
|
||||||
|
hexval = Config.get(constant)
|
||||||
|
color = gtk.gdk.color_parse(hexval)
|
||||||
|
entry = gtk.ColorButton(color=color)
|
||||||
|
entry.connect('color-set', self.update_color, constant)
|
||||||
|
table.attach(lwidget, 0, 1, index, index+1, yoptions=0)
|
||||||
|
table.attach(entry, 1, 3, index, index+1, yoptions=0)
|
||||||
|
|
||||||
def update_entry(self, obj, constant):
|
def update_entry(self, obj, constant):
|
||||||
Config.set(constant, unicode(obj.get_text()))
|
Config.set(constant, unicode(obj.get_text()))
|
||||||
|
|
||||||
|
def update_color(self, obj, constant):
|
||||||
|
color = obj.get_color()
|
||||||
|
hexval = "#%02x%02x%02x" % (color.red/256,
|
||||||
|
color.green/256,
|
||||||
|
color.blue/256)
|
||||||
|
Config.set(constant, hexval)
|
||||||
|
|
||||||
def update_checkbox(self, obj, constant):
|
def update_checkbox(self, obj, constant):
|
||||||
Config.set(constant, obj.get_active())
|
Config.set(constant, obj.get_active())
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ import time
|
|||||||
import cgi
|
import cgi
|
||||||
import sys
|
import sys
|
||||||
import locale
|
import locale
|
||||||
|
import Config
|
||||||
|
|
||||||
try:
|
try:
|
||||||
set()
|
set()
|
||||||
@ -139,6 +140,17 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
|
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|
||||||
|
Config.client.notify_add("/apps/gramps/preferences/todo-color",
|
||||||
|
self.update_todo)
|
||||||
|
Config.client.notify_add("/apps/gramps/preferences/custom-marker-color",
|
||||||
|
self.update_custom)
|
||||||
|
Config.client.notify_add("/apps/gramps/preferences/complete-color",
|
||||||
|
self.update_complete)
|
||||||
|
|
||||||
|
self.complete_color = Config.get(Config.COMPLETE_COLOR)
|
||||||
|
self.todo_color = Config.get(Config.TODO_COLOR)
|
||||||
|
self.custom_color = Config.get(Config.CUSTOM_MARKER_COLOR)
|
||||||
|
|
||||||
self.sortnames = {}
|
self.sortnames = {}
|
||||||
self.marker_color_column = 11
|
self.marker_color_column = 11
|
||||||
self.tooltip_column = 12
|
self.tooltip_column = 12
|
||||||
@ -159,6 +171,15 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
self._build_data = self._build_filter_sub
|
self._build_data = self._build_filter_sub
|
||||||
self.rebuild_data(data_filter, skip)
|
self.rebuild_data(data_filter, skip)
|
||||||
|
|
||||||
|
def update_todo(self,client,cnxn_id,entry,data):
|
||||||
|
self.todo_color = Config.get(Config.TODO_COLOR)
|
||||||
|
|
||||||
|
def update_custom(self,client,cnxn_id,entry,data):
|
||||||
|
self.custom_color = Config.get(Config.CUSTOM_MARKER_COLOR)
|
||||||
|
|
||||||
|
def update_complete(self,client,cnxn_id,entry,data):
|
||||||
|
self.complete_color = Config.get(Config.COMPLETE_COLOR)
|
||||||
|
|
||||||
def rebuild_data(self, data_filter=None, skip=[]):
|
def rebuild_data(self, data_filter=None, skip=[]):
|
||||||
"""
|
"""
|
||||||
Convience function that calculates the new data and assigns it.
|
Convience function that calculates the new data and assigns it.
|
||||||
@ -512,11 +533,11 @@ class PeopleModel(gtk.GenericTreeModel):
|
|||||||
try:
|
try:
|
||||||
if data[_MARKER_COL]:
|
if data[_MARKER_COL]:
|
||||||
if data[_MARKER_COL][0] == MarkerType.COMPLETE:
|
if data[_MARKER_COL][0] == MarkerType.COMPLETE:
|
||||||
return u"#46a046" # green
|
return self.complete_color
|
||||||
if data[_MARKER_COL][0] == MarkerType.TODO:
|
if data[_MARKER_COL][0] == MarkerType.TODO:
|
||||||
return u"#df421e" # red
|
return self.todo_color
|
||||||
if data[_MARKER_COL][0] == MarkerType.CUSTOM:
|
if data[_MARKER_COL][0] == MarkerType.CUSTOM:
|
||||||
return u"#eed680" # ligh brown
|
return self.custom_color
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user