* src/ReportBase/_ReportDialog.py (report): Use new report modules
for oddball reports. * src/plugins/GraphViz.py: Use new report modules. * src/plugins/NarrativeWeb.py: Use new report modules. * src/plugins/CountAncestors.py: Use wm and new report modules. * src/plugins/Summary.py: Use wm and new report modules. svn: r6842
This commit is contained in:
parent
51f42ca315
commit
c1c7e1359a
@ -1,4 +1,10 @@
|
|||||||
2006-06-01 Alex Roitman <shura@gramps-project.org>
|
2006-06-01 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/ReportBase/_ReportDialog.py (report): Use new report modules
|
||||||
|
for oddball reports.
|
||||||
|
* src/plugins/GraphViz.py: Use new report modules.
|
||||||
|
* src/plugins/NarrativeWeb.py: Use new report modules.
|
||||||
|
* src/plugins/CountAncestors.py: Use wm and new report modules.
|
||||||
|
* src/plugins/Summary.py: Use wm and new report modules.
|
||||||
* src/ReportBase/_BareReportDialog.py: import FilterComboBox.
|
* src/ReportBase/_BareReportDialog.py: import FilterComboBox.
|
||||||
|
|
||||||
2006-06-01 Don Allingham <don@gramps-project.org>
|
2006-06-01 Don Allingham <don@gramps-project.org>
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
|
log = logging.getLogger(".")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -617,15 +619,12 @@ def report(dbstate,uistate,person,report_class,options_class,
|
|||||||
elif category == CATEGORY_DRAW:
|
elif category == CATEGORY_DRAW:
|
||||||
from _DrawReportDialog import DrawReportDialog
|
from _DrawReportDialog import DrawReportDialog
|
||||||
dialog_class = DrawReportDialog
|
dialog_class = DrawReportDialog
|
||||||
elif category == CATEGORY_BOOK:
|
elif category in (CATEGORY_BOOK,CATEGORY_CODE,CATEGORY_VIEW,CATEGORY_WEB):
|
||||||
try:
|
try:
|
||||||
report_class(dbstate,uistate,person)
|
report_class(dbstate,uistate,person)
|
||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
pass
|
pass
|
||||||
return
|
return
|
||||||
elif category in (CATEGORY_VIEW,CATEGORY_CODE,CATEGORY_WEB):
|
|
||||||
report_class(dbstate.db,person)
|
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
dialog_class = ReportDialog
|
dialog_class = ReportDialog
|
||||||
|
|
||||||
|
@ -30,8 +30,11 @@
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import os
|
import os
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from sets import Set
|
|
||||||
from math import pow
|
from math import pow
|
||||||
|
try:
|
||||||
|
set()
|
||||||
|
except NameError:
|
||||||
|
from sets import Set as set
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -45,38 +48,40 @@ import gtk.glade
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import Utils
|
|
||||||
from PluginUtils import register_report
|
from PluginUtils import register_report
|
||||||
from ReportBase import Report, CATEGORY_VIEW, MODE_GUI
|
from ReportBase import CATEGORY_VIEW, MODE_GUI
|
||||||
from ManagedWindow import set_titles
|
import ManagedWindow
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class CountAncestors:
|
class CountAncestors(ManagedWindow.ManagedWindow):
|
||||||
|
|
||||||
def __init__(self,database,person):
|
def __init__(self,dbstate,uistate,person):
|
||||||
|
self.title = _('Ancestors of "%s"') \
|
||||||
|
% person.get_primary_name().get_name()
|
||||||
|
|
||||||
|
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
|
||||||
|
|
||||||
|
database = dbstate.db
|
||||||
text = ""
|
text = ""
|
||||||
glade_file = "%s/summary.glade" % os.path.dirname(__file__)
|
glade_file = "%s/summary.glade" % os.path.dirname(__file__)
|
||||||
topDialog = gtk.glade.XML(glade_file,"summary","gramps")
|
topDialog = gtk.glade.XML(glade_file,"summary","gramps")
|
||||||
topDialog.signal_autoconnect({
|
topDialog.signal_autoconnect({
|
||||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
"destroy_passed_object" : self.close,
|
||||||
})
|
})
|
||||||
thisgen = Set()
|
thisgen = set()
|
||||||
all = Set()
|
all = set()
|
||||||
allgen = 0
|
allgen = 0
|
||||||
total_theoretical = 0
|
total_theoretical = 0
|
||||||
thisgen.add(person.get_handle())
|
thisgen.add(person.get_handle())
|
||||||
|
|
||||||
title_text = _('Ancestors of "%s"') \
|
|
||||||
% person.get_primary_name().get_name()
|
|
||||||
|
|
||||||
top = topDialog.get_widget("summary")
|
window = topDialog.get_widget("summary")
|
||||||
title = topDialog.get_widget("title")
|
title = topDialog.get_widget("title")
|
||||||
set_titles(top,title,title_text)
|
self.set_window(window,title,self.title)
|
||||||
|
|
||||||
thisgensize = 1
|
thisgensize = 1
|
||||||
gen = 0
|
gen = 0
|
||||||
@ -89,11 +94,13 @@ class CountAncestors:
|
|||||||
total_theoretical += theoretical
|
total_theoretical += theoretical
|
||||||
percent = ( thisgensize / theoretical ) * 100
|
percent = ( thisgensize / theoretical ) * 100
|
||||||
if thisgensize == 1 :
|
if thisgensize == 1 :
|
||||||
text += _("Generation %d has 1 individual. (%3.2f%%)\n") % (gen,percent)
|
text += _("Generation %d has 1 individual. (%3.2f%%)\n") \
|
||||||
|
% (gen,percent)
|
||||||
else:
|
else:
|
||||||
text += _("Generation %d has %d individuals. (%3.2f%%)\n") % (gen,thisgensize,percent)
|
text += _("Generation %d has %d individuals. (%3.2f%%)\n")\
|
||||||
|
% (gen,thisgensize,percent)
|
||||||
temp = thisgen
|
temp = thisgen
|
||||||
thisgen = Set()
|
thisgen = set()
|
||||||
for person_handle in temp:
|
for person_handle in temp:
|
||||||
person = database.get_person_from_handle(person_handle)
|
person = database.get_person_from_handle(person_handle)
|
||||||
family_handle = person.get_main_parents_family_handle()
|
family_handle = person.get_main_parents_family_handle()
|
||||||
@ -114,11 +121,15 @@ class CountAncestors:
|
|||||||
else:
|
else:
|
||||||
percent = 0
|
percent = 0
|
||||||
|
|
||||||
text += _("Total ancestors in generations 2 to %d is %d. (%3.2f%%)\n") % (gen,allgen,percent)
|
text += _("Total ancestors in generations 2 to %d is %d. (%3.2f%%)\n")\
|
||||||
|
% (gen,allgen,percent)
|
||||||
|
|
||||||
textwindow = topDialog.get_widget("textwindow")
|
textwindow = topDialog.get_widget("textwindow")
|
||||||
textwindow.get_buffer().set_text(text)
|
textwindow.get_buffer().set_text(text)
|
||||||
top.show()
|
self.show()
|
||||||
|
|
||||||
|
def build_menu_names(self,obj):
|
||||||
|
return (self.title,None)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -132,6 +143,6 @@ register_report(
|
|||||||
options_class = None,
|
options_class = None,
|
||||||
modes = MODE_GUI,
|
modes = MODE_GUI,
|
||||||
translated_name = _("Number of ancestors"),
|
translated_name = _("Number of ancestors"),
|
||||||
status = _("Beta"),
|
status = _("Stable"),
|
||||||
description= _("Counts number of ancestors of selected person")
|
description= _("Counts number of ancestors of selected person")
|
||||||
)
|
)
|
||||||
|
@ -928,22 +928,22 @@ class GraphVizOptions(ReportOptions):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class GraphVizDialog(ReportDialog):
|
class GraphVizDialog(ReportDialog):
|
||||||
|
|
||||||
def __init__(self,database,person):
|
def __init__(self,dbstate,uistate,person):
|
||||||
self.database = database
|
self.database = dbstate.db
|
||||||
self.person = person
|
self.person = person
|
||||||
name = "rel_graph"
|
name = "rel_graph"
|
||||||
translated_name = _("Relationship Graph")
|
translated_name = _("Relationship Graph")
|
||||||
self.options_class = GraphVizOptions(name)
|
self.options_class = GraphVizOptions(name)
|
||||||
self.category = CATEGORY_CODE
|
self.category = CATEGORY_CODE
|
||||||
ReportDialog.__init__(self,database,person,self.options_class,
|
ReportDialog.__init__(self,dbstate,uistate,person,self.options_class,
|
||||||
name,translated_name)
|
name,translated_name)
|
||||||
response = self.window.run()
|
response = self.window.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
try:
|
try:
|
||||||
self.make_report()
|
self.make_report()
|
||||||
except (IOError,OSError),msg:
|
except (IOError,OSError),msg:
|
||||||
ErrorDialog(str(msg))
|
ErrorDialog(str(msg))
|
||||||
self.window.destroy()
|
self.close()
|
||||||
|
|
||||||
def make_doc_menu(self,active=None):
|
def make_doc_menu(self,active=None):
|
||||||
"""Build a one item menu of document types that are
|
"""Build a one item menu of document types that are
|
||||||
|
@ -2591,21 +2591,21 @@ class WebReportOptions(ReportOptions):
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class WebReportDialog(ReportDialog):
|
class WebReportDialog(ReportDialog):
|
||||||
|
|
||||||
def __init__(self,database,person):
|
def __init__(self,dbstate,uistate,person):
|
||||||
self.database = database
|
self.database = dbstate.db
|
||||||
self.person = person
|
self.person = person
|
||||||
name = "navwebpage"
|
name = "navwebpage"
|
||||||
translated_name = _("Generate Web Site")
|
translated_name = _("Generate Web Site")
|
||||||
self.options = WebReportOptions(name,database)
|
self.options = WebReportOptions(name,self.database)
|
||||||
self.category = CATEGORY_WEB
|
self.category = CATEGORY_WEB
|
||||||
ReportDialog.__init__(self,database,person,self.options,
|
ReportDialog.__init__(self,dbstate,uistate,person,self.options,
|
||||||
name,translated_name)
|
name,translated_name)
|
||||||
self.style_name = None
|
self.style_name = None
|
||||||
|
|
||||||
response = self.window.run()
|
response = self.window.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
self.make_report()
|
self.make_report()
|
||||||
self.window.destroy()
|
self.close()
|
||||||
|
|
||||||
def setup_style_frame(self):
|
def setup_style_frame(self):
|
||||||
"""The style frame is not used in this dialog."""
|
"""The style frame is not used in this dialog."""
|
||||||
@ -2747,7 +2747,7 @@ def sort_people(db,handle_list):
|
|||||||
def cl_report(database,name,category,options_str_dict):
|
def cl_report(database,name,category,options_str_dict):
|
||||||
|
|
||||||
clr = CommandLineReport(database,name,category,WebReportOptions,
|
clr = CommandLineReport(database,name,category,WebReportOptions,
|
||||||
options_str_dict)
|
options_str_dict)
|
||||||
|
|
||||||
# Exit here if show option was given
|
# Exit here if show option was given
|
||||||
if clr.show:
|
if clr.show:
|
||||||
|
@ -43,12 +43,11 @@ import gtk.glade
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import Utils
|
|
||||||
import RelLib
|
import RelLib
|
||||||
from PluginUtils import register_report
|
from PluginUtils import register_report
|
||||||
from ReportBase import Report, CATEGORY_VIEW, MODE_GUI
|
from ReportBase import CATEGORY_VIEW, MODE_GUI
|
||||||
import DateHandler
|
import DateHandler
|
||||||
from ManagedWindow import set_titles
|
import ManagedWindow
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -141,8 +140,12 @@ def build_report(database,person):
|
|||||||
# Output report in a window
|
# Output report in a window
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class SummaryReport:
|
class SummaryReport(ManagedWindow.ManagedWindow):
|
||||||
def __init__(self,database,person):
|
def __init__(self,dbstate,uistate,person):
|
||||||
|
self.title = _('Database summary')
|
||||||
|
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
|
||||||
|
|
||||||
|
database = dbstate.db
|
||||||
text = build_report(database,person)
|
text = build_report(database,person)
|
||||||
|
|
||||||
base = os.path.dirname(__file__)
|
base = os.path.dirname(__file__)
|
||||||
@ -150,18 +153,17 @@ class SummaryReport:
|
|||||||
|
|
||||||
topDialog = gtk.glade.XML(glade_file,"summary","gramps")
|
topDialog = gtk.glade.XML(glade_file,"summary","gramps")
|
||||||
topDialog.signal_autoconnect({
|
topDialog.signal_autoconnect({
|
||||||
"destroy_passed_object" : Utils.destroy_passed_object,
|
"destroy_passed_object" : self.close,
|
||||||
})
|
})
|
||||||
|
|
||||||
set_titles(topDialog.get_widget('summary'),
|
window = topDialog.get_widget("summary")
|
||||||
topDialog.get_widget('title'),
|
self.set_window(window,topDialog.get_widget('title'),self.title)
|
||||||
_('Database summary'))
|
|
||||||
|
|
||||||
|
|
||||||
top = topDialog.get_widget("summary")
|
|
||||||
textwindow = topDialog.get_widget("textwindow")
|
textwindow = topDialog.get_widget("textwindow")
|
||||||
textwindow.get_buffer().set_text(text)
|
textwindow.get_buffer().set_text(text)
|
||||||
top.show()
|
self.show()
|
||||||
|
|
||||||
|
def build_menu_names(self,obj):
|
||||||
|
return (self.title,None)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user