cdhorn / CardView

A Gramps browseable object view
GNU General Public License v2.0
24 stars 5 forks source link

CardView mode not restored on restart & crippled Console for Gramps #204

Closed emyoulation closed 2 years ago

emyoulation commented 2 years ago

The Dashboard CardView is not reloaded when it was the last view mode on exit.

Suddenly, the Gramps console no longer shows any context menu (mark all, copy, etc.) nor allows marking console text for clipboarding. Is something trying to set up a context menu? Perhaps it reset the Console's context menu instead of the one for the Gramps GUI?

Was trying to collect the following message about "ModuleNotFoundError: No module named 'gramps'": image

cdhorn commented 2 years ago

Interesting, that seems to have been working okay for me.

After shutdown what are last-view and last-views set to in your gramps.ini?

emyoulation commented 2 years ago

I also noticed that the Dashboard view appeared with the default set of toolbar icons, then the Default Dashboard view mode populated its gramplets, then the Toolbar refreshed and added the Dashboard CardView mode icon.

[preferences]
age-display-precision=3
;;calendar-format-report=0
cprefix='C%06d'
date-format=5
;;default-source=0
eprefix='E%07d'
family-relation-type=0
;;family-warn=1
font='Sans 10'
fprefix='F%06d'
;;hide-ep-msg=0
;;invalid-date-format='<b>%s</b>'
iprefix='I%07d'
last-view='dashboardcardview'
last-views=['dashboardcardview', 'personview', 'relview', 'familyview', 'pedigreeview', 'eventview', 'placetreeview', 'geo6', 'sourceview', 'citationlistview', 'repoview', 'mediaview', 'noteview', 'tagcardview']
;;name-format=1
;;no-given-text='[Missing Given Name]'
;;no-record-text='[Missing Record]'
;;no-surname-text='[Missing Surname]'
nprefix='N%06d'
;;online-maps=0
oprefix='O%06d'
;;paper-metric=0
;;paper-preference='Letter'
;;patronimic-surname=0
;;place-auto=1
;;place-format=0
pprefix='P%06d'
;;private-given-text='[Living]'
;;private-record-text='[Private Record]'
;;private-surname-text='[Living]'
quick-backup-include-mode=1
;;rprefix='R%04d'
sprefix='S%06d'
tag-on-import=1
;;tag-on-import-format='Imported %Y/%m/%d %H:%M:%S'
theme='Adwaita'
theme-dark-variant='False'
;;use-last-view=0
emyoulation commented 2 years ago

And after the last test with Gramps sitting idle in the default Dashboard View, a spontaneous exit.

cdhorn commented 2 years ago

When you have a chance let me know if you continue to have issues with 0.99.105

emyoulation commented 2 years ago

[Correction: CardView mode restores.]

The issue persists with the 0.99.105 version. I launched Gramps twice in succession with my tree. Both times required manually choosing the Dashboard Card View mode.

C:\Program Files\GrampsAIO64-5.1.5>gramps
2022-06-29 19:39:05.126: WARNING: dummydb.py: line 685: database is closed
2022-06-29 19:39:05.437: WARNING: dummydb.py: line 685: database is closed
render_page: dashboard 0.5480022430419922
Traceback (most recent call last):
  File "C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\CardView\src\view\services\service_statistics_worker.py", line 46, in <module>
    from gramps.gen.datehandler import get_date
ModuleNotFoundError: No module named 'gramps'
stats collected: 60.46595811843872

C:\Program Files\GrampsAIO64-5.1.5>gramps
2022-06-29 19:41:46.552: WARNING: dummydb.py: line 685: database is closed
2022-06-29 19:41:46.866: WARNING: dummydb.py: line 685: database is closed

manually select the Card View dashboard (even though it was the last active view)

render_page: dashboard 0.5241250991821289
Traceback (most recent call last):
  File "C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\CardView\src\view\services\service_statistics_worker.py", line 46, in <module>
    from gramps.gen.datehandler import get_date
ModuleNotFoundError: No module named 'gramps'
stats collected: 48.36422562599182
emyoulation commented 2 years ago

Did some further tests.

emyoulation commented 2 years ago

Success!!

Tried turning of the Preferences setting, exiting, restarting, resetting the preferences. Repeating the test with a 1 person Tree now showed the CardView dashboard upon relaunch.

Still saw odd log messages:


C:\Program Files\GrampsAIO64-5.1.5>gramps
Warning: GlobalHistory: Signal emitted with wrong arg types: active-changed
         from: file: C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\RestoreHist\restorehist.py
               line: 59
               func: clear_history
    arg passed was: ['Person', 'f10f53d599d6b545cb823003a14'], type of arg passed <class 'list'>,  type should be: <class 'tuple'>
render_page: dashboard 0.17999863624572754
stats collected: 0.5838706493377686
Warning: StatisticsService: Exception occurred in callback function.
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\utils\callback.py", line 409, in emit
    fn(*args)
  File "C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\CardView\src\view\groups\group_statistics.py", line 593, in load_data
    result = PREPARE_GROUP[self.key](data)
  File "C:\Users\DistrictSupport\AppData\Roaming\gramps\gramps51\plugins\CardView\src\view\groups\group_statistics.py", line 354, in get_citation_statistics
    ("> %s" % CITATION_LABELS[key], count, count * 100 / total)
ZeroDivisionError: division by zero

C:\Program Files\GrampsAIO64-5.1.5>
cdhorn commented 2 years ago

The RestoreHist issue can be ignored as I recall. I submitted a PR to help make it work cleanly with the GlobalHistory class but don't think Paul looked at it yet. If you examine the hist_save.ini it saves the data in json format, and the tuples the GlobalHistory class passes to it are converted to lists and when read back in need to be recast as tuples.