This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
+
+@todo It would be nice to move the category selector to the category list's column and search below everything.
+@todo Search would be activated by menu or CTRL+F rather than zoom
"""
import time
except ImportError:
gtkspell = None
+import hildonize
+import gtk_toolbox
import simple_list
gtk.HBox.__init__(self, homogeneous = False, spacing = 0)
_moduleLogger.info("libnotizen, init")
+ # Note list
self._noteslist = simple_list.SimpleList()
self._noteslist.set_eventfunction_cursor_changed(self._update_noteslist)
-
- self._noteslist.set_size_request(250, -1)
-
- vbox = gtk.VBox(homogeneous = False, spacing = 0)
-
- frame = gtk.Frame(_("Titles"))
- frame.add(self._noteslist)
- vbox.pack_start(frame, expand = True, fill = True, padding = 3)
+ self._noteslist.widget.set_size_request(250, -1)
buttonHBox = gtk.HBox()
- vbox.pack_start(buttonHBox, expand = False, fill = True, padding = 3)
button = gtk.Button(stock = gtk.STOCK_ADD)
button.connect("clicked", self._on_add_note, None)
button.connect("clicked", self._on_delete_note, None)
buttonHBox.pack_start(button, expand = True, fill = True, padding = 3)
- self.pack_start(vbox, expand = False, fill = True, padding = 3)
+ listVbox = gtk.VBox(homogeneous = False, spacing = 0)
+ listVbox.pack_start(self._noteslist.widget, expand = True, fill = True, padding = 3)
+ listVbox.pack_start(buttonHBox, expand = False, fill = True, padding = 3)
+ self.pack_start(listVbox, expand = False, fill = True, padding = 3)
+ # Note view
self._noteBodyView = gtk.TextView()
self._noteBodyView.connect("focus-out-event", self.save_note, "focus-out-event")
buf = self._noteBodyView.get_buffer()
else:
self._noteBodySpellChecker = None
- #self.textviewNotiz.set_size_request(-1, 50)
self._noteScrollWindow = gtk.ScrolledWindow()
self._noteScrollWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self._noteScrollWindow.add(self._noteBodyView)
+ hildonize.hildonize_scrollwindow_with_viewport(self._noteScrollWindow)
- frame = gtk.Frame(_("Note"))
- frame.add(self._noteScrollWindow)
-
- vbox = gtk.VBox(homogeneous = False, spacing = 0)
- vbox.pack_start(frame, expand = True, fill = True, padding = 3)
-
+ # History
self._historyBox = gtk.HBox(homogeneous = False, spacing = 0)
self._historyStatusLabel = gtk.Label(_("No History"))
button.connect("clicked", self._on_show_history, None)
self._historyBox.pack_start(button, expand = True, fill = True, padding = 3)
- vbox.pack_start(self._historyBox, expand = False, fill = True, padding = 3)
-
- self.pack_start(vbox, expand = True, fill = True, padding = 3)
+ # Note and history stuff in same column
+ noteVbox = gtk.VBox(homogeneous = False, spacing = 0)
+ noteVbox.pack_start(self._noteScrollWindow, expand = True, fill = True, padding = 3)
+ noteVbox.pack_start(self._historyBox, expand = False, fill = True, padding = 3)
+ self.pack_start(noteVbox, expand = True, fill = True, padding = 3)
self.load_notes()
self._topBox.connect("reload_notes", self.load_notes)
self._noteBodyView.grab_focus()
return False
- def _update_noteslist(self, data = None, data2 = None):
+ def _update_noteslist(self, *args):
if self._pos != -1:
self.save_note()
+ if args:
+ data = args[0]
+ else:
+ data = None
+
try:
(pos, key, value) = self._noteslist.get_selection_data()
if (pos == -1):
gobject.timeout_add(200, self._set_focus)
+ @gtk_toolbox.log_exception(_moduleLogger)
def _on_note_changed(self, widget = None, data = None):
if self._pos == -1 or self.noteId == -1:
return
if value != title:
self._noteslist.change_item(self._pos, title, self.noteId)
+ @gtk_toolbox.log_exception(_moduleLogger)
def _on_add_note(self, widget = None, data = None):
self._update_noteslist("new")
+ @gtk_toolbox.log_exception(_moduleLogger)
def _on_delete_note(self, widget = None, data = None):
if (self.noteId == -1):
return
self._pos = -1
self._noteBodyView.get_buffer().set_text("")
+ @gtk_toolbox.log_exception(_moduleLogger)
def _on_show_history(self, widget = None, data = None, label = None):
if self.noteId == -1:
mbox = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("No note selected."))