Fixed bug with Move To Category
authorepage <eopage@byu.net>
Sat, 12 Dec 2009 05:43:37 +0000 (05:43 +0000)
committerepage <eopage@byu.net>
Sat, 12 Dec 2009 05:43:37 +0000 (05:43 +0000)
git-svn-id: file:///svnroot/quicknote/trunk@85 bb7704e3-badb-4cfa-9ab3-9374dc87eaa2

src/quicknote_gtk.py
src/speichern.py
support/builddeb.py

index 1e7e14e..bd466bb 100644 (file)
@@ -344,42 +344,43 @@ class QuicknoteProgram(hildonize.get_app_class()):
 
        @gtk_toolbox.log_exception(_moduleLogger)
        def _on_move_category(self, widget = None, data = None):
-               dialog = gtk.Dialog(_("Choose category"), self._window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
-
-               dialog.set_position(gtk.WIN_POS_CENTER)
                comboCategory = gtk.combo_box_new_text()
-
                comboCategory.append_text('undefined')
                sql = "SELECT id, liste FROM categories WHERE id = 0 ORDER BY liste"
                rows = self._db.ladeSQL(sql)
                for row in rows:
                        comboCategory.append_text(row[1])
 
-               dialog.vbox.pack_start(comboCategory, True, True, 0)
+               dialog = gtk.Dialog(_("Choose category"), self._window, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
+               try:
+                       dialog.set_position(gtk.WIN_POS_CENTER)
 
-               dialog.vbox.show_all()
-               #dialog.set_size_request(400, 300)
+                       dialog.vbox.pack_start(comboCategory, True, True, 0)
+                       dialog.vbox.show_all()
 
-               if dialog.run() == gtk.RESPONSE_ACCEPT:
-                       n = comboCategory.get_active()
-                       if -1 < n and self._notizen.noteId != -1:
-                               model = comboCategory.get_model()
-                               active = comboCategory.get_active()
-                               if active < 0:
-                                       return None
-                               cat_id = model[active][0]
+                       userResponse = dialog.run()
+               finally:
+                       dialog.destroy()
 
-                               noteid, category, note = self._db.loadNote(self._notizen.noteId)
-                               #print noteid, category, cat_id
-                               self._db.saveNote(noteid, note, cat_id, pcdatum = None)
-                               self._topBox.category_combo_changed()
-                       else:
-                               mbox = gtk.MessageDialog(self._window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("No note selected."))
-                               response = mbox.run()
-                               mbox.hide()
-                               mbox.destroy()
+               if userResponse != gtk.RESPONSE_ACCEPT:
+                       return
 
-               dialog.destroy()
+               n = comboCategory.get_active()
+               if -1 < n and self._notizen.noteId != -1:
+                       model = comboCategory.get_model()
+                       active = comboCategory.get_active()
+                       if active < 0:
+                               return None
+                       cat_id = model[active][0]
+
+                       noteid, pcdatum, category, note = self._db.loadNote(self._notizen.noteId)
+                       self._db.saveNote(noteid, note, cat_id, pcdatum = None)
+                       self._topBox.category_combo_changed()
+               else:
+                       mbox = gtk.MessageDialog(self._window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _("No note selected."))
+                       response = mbox.run()
+                       mbox.hide()
+                       mbox.destroy()
 
        @gtk_toolbox.log_exception(_moduleLogger)
        def _on_delete_category(self, widget = None, data = None):
index c66e811..d7fcc12 100644 (file)
@@ -165,7 +165,7 @@ class Speichern(object):
 
        def loadNote(self, noteid):
                if noteid is None or str(noteid) == "":
-                       return (None, None, None)
+                       return (None, None, None, None)
                sql = "SELECT noteid, pcdatum, category, note FROM notes WHERE noteid = ?"
                rows = self.ladeSQL(sql, (noteid, ))
                if rows is None or len(rows) == 0:
index f696e04..a24960c 100755 (executable)
@@ -21,6 +21,10 @@ __email__ = "n800@axique.net"
 __version__ = constants.__version__
 __build__ = constants.__build__
 __changelog__ = """
+0.7.9
+ * UI Tweak: Removed "New Note..." due to weirdness and duplicated behavior
+ * Bugfix: Move To Category
+
 0.7.8
  * Spell checking
  * Fixing the application title