Ejemplo n.º 1
0
def delete_search(search):
    find_new = False
    id = options.getIntOption("default_search", -1)
    if id == search.id:
        find_new = True

    db.store.remove(search)
    db.store.commit()

    if find_new:
        s = db.store.find(Searches, Searches.id == search.id).one()
        next_id = -1
        if s:
            next_id = s.id()
        options.setOption("default_search", str(next_id))
Ejemplo n.º 2
0
def delete_search(search):
    find_new = False
    id = options.getIntOption("default_search", -1)
    if id == search.id:
        find_new = True

    db.store.remove(search)
    db.store.commit()
    
    if find_new:
        s = db.store.find(Searches, Searches.id == search.id).one()
        next_id = -1
        if s:
            next_id = s.id()
        options.setOption("default_search", str(next_id))
Ejemplo n.º 3
0
 def _onDefault(self, event):
     idx = self._list.GetFirstSelected()
     if idx != wx.NOT_FOUND:
         id = self._list.GetItemData(idx)
         
         old_id = options.getIntOption("default_search")
         options.setOption("default_search", str(id))
         
         search = db.store.find(searches.Searches, searches.Searches.id == id).one()
         self._updateItem(idx, search)
         
         if old_id != -1:
             idx = self._list.FindItemData(-1, old_id)
             if idx != wx.NOT_FOUND:
                 search = db.store.find(searches.Searches, searches.Searches.id == old_id).one()
                 self._updateItem(idx, search)
Ejemplo n.º 4
0
    def _onDefault(self, event):
        idx = self._list.GetFirstSelected()
        if idx != wx.NOT_FOUND:
            id = self._list.GetItemData(idx)

            old_id = options.getIntOption("default_search")
            options.setOption("default_search", str(id))

            search = db.store.find(searches.Searches,
                                   searches.Searches.id == id).one()
            self._updateItem(idx, search)

            if old_id != -1:
                idx = self._list.FindItemData(-1, old_id)
                if idx != wx.NOT_FOUND:
                    search = db.store.find(
                        searches.Searches,
                        searches.Searches.id == old_id).one()
                    self._updateItem(idx, search)