add images to the README, clean up the imports in the python code

This commit is contained in:
2022-11-03 08:37:57 -04:00
parent 938a023a11
commit 925ae23f64
5 changed files with 46 additions and 29 deletions
+29 -10
View File
@@ -40,6 +40,9 @@ or if terminal apps are your preference.
The <code>**dirnotes-cli**</code> is a command line tool,
which may be handy for scripting. This all can also do maintenance on the database.
<img src=images/gui_sample.png alt="gui sample" />
<img src=images/tui_sample.png alt="tui sample" />
## USAGE
The <code>**dirnotes**</code> program displays usage and keystoke info
@@ -49,7 +52,7 @@ The <code>**dirnotes-cli**</code> program has a man page.
In short, you navigate <code>**dirnotes**</code> and
<code>**dirnotes-tui**</code> by using the up/down arrow keys,
<enter> to enter into a directory.
\<enter\> to enter into a directory.
The **-tui** version accepts _e_ for edit, _s_ for sort, _M_ to change
between xattr/database priority.
@@ -68,10 +71,22 @@ The <code>**dirnotes**</code> app requires _Python3_ and the _Qt5_ framework.
The <code>**dirnotes-tui**</code> and <code>**dirnotes-cli**</code> apps
simply require _Python3_.
Simply copy the file into your path, to ~/.local/bin for example.
Simply mark the 3 python files as executable copy them into your
path, to <code>\~/.local/bin/</code> or <code>/usr/local/bin/</code>.
chmod a+x dirnotes dirnotes-tui dirnotes-cli
cp dirnotes dirnotes-tui dirnotes-cli \~/.local/bin/
For a better GUI experience, copy
<code>dirnotes.desktop</code> to <code>~/.local/share/applications</code> and
<code>dirnotes.xpm</code> to <code>~/.local/share/icons/</code>
<code>dirnotes.desktop</code> to <code>\~/.local/share/applications</code> and
<code>dirnotes.xpm</code> to <code>\~/.local/share/icons/</code>
If you are using the command-line tool <code>**dirnotes-cli**</code>,
you can generate a man page using
pandoc -s -t man -o dirnotes-cli.1 dirnotes-cli.md
and copy that to ```~/.local/share/man/man1```
### CONFIG FILE
@@ -79,9 +94,9 @@ By default, the file **~/.config/dirnotes/dirnotes.conf** will be used to
load the user's config.
This is a JSON file, with three attributes that are important:
> * xattr_tag (default: <code>usrr.xdg.comment</code>)
> * database (default: <code>~/.local/share/dirnotes/dirnotes.db</code>, sensible alt: <code>/var/lib/dirnotes.db</code>)
> * start_mode (_xattr_ or _db_ display priority)
* xattr_tag (default: <code>user.xdg.comment</code>)
* database (default: <code>~/.local/share/dirnotes/dirnotes.db</code>, sensible alt: <code>/var/lib/dirnotes.db</code>)
* start_mode (_xattr_ or _db_ display priority)
The _config_file_ should be auto-generated the first time one of
the **dirnotes** apps is run.
@@ -190,9 +205,7 @@ As comments are editted or appended, new records are added to the database.
Older records are are not purged. This gives you a history of the comments,
but it means that fetching the most recent comment involves something like
~~~~
SELECT * FROM dirnotes WHERE name=? ORDER BY comment_date DESC
~~~~
and just fetch the first record.
@@ -202,7 +215,12 @@ The database is created the first time one of the **dirnotes** apps is run.
The <code>**dirnotes**</code> gui app has a desktop icon built into the code.
There is not need for an external .icon file, but there is an .xpm file included
in the project, which can be copied to ~/.local/share/icons/
in the project, which can be copied to <code>~/.local/share/icons/</code>
The 3 apps share a big block of common code. At this point, the code is embedded
in each executable, but perhaps in the future it will be brought out as a library.
I just like apps to be a single file I can copy to my various devices and servers,
but it does create a problem of keepint the 3 apps in sync.
### comment date & author
@@ -284,3 +302,4 @@ Perhaps the default locations should be in the user directory?
- so, for example, the user can't add comments to /usr/bin/\*
6. Is anyone interested in the MacOS version?
+3 -3
View File
@@ -2,6 +2,7 @@
# TODO: XDG compatibility: config in ~/.config/dirnotes/dirnotes.conf and data in ~/.local/share/dirnotes/dirnotes.db
# TODO: clearing a comment out to '' doesn't seem to work on both sides
# TODO: change banner line to indicate the CWD
""" a simple gui or command line app
to view and create/edit file comments
@@ -61,11 +62,10 @@ the comment box gets a light yellow background.
double-click the mouse, or hit &lt;Enter&gt;.
"""
import sys,os,time,argparse,stat,getpass,shutil,logging,math
import sys,argparse,logging
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt, pyqtSignal
import sqlite3, json
xattr_comment = "user.xdg.comment"
xattr_author = "user.xdg.comment.author"
@@ -87,7 +87,7 @@ def print_d(*a):
# >>> snip here <<<
#============ the DnDataBase, UiHelper and FileObj code is shared with other dirnotes programs
import getpass, time, stat, shutil
import getpass, time, stat, shutil, sqlite3, json, os, math
DEFAULT_CONFIG_FILE = "~/.config/dirnotes/dirnotes.conf" # or /etc/dirnotes.conf
+2 -3
View File
@@ -3,7 +3,7 @@
VERSION = "0.4"
import os, sys, argparse, json, sqlite3
import sys, argparse
# global mutables
answer_json = []
@@ -23,8 +23,7 @@ def errorBox(*a):
# >>> snip here <<<
#============ the DnDataBase, UiHelper and FileObj code is shared with other dirnotes programs
import getpass, time, stat, shutil
import getpass, time, stat, shutil, sqlite3, json, os, math
DEFAULT_CONFIG_FILE = "~/.config/dirnotes/dirnotes.conf" # or /etc/dirnotes.conf
# config
+3
View File
@@ -184,6 +184,9 @@ Or, in json format:
> <code>$ dirnotes-cli -j car_notes.txt</code>
> <code>[{"file": "car_notes.txt", "comment": "notes on the car repair"}]</code>
[NOTE: with json output, consider piping the results to <code>jq</code> for
pretty-print]
To append to a comment:
> <code>$ dirnotes-cli -a 'first quote: \$1,400' car_notes.txt</code>
+4 -8
View File
@@ -17,12 +17,9 @@
# FileObj: a file with its xattr-comment and db-comment data
# Files: a collection of FileObjs, sortable
import os, time, stat, sys, shutil
import time, math
import curses, sqlite3, curses.textpad
import logging, getpass, argparse
import json
import sys, time
import curses, curses.textpad
import logging, argparse
VERSION = "1.9"
# these may be different on MacOS
@@ -326,8 +323,7 @@ def errorBox(string):
# >>> snip here <<<
#============ the DnDataBase, UiHelper and FileObj code is shared with other dirnotes programs
import getpass, time, stat, shutil
import getpass, time, stat, shutil, sqlite3, json, os, math
DEFAULT_CONFIG_FILE = "~/.config/dirnotes/dirnotes.conf" # or /etc/dirnotes.conf
# config