2006-05-31 Alex Roitman <shura@gramps-project.org>
* src/Selectors/_SelectPerson.py (__init__): take track argument. * src/Editors/_EditFamily.py: Adapt to SelectPerson change. * src/Editors/_EditPersonRef.py (_select_person): Adapt to SelectPerson change. * src/ReportBase/_BareReportDialog.py: Use dbstata and uistate, convert to Managed window. * src/ReportBase/_ReportDialog.py: Use dbstate and uistate. * src/ReportBase/_DrawReportDialog.py: Use dbstate and uistate. * src/ReportBase/_TextReportDialog.py: Use dbstate and uistate. * src/ViewManager.py (make_report_callback): Use dbstate and uistate. svn: r6830
This commit is contained in:
parent
5310057173
commit
cb63f90caa
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
2006-05-31 Alex Roitman <shura@gramps-project.org>
|
||||
* src/Selectors/_SelectPerson.py (__init__): take track argument.
|
||||
* src/Editors/_EditFamily.py: Adapt to SelectPerson change.
|
||||
* src/Editors/_EditPersonRef.py (_select_person): Adapt to
|
||||
SelectPerson change.
|
||||
* src/ReportBase/_BareReportDialog.py: Use dbstata and uistate,
|
||||
convert to Managed window.
|
||||
* src/ReportBase/_ReportDialog.py: Use dbstate and uistate.
|
||||
* src/ReportBase/_DrawReportDialog.py: Use dbstate and uistate.
|
||||
* src/ReportBase/_TextReportDialog.py: Use dbstate and uistate.
|
||||
* src/ViewManager.py (make_report_callback): Use dbstate and uistate.
|
||||
|
||||
2006-05-30 Don Allingham <don@gramps-project.org>
|
||||
* src/plugins/FilterEditor.py: start to bring into sync with
|
||||
code changes
|
||||
|
@ -224,8 +224,8 @@ class ChildEmbedList(EmbeddedList):
|
||||
self.family.get_mother_handle()] + \
|
||||
[x.ref for x in self.family.get_child_ref_list() ]
|
||||
|
||||
sel = SelectPerson(self.dbstate, self.uistate, _("Select Child"),
|
||||
skip=skip_list)
|
||||
sel = SelectPerson(self.dbstate, self.uistate, self.track,
|
||||
_("Select Child"), skip=skip_list)
|
||||
person = sel.run()
|
||||
|
||||
if person:
|
||||
@ -236,8 +236,8 @@ class ChildEmbedList(EmbeddedList):
|
||||
|
||||
def run(self,skip):
|
||||
skip_list = [ x for x in skip if x]
|
||||
SelectPerson(self.dbstate, self.uistate, _("Select Child"),
|
||||
skip=skip_list)
|
||||
SelectPerson(self.dbstate, self.uistate, self.track,
|
||||
_("Select Child"), skip=skip_list)
|
||||
|
||||
def del_button_clicked(self,obj):
|
||||
handle = self.get_selected()
|
||||
@ -542,7 +542,7 @@ class EditFamily(EditPrimary):
|
||||
self.update_mother(None)
|
||||
else:
|
||||
data_filter = FastFemaleFilter(self.dbstate.db)
|
||||
sel = SelectPerson(self.dbstate, self.uistate,
|
||||
sel = SelectPerson(self.dbstate, self.uistate, self.track,
|
||||
_("Select Mother"),
|
||||
filter=data_filter,
|
||||
skip=[x.ref for x in self.obj.get_child_ref_list()])
|
||||
@ -586,7 +586,7 @@ class EditFamily(EditPrimary):
|
||||
self.update_father(None)
|
||||
else:
|
||||
data_filter = FastMaleFilter(self.dbstate.db)
|
||||
sel = SelectPerson(self.dbstate, self.uistate,
|
||||
sel = SelectPerson(self.dbstate, self.uistate, self.track,
|
||||
_("Select Father"),
|
||||
filter=data_filter,
|
||||
skip=[x.ref for x in self.obj.get_child_ref_list()])
|
||||
|
@ -103,7 +103,7 @@ class EditPersonRef(EditSecondary):
|
||||
from Selectors import selector_factory
|
||||
SelectPerson = selector_factory('Person')
|
||||
|
||||
sel = SelectPerson(self.dbstate, self.uistate, "Select Person")
|
||||
sel = SelectPerson(self.dbstate, self.uistate, self.track)
|
||||
person = sel.run()
|
||||
|
||||
if person:
|
||||
|
@ -20,14 +20,36 @@
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from types import ClassType, InstanceType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import NameDisplay
|
||||
import BaseDoc
|
||||
import ManagedWindow
|
||||
from _StyleComboBox import StyleComboBox
|
||||
|
||||
class BareReportDialog:
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# BareReportDialog class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class BareReportDialog(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
The BareReportDialog base class. This is a base class for generating
|
||||
customized dialogs to solicit some options for a report. This class
|
||||
@ -40,19 +62,36 @@ class BareReportDialog:
|
||||
frame_pad = 5
|
||||
border_pad = 6
|
||||
|
||||
def __init__(self,database,person,option_class,name,translated_name):
|
||||
def __init__(self,dbstate,uistate,person,option_class,
|
||||
name,translated_name,track=[]):
|
||||
"""Initialize a dialog to request that the user select options
|
||||
for a basic *bare* report."""
|
||||
|
||||
self.db = database
|
||||
self.dbstate = dbstate
|
||||
self.uistate = uistate
|
||||
self.db = dbstate.db
|
||||
self.person = person
|
||||
self.report_name = translated_name
|
||||
self.raw_name = name
|
||||
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
|
||||
|
||||
if type(option_class) == ClassType:
|
||||
self.options = option_class(name)
|
||||
elif type(option_class) == InstanceType:
|
||||
self.options = option_class
|
||||
self.report_name = translated_name
|
||||
|
||||
self.init_interface()
|
||||
|
||||
def build_window_key(self,obj):
|
||||
key = self.raw_name
|
||||
if self.person:
|
||||
key += self.person.get_handle()
|
||||
return key
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (self.report_name,None)
|
||||
|
||||
def init_interface(self):
|
||||
#self.output_notebook = None
|
||||
#self.notebook_page = 1
|
||||
@ -69,13 +108,15 @@ class BareReportDialog:
|
||||
self.style_button = None
|
||||
|
||||
self.style_name = self.options.handler.get_default_stylesheet_name()
|
||||
(self.max_gen,self.page_breaks) = self.options.handler.get_report_generations()
|
||||
(self.max_gen,self.page_breaks) = \
|
||||
self.options.handler.get_report_generations()
|
||||
try:
|
||||
self.local_filters = self.options.get_report_filters(self.person)
|
||||
except AttributeError:
|
||||
self.local_filters = []
|
||||
|
||||
self.window = gtk.Dialog('GRAMPS')
|
||||
window = gtk.Dialog('GRAMPS')
|
||||
self.set_window(window,None,self.get_title())
|
||||
self.window.set_has_separator(False)
|
||||
self.cancel = self.window.add_button(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL)
|
||||
self.ok = self.window.add_button(gtk.STOCK_OK,gtk.RESPONSE_OK)
|
||||
@ -612,7 +653,7 @@ class BareReportDialog:
|
||||
def on_center_person_change_clicked(self,*obj):
|
||||
from Selectors import selector_factory
|
||||
SelectPerson = selector_factory('Person')
|
||||
sel_person = SelectPerson(self.db,_('Select Person'))
|
||||
sel_person = SelectPerson(self.dbstate,self.uistate,self.track)
|
||||
new_person = sel_person.run()
|
||||
if new_person:
|
||||
self.new_person = new_person
|
||||
|
@ -31,12 +31,13 @@ from _DrawFormatComboBox import DrawFormatComboBox
|
||||
#-----------------------------------------------------------------------
|
||||
class DrawReportDialog(ReportDialog):
|
||||
"""A class of ReportDialog customized for drawing based reports."""
|
||||
def __init__(self,database,person,opt,name,translated_name):
|
||||
def __init__(self,dbstate,uistate,person,opt,name,translated_name):
|
||||
"""Initialize a dialog to request that the user select options
|
||||
for a basic drawing report. See the ReportDialog class for
|
||||
more information."""
|
||||
self.category = CATEGORY_DRAW
|
||||
ReportDialog.__init__(self,database,person,opt,name,translated_name)
|
||||
ReportDialog.__init__(self,dbstate,uistate,person,opt,
|
||||
name,translated_name)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -20,9 +20,25 @@
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK+ modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Config
|
||||
import Errors
|
||||
from QuestionDialog import ErrorDialog, OptionDialog
|
||||
@ -34,6 +50,11 @@ from _FileEntry import FileEntry
|
||||
from _PaperMenu import PaperComboBox, OrientationComboBox, paper_sizes
|
||||
from _TemplateParser import _template_map, _default_template, _user_template
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# ReportDialog class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class ReportDialog(BareReportDialog):
|
||||
"""
|
||||
The ReportDialog base class. This is a base class for generating
|
||||
@ -42,14 +63,14 @@ class ReportDialog(BareReportDialog):
|
||||
dialog for a stand-alone report.
|
||||
"""
|
||||
|
||||
def __init__(self,database,person,option_class,name,translated_name):
|
||||
def __init__(self,dbstate,uistate,person,option_class,name,trans_name):
|
||||
"""Initialize a dialog to request that the user select options
|
||||
for a basic *stand-alone* report."""
|
||||
|
||||
self.style_name = "default"
|
||||
self.page_html_added = False
|
||||
BareReportDialog.__init__(self,database,person,option_class,
|
||||
name,translated_name)
|
||||
BareReportDialog.__init__(self,dbstate,uistate,person,option_class,
|
||||
name,trans_name)
|
||||
|
||||
# Allow for post processing of the format frame, since the
|
||||
# show_all task calls events that may reset values
|
||||
@ -530,7 +551,8 @@ class ReportDialog(BareReportDialog):
|
||||
if self.pagecount_menu == None:
|
||||
self.pagecount = 0
|
||||
else:
|
||||
self.pagecount = self.pagecount_menu.get_menu().get_active().get_data("d")
|
||||
self.pagecount = \
|
||||
self.pagecount_menu.get_menu().get_active().get_data("d")
|
||||
|
||||
def parse_html_frame(self):
|
||||
"""Parse the html frame of the dialog. Save the user selected
|
||||
@ -546,7 +568,8 @@ class ReportDialog(BareReportDialog):
|
||||
if text == _user_template:
|
||||
self.template_name = self.html_fileentry.get_full_path(0)
|
||||
else:
|
||||
self.template_name = "%s/%s" % (const.template_dir,_template_map[text])
|
||||
self.template_name = "%s/%s" % (const.template_dir,
|
||||
_template_map[text])
|
||||
else:
|
||||
self.template_name = ""
|
||||
self.options.handler.set_template_name(self.template_name)
|
||||
@ -580,8 +603,8 @@ class ReportDialog(BareReportDialog):
|
||||
# Generic task function a standalone GUI report
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def report(database,person,report_class,options_class,
|
||||
translated_name,name,category):
|
||||
def report(dbstate,uistate,person,report_class,options_class,
|
||||
trans_name,name,category):
|
||||
"""
|
||||
report - task starts the report. The plugin system requires that the
|
||||
task be in the format of task that takes a database and a person as
|
||||
@ -594,14 +617,13 @@ def report(database,person,report_class,options_class,
|
||||
elif category == CATEGORY_DRAW:
|
||||
from _DrawReportDialog import DrawReportDialog
|
||||
dialog_class = DrawReportDialog
|
||||
elif category in (CATEGORY_BOOK,CATEGORY_VIEW,
|
||||
CATEGORY_CODE,CATEGORY_WEB):
|
||||
report_class(database,person)
|
||||
elif category in (CATEGORY_BOOK,CATEGORY_VIEW,CATEGORY_CODE,CATEGORY_WEB):
|
||||
report_class(dbstate,uistate,person)
|
||||
return
|
||||
else:
|
||||
dialog_class = ReportDialog
|
||||
|
||||
dialog = dialog_class(database,person,options_class,name,translated_name)
|
||||
dialog = dialog_class(dbstate,uistate,person,options_class,name,trans_name)
|
||||
response = dialog.window.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
try:
|
||||
@ -620,4 +642,4 @@ def report(database,person,report_class,options_class,
|
||||
ErrorDialog(_("Report could not be created"),str(msg))
|
||||
except:
|
||||
log.error("Failed to run report.", exc_info=True)
|
||||
dialog.window.destroy()
|
||||
dialog.close()
|
||||
|
@ -32,12 +32,13 @@ from _TextFormatComboBox import TextFormatComboBox
|
||||
class TextReportDialog(ReportDialog):
|
||||
"""A class of ReportDialog customized for text based reports."""
|
||||
|
||||
def __init__(self,database,person,options,name,translated_name):
|
||||
def __init__(self,dbstate,uistate,person,options,name,translated_name):
|
||||
"""Initialize a dialog to request that the user select options
|
||||
for a basic text report. See the ReportDialog class for more
|
||||
information."""
|
||||
self.category = CATEGORY_TEXT
|
||||
ReportDialog.__init__(self,database,person,options,name,translated_name)
|
||||
ReportDialog.__init__(self,dbstate,uistate,person,options,
|
||||
name,translated_name)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -52,9 +52,14 @@ import ManagedWindow
|
||||
#-------------------------------------------------------------------------
|
||||
class SelectPerson(ManagedWindow.ManagedWindow):
|
||||
|
||||
def __init__(self, dbstate, uistate, title, filter=None, skip=[]):
|
||||
def __init__(self, dbstate, uistate, track=[], title='',
|
||||
filter=None, skip=[]):
|
||||
if title:
|
||||
self.title = title
|
||||
else:
|
||||
self.title = _("Select Person")
|
||||
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
|
||||
|
||||
self.renderer = gtk.CellRendererText()
|
||||
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
|
||||
@ -63,11 +68,9 @@ class SelectPerson(ManagedWindow.ManagedWindow):
|
||||
self.plist = self.glade.get_widget('plist')
|
||||
self.notebook = self.glade.get_widget('notebook')
|
||||
|
||||
self.set_window(
|
||||
self.glade.get_widget('select_person'),
|
||||
self.glade.get_widget('title'),
|
||||
title)
|
||||
|
||||
window = self.glade.get_widget('select_person')
|
||||
title_label = self.glade.get_widget('title')
|
||||
self.set_window(window,title_label,self.title)
|
||||
self.model = PeopleModel(self.db,
|
||||
(PeopleModel.FAST, filter),
|
||||
skip=skip)
|
||||
@ -77,7 +80,7 @@ class SelectPerson(ManagedWindow.ManagedWindow):
|
||||
self.show()
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (_('Select Person'), None)
|
||||
return (self.title, None)
|
||||
|
||||
def add_columns(self,tree):
|
||||
tree.set_fixed_height_mode(True)
|
||||
|
@ -966,8 +966,8 @@ def by_menu_name(a, b):
|
||||
|
||||
|
||||
def make_report_callback(lst, dbstate, uistate):
|
||||
return lambda x: report(dbstate.db, dbstate.get_active_person(),
|
||||
lst[0], lst[1], lst[2], lst[3], lst[4])
|
||||
return lambda x: report(dbstate, uistate, dbstate.get_active_person(),
|
||||
lst[0], lst[1], lst[2], lst[3], lst[4])
|
||||
|
||||
def make_tool_callback(lst, dbstate, uistate):
|
||||
return lambda x: Tool.gui_tool(dbstate, uistate,
|
||||
|
Loading…
Reference in New Issue
Block a user