More cleanup of code

svn: r465
This commit is contained in:
Don Allingham
2001-10-14 05:19:43 +00:00
parent 0f21f2b76e
commit 43ebdeb2c9
12 changed files with 171 additions and 333 deletions

View File

@ -23,7 +23,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os
import string import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -106,6 +105,7 @@ class AddressEditor:
}) })
def on_addr_source_clicked(self,obj): def on_addr_source_clicked(self,obj):
import Sources
Sources.SourceSelector(self.srcreflist,self.parent,src_changed) Sources.SourceSelector(self.srcreflist,self.parent,src_changed)
def on_addr_edit_ok_clicked(self,obj): def on_addr_edit_ok_clicked(self,obj):

View File

@ -33,7 +33,6 @@ import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gtk import * from gtk import *
from gnome.ui import * from gnome.ui import *
import GDK
import libglade import libglade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -44,7 +43,6 @@ import libglade
import intl import intl
import const import const
import utils import utils
import Config
from RelLib import * from RelLib import *
import Sources import Sources

View File

@ -51,20 +51,6 @@ import ImageSelect
_ = intl.gettext _ = intl.gettext
#-------------------------------------------------------------------------
#
# Constants - quite frequently, data needs to be attached to a widget.
# this is done to prevent the use of globals, and to allow data to be
# passed with a widget (especially critical, since more that one window
# can be opened at a time). Data is attached to an widget using a string
# as the key. To avoid a lot of hard coded text strings floating around
# everywhere, values are defined here as constants with more meaningful
# names.
#
#-------------------------------------------------------------------------
NOTEOBJ = "n"
TEXTOBJ = "w"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# EditPerson class # EditPerson class

View File

@ -45,15 +45,11 @@ import intl
import const import const
import utils import utils
from RelLib import * from RelLib import *
import RelImage
import Sources import Sources
import ImageSelect import ImageSelect
import UrlEdit
_ = intl.gettext _ = intl.gettext
_DEFHTTP = "http://gramps.sourceforge.net"
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Constants # Constants
@ -276,6 +272,7 @@ def on_switch_page(obj,a,page):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_update_url_clicked(obj): def on_update_url_clicked(obj):
import UrlEdit
if len(obj.selection) > 0: if len(obj.selection) > 0:
row = obj.selection[0] row = obj.selection[0]
mobj = obj.get_data(_PLACE) mobj = obj.get_data(_PLACE)
@ -323,6 +320,7 @@ def on_delete_loc_clicked(obj):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def on_add_url_clicked(obj): def on_add_url_clicked(obj):
import UrlEdit
mobj = obj.get_data(_PLACE) mobj = obj.get_data(_PLACE)
if mobj.place: if mobj.place:
name = _("Internet Address Editor for %s") % mobj.place.get_title() name = _("Internet Address Editor for %s") % mobj.place.get_title()

View File

@ -44,7 +44,6 @@ import intl
import const import const
import utils import utils
from RelLib import * from RelLib import *
import RelImage
import ImageSelect import ImageSelect
_ = intl.gettext _ = intl.gettext

View File

@ -25,15 +25,9 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gtk import * from gtk import *
from gnome.ui import * from gnome.ui import *
import GDK
import libglade import libglade
import os
import intl
import Sources import Sources
import AttrEdit
_ = intl.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -42,11 +36,8 @@ _ = intl.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import Config
import utils import utils
from RelLib import * from RelLib import *
import RelImage
import ImageSelect
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #

View File

@ -35,7 +35,6 @@ from gtk import *
from gnome.ui import * from gnome.ui import *
import GDK import GDK
import libglade import libglade
import GdkImlib
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -48,8 +47,6 @@ import utils
import Config import Config
from RelLib import * from RelLib import *
import RelImage import RelImage
import Sources
import AttrEdit
_ = intl.gettext _ = intl.gettext
@ -393,8 +390,6 @@ class LocalMediaProperties:
self.lists_changed = 0 self.lists_changed = 0
fname = self.object.getPath() fname = self.object.getPath()
src = os.path.basename(fname)
self.change_dialog = libglade.GladeXML(const.imageselFile,"change_description") self.change_dialog = libglade.GladeXML(const.imageselFile,"change_description")
window = self.change_dialog.get_widget("change_description") window = self.change_dialog.get_widget("change_description")
descr_window = self.change_dialog.get_widget("description") descr_window = self.change_dialog.get_widget("description")
@ -462,6 +457,7 @@ class LocalMediaProperties:
self.attr_details.set_text(utils.get_detail_text(attr)) self.attr_details.set_text(utils.get_detail_text(attr))
def on_update_attr_clicked(self,obj): def on_update_attr_clicked(self,obj):
import AttrEdit
if len(obj.selection) > 0: if len(obj.selection) > 0:
row = obj.selection[0] row = obj.selection[0]
attr = obj.get_row_data(row) attr = obj.get_row_data(row)
@ -473,6 +469,7 @@ class LocalMediaProperties:
self.redraw_attr_list() self.redraw_attr_list()
def on_add_attr_clicked(self,obj): def on_add_attr_clicked(self,obj):
import AttrEdit
AttrEdit.AttributeEditor(self,None,"Media Object",[]) AttrEdit.AttributeEditor(self,None,"Media Object",[])
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -25,14 +25,9 @@
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gtk import * from gtk import *
from gnome.ui import * from gnome.ui import *
import GDK
import libglade import libglade
import os
import intl import intl
import Sources
import AttrEdit
import EventEdit
_ = intl.gettext _ = intl.gettext
@ -46,7 +41,6 @@ import const
import Config import Config
import utils import utils
from RelLib import * from RelLib import *
import RelImage
import ImageSelect import ImageSelect
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -79,22 +73,22 @@ class Marriage:
plwidget = self.top.get_widget("photolist") plwidget = self.top.get_widget("photolist")
self.gallery = ImageSelect.Gallery(family, self.path, fid, plwidget, db) self.gallery = ImageSelect.Gallery(family, self.path, fid, plwidget, db)
self.top.signal_autoconnect({ self.top.signal_autoconnect({
"destroy_passed_object" : on_cancel_edit, "destroy_passed_object" : self.on_cancel_edit,
"on_add_attr_clicked" : on_add_attr_clicked, "on_add_attr_clicked" : self.on_add_attr_clicked,
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked, "on_addphoto_clicked" : self.gallery.on_add_photo_clicked,
"on_attr_list_select_row" : on_attr_list_select_row, "on_attr_list_select_row" : self.on_attr_list_select_row,
"on_close_marriage_editor" : on_close_marriage_editor, "on_close_marriage_editor" : self.on_close_marriage_editor,
"on_delete_attr_clicked" : on_delete_attr_clicked, "on_delete_attr_clicked" : self.on_delete_attr_clicked,
"on_delete_event" : on_delete_event, "on_delete_event" : self.on_delete_event,
"on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked, "on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked,
"on_edit_properties_clicked": self.gallery.popup_change_description, "on_edit_properties_clicked": self.gallery.popup_change_description,
"on_marriageAddBtn_clicked" : on_add_clicked, "on_marriageAddBtn_clicked" : self.on_add_clicked,
"on_marriageDeleteBtn_clicked" : on_delete_clicked, "on_marriageDeleteBtn_clicked" : self.on_delete_clicked,
"on_marriageEventList_select_row" : on_select_row, "on_marriageEventList_select_row" : self.on_select_row,
"on_marriageUpdateBtn_clicked" : on_update_clicked, "on_marriageUpdateBtn_clicked" : self.on_update_clicked,
"on_photolist_button_press_event" : self.gallery.on_photolist_button_press_event, "on_photolist_button_press_event" : self.gallery.on_photolist_button_press_event,
"on_photolist_select_icon" : self.gallery.on_photo_select_icon, "on_photolist_select_icon" : self.gallery.on_photo_select_icon,
"on_update_attr_clicked" : on_update_attr_clicked, "on_update_attr_clicked" : self.on_update_attr_clicked,
}) })
text_win = self.get_widget("marriageTitle") text_win = self.get_widget("marriageTitle")
@ -162,66 +156,38 @@ class Marriage:
self.family.setEventList(self.elist) self.family.setEventList(self.elist)
self.family.setAttributeList(self.alist) self.family.setAttributeList(self.alist)
#---------------------------------------------------------------------
#
# redraw_attr_list - redraws the attribute list for the person
#
#---------------------------------------------------------------------
def redraw_attr_list(self): def redraw_attr_list(self):
utils.redraw_list(self.alist,self.attr_list,disp_attr) utils.redraw_list(self.alist,self.attr_list,disp_attr)
#-------------------------------------------------------------------------
#
# redraw_events - redraws the event list by deleting all the entries and
# reconstructing the list
#
#-------------------------------------------------------------------------
def redraw_event_list(self): def redraw_event_list(self):
utils.redraw_list(self.elist,self.event_list,disp_event) utils.redraw_list(self.elist,self.event_list,disp_event)
#-------------------------------------------------------------------------
#
# get_widget - returns the widget associated with the specified name
#
#-------------------------------------------------------------------------
def get_widget(self,name): def get_widget(self,name):
return self.top.get_widget(name) return self.top.get_widget(name)
#------------------------------------------------------------------------- def did_data_change(self):
#
#
#
#-------------------------------------------------------------------------
def did_data_change(obj):
family_obj = obj.get_data(MARRIAGE)
changed = 0 changed = 0
relation = family_obj.type_field.entry.get_text() relation = self.type_field.entry.get_text()
if const.save_frel(relation) != family_obj.family.getRelationship(): if const.save_frel(relation) != self.family.getRelationship():
changed = 1 changed = 1
text = family_obj.notes_field.get_chars(0,-1) text = self.notes_field.get_chars(0,-1)
if text != family_obj.family.getNote(): if text != self.family.getNote():
changed = 1 changed = 1
if family_obj.lists_changed: if self.lists_changed:
changed = 1 changed = 1
idval = family_obj.gid.get_text() idval = self.gid.get_text()
if family_obj.family.getId() != idval: if self.family.getId() != idval:
changed = 1 changed = 1
return changed return changed
#------------------------------------------------------------------------- def on_cancel_edit(self,obj):
#
# on_cancel_edit
#
#-------------------------------------------------------------------------
def on_cancel_edit(obj):
if did_data_change(obj): if self.did_data_change():
global quit global quit
q = _("Data was modified. Are you sure you want to abandon your changes?") q = _("Data was modified. Are you sure you want to abandon your changes?")
quit = obj quit = obj
@ -229,44 +195,14 @@ def on_cancel_edit(obj):
else: else:
utils.destroy_passed_object(obj) utils.destroy_passed_object(obj)
#------------------------------------------------------------------------- def on_delete_event(self,obj,b):
# self.on_cancel_edit(obj)
#
#
#-------------------------------------------------------------------------
def cancel_callback(a):
if a==0:
utils.destroy_passed_object(quit)
#------------------------------------------------------------------------- def on_close_marriage_editor(self,obj):
# idval = self.gid.get_text()
# family = self.family
#
#-------------------------------------------------------------------------
def on_delete_event(obj,b):
global quit
if did_data_change(obj):
q = _("Data was modified. Are you sure you want to abandon your changes?")
quit = obj
GnomeQuestionDialog(q,cancel_callback)
return 1
else:
utils.destroy_passed_object(obj)
return 0
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def on_close_marriage_editor(obj):
family_obj = obj.get_data(MARRIAGE)
idval = family_obj.gid.get_text()
family = family_obj.family
if idval != family.getId(): if idval != family.getId():
m = family_obj.db.getFamilyMap() m = self.db.getFamilyMap()
if not m.has_key(idval): if not m.has_key(idval):
if m.has_key(family.getId()): if m.has_key(family.getId()):
del m[family.getId()] del m[family.getId()]
@ -277,45 +213,38 @@ def on_close_marriage_editor(obj):
msg1 = _("GRAMPS ID value was not changed.") msg1 = _("GRAMPS ID value was not changed.")
GnomeWarningDialog("%s" % msg1) GnomeWarningDialog("%s" % msg1)
relation = family_obj.type_field.entry.get_text() relation = self.type_field.entry.get_text()
if const.save_frel(relation) != family_obj.family.getRelationship(): if const.save_frel(relation) != self.family.getRelationship():
father = family_obj.family.getFather() father = self.family.getFather()
mother = family_obj.family.getMother() mother = self.family.getMother()
if father.getGender() == mother.getGender(): if father.getGender() == mother.getGender():
family_obj.family.setRelationship("Partners") self.family.setRelationship("Partners")
else: else:
val = const.save_frel(relation) val = const.save_frel(relation)
if val == "Partners": if val == "Partners":
val = "Unknown" val = "Unknown"
if father.getGender() == Person.female or \ if father.getGender() == Person.female or \
mother.getGender() == Person.male: mother.getGender() == Person.male:
family_obj.family.setFather(mother) self.family.setFather(mother)
family_obj.family.setMother(father) self.family.setMother(father)
family_obj.family.setRelationship(val) self.family.setRelationship(val)
utils.modified() utils.modified()
text = family_obj.notes_field.get_chars(0,-1) text = self.notes_field.get_chars(0,-1)
if text != family_obj.family.getNote(): if text != self.family.getNote():
family_obj.family.setNote(text) self.family.setNote(text)
utils.modified() utils.modified()
utils.destroy_passed_object(family_obj.get_widget("marriageEditor")) utils.destroy_passed_object(self.get_widget("marriageEditor"))
family_obj.update_lists() self.update_lists()
if family_obj.lists_changed: if self.lists_changed:
utils.modified() utils.modified()
#------------------------------------------------------------------------- def on_add_clicked(self,obj):
# import EventEdit
# on_add_clicked - creates a new event from the data displayed in the father = self.family.getFather()
# window. Special care has to be take for the marriage and divorce mother = self.family.getMother()
# events, since they are not stored in the event list.
#
#-------------------------------------------------------------------------
def on_add_clicked(obj):
mobj = obj.get_data(MARRIAGE)
father = mobj.family.getFather()
mother = mobj.family.getMother()
if father and mother: if father and mother:
name = _("%s and %s") % (father.getPrimaryName().getName(), name = _("%s and %s") % (father.getPrimaryName().getName(),
mother.getPrimaryName().getName()) mother.getPrimaryName().getName())
@ -323,22 +252,16 @@ def on_add_clicked(obj):
name = father.getPrimaryName().getName() name = father.getPrimaryName().getName()
else: else:
name = mother.getPrimaryName().getName() name = mother.getPrimaryName().getName()
EventEdit.EventEditor(mobj,name,const.marriageEvents,const.save_pevent,None,0) EventEdit.EventEditor(self,name,const.marriageEvents,const.save_pevent,None,0)
#------------------------------------------------------------------------- def on_update_clicked(self,obj):
# import EventEdit
# on_update_clicked - updates the selected event with the values in the
# current display
#
#-------------------------------------------------------------------------
def on_update_clicked(obj):
if len(obj.selection) <= 0: if len(obj.selection) <= 0:
return return
mobj = obj.get_data(MARRIAGE)
event = obj.get_row_data(obj.selection[0]) event = obj.get_row_data(obj.selection[0])
father = mobj.family.getFather() father = self.family.getFather()
mother = mobj.family.getMother() mother = self.family.getMother()
if father and mother: if father and mother:
name = _("%s and %s") % (father.getPrimaryName().getName(), name = _("%s and %s") % (father.getPrimaryName().getName(),
mother.getPrimaryName().getName()) mother.getPrimaryName().getName())
@ -346,66 +269,37 @@ def on_update_clicked(obj):
name = father.getPrimaryName().getName() name = father.getPrimaryName().getName()
else: else:
name = mother.getPrimaryName().getName() name = mother.getPrimaryName().getName()
EventEdit.EventEditor(mobj,name,const.marriageEvents,const.save_pevent,event,0) EventEdit.EventEditor(self,name,const.marriageEvents,const.save_pevent,event,0)
#------------------------------------------------------------------------- def on_delete_clicked(self,obj):
# if utils.delete_selected(obj,self.elist):
# on_delete_clicked - deletes the currently displayed event from the self.lists_changed = 1
# marriage event list. Special care needs to be taken for the Marriage self.redraw_event_list()
# and Divorce events, since they are not stored in the event list
#
#-------------------------------------------------------------------------
def on_delete_clicked(obj):
family_obj = obj.get_data(MARRIAGE)
if utils.delete_selected(obj,family_obj.elist):
family_obj.lists_changed = 1
family_obj.redraw_event_list()
#------------------------------------------------------------------------- def on_select_row(self,obj,row,b,c):
#
# on_select_row - updates the internal data attached to the passed object,
# then updates the display.
#
#-------------------------------------------------------------------------
def on_select_row(obj,row,b,c):
family_obj = obj.get_data(MARRIAGE)
event = obj.get_row_data(row) event = obj.get_row_data(row)
family_obj.date_field.set_text(event.getDate()) self.date_field.set_text(event.getDate())
family_obj.place_field.set_text(event.getPlaceName()) self.place_field.set_text(event.getPlaceName())
family_obj.cause_field.set_text(event.getCause()) self.cause_field.set_text(event.getCause())
family_obj.name_field.set_label(const.display_fevent(event.getName())) self.name_field.set_label(const.display_fevent(event.getName()))
family_obj.event_details.set_text(utils.get_detail_text(event)) self.event_details.set_text(utils.get_detail_text(event))
family_obj.descr_field.set_text(event.getDescription()) self.descr_field.set_text(event.getDescription())
def on_attr_list_select_row(self,obj,row,b,c):
#-------------------------------------------------------------------------
#
# on_attr_list_select_row - sets the row object attached to the passed
# object, and then updates the display with the data corresponding to
# the row.
#
#-------------------------------------------------------------------------
def on_attr_list_select_row(obj,row,b,c):
family_obj = obj.get_data(MARRIAGE)
attr = obj.get_row_data(row) attr = obj.get_row_data(row)
family_obj.attr_type.set_label(const.display_fattr(attr.getType())) self.attr_type.set_label(const.display_fattr(attr.getType()))
family_obj.attr_value.set_text(attr.getValue()) self.attr_value.set_text(attr.getValue())
family_obj.attr_details_field.set_text(utils.get_detail_text(attr)) self.attr_details_field.set_text(utils.get_detail_text(attr))
#------------------------------------------------------------------------- def on_update_attr_clicked(self,obj):
# import AttrEdit
#
#
#-------------------------------------------------------------------------
def on_update_attr_clicked(obj):
if len(obj.selection) > 0: if len(obj.selection) > 0:
row = obj.selection[0] row = obj.selection[0]
mobj = obj.get_data(MARRIAGE)
attr = obj.get_row_data(row) attr = obj.get_row_data(row)
father = mobj.family.getFather() father = self.family.getFather()
mother = mobj.family.getMother() mother = self.family.getMother()
if father and mother: if father and mother:
name = _("%s and %s") % (father.getPrimaryName().getName(), name = _("%s and %s") % (father.getPrimaryName().getName(),
mother.getPrimaryName().getName()) mother.getPrimaryName().getName())
@ -413,28 +307,17 @@ def on_update_attr_clicked(obj):
name = father.getPrimaryName().getName() name = father.getPrimaryName().getName()
else: else:
name = mother.getPrimaryName().getName() name = mother.getPrimaryName().getName()
AttrEdit.AttributeEditor(mobj,attr,name,const.familyAttributes) AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes)
#------------------------------------------------------------------------- def on_delete_attr_clicked(self,obj):
# if utils.delete_selected(obj,self.alist):
# self.lists_changed = 1
# self.redraw_attr_list()
#-------------------------------------------------------------------------
def on_delete_attr_clicked(obj):
family_obj = obj.get_data(MARRIAGE)
if utils.delete_selected(obj,family_obj.alist):
family_obj.lists_changed = 1
family_obj.redraw_attr_list()
#------------------------------------------------------------------------- def on_add_attr_clicked(self,obj):
# import AttrEdit
# father = self.family.getFather()
# mother = self.family.getMother()
#-------------------------------------------------------------------------
def on_add_attr_clicked(obj):
mobj = obj.get_data(MARRIAGE)
father = mobj.family.getFather()
mother = mobj.family.getMother()
if father and mother: if father and mother:
name = _("%s and %s") % (father.getPrimaryName().getName(), name = _("%s and %s") % (father.getPrimaryName().getName(),
mother.getPrimaryName().getName()) mother.getPrimaryName().getName())
@ -442,7 +325,7 @@ def on_add_attr_clicked(obj):
name = father.getPrimaryName().getName() name = father.getPrimaryName().getName()
else: else:
name = mother.getPrimaryName().getName() name = mother.getPrimaryName().getName()
AttrEdit.AttributeEditor(mobj,None,name,const.familyAttributes) AttrEdit.AttributeEditor(self,None,name,const.familyAttributes)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -462,3 +345,13 @@ def disp_attr(attr):
def disp_event(event): def disp_event(event):
return [const.display_fevent(event.getName()), event.getQuoteDate(), return [const.display_fevent(event.getName()), event.getQuoteDate(),
event.getPlaceName(), utils.get_detail_flags(event)] event.getPlaceName(), utils.get_detail_flags(event)]
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def cancel_callback(a):
if a==0:
utils.destroy_passed_object(quit)

View File

@ -23,7 +23,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os
import string import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -34,7 +33,6 @@ import string
from gtk import * from gtk import *
from gnome.ui import * from gnome.ui import *
import libglade import libglade
import GdkImlib
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -44,10 +42,7 @@ import GdkImlib
import intl import intl
import const import const
import utils import utils
import Config
from RelLib import * from RelLib import *
import RelImage
import Sources
_ = intl.gettext _ = intl.gettext
@ -101,6 +96,7 @@ class NameEditor:
}) })
def on_name_source_clicked(self,obj): def on_name_source_clicked(self,obj):
import Sources
Sources.SourceSelector(self.srcreflist,self.parent,src_changed) Sources.SourceSelector(self.srcreflist,self.parent,src_changed)
def on_name_edit_ok_clicked(self,obj): def on_name_edit_ok_clicked(self,obj):

View File

@ -23,7 +23,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os
import string import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -42,7 +41,6 @@ import libglade
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import utils import utils
import Config
from RelLib import * from RelLib import *
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -23,7 +23,6 @@
# Standard python modules # Standard python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os
import string import string
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -41,13 +40,10 @@ import libglade
# gramps modules # gramps modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import intl
import const import const
import utils import utils
from RelLib import * from RelLib import *
_ = intl.gettext
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# UrlEditor class # UrlEditor class

View File

@ -52,7 +52,7 @@ class VersionControl:
form of three strings - (version,date,comment).""" form of three strings - (version,date,comment)."""
return [] return []
def checkin(self,name,comment,binary,tag): def checkin(self,name,comment,binary):
"""Checks in a file into the revision control database """Checks in a file into the revision control database
name - file to check in name - file to check in
@ -78,6 +78,7 @@ class RcsVersionControl(VersionControl):
def __init__(self,wd): def __init__(self,wd):
"""Initializes the RCS database if it does not already exist. """Initializes the RCS database if it does not already exist.
Sets the database to disable locking""" Sets the database to disable locking"""
VersionControl.__init__(self,wd)
self.wd = wd self.wd = wd
self.vfile = "%s/version,v" % wd self.vfile = "%s/version,v" % wd
self.tfile = "%s/version" % wd self.tfile = "%s/version" % wd
@ -90,6 +91,9 @@ class RcsVersionControl(VersionControl):
rlist = [] rlist = []
slog = 0 slog = 0
sname = 0 sname = 0
v = None
l = None
d = None
r,w = popen2.popen2("rlog %s" % self.vfile) r,w = popen2.popen2("rlog %s" % self.vfile)
for line in r.readlines(): for line in r.readlines():
@ -155,8 +159,8 @@ class RcsVersionControl(VersionControl):
def set_tag(self,tag): def set_tag(self,tag):
"""Sets the tag to the symbolic string""" """Sets the tag to the symbolic string"""
if tag != "": if tag != "":
pproc = popen2.Popen3("rcs -N%s: %s" % (tag,self.tfile),1) proc = popen2.Popen3("rcs -N%s: %s" % (tag,self.tfile),1)
proc.tochild.write(comment) proc.tochild.write("")
proc.tochild.close() proc.tochild.close()
status = proc.wait() status = proc.wait()
del proc del proc
@ -185,21 +189,3 @@ def get_vc_list():
classes. The tuple is in the format of (class,description)""" classes. The tuple is in the format of (class,description)"""
return _version_control_list return _version_control_list
if __name__ == "__main__":
import sys
c = RcsVersionControl(os.getcwd())
if sys.argv[1] == "log":
for val in c.revision_list():
print "%s - %s : %s" % val
elif sys.argv[1] == "ci":
c.checkin(sys.argv[2],"mycomment",0)
for val in c.revision_list():
print "%s - %s : %s" % val
elif sys.argv[1] == "co":
f = c.get_version(sys.argv[2])
for l in f.readlines():
print l
f.close()