Commits

jfr...@isabelle  committed 8dba5cc

Added notes field to Revelation.

  • Participants
  • Parent commits 52c5df4

Comments (0)

Files changed (4)

File src/lib/data.py

 
 
 		# check entry fields
-		items = [ e.name, e.description ]
+		items = [ e.name, e.description, e.notes ]
 
 		if self.namedesconly == False:
 			items.extend([ field.value for field in e.fields if field.value != "" ])

File src/lib/dialog.py

 		# set up the ui
 		self.sect_meta		= self.add_section(title)
 		self.sect_fields	= self.add_section(_('Account Data'))
+		self.sect_notes		= self.add_section(_('Notes'))
 
 		self.entry_name = ui.Entry()
 		self.entry_name.set_width_chars(50)
 		eventbox.set_tooltip_text(_('The type of entry'))
 		self.sect_meta.append_widget(_('Type'), eventbox)
 
+		self.entry_notes = ui.EditableTextView()
+		self.tooltips.set_tip(self.entry_notes, _('Notes for the entry'))
+		self.sect_notes.append_widget(None, self.entry_notes)
+
 		# populate the dialog with data
 		self.set_entry(e)
 
 
 		e.name = self.entry_name.get_text()
 		e.description = self.entry_desc.get_text()
+		e.notes = self.entry_notes.get_text()
 
 		for field in e.fields:
 			field.value = self.entry_field[type(field)].get_text()
 
 		self.entry_name.set_text(e.name)
 		self.entry_desc.set_text(e.description)
+		self.entry_notes.set_text(e.notes)
 		self.dropdown.set_active_type(type(e))
 
 		for field in e.fields:

File src/lib/entry.py

 	def __init__(self):
 		self.name		= ""
 		self.description	= ""
+		self.notes		= ""
 		self.updated		= int(time.time())
 		self.fields		= []
 
 		generic = GenericEntry()
 		generic.name = self.name
 		generic.description = self.description
+		generic.notes = self.notes
 		generic.updated = self.updated
 
 		# do direct field copies
 
 		self.name		= entry.name
 		self.description	= entry.description
+		self.notes		= entry.notes
 		self.updated		= entry.updated
 
 		for field in entry.fields:

File src/lib/ui.py

 
 
 
+class EditableTextView(gtk.ScrolledWindow):
+	"An editable text view"
+
+	def __init__(self, buffer = None, text = None):
+
+		gtk.ScrolledWindow.__init__(self)
+		self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+		self.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
+		self.textview = gtk.TextView(buffer)
+		self.textbuffer = self.textview.get_buffer()
+		self.add(self.textview)
+
+		if text is not None:
+			self.textview.get_buffer().set_text(text)
+
+	def set_text(self, text):
+		"Sets the entry contents"
+
+		if text is None:
+			self.textbuffer.set_text("")
+
+		self.textbuffer.set_text(text)
+
+	def get_text(self):
+		"Returns the text of the entry"
+
+		return self.textbuffer.get_text(self.textbuffer.get_start_iter(), self.textbuffer.get_end_iter())
+
 class TextView(gtk.TextView):
 	"A text view"
 
 				widget = generate_field_display_widget(field, self.config, self.clipboard)
 				table.attach(widget, 1, rowindex)
 
+		# notes
+		label = Label("<span weight=\"bold\">%s</span>%s" % ((e.notes != "" and "Notes: " or ""),
+			util.escape_markup(e.notes) ), gtk.JUSTIFY_LEFT)
+		self.pack_start(label)
+
 		# display updatetime
 		if type(e) != entry.FolderEntry:
 			label = Label((_('Updated %s ago') + "\n%s") % ( util.time_period_rough(e.updated, time.time()), time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(e.updated)) ), gtk.JUSTIFY_CENTER)