zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #04149
Re: Search by time
Hi Agus,
good to hear that. I attach the changed file again as it was not added
to the zim-wiki list.
Regards,
Murat
On 17.02.2017 11:50, Agustin Lobo wrote:
Works great in 0.65
Thanks
Agus
On Thu, Feb 16, 2017 at 4:28 PM, Murat Güven <murat@xxxxxxxx> wrote:
Hi,
it's within the search menu.. Not sure if it was implemented in 0.62
already.
I used the latest version 0.65. I suggest that you update your version.
Regards,
Murat
Am 16. Feb. 2017, um 16:24, Agustin Lobo <aloboaleu@xxxxxxxxx> schrieb:
I've done as you say but cannot find the "Recent Changes Dialog" in
the zim menu. I'm using 0.62
Agus
On Thu, Feb 16, 2017 at 3:44 PM, "Murat Güven" <murat@xxxxxxxx> wrote:
Hi Agus,
psa the quick patch for this function. You need to replace this with the
py
file within the zim/gui folder.
The standard view will display your pages from today - 60 days.
I also switched the order of the columns to have the date visible right
away
without the need to scroll the window to the right on large page names.
I will most probably add a calendar selector for the date. Currently you
need to type in the desired date in the given format.
Please let me know if this works.
Regards,
Murat
Gesendet: Dienstag, 14. Februar 2017 um 13:37 Uhr
Von: "Agustin Lobo" <aloboaleu@xxxxxxxxx>
An: "Murat Güven" <murat@xxxxxxxx>
Cc: "zim-wiki@xxxxxxxxxxxxxxxxxxx" <zim-wiki@xxxxxxxxxxxxxxxxxxx>
Betreff: Re: [Zim-wiki] Search by time
Murat,
Yes, being able to set the date range would be great, thanks
Agus
On Tue, Feb 14, 2017 at 1:03 PM, "Murat Güven" <murat@xxxxxxxx> wrote:
Hi,
I had a look into recentchangesdialog.py and it seems as if the limit
is
currently set to 50 entries.
@Augustin:
Is this what you were looking for? I thought about patching this
dialog,
but
I don't know if it makes sense to have
a from / to field to select the date window?
Regards,
Murat
Gesendet: Donnerstag, 09. Februar 2017 um 10:53 Uhr
Von: "Jaap Karssenberg" <jaap.karssenberg@xxxxxxxxx>
An: "Amir Baghban" <arbasli2@xxxxxxxxx>, "Agustin Lobo"
<aloboaleu@xxxxxxxxx>
Cc: "zim-wiki@xxxxxxxxxxxxxxxxxxx" <zim-wiki@xxxxxxxxxxxxxxxxxxx>
Betreff: Re: [Zim-wiki] Search by time
There is a "recent changes" dialog in the latest version - you can find
it
in the "Search" menu.
Currently it is limited to showing the last 20 pages, but I would
suggest
patching that dialog if you want to add more functionality.
-- Jaap
On Thu, Feb 9, 2017 at 9:26 AM Amir Baghban <arbasli2@xxxxxxxxx> wrote:
I think this is a missing feature and it would be great sometime to
have
a
plugin for it. Such a plugin would sort the pages based on time in a
pane
next to index pane.
For now I have written a python script that I run it using "custom
tools"
feature of zim. This script creates links to the last n page and
prints
them
in the open page.
You can see it here:
https://github.com/arbasli2/Zim-Scripts
I have tested it on both Linux and windows.
Best
Amir
On Wed, Feb 8, 2017 at 6:25 PM, Agustin Lobo <aloboaleu@xxxxxxxxx>
wrote:
Can I search my notes by time? For example, listing those notes
modified in the last 3 months
Thanks
--
Agustin Lobo
aloboaleu@xxxxxxxxx
________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~zim-wiki
More help : https://help.launchpad.net/ListHelp
________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~zim-wiki
More help : https://help.launchpad.net/ListHelp
________________________________
Mailing list:
https://launchpad.net/~zim-wiki Post to : zim-wiki@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~zim-wiki More help :
https://help.launchpad.net/ListHelp
--
Agustin Lobo
aloboaleu@xxxxxxxxx
________________________________
Mailing list: https://launchpad.net/~zim-wiki
Post to : zim-wiki@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~zim-wiki
More help : https://help.launchpad.net/ListHelp
# -*- coding: utf-8 -*-
# Copyright 2013 Jaap Karssenberg <jaap.karssenberg@xxxxxxxxx>
# 2017-02-16: patched with date entries by Murat Güven <muratg@xxxxxxxxx>
import gtk
import gobject
import logging
import zim.datetimetz as datetime
from zim.notebook import Path
from zim.gui.widgets import Dialog, BrowserTreeView, ScrolledWindow
logger = logging.getLogger('zim.gui.dialogs')
class RecentChangesDialog(Dialog):
def __init__(self, ui):
Dialog.__init__(self, ui, _('Recent Changes'), # T: Dialog title
buttons=gtk.BUTTONS_CLOSE,
defaultwindowsize=(500, 300)
)
self.hbox_from_date = gtk.HBox()
self.label_from_date = gtk.Label("From date: ")
self.entry_from_date = gtk.Entry()
self.entry_from_date.set_icon_from_stock(1, "gtk-find")
#self.entry_from_date.connect("icon-press", self.get_from_date) # TODO: Allow selection of date via calendar
self.entry_from_date.connect('activate', self.get_from_date)
self.hbox_from_date.pack_start(self.label_from_date, expand = False, padding = 2)
self.hbox_from_date.pack_start(self.entry_from_date, expand = False, padding = 2)
self.hbox_to_date = gtk.HBox()
self.label_to_date = gtk.Label("To date: ")
self.entry_to_date = gtk.Entry()
self.entry_to_date.set_icon_from_stock(1, "gtk-find")
#self.entry_to_date.connect("icon-press", self.get_to_date) # TODO: Allow selection of date via calendar
self.entry_to_date.connect('activate', self.get_to_date)
self.hbox_to_date.pack_start(self.label_to_date, expand = False, padding = 2)
self.hbox_to_date.pack_start(self.entry_to_date, expand = False, padding = 2)
self.hbox = gtk.HBox()
self.hbox.pack_start(self.hbox_from_date, expand = False, padding = 2)
self.hbox.pack_start(self.hbox_to_date, expand = False, padding = 2)
self.vbox.pack_start(self.hbox, expand = False, padding = 2)
self.start_date = datetime.date.today() - datetime.timedelta(days=60) # TODO: days...could be something for preferences
self.end_date = datetime.date.today()
self.treeview = RecentChangesTreeView(ui)
self.vbox.pack_start(ScrolledWindow(self.treeview), expand = True, padding = 2)
self.update(self.start_date, self.end_date)
self.ui.notebook.connect_after('stored-page', lambda *a: self.update(self.start_date, self.end_date))
#self.entry_from_date.append_text(RecentChangesTreeView._start_date)
def get_from_date(self, entry):
date_entered = entry.get_text()
dt_entered = datetime.datetime.strptime(date_entered, '%Y-%m-%d').date()
self.update(dt_entered, self.end_date)
def get_to_date(self, entry):
date_entered = entry.get_text()
dt_entered = datetime.datetime.strptime(date_entered, '%Y-%m-%d').date()
self.update(self.start_date, dt_entered)
def update(self, start_dt, end_dt):
model = self.treeview.get_model()
model.clear()
self.start_date = start_dt
self.end_date = end_dt
n_list_all_pages = self.ui.notebook.index.n_list_all_pages()
# list = self.ui.notebook.index.list_recent_pages(offset=0, limit=50)
list = self.ui.notebook.index.list_recent_pages(offset=0, limit=n_list_all_pages)
for indexpath in list:
# model.append((indexpath.name, indexpath.contentkey)) # HACK !
page_date = self.get_date_of_page(indexpath.contentkey)
if page_date >= start_dt and page_date <= end_dt:
model.append((indexpath.name, indexpath.contentkey)) # HACK !
self.entry_from_date.set_text(str(self.start_date))
self.entry_to_date.set_text(str(self.end_date))
def get_date_of_page(self, date):
utime = date
if utime:
utime = float(utime)
dt = datetime.datetime.fromtimestamp(utime)
return dt.date()
else:
return datetime.date.today()
class RecentChangesTreeView(BrowserTreeView):
NAME_COL = 0
MODIFIED_COL = 1
def __init__(self, ui):
model = gtk.ListStore(str, str)
# NAME_COL, MODIFIED_COL
BrowserTreeView.__init__(self, model)
self.ui = ui
today = datetime.date.today()
yesterday = today - datetime.timedelta(days=1)
self.start_date = today
self.end_date = today
def render_date(col, cell, model, i):
utime = model.get_value(i, self.MODIFIED_COL)
if utime:
utime = float(utime)
dt = datetime.datetime.fromtimestamp(utime)
date = dt.date()
if date == today:
text = _('Today') + datetime.strftime(' %H:%M', dt)
# T: label for modified time
elif date == yesterday:
text = _('Yesterday') + datetime.strftime(' %H:%M', dt)
# T: label for modified time
elif date.year == today.year:
text = datetime.strftime('%a %d %b %H:%M', dt) # TODO allow config for format ?
else:
text = datetime.strftime('%a %d %b %Y %H:%M', dt) # TODO allow config for format ?
else:
text = ''
cell.set_property('text', text)
cell_renderer = gtk.CellRendererText()
#cell_renderer.set_property('font', 'mono')
column = gtk.TreeViewColumn(_('Last Modified'), cell_renderer, text=self.MODIFIED_COL) # T: Column header
column.set_cell_data_func(cell_renderer, render_date)
column.set_sort_column_id(self.MODIFIED_COL)
self.append_column(column)
# changed the order of the columns as date column is not shown in dialog directly if page name is too long
cell_renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn(_('Page'), cell_renderer, text=self.NAME_COL) # T: Column header
column.set_sort_column_id(self.NAME_COL)
column.set_expand(True)
self.append_column(column)
self.connect('row-activated', self._do_open_page)
def _do_open_page(self, view, path, col):
page = Path( self.get_model()[path][self.NAME_COL].decode('utf-8') )
self.ui.open_page(page)
References