Dropped glade edit note in favor of directly building. Eliminates several
small files. svn: r829
This commit is contained in:
parent
070f4c8d91
commit
0943aa7dce
@ -23,44 +23,70 @@
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import libglade
|
||||
from gnome.ui import *
|
||||
from gtk import *
|
||||
import GTK
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import Utils
|
||||
from RelLib import *
|
||||
from intl import gettext
|
||||
_ = gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# NoteEditor
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class NoteEditor:
|
||||
|
||||
"""Displays a simple text editor that allows a person to edit a note"""
|
||||
def __init__(self,data):
|
||||
|
||||
self.editnote = libglade.GladeXML(const.editnoteFile,"editnote")
|
||||
self.textobj = self.editnote.get_widget("notetext")
|
||||
self.en_obj = self.editnote.get_widget("editnote")
|
||||
self.data = data
|
||||
self.en_obj.editable_enters(self.textobj);
|
||||
self.draw()
|
||||
self.entry.set_point(0)
|
||||
self.entry.insert_defaults(self.data.getNote())
|
||||
self.entry.set_word_wrap(1)
|
||||
|
||||
self.textobj.set_point(0)
|
||||
self.textobj.insert_defaults(self.data.getNote())
|
||||
self.textobj.set_word_wrap(1)
|
||||
def draw(self):
|
||||
"""Displays the NoteEditor window"""
|
||||
title = "%s - GRAMPS" % _("Edit Note")
|
||||
|
||||
self.editnote.signal_autoconnect({
|
||||
"on_save_note_clicked" : self.on_save_note_clicked,
|
||||
"destroy_passed_object" : Utils.destroy_passed_object
|
||||
})
|
||||
self.top = GnomeDialog(title,STOCK_BUTTON_OK,STOCK_BUTTON_CANCEL)
|
||||
self.top.set_policy(FALSE,TRUE,FALSE)
|
||||
|
||||
vbox = GtkVBox()
|
||||
self.top.vbox.pack_start(vbox,TRUE,TRUE,0)
|
||||
vbox.pack_start(GtkLabel(_("Edit Note")), FALSE, FALSE, 10)
|
||||
|
||||
vbox.pack_start(GtkHSeparator(), FALSE, TRUE, 5)
|
||||
self.entry = GtkText()
|
||||
self.entry.set_editable(TRUE)
|
||||
self.entry.show()
|
||||
scroll = GtkScrolledWindow()
|
||||
scroll.add(self.entry)
|
||||
scroll.set_policy (GTK.POLICY_NEVER, GTK.POLICY_ALWAYS)
|
||||
scroll.set_usize(450, 300)
|
||||
scroll.show()
|
||||
vbox.pack_start(scroll, TRUE, TRUE, 0)
|
||||
|
||||
self.top.button_connect(0,self.on_save_note_clicked)
|
||||
self.top.button_connect(1,self.cancel)
|
||||
self.top.show_all()
|
||||
self.entry.grab_focus()
|
||||
|
||||
def cancel(self,obj):
|
||||
"""Closes the window without saving the note"""
|
||||
self.top.destroy()
|
||||
|
||||
def on_save_note_clicked(self,obj):
|
||||
text = self.textobj.get_chars(0,-1)
|
||||
"""Saves the note and closes the window"""
|
||||
text = self.entry.get_chars(0,-1)
|
||||
if text != self.data.getNote():
|
||||
self.data.setNote(text)
|
||||
Utils.modified()
|
||||
Utils.destroy_passed_object(obj)
|
||||
self.top.destroy()
|
||||
|
||||
|
@ -1,152 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<GTK-Interface>
|
||||
|
||||
<project>
|
||||
<name>Gramps</name>
|
||||
<program_name>gramps</program_name>
|
||||
<directory></directory>
|
||||
<source_directory>src</source_directory>
|
||||
<pixmaps_directory>pixmaps</pixmaps_directory>
|
||||
<language>C</language>
|
||||
<gnome_support>True</gnome_support>
|
||||
<gettext_support>True</gettext_support>
|
||||
</project>
|
||||
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>editnote</name>
|
||||
<title>Edit Note - GRAMPS</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>True</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
<auto_close>False</auto_close>
|
||||
<hide_on_close>False</hide_on_close>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<child_name>GnomeDialog:vbox</child_name>
|
||||
<name>dialog-vbox1</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>4</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHButtonBox</class>
|
||||
<child_name>GnomeDialog:action_area</child_name>
|
||||
<name>dialog-action_area1</name>
|
||||
<layout_style>GTK_BUTTONBOX_END</layout_style>
|
||||
<spacing>8</spacing>
|
||||
<child_min_width>85</child_min_width>
|
||||
<child_min_height>27</child_min_height>
|
||||
<child_ipad_x>7</child_ipad_x>
|
||||
<child_ipad_y>0</child_ipad_y>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
<pack>GTK_PACK_END</pack>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button99</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_save_note_clicked</handler>
|
||||
<object>editnote</object>
|
||||
<last_modification_time>Tue, 29 May 2001 15:06:53 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button100</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>destroy_passed_object</handler>
|
||||
<object>editnote</object>
|
||||
<last_modification_time>Tue, 29 May 2001 15:06:38 GMT</last_modification_time>
|
||||
</signal>
|
||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkVBox</class>
|
||||
<name>vbox29</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label153</name>
|
||||
<label>Edit Note</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
<xalign>0.5</xalign>
|
||||
<yalign>0.5</yalign>
|
||||
<xpad>0</xpad>
|
||||
<ypad>0</ypad>
|
||||
<child>
|
||||
<padding>10</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkHSeparator</class>
|
||||
<name>hseparator1</name>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow21</name>
|
||||
<width>450</width>
|
||||
<height>300</height>
|
||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkText</class>
|
||||
<name>notetext</name>
|
||||
<can_focus>True</can_focus>
|
||||
<has_focus>True</has_focus>
|
||||
<editable>True</editable>
|
||||
<text></text>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
</GTK-Interface>
|
Loading…
Reference in New Issue
Block a user