X-Git-Url: https://git.phdru.name/?p=xsetbg.git;a=blobdiff_plain;f=xsetbg_db.py;h=406ca9609809caf9c77714a2b66e3091f0af7425;hp=e64440ae7b045730e6adee16031b675455cdd1eb;hb=HEAD;hpb=5bf30e4e42543b6be01448937183f3470cc731f3 diff --git a/xsetbg_db.py b/xsetbg_db.py index e64440a..638ce49 100755 --- a/xsetbg_db.py +++ b/xsetbg_db.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 """XSetBg database """ @@ -11,7 +11,7 @@ from xsetbg_conf import xsetbg_conf __all__ = ['xsetbg_db_path', 'xsetbg_db'] # octal; -rw-------; make the database file(s) readable only by the user -os.umask(0066) +os.umask(0o066) class XSetBg(SQLObject): @@ -19,10 +19,12 @@ class XSetBg(SQLObject): last_shown = IntCol(default=None) # timestamp flag = BoolCol(default=None) is_image = BoolCol(default=None) + show = BoolCol(default=True) last_shown_idx = DatabaseIndex('last_shown') flag_idx = DatabaseIndex('flag') is_image_idx = DatabaseIndex('is_image') + show_idx = DatabaseIndex('show') def recreate_db(): @@ -49,9 +51,10 @@ class SQLiteMassInsert(object): return txn def __exit__(self, *args, **kw): - sqlhub.processConnection.commit() + sqlhub.processConnection.commit(close=True) connection = sqlhub.processConnection = self.connection connection.query("VACUUM") + connection.close() db_dirs = []