Skip to content

Commit 0870e6e

Browse files
committed
Remove Reindex code
1 parent 7959548 commit 0870e6e

File tree

1 file changed

+0
-142
lines changed

1 file changed

+0
-142
lines changed

JWLManager.py

-142
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ def connect_signals():
8282
self.actionSave_As.triggered.connect(self.save_as_file)
8383
self.actionClean.triggered.connect(self.clean_items)
8484
self.actionObscure.triggered.connect(self.obscure_items)
85-
# self.actionReindex.triggered.connect(self.reindex_db)
8685
self.actionSort.triggered.connect(self.sort_notes)
8786
self.actionExpand_All.triggered.connect(self.expand_all)
8887
self.actionCollapse_All.triggered.connect(self.collapse_all)
@@ -634,7 +633,6 @@ def enable_options(enabled):
634633
self.combo_grouping.setEnabled(enabled)
635634
self.combo_category.setEnabled(enabled)
636635
self.actionMerge.setEnabled(enabled)
637-
# self.actionReindex.setEnabled(enabled)
638636
self.actionObscure.setEnabled(enabled)
639637
self.actionSort.setEnabled(enabled)
640638
self.actionClean.setEnabled(enabled)
@@ -959,7 +957,6 @@ def archive_modified(self):
959957
self.button_export.setEnabled(self.int_total)
960958
self.actionClean.setEnabled(self.actionClean.isEnabled() and self.int_total)
961959
self.actionObscure.setEnabled(self.actionObscure.isEnabled() and self.int_total)
962-
# self.actionReindex.setEnabled(self.actionReindex.isEnabled() and self.int_total)
963960
self.actionSort.setEnabled(self.actionSort.isEnabled() and self.int_total)
964961
self.actionExpand_All.setEnabled(self.actionExpand_All.isEnabled() and self.int_total)
965962
self.actionCollapse_All.setEnabled(self.actionCollapse_All.isEnabled() and self.int_total)
@@ -1470,7 +1467,6 @@ def playlist_export():
14701467
expcon = sqlite3.connect(f'{playlist_path}/userData.db')
14711468
expcon.executescript("PRAGMA temp_store = 2; PRAGMA journal_mode = 'OFF'; PRAGMA foreign_keys = 'OFF';")
14721469
item_list = playlist_export()
1473-
# self.reindex_db(expcon, playlist_path)
14741470
expcon.execute('INSERT INTO LastModified VALUES (?);', (datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ'),))
14751471
expcon.executescript('PRAGMA foreign_keys = "ON"; VACUUM;')
14761472
expcon.commit()
@@ -3316,144 +3312,6 @@ def obscure_notes():
33163312
self.regroup(False, message)
33173313
self.archive_modified()
33183314

3319-
# def reindex_db(self, con=None, pth=None):
3320-
3321-
# def init_progress():
3322-
# progress_dialog = QProgressDialog(_('Please wait…'), None, 0, 28, parent=self)
3323-
# progress_dialog.setWindowModality(Qt.WindowModal)
3324-
# progress_dialog.setWindowTitle(_('Reindexing'))
3325-
# progress_dialog.setWindowFlag(Qt.FramelessWindowHint)
3326-
# progress_dialog.setModal(True)
3327-
# progress_dialog.setMinimumDuration(0)
3328-
# return progress_dialog
3329-
3330-
# def make_table(table):
3331-
# con.executescript(f'CREATE TABLE CrossReference (Old INTEGER, New INTEGER PRIMARY KEY AUTOINCREMENT); INSERT INTO CrossReference (Old) SELECT {table}Id FROM {table} ORDER BY {table}Id;')
3332-
3333-
# def update_table(table, field):
3334-
# app.processEvents()
3335-
# con.executescript(f'UPDATE {table} SET {field} = (SELECT -New FROM CrossReference WHERE Old = {table}.{field}); UPDATE {table} SET {field} = abs({field});')
3336-
# if self.interactive:
3337-
# progress_dialog.setValue(progress_dialog.value() + 1)
3338-
3339-
# def reindex_notes():
3340-
# make_table('Note')
3341-
# update_table('Note', 'NoteId')
3342-
# update_table('TagMap', 'NoteId')
3343-
# con.execute('DROP TABLE CrossReference;')
3344-
# con.execute('UPDATE Note SET LastModified = LastModified || "Z" WHERE LastModified IS NOT NULL AND LastModified NOT LIKE "%Z"')
3345-
# con.execute('UPDATE Note SET Created = Created || "Z" WHERE Created IS NOT NULL AND Created NOT LIKE "%Z"')
3346-
3347-
# def reindex_bookmarks():
3348-
# make_table('Bookmark')
3349-
# update_table('Bookmark', 'BookmarkId')
3350-
# con.execute('DROP TABLE CrossReference;')
3351-
3352-
# def reindex_highlights():
3353-
# make_table('UserMark')
3354-
# update_table('UserMark', 'UserMarkId')
3355-
# update_table('Note', 'UserMarkId')
3356-
# update_table('BlockRange', 'UserMarkId')
3357-
# con.execute('DROP TABLE CrossReference;')
3358-
# make_table('BlockRange')
3359-
# update_table('BlockRange', 'BlockRangeId')
3360-
# con.execute('DROP TABLE CrossReference;')
3361-
3362-
# def reindex_playlists():
3363-
3364-
# def clean_media():
3365-
# thumbs = {row[0] for row in con.execute('SELECT ThumbnailFilePath FROM PlaylistItem;').fetchall()}
3366-
# ind = {row[0] for row in con.execute('SELECT FilePath FROM IndependentMedia JOIN PlaylistItemIndependentMediaMap USING (IndependentMediaId)').fetchall()}
3367-
# ind.update(['userData.db', 'manifest.json', 'default_thumbnail.png'])
3368-
# for file in glob(pth + '/*'):
3369-
# f = Path(file).name
3370-
# if (f not in thumbs) and (f not in ind):
3371-
# try:
3372-
# os.remove(pth + '/' + f)
3373-
# except:
3374-
# pass
3375-
# if self.interactive:
3376-
# progress_dialog.setValue(progress_dialog.value() + 1)
3377-
3378-
# make_table('PlaylistItem')
3379-
# update_table('PlaylistItem', 'PlaylistItemId')
3380-
# update_table('PlaylistItemIndependentMediaMap', 'PlaylistItemId')
3381-
# update_table('PlaylistItemLocationMap', 'PlaylistItemId')
3382-
# update_table('PlaylistItemMarker', 'PlaylistItemId')
3383-
# update_table('TagMap', 'PlaylistItemId')
3384-
# con.execute('DROP TABLE CrossReference;')
3385-
3386-
# make_table('IndependentMedia')
3387-
# update_table('IndependentMedia', 'IndependentMediaId')
3388-
# update_table('PlaylistItemIndependentMediaMap','IndependentMediaId')
3389-
# con.execute('DROP TABLE CrossReference;')
3390-
3391-
# make_table('PlaylistItemMarker')
3392-
# update_table('PlaylistItemMarker', 'PlaylistItemMarkerId')
3393-
# update_table('PlaylistItemMarkerBibleVerseMap', 'PlaylistItemMarkerId')
3394-
# update_table('PlaylistItemMarkerParagraphMap', 'PlaylistItemMarkerId')
3395-
# con.execute('DROP TABLE CrossReference;')
3396-
3397-
# clean_media()
3398-
3399-
# def reindex_tags():
3400-
# make_table('TagMap')
3401-
# update_table('TagMap', 'TagMapId')
3402-
# con.execute('DROP TABLE CrossReference;')
3403-
# make_table('Tag')
3404-
# update_table('Tag', 'TagId')
3405-
# update_table('TagMap', 'TagId')
3406-
# con.execute('DROP TABLE CrossReference;')
3407-
3408-
# def reindex_locations():
3409-
# make_table('Location')
3410-
# update_table('Location', 'LocationId')
3411-
# update_table('Note', 'LocationId')
3412-
# update_table('InputField', 'LocationId')
3413-
# update_table('UserMark', 'LocationId')
3414-
# update_table('Bookmark', 'LocationId')
3415-
# update_table('Bookmark', 'PublicationLocationId')
3416-
# update_table('TagMap', 'LocationId')
3417-
# update_table('PlaylistItemLocationMap', 'LocationId')
3418-
# con.execute('DROP TABLE CrossReference;')
3419-
3420-
# self.interactive = False
3421-
# if not con:
3422-
# self.interactive = True
3423-
# reply = QMessageBox.information(self, _('Reindex'), _('This may take a few seconds.\nProceed?'), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
3424-
# if reply == QMessageBox.No:
3425-
# return
3426-
# self.statusBar.showMessage(' '+_('Reindexing. Please wait…'))
3427-
# app.processEvents()
3428-
# progress_dialog = init_progress()
3429-
# if not pth:
3430-
# pth = TMP_PATH
3431-
# try:
3432-
# if self.interactive:
3433-
# con = sqlite3.connect(f'{pth}/{DB_NAME}')
3434-
# con.executescript("PRAGMA temp_store = 2; PRAGMA journal_mode = 'OFF'; PRAGMA foreign_keys = 'OFF';")
3435-
# reindex_notes()
3436-
# reindex_tags()
3437-
# reindex_playlists()
3438-
# reindex_highlights()
3439-
# reindex_bookmarks()
3440-
# reindex_locations()
3441-
# con.executescript("PRAGMA foreign_keys = 'ON'; VACUUM;")
3442-
# con.commit()
3443-
# if self.interactive:
3444-
# con.close()
3445-
# else:
3446-
# except Exception as ex:
3447-
# self.crash_box(ex)
3448-
# progress_dialog.close()
3449-
# self.clean_up()
3450-
# sys.exit()
3451-
# if self.interactive:
3452-
# message = ' '+_('Reindexed successfully')
3453-
# self.statusBar.showMessage(message, 4000)
3454-
# self.regroup(True, message)
3455-
# self.archive_modified()
3456-
34573315
def sort_notes(self):
34583316

34593317
def reorder():

0 commit comments

Comments
 (0)