Commit ef7b44ef authored by Yves Combe's avatar Yves Combe
Browse files

improve boards selection: now menu selection follow childs.

parent b009f4fd
2005-08-12 Yves Combe <yves@ycombe.net>
improve boards selection: now menu selection follow childs.
* po/Makefile.in.in:
* src/boards/python/admin/board_list.py:
2005-08-04 Bruno coudoin <bruno.coudoin@free.fr>
Improved by Yves. Now there is a by level filtering.
......
......@@ -21,6 +21,7 @@ SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
VPATH = @srcdir@
prefix = @prefix@
......@@ -31,17 +32,22 @@ localedir = $(libdir)/locale
gnulocaledir = $(datadir)/locale
gettextsrcdir = $(datadir)/glib-2.0/gettext/po
subdir = po
install_sh = @install_sh@
mkdir_p = @mkdir_p@
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
CC = @CC@
GENCAT = @GENCAT@
GMSGFMT = @GMSGFMT@
MSGFMT = @MSGFMT@
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge
INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
DEFS = @DEFS@
CFLAGS = @CFLAGS@
......@@ -54,7 +60,7 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
SOURCES =
POFILES = @POFILES@
GMOFILES = @GMOFILES@
DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \
DISTFILES = ChangeLog Makefile.in.in POTFILES.in \
$(POFILES) $(GMOFILES) $(SOURCES)
POTFILES = \
......@@ -71,13 +77,13 @@ INSTOBJEXT = @INSTOBJEXT@
.po.pox:
$(MAKE) $(GETTEXT_PACKAGE).pot
$(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
$(MSGMERGE) $< $(top_builddir)/po/$(GETTEXT_PACKAGE).pot -o $*pox
.po.mo:
$(MSGFMT) -o $@ $<
.po.gmo:
file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
file=`echo $* | sed 's,.*/,,'`.gmo \
&& rm -f $$file && $(GMSGFMT) -o $$file $<
.po.cat:
......@@ -90,20 +96,15 @@ all: all-@USE_NLS@
all-yes: $(CATALOGS)
all-no:
$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
--add-comments --keyword=_ --keyword=N_ \
--files-from=$(srcdir)/POTFILES.in \
&& test ! -f $(GETTEXT_PACKAGE).po \
|| ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
&& mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
$(GETTEXT_PACKAGE).pot: $(POTFILES)
$(GENPOT)
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
if test -r "$(MKINSTALLDIRS)"; then \
if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
......@@ -117,7 +118,7 @@ install-data-yes: all
esac; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
if test -r "$(MKINSTALLDIRS)"; then \
if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $$dir; \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
......@@ -145,7 +146,7 @@ install-data-yes: all
fi; \
done
if test "$(PACKAGE)" = "glib"; then \
if test -r "$(MKINSTALLDIRS)"; then \
if test -n "$(MKINSTALLDIRS)"; then \
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
else \
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
......@@ -169,15 +170,18 @@ uninstall:
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \
done
rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
if test "$(PACKAGE)" = "glib"; then \
rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
fi
check: all
dvi info tags TAGS ID:
mostlyclean:
rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp
rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
rm -fr *.o
rm -f .intltool-merge-cache
clean: mostlyclean
......@@ -190,7 +194,7 @@ maintainer-clean: distclean
rm -f $(GMOFILES)
distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir)
dist distdir: update-po $(DISTFILES)
dist distdir: $(DISTFILES) $(GETTEXT_PACKAGE).pot
dists="$(DISTFILES)"; \
for file in $$dists; do \
ln $(srcdir)/$$file $(distdir) 2> /dev/null \
......@@ -199,19 +203,28 @@ dist distdir: update-po $(DISTFILES)
update-po: Makefile
$(MAKE) $(GETTEXT_PACKAGE).pot
cd $(srcdir); \
tmpdir=`pwd`; \
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
mv $$lang.po $$lang.old.po; \
echo "$$lang:"; \
if $(MSGMERGE) $$lang.old.po $(GETTEXT_PACKAGE).pot -o $$lang.po; then \
rm -f $$lang.old.po; \
result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
if $$result; then \
if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$cat failed!"; \
rm -f $$lang.po; \
mv $$lang.old.po $$lang.po; \
rm -f $$tmpdir/$$lang.new.po; \
fi; \
done
......
......@@ -281,6 +281,13 @@ class Board_list:
if model[path][2]:
self.update_parent(model[path].parent)
else:
self.check_parent_active(model[path].parent)
try:
self.update_child(model[path].iterchildren().next(), model[path][2])
except StopIteration:
pass
self.update_selected(model, path)
......@@ -470,7 +477,6 @@ class Board_list:
else:
self.stars[i].set_sensitive(False)
def arrow_clicked(self, arrow, i):
if i < 3:
value = 0
......@@ -492,12 +498,11 @@ class Board_list:
self.update_arrows_active()
def filter_apply(self, button):
self.model.foreach(self.blank)
self.model.foreach(self.board_filter)
# Apply the filter as asked.
def board_filter(self, model, path, iter):
if self.board_dict[model[path][3]].type != "menu":
model[path][2] = ( eval(self.board_dict[model[path][3]].difficulty) \
......@@ -511,10 +516,11 @@ class Board_list:
self.update_selected( model, path)
# toggled off.
def blank(self, model, path, iter):
model[path][2] = False
# This function toggles parents when a child is toggled.
def update_parent( self, row):
if row == None:
return
......@@ -528,4 +534,43 @@ class Board_list:
self.update_selected(row.model, row.path)
# This function toggles parents off when all childs are toggled off.
def check_parent_active( self, row):
if row == None:
return
# should never appends
if not row[2]:
return
child = row.iterchildren().next()
select = False
while child != None:
if child[2]:
select = True
break
child = child.next
if not select:
row[2] = False
self.check_parent_active(row.parent)
self.update_selected(row.model, row.path)
# This function recursively update childs
def update_child( self, row, value):
if row[2] == value:
return
row[2] = value
try:
self.update_child(row.iterchildren().next(), value)
except StopIteration:
pass
if row.next != None:
self.update_child(row.next, value)
self.update_selected(row.model, row.path)
Supports Markdown
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