pychecker fixes

svn: r6407
This commit is contained in:
Don Allingham 2006-04-22 03:23:57 +00:00
parent 33decd724d
commit d894db5ce8
22 changed files with 39 additions and 57 deletions

View File

@ -36,7 +36,6 @@ import RelLib
import PageView
import DisplayModels
import const
import Utils
import Errors
from QuestionDialog import QuestionDialog, ErrorDialog

View File

@ -4,8 +4,6 @@
#
#-------------------------------------------------------------------------
from gettext import gettext as _
import gc
import re
import cgi
#-------------------------------------------------------------------------
@ -13,9 +11,7 @@ import cgi
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gobject
import gtk
import pango
#-------------------------------------------------------------------------
#
@ -25,12 +21,13 @@ import pango
import RelLib
import PageView
import NameDisplay
import Utils
import DateHandler
import ImgManip
import Config
import GrampsWidgets
import Errors
import GrampsDb
from PluginUtils import ReportUtils
_GenderCode = {
@ -397,7 +394,6 @@ class FamilyView(PageView.PersonNavView):
pname = self.place_name(phandle)
else:
pname = None
date_str = DateHandler.displayer.display(dobj)
value = {
'date' : DateHandler.displayer.display(dobj),
@ -473,7 +469,7 @@ class FamilyView(PageView.PersonNavView):
family = self.dbstate.db.get_family_from_handle(family_handle)
if not family:
return
self.write_label("%s:" % _('Parents'), family, True),
self.write_label("%s:" % _('Parents'), family, True)
self.write_person(_('Father'), family.get_father_handle())
if self.show_details:
value = self.info_string(family.get_father_handle())
@ -609,7 +605,6 @@ class FamilyView(PageView.PersonNavView):
pname = self.place_name(phandle)
else:
pname = None
date_str = DateHandler.displayer.display(dobj)
value = {
'date' : DateHandler.displayer.display(dobj),
@ -716,7 +711,8 @@ class FamilyView(PageView.PersonNavView):
family = dialog.run()
if family:
person = self.dbstate.db.get_person_from_handle(self.dbstate.active.handle)
active_handle = self.dbstate.active.handle
child = self.dbstate.db.get_person_from_handle(active_handle)
GrampsDb.add_child_to_family(family, child,
RelLib.ChildRef(),
RelLib.ChildRef())
@ -738,14 +734,12 @@ class FamilyView(PageView.PersonNavView):
def delete_family(self, obj, event, handle):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
import GrampsDb
GrampsDb.remove_parent_from_family(self.dbstate.db,
self.dbstate.active.handle,
handle)
def delete_parent_family(self, obj, event, handle):
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
import GrampsDb
GrampsDb.remove_child_from_family(self.dbstate.db,
self.dbstate.active.handle,
handle)

View File

@ -27,7 +27,6 @@
#-------------------------------------------------------------------------
from gettext import gettext as _
import gc
import re
import logging
import os
import math
@ -48,7 +47,6 @@ import gtk.gdk
# Gramps Modules
#
#-------------------------------------------------------------------------
import RelLib
import PageView
import const

View File

@ -78,7 +78,7 @@ class MediaView(PageView.ListView):
def define_actions(self):
PageView.ListView.define_actions(self)
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
'_Column Editor', callback=self.column_editor),
'_Column Editor', callback=self.column_editor)
def column_editor(self,obj):
import ColumnOrder
@ -145,11 +145,6 @@ class MediaView(PageView.ListView):
</popup>
</ui>'''
def on_double_click(self,obj,event):
handle = self.first_selected()
if handle:
media_obj = self.dbstate.db.get_object_from_handle(handle)
def add(self,obj):
"""Add a new media object to the media list"""
import AddMedia

View File

@ -119,7 +119,7 @@ class PersonView(PageView.PersonNavView):
self.add_toggle_action('Filter', None, '_Filter', None, None,
self.filter_toggle)
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
'_Column Editor', callback=self.column_editor),
'_Column Editor', callback=self.column_editor)
def column_editor(self,obj):
import ColumnOrder

View File

@ -85,7 +85,7 @@ class PlaceView(PageView.ListView):
def define_actions(self):
PageView.ListView.define_actions(self)
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
'_Column Editor', callback=self.column_editor),
'_Column Editor', callback=self.column_editor)
def column_editor(self,obj):
import ColumnOrder

View File

@ -90,7 +90,7 @@ class RepositoryView(PageView.ListView):
def define_actions(self):
PageView.ListView.define_actions(self)
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
'_Column Editor', callback=self.column_editor),
'_Column Editor', callback=self.column_editor)
def column_editor(self,obj):
import ColumnOrder

View File

@ -84,7 +84,7 @@ class SourceView(PageView.ListView):
def define_actions(self):
PageView.ListView.define_actions(self)
self.add_action('ColumnEdit', gtk.STOCK_PROPERTIES,
'_Column Editor', callback=self.column_editor),
'_Column Editor', callback=self.column_editor)
def column_editor(self,obj):
import ColumnOrder

View File

@ -77,9 +77,6 @@ class EditAttribute(EditSecondary):
self.alist = data_list
EditSecondary.__init__(self, state, uistate, track, attrib, callback)
def attribute_list(self):
return Utils.personal_attributes
def _local_init(self):
self.top = gtk.glade.XML(const.gladeFile, "attr_edit","gramps")
self.define_top_level(self.top.get_widget("attr_edit"),
@ -120,8 +117,8 @@ class EditAttribute(EditSecondary):
self.obj.get_note_object()))
notebook.show_all()
vbox = self.top.get_widget('vbox').pack_start(notebook,True)
self.top.get_widget('vbox').pack_start(notebook,True)
def build_menu_names(self, attrib):
if not attrib:
label = _("New Attribute")
@ -162,7 +159,4 @@ class EditFamilyAttribute(EditAttribute):
"""
EditAttribute.__init__(self, state, uistate, track, attrib, title,
data_list, callback)
def attribute_list(self):
return Utils.family_attributes

View File

@ -212,7 +212,7 @@ class EditEvent(EditPrimary):
if self.callback:
self.callback(self.obj)
self.close(obj)
self.close()
def data_has_changed(self):
if self.db.readonly:

View File

@ -221,9 +221,6 @@ class EditFamilyEventRef(EditEventRef):
self.commit_event = self.db.commit_family_event
self.add_event = self.db.add_family_event
def get_roles(self):
return Utils.event_roles
def get_custom_events(self):
return [ RelLib.EventType((RelLib.EventType.CUSTOM,val)) \
for val in self.dbstate.db.get_family_event_types()]

View File

@ -212,7 +212,7 @@ class EditLdsOrd(EditSecondary):
self.obj.get_note_object()))
notebook.show_all()
vbox = self.top.get_widget('vbox').pack_start(notebook,True)
self.top.get_widget('vbox').pack_start(notebook,True)
def select_parents_clicked(self, obj):
from SelectFamily import SelectFamily
@ -380,7 +380,7 @@ class EditFamilyLdsOrd(EditSecondary):
self.obj.get_note_object()))
notebook.show_all()
vbox = self.top.get_widget('vbox').pack_start(notebook,True)
self.top.get_widget('vbox').pack_start(notebook,True)
def build_menu_names(self, attrib):
label = _("LDS Ordinance")

View File

@ -108,5 +108,5 @@ class EditLocation(EditSecondary):
def save(self,*obj):
if self.callback:
self.callback(self.obj)
self.close(obj)
self.close()

View File

@ -46,7 +46,6 @@ import Utils
import RelLib
import Mime
import ImgManip
import DisplayState
import GrampsDisplay
from DisplayTabs import *

View File

@ -205,7 +205,7 @@ class EditPlace(EditPrimary):
self.db.transaction_commit(trans,
_("Edit Place (%s)") % self.obj.get_title())
self.close(obj)
self.close()
#-------------------------------------------------------------------------
#

View File

@ -137,6 +137,7 @@ class EditReference(ManagedWindow.ManagedWindow):
button.connect('clicked',self.close_window)
def define_help_button(self,button,tag):
import GrampsDisplay
button.connect('clicked', lambda x: GrampsDisplay.help(tag))
def _cleanup_on_exit(self):

View File

@ -48,7 +48,6 @@ import gtk.glade
import const
import Utils
import RelLib
import DisplayState
from DisplayTabs import *
from GrampsWidgets import *
@ -86,24 +85,29 @@ class EditRepoRef(EditReference):
self.source_ref.get_call_number, False)
self.gid = MonitoredEntry(
self.top.get_widget('gid'), self.source.set_gramps_id,
self.source.get_gramps_id,False)
self.top.get_widget('gid'),
self.source.set_gramps_id,
self.source.get_gramps_id,
False)
self.title = MonitoredEntry(
self.top.get_widget('repo_name'), self.source.set_name,
self.source.get_name,False)
self.top.get_widget('repo_name'),
self.source.set_name,
self.source.get_name,
False)
self.type_selector = MonitoredType(
self.top.get_widget("media_type"),
self.source_ref.set_media_type, self.source_ref.get_media_type,
self.source_ref.set_media_type,
self.source_ref.get_media_type,
dict(Utils.source_media_types),
RelLib.RepoRef.CUSTOM)
self.media_type_selector = MonitoredType(
self.media_type_selector = MonitoredDataType(
self.top.get_widget("repo_type"),
self.source.set_type, self.source.get_type,
dict(Utils.repository_types),
RelLib.Repository.CUSTOM)
self.source.set_type,
self.source.get_type
)
def _create_tabbed_pages(self):
"""

View File

@ -126,13 +126,12 @@ class EditRepository(EditPrimary):
trans = self.db.transaction_begin()
if self.obj.get_handle() == None:
handle = self.db.add_repository(self.obj,trans)
self.db.add_repository(self.obj,trans)
else:
self.db.commit_repository(self.obj,trans)
handle = self.obj.get_handle()
msg = _("Edit Repository (%s)") % self.obj.get_name()
self.db.transaction_commit(trans,msg)
self.close(obj)
self.close()
class DelRepositoryQuery:
def __init__(self,repository,db,sources):

View File

@ -152,6 +152,8 @@ class EditSource(EditPrimary):
def save(self,*obj):
if self.object_is_empty():
from QuestionDialog import ErrorDialog
ErrorDialog(_("Cannot save source"),
_("No data exists for this source. Please "
"enter data or cancel the edit."))
@ -164,7 +166,7 @@ class EditSource(EditPrimary):
self.db.commit_source(self.obj,trans)
self.db.transaction_commit(trans,
_("Edit Source (%s)") % self.obj.get_title())
self.close(obj)
self.close()
class DelSrcQuery:
def __init__(self,source,db,the_lists):

View File

@ -42,7 +42,6 @@ import gtk.glade
#-------------------------------------------------------------------------
import const
import Utils
import RelLib
from _EditSecondary import EditSecondary
from GrampsWidgets import *

View File

@ -331,7 +331,7 @@ class ManagedWindow:
self.window.set_transient_for(self.parent_window)
self.window.show()
def close(self,obj=None,obj2=None):
def close(self):
"""
Close itself.

View File

@ -15,6 +15,7 @@ pkgdata_PYTHON = \
_StyleEditor.py\
_PluginMgr.py\
_PaperMenu.py\
_PluginStatus.py\
_Plugins.py
pkgpyexecdir = @pkgpyexecdir@/PluginUtils