pgaskin / NickelMenu

The easiest way to launch scripts, change settings, and run actions on Kobo e-readers.
https://pgaskin.net/NickelMenu
MIT License
507 stars 24 forks source link

Implement experimental option for custom main menu icon on 4.23.15505+ #98

Closed pgaskin closed 3 years ago

pgaskin commented 3 years ago

closes #84

pgaskin commented 3 years ago

Done, but I haven't actually tested it yet.

NiLuJe commented 3 years ago

Might not be directly related to this PR, but, I botched the syntax (forgot the extra), and I'd also left the selection stuff uncommented, which meant I ended up with a Config parsing error.

Except, even if I fix it, NM tries to re-parse it (e.g., the ts change is detected, revision incremented and all that jazz), but it still fails to parse, and prints the line numbers from the old, broken file?

NiLuJe commented 3 years ago

Okay, have now tried with random giant (as in, Forma-sized) PNGs (e.g., KOReader's icon), and it's quite likely crashing right after:

Dec  3 17:54:37 nickel: (NickelMenu) MainNavView::MainNavView(0x17271e8, (nil)) (src/nickelmenu.cc:220)
Dec  3 17:54:37 nickel: (NickelMenu) Adding main menu button in tab bar for firmware 4.23.15505+. (src/nickelmenu.cc:223)
Dec  3 17:54:37 nickel: (NickelMenu) Added button. (src/nickelmenu.cc:360)
NiLuJe commented 3 years ago
warning: Can't read data for section '.eh_frame' in file '/usr/local/Kobo/imageformats/libnm.so'
0x2e5a3432 in ?? () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
(gdb) bt full
#0  0x2e5a3432 in ?? () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
No symbol table info available.
#1  0x2e5a8154 in QImage::convertToFormat(QImage::Format, QFlags<Qt::ImageConversionFlag>) const () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
No symbol table info available.
#2  0x2e5c5718 in QRasterPlatformPixmap::createPixmapForImage(QImage&, QFlags<Qt::ImageConversionFlag>, bool) () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
No symbol table info available.
#3  0x2e5c5844 in QRasterPlatformPixmap::fromImage(QImage const&, QFlags<Qt::ImageConversionFlag>) () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
No symbol table info available.
#4  0x2e5c2d14 in QPlatformPixmap::fromFile(QString const&, char const*, QFlags<Qt::ImageConversionFlag>) () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
No symbol table info available.
#5  0x2e5bd296 in QPixmap::load(QString const&, char const*, QFlags<Qt::ImageConversionFlag>) () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
No symbol table info available.
#6  0x2e5bd384 in QPixmap::QPixmap(QString const&, char const*, QFlags<Qt::ImageConversionFlag>) () from /usr/local/Qt-5.2.1-arm/lib/libQt5Gui.so.5
No symbol table info available.
#7  0x2b82d044 in QuickTourWidget::QuickTourWidget(QWidget*) () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#8  0x2b826eca in Ui_HomePageView::setupUi(QWidget*) () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#9  0x2b8267de in HomePageView::HomePageView(QWidget*) () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#10 0x2b81f4b0 in HomePageController::loadView() () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#11 0x2b8efb22 in ?? () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#12 0x2b8f129c in MainWindowController::push(AbstractController*, bool) () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#13 0x2b8f24fc in MainWindowController::show(AbstractController*) () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#14 0x2b8f2ed4 in MainWindowController::createHomePage() () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#15 0x2b80335a in N3PostFTEWorkflowManager::endWorkflow() () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#16 0x2b803418 in N3PostFTEWorkflowManager::progressWorkflow() () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#17 0x2b80367e in N3PostFTEWorkflowManager::startWorkflow() () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#18 0x2b8f4b56 in Nickel3Application::finishInitialization() () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#19 0x2b8f69d2 in Nickel3Application::Nickel3Application(int&, char**) () from /usr/local/Kobo/libnickel.so.1
No symbol table info available.
#20 0x0001f172 in main ()
No symbol table info available.
NiLuJe commented 3 years ago

Good news: it's 100% less explode-y when using smaller icons.

New problem, though: the scaling ^^.

nm_pixmap

(From 144x icons pilfered from https://github.com/koreader/koreader/pull/6937 ;p).

nm nm_act

Also: the active variant is never displayed.

NiLuJe commented 3 years ago

Also: the active variant is never displayed.

Note that this also applies to the default icon ^^

jackiew1 commented 3 years ago

Unless I'm misunderstanding nickel, MainNavView.qss is expecting the icon to be a certain size:

pgaskin commented 3 years ago

Thanks for testing this!

(From 144x icons pilfered from koreader/koreader#6937 ;p).

Ooh, I like that icon. It fits well with the rest (I should have thought of the new material icons earlier). I might even make it the default in the future.

Also: the active variant is never displayed

That's why I set the defaults for it as I did :) .

Unless I'm misunderstanding nickel, MainNavView.qss is expecting the icon to be a certain size:

I guess I could parse the scale from MainNavView.qss or one of the existing icons, then dynamically resize the pixmap. This would also allow me to easily add an option for SVG icons in the future, which would be a requirement for me to add a custom icon since I try to keep NM as forward-compatible as possible.

Okay, have now tried with random giant (as in, Forma-sized) PNGs (e.g., KOReader's icon), and it's quite likely crashing right after:

I'll have to look into that crash to ensure I understand the requirements properly.

Might not be directly related to this PR, but, I botched the syntax (forgot the extra), and I'd also left the selection stuff uncommented, which meant I ended up with a Config parsing error.

Except, even if I fix it, NM tries to re-parse it (e.g., the ts change is detected, revision incremented and all that jazz), but it still fails to parse, and prints the line numbers from the old, broken file?

Huh. That shouldn't be possible unless there's a bug somewhere or one of my assumptions with menu behaviour was incorrect. Do the logs shown NM re-injecting the config error after the updated config files are parsed, or is it staying with the old one?

jackiew1 commented 3 years ago

I guess I could parse the scale from MainNavView.qss or one of the existing icons, then dynamically resize the pixmap. This would also allow me to easily add an option for SVG icons in the future, which would be a requirement for me to add a custom icon since I try to keep NM as forward-compatible as possible.

Just FYI... MainNavView doesn't contain the exact icon size it contains a min-/max-height value of 2.5 x icon height (for model), to also include height of label (plus some vertical padding???). So taking size from existing icons might be more reliable in the long run.

NiLuJe commented 3 years ago

Huh. That shouldn't be possible unless there's a bug somewhere or one of my assumptions with menu behaviour was incorrect. Do the logs shown NM re-injecting the config error after the updated config files are parsed, or is it staying with the old one?

Here's the full log:

``` Dec 3 17:45:55 syslogd started: BusyBox v1.31.1.kobo Dec 3 17:45:56 nickel: ( 0.394 @ 0x154adf0) FT_New_Face failed with index 0 : 0 Dec 3 17:45:56 nickel: ( 0.964 @ 0x154adf0) FT_New_Face failed with index 0 : 0 Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) initializing 'NickelDBus' (version: 0.1.0) Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... desc: Observe and control Nickel over D-Bus Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) creating failsafe Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: allocating memory Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: finding filenames Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: ensuring own lib remains in memory even if it is dlclosed after being loaded with a dlopen Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: renaming /usr/local/Kobo/imageformats/libndb.so to /usr/local/Kobo/imageformats/libndb.so.failsafe Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) checking config Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) checking for uninstall !flag '/mnt/onboard/.adds/nickeldbus' Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) loading libraries Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) resolving symbols Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) applying hooks Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) calling next init Dec 3 17:45:57 nickel: (NickelDBus) (init) Writing version to /mnt/onboard/.adds/nickeldbus Dec 3 17:45:57 nickel: (NickelDBus) NickelDBus: registering object /nickeldbus Dec 3 17:45:57 nickel: (NickelDBus) NickelDBus: registering interface com.github.shermp.nickeldbus Dec 3 17:45:57 nickel: (NickelDBus) connecting 2aboutToConnect() to 2pfmAboutToConnect() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2doneProcessing() to 2pfmDoneProcessing() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2tryingToConnect() to 2wmTryingToConnect() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2networkConnected() to 2wmNetworkConnected() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2networkDisconnected() to 2wmNetworkDisconnected() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2networkForgotten() to 2wmNetworkForgotten() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2networkFailedToConnect() to 2wmNetworkFailedToConnect() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2scanningStarted() to 2wmScanningStarted() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2scanningFinished() to 2wmScanningFinished() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2scanningAborted() to 2wmScanningAborted() Dec 3 17:45:57 nickel: (NickelDBus) connecting 2wifiEnabled(bool) to 2wmWifiEnabled(bool) Dec 3 17:45:57 nickel: (NickelDBus) connecting 2linkQualityForConnectedNetwork(double) to 2wmLinkQualityForConnectedNetwork(double) Dec 3 17:45:57 nickel: (NickelDBus) connecting 2macAddressAvailable(QString) to 2wmMacAddressAvailable(QString) Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) destroying failsafe Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: scheduling restore Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) done init Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) initializing 'NickelMenu' (version: v0.4.1-2-gd0b291f) Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: restoring after 0 seconds Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: renaming /usr/local/Kobo/imageformats/libndb.so.failsafe to /usr/local/Kobo/imageformats/libndb.so Dec 3 17:45:57 nickel: (NickelDBus) (NickelHook) ... failsafe: info: freeing memory Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... desc: Integrated launcher for Nickel. Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) creating failsafe Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... failsafe: info: allocating memory Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... failsafe: info: finding filenames Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... failsafe: info: ensuring own lib remains in memory even if it is dlclosed after being loaded with a dlopen Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... failsafe: info: renaming /usr/local/Kobo/imageformats/libnm.so to /usr/local/Kobo/imageformats/libnm.so.failsafe Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) checking config Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) checking for uninstall flag '/mnt/onboard/.adds/nm/uninstall' Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) loading libraries Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) resolving symbols Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN28AbstractNickelMenuController18createMenuTextItemEP5QMenuRK7QStringbbS4_' from RTLD_DEFAULT to 0x327ee4f4 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN22AbstractMenuController12createActionEP5QMenuP7QWidgetbbb' from RTLD_DEFAULT to 0x327ee4e8 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN25ConfirmationDialogFactory12showOKDialogERK7QStringS2_' from RTLD_DEFAULT to 0x327ee4cc Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN20MainWindowController14sharedInstanceEv' from RTLD_DEFAULT to 0x327ee4d0 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN20MainWindowController5toastERK7QStringS2_i' from RTLD_DEFAULT to 0x327ee4d4 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN18LightMenuSeparatorC2EP7QWidget' from RTLD_DEFAULT to 0x327ee4ec Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN17BoldMenuSeparatorC1EP7QWidget' from RTLD_DEFAULT to 0x327ee4f0 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN13MainNavButtonC1EP7QWidget' from RTLD_DEFAULT to 0x327ee4fc (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN13MainNavButton9setPixmapERK7QString' from RTLD_DEFAULT to 0x327ee500 (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN13MainNavButton15setActivePixmapERK7QString' from RTLD_DEFAULT to 0x327ee504 (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN13MainNavButton7setTextERK7QString' from RTLD_DEFAULT to 0x327ee508 (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN13MainNavButton6tappedEv' from RTLD_DEFAULT to 0x327ee50c (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN15NickelTouchMenuC2EP7QWidget18DecorationPosition' from RTLD_DEFAULT to 0x327ee4d8 (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN12MenuTextItemC1EP7QWidgetbb' from RTLD_DEFAULT to 0x327ee4dc (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN12MenuTextItem7setTextERK7QString' from RTLD_DEFAULT to 0x327ee4e0 (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_dlsym: loading symbol '_ZN12MenuTextItem22registerForTapGesturesEv' from RTLD_DEFAULT to 0x327ee4e4 (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) applying hooks Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_hook: setting hook on ('libnickel.so.1.0.0', '_ZN28AbstractNickelMenuController18createMenuTextItemEP5QMenuRK7QStringbbS4_') to (self, '_nm_menu_hook') Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: lib /usr/local/Kobo/libnickel.so.1 is mapped at 2adfe000 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: DT_DYNAMIC: plt_is_rela=0 plt=0x2b2cea08 plt_sz=737965296 plt_ent_sz=156760 sym=(nil) str=0x8 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: found symbol _ZN28AbstractNickelMenuController18createMenuTextItemEP5QMenuRK7QStringbbS4_ (gotoff=0x11d3658 [mapped=0x2bfd1658]) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: ensuring the symbol is loaded (to get the original address) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: removing memory protection Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: patching symbol Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: successfully patched symbol _ZN28AbstractNickelMenuController18createMenuTextItemEP5QMenuRK7QStringbbS4_ (orig=0x2b8f9da5, new=0x327d4785) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... info: redirected ('libnickel.so.1.0.0'=0x2aacd148, '_ZN28AbstractNickelMenuController18createMenuTextItemEP5QMenuRK7QStringbbS4_'=0x2b8f9da5) to (self=0x17e95a0, '_nm_menu_hook'=0x327d4785) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) info: nh_hook: setting hook on ('libnickel.so.1.0.0', '_ZN11MainNavViewC1EP7QWidget') to (self, '_nm_menu_hook2') (desc: bottom nav main menu button injection (15505+)) (optional) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: lib /usr/local/Kobo/libnickel.so.1 is mapped at 2adfe000 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: DT_DYNAMIC: plt_is_rela=0 plt=0x2b2cea08 plt_sz=737965296 plt_ent_sz=156760 sym=(nil) str=0x8 Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: found symbol _ZN11MainNavViewC1EP7QWidget (gotoff=0x11d2170 [mapped=0x2bfd0170]) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: ensuring the symbol is loaded (to get the original address) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: removing memory protection Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: patching symbol Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... dlhook: info: successfully patched symbol _ZN11MainNavViewC1EP7QWidget (orig=0x2b8edbb9, new=0x327d5849) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... info: redirected ('libnickel.so.1.0.0'=0x2aacd148, '_ZN11MainNavViewC1EP7QWidget'=0x2b8edbb9) to (self=0x17e95a0, '_nm_menu_hook2'=0x327d5849) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) calling next init Dec 3 17:45:57 nickel: (NickelMenu) feature: NM_UNINSTALL_CONFIGDIR: false (src/nickelmenu.cc:157) Dec 3 17:45:57 nickel: (NickelMenu) updating config (src/nickelmenu.cc:160) Dec 3 17:45:57 nickel: (NickelMenu) global: scanning for config files (src/config.c:856) Dec 3 17:45:57 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/. because it's a special file (src/config.c:43) Dec 3 17:45:57 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/.. because it's a special file (src/config.c:43) Dec 3 17:45:57 nickel: (NickelMenu) global: changes detected (src/config.c:866) Dec 3 17:45:57 nickel: (NickelMenu) global: parsing new config (src/config.c:869) Dec 3 17:45:57 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/doc (src/config.c:249) Dec 3 17:45:57 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/generators (src/config.c:249) Dec 3 17:45:57 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/kfmon (src/config.c:249) Dec 3 17:45:57 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/koreader (src/config.c:249) Dec 3 17:45:57 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/niluje (src/config.c:249) Dec 3 17:45:57 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/plato (src/config.c:249) Dec 3 17:45:57 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/test (src/config.c:249) Dec 3 17:45:57 nickel: (NickelMenu) ... error: file /mnt/onboard/.adds/nm/test: line 19: field 1: unknown type 'menu_item' (src/config.c:300) (src/config.c:873) Dec 3 17:45:57 nickel: (NickelMenu) global: freeing old config and replacing with error item (src/config.c:874) Dec 3 17:45:57 nickel: (NickelMenu) ... warning: error parsing config, will show a menu item with the error: parse config files: file /mnt/onboard/.adds/nm/test: line 19: field 1: unknown type 'menu_item' (src/config.c:300) (src/config.c:877) (src/nickelmenu.cc:164) Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) destroying failsafe after 3s Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... failsafe: info: scheduling restore Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) done init Dec 3 17:45:57 nickel: (NickelMenu) (NickelHook) ... failsafe: info: restoring after 3 seconds Dec 3 17:45:57 nickel: ( 1.685 @ 0x154adf0) loadPlugin: loaded plugin for QFontEngine Dec 3 17:45:57 nickel: ( 1.713 @ 0x154adf0) loadPlugin: loaded plugin for QRawFont Dec 3 17:45:57 nickel: ( 1.714 @ 0x154adf0) Loading iType.. true Dec 3 17:45:58 nickel: ( 2.728 @ 0x154adf0) loadPlugin: loaded plugin for QRasterPaintEngine Dec 3 17:45:58 nickel: ( 2.753 @ 0x154adf0 / ui.warning) "4.25.15875 (7615d0aa08, 11/9/20)" Dec 3 17:45:58 nickel: ( 2.754 @ 0x154adf0 / ui.debug) Periodic sync scheduled for "04:36:17" Dec 3 17:45:58 nickel: (NickelMenu) MainNavView::MainNavView(0x1727218, (nil)) (src/nickelmenu.cc:220) Dec 3 17:45:58 nickel: (NickelMenu) Adding main menu button in tab bar for firmware 4.23.15505+. (src/nickelmenu.cc:223) Dec 3 17:45:58 nickel: (NickelMenu) Added button. (src/nickelmenu.cc:360) Dec 3 17:46:00 nickel: (NickelMenu) (NickelHook) ... failsafe: info: renaming /usr/local/Kobo/imageformats/libnm.so.failsafe to /usr/local/Kobo/imageformats/libnm.so Dec 3 17:46:00 nickel: (NickelMenu) (NickelHook) ... failsafe: info: freeing memory Dec 3 17:46:02 wpa_supplicant[32184]: Successfully initialized wpa_supplicant Dec 3 17:46:02 wpa_supplicant[32184]: rfkill: Cannot get wiphy information Dec 3 17:46:02 wpa_supplicant[32184]: ioctl[SIOCSIWESSID]: Resource temporarily unavailable Dec 3 17:46:02 dbus[574]: [system] Activating service name='name.marples.roy.dhcpcd' (using servicehelper) Dec 3 17:46:02 dhcpcd[32187]: version 6.6.6 starting Dec 3 17:46:02 dhcpcd[32187]: eth0: using /sys hwaddr: 70:25:59:e1:2d:2b Dec 3 17:46:02 dhcpcd[32187]: eth0: executing `/libexec/dhcpcd-run-hooks' PREINIT Dec 3 17:46:02 dhcpcd-dbus: starting dhcpcd-dbus-0.6.0 Dec 3 17:46:02 dhcpcd[32187]: eth0: executing `/libexec/dhcpcd-run-hooks' NOCARRIER Dec 3 17:46:02 dhcpcd[32187]: no interfaces have a carrier Dec 3 17:46:02 dhcpcd[32187]: forking to background Dec 3 17:46:02 dhcpcd[32187]: forked to background, child pid 32199 Dec 3 17:46:02 dhcpcd[32199]: eth0: waiting for carrier Dec 3 17:46:02 dhcpcd-dbus: connected to dhcpcd-6.6.6 Dec 3 17:46:02 dhcpcd-dbus: retrieved interface eth0 (NOCARRIER) Dec 3 17:46:02 dhcpcd-dbus: status changed to disconnected Dec 3 17:46:02 dhcpcd-dbus: no DBus connection to notify of status change Dec 3 17:46:02 dhcpcd-dbus: connected to wpa_supplicant on interface eth0 Dec 3 17:46:02 dhcpcd-dbus: scan results on interface eth0 Dec 3 17:46:02 dhcpcd-dbus: no DBus connection to notify of status change Dec 3 17:46:02 dbus[574]: [system] Successfully activated service 'name.marples.roy.dhcpcd' Dec 3 17:46:02 dhcpcd-dbus: init completed, waiting for events Dec 3 17:46:02 wpa_supplicant[32185]: eth0: Trying to associate with 44:a5:6e:47:3e:f8 (SSID='Serenity' freq=2472 MHz) Dec 3 17:46:02 dhcpcd-dbus: scan results on interface eth0 Dec 3 17:46:02 wpa_supplicant[32185]: Failed to add supported operating classes IE Dec 3 17:46:02 wpa_supplicant[32185]: eth0: Associated with 44:a5:6e:47:3e:f8 Dec 3 17:46:03 wpa_supplicant[32185]: eth0: WPA: Key negotiation completed with 44:a5:6e:47:3e:f8 [PTK=CCMP GTK=CCMP] Dec 3 17:46:03 wpa_supplicant[32185]: eth0: CTRL-EVENT-CONNECTED - Connection to 44:a5:6e:47:3e:f8 completed [id=0 id_str=] Dec 3 17:46:03 dhcpcd[32199]: eth0: carrier acquired Dec 3 17:46:03 dhcpcd[32199]: eth0: executing `/libexec/dhcpcd-run-hooks' CARRIER Dec 3 17:46:03 dhcpcd[32199]: eth0: delaying IPv4 for 0.8 seconds Dec 3 17:46:03 dhcpcd-dbus: event on interface eth0 (CARRIER) Dec 3 17:46:03 dhcpcd[32199]: eth0: using ClientID 01:70:25:59:e1:2d:2b Dec 3 17:46:03 dhcpcd[32199]: eth0: reading lease `/var/db/dhcpcd-eth0-Serenity.lease' Dec 3 17:46:03 dhcpcd[32199]: eth0: rebinding lease of 192.168.1.150 Dec 3 17:46:03 dhcpcd[32199]: eth0: sending REQUEST (xid 0x57915e1d), next in 4.4 seconds Dec 3 17:46:03 dhcpcd[32199]: eth0: acknowledged 192.168.1.150 from 192.168.1.1 Dec 3 17:46:03 dhcpcd[32199]: eth0: leased 192.168.1.150 for 86400 seconds Dec 3 17:46:03 dhcpcd[32199]: eth0: renew in 43200 seconds, rebind in 75600 seconds Dec 3 17:46:03 dhcpcd[32199]: eth0: writing lease `/var/db/dhcpcd-eth0-Serenity.lease' Dec 3 17:46:03 dhcpcd[32199]: eth0: adding IP address 192.168.1.150/24 Dec 3 17:46:03 dhcpcd[32199]: eth0: adding route to 192.168.1.0/24 Dec 3 17:46:03 dhcpcd[32199]: eth0: adding default route via 192.168.1.1 Dec 3 17:46:03 dhcpcd[32199]: eth0: executing `/libexec/dhcpcd-run-hooks' REBOOT Dec 3 17:46:03 dhcpcd-dbus: event on interface eth0 (REBOOT) Dec 3 17:46:03 dhcpcd-dbus: status changed to connected Dec 3 17:46:10 nickel: (NickelMenu) checking for config updates (src/nickelmenu.cc:271) Dec 3 17:46:10 nickel: (NickelMenu) global: scanning for config files (src/config.c:856) Dec 3 17:46:10 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/. because it's a special file (src/config.c:43) Dec 3 17:46:10 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/.. because it's a special file (src/config.c:43) Dec 3 17:46:10 nickel: (NickelMenu) global: changes detected (src/config.c:866) Dec 3 17:46:10 nickel: (NickelMenu) global: parsing new config (src/config.c:869) Dec 3 17:46:10 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/doc (src/config.c:249) Dec 3 17:46:10 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/generators (src/config.c:249) Dec 3 17:46:10 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/kfmon (src/config.c:249) Dec 3 17:46:10 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/koreader (src/config.c:249) Dec 3 17:46:10 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/niluje (src/config.c:249) Dec 3 17:46:10 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/plato (src/config.c:249) Dec 3 17:46:10 nickel: (NickelMenu) config: reading config file /mnt/onboard/.adds/nm/test (src/config.c:249) Dec 3 17:46:10 nickel: (NickelMenu) ... error: file /mnt/onboard/.adds/nm/test: line 19: field 1: unknown type 'menu_item' (src/config.c:300) (src/config.c:873) Dec 3 17:46:10 nickel: (NickelMenu) global: freeing old config and replacing with error item (src/config.c:874) Dec 3 17:46:10 nickel: (NickelMenu) revision = 1 (src/nickelmenu.cc:273) Dec 3 17:46:10 nickel: (NickelMenu) building menu (src/nickelmenu.cc:275) Dec 3 17:46:10 nickel: (NickelMenu) adding item 'Config Error'... (src/nickelmenu.cc:300) Dec 3 17:46:10 nickel: (NickelMenu) showing menu (src/nickelmenu.cc:349) Dec 3 17:47:05 nickel: (NickelMenu) checking for config updates (src/nickelmenu.cc:271) Dec 3 17:47:05 nickel: (NickelMenu) global: scanning for config files (src/config.c:856) Dec 3 17:47:05 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/. because it's a special file (src/config.c:43) Dec 3 17:47:05 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/.. because it's a special file (src/config.c:43) Dec 3 17:47:05 nickel: (NickelMenu) ... error: parse config files: file /mnt/onboard/.adds/nm/test: line 19: field 1: unknown type 'menu_item' (src/config.c:300) (src/config.c:877) (src/config.c:860) Dec 3 17:47:05 nickel: (NickelMenu) global: freeing old config and replacing with error item (src/config.c:861) Dec 3 17:47:05 nickel: (NickelMenu) revision = 2 (src/nickelmenu.cc:273) Dec 3 17:47:05 nickel: (NickelMenu) building menu (src/nickelmenu.cc:275) Dec 3 17:47:05 nickel: (NickelMenu) adding item 'Config Error'... (src/nickelmenu.cc:300) Dec 3 17:47:05 nickel: (NickelMenu) showing menu (src/nickelmenu.cc:349) Dec 3 17:47:31 nickel: (NickelMenu) checking for config updates (src/nickelmenu.cc:271) Dec 3 17:47:31 nickel: (NickelMenu) global: scanning for config files (src/config.c:856) Dec 3 17:47:31 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/. because it's a special file (src/config.c:43) Dec 3 17:47:31 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/.. because it's a special file (src/config.c:43) Dec 3 17:47:31 nickel: (NickelMenu) ... error: scan for config files: parse config files: file /mnt/onboard/.adds/nm/test: line 19: field 1: unknown type 'menu_item' (src/config.c:300) (src/config.c:877) (src/config.c:864) (src/config.c:860) Dec 3 17:47:31 nickel: (NickelMenu) global: freeing old config and replacing with error item (src/config.c:861) Dec 3 17:47:31 nickel: (NickelMenu) revision = 3 (src/nickelmenu.cc:273) Dec 3 17:47:31 nickel: (NickelMenu) building menu (src/nickelmenu.cc:275) Dec 3 17:47:31 nickel: (NickelMenu) adding item 'Config Error'... (src/nickelmenu.cc:300) Dec 3 17:47:32 nickel: (NickelMenu) showing menu (src/nickelmenu.cc:349) Dec 3 17:47:44 nickel: (NickelMenu) AbstractNickelMenuController::createMenuTextItem(0x3ca5f20, `Cover view`, 0, 0, ``) (src/nickelmenu.cc:181) Dec 3 17:47:44 nickel: (NickelMenu) Comparing against 'Settings', 'Dictionary', 'Keyboard', 'Manage downloads' (src/nickelmenu.cc:187) Dec 3 17:47:44 nickel: (NickelMenu) AbstractNickelMenuController::createMenuTextItem(0x3ca5f20, `Manage books`, 0, 0, ``) (src/nickelmenu.cc:181) Dec 3 17:47:44 nickel: (NickelMenu) Comparing against 'Settings', 'Dictionary', 'Keyboard', 'Manage downloads' (src/nickelmenu.cc:187) Dec 3 17:47:44 nickel: (NickelMenu) AbstractNickelMenuController::createMenuTextItem(0x3ca5f20, `Download all`, 0, 0, ``) (src/nickelmenu.cc:181) Dec 3 17:47:44 nickel: (NickelMenu) Comparing against 'Settings', 'Dictionary', 'Keyboard', 'Manage downloads' (src/nickelmenu.cc:187) Dec 3 17:47:44 nickel: (NickelMenu) AbstractNickelMenuController::createMenuTextItem(0x3ca5f20, `Cancel all downloads`, 0, 0, ``) (src/nickelmenu.cc:181) Dec 3 17:47:44 nickel: (NickelMenu) Comparing against 'Settings', 'Dictionary', 'Keyboard', 'Manage downloads' (src/nickelmenu.cc:187) Dec 3 17:47:44 nickel: (NickelMenu) AbstractNickelMenuController::createMenuTextItem(0x3ca5f20, `Manage downloads`, 0, 0, ``) (src/nickelmenu.cc:181) Dec 3 17:47:44 nickel: (NickelMenu) Comparing against 'Settings', 'Dictionary', 'Keyboard', 'Manage downloads' (src/nickelmenu.cc:187) Dec 3 17:47:44 nickel: (NickelMenu) Intercepting library menu (label=Manage downloads, checkable=false)... (src/nickelmenu.cc:200) Dec 3 17:47:44 nickel: (NickelMenu) inject 4 @ 8 (src/nickelmenu.cc:364) Dec 3 17:47:44 nickel: (NickelMenu) checking for config updates (current revision: 0) (src/nickelmenu.cc:368) Dec 3 17:47:44 nickel: (NickelMenu) global: scanning for config files (src/config.c:856) Dec 3 17:47:44 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/. because it's a special file (src/config.c:43) Dec 3 17:47:44 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/.. because it's a special file (src/config.c:43) Dec 3 17:47:44 nickel: (NickelMenu) ... error: scan for config files: scan for config files: parse config files: file /mnt/onboard/.adds/nm/test: line 19: field 1: unknown type 'menu_item' (src/config.c:300) (src/config.c:877) (src/config.c:864) (src/config.c:864) (src/config.c Dec 3 17:47:44 nickel: (NickelMenu) global: freeing old config and replacing with error item (src/config.c:861) Dec 3 17:47:44 nickel: (NickelMenu) new revision = 4 (changed) (src/nickelmenu.cc:370) Dec 3 17:47:44 nickel: (NickelMenu) checking for existing items added by nm (src/nickelmenu.cc:372) Dec 3 17:47:44 nickel: (NickelMenu) getting insertion point (src/nickelmenu.cc:383) Dec 3 17:47:44 nickel: (NickelMenu) injecting new items (src/nickelmenu.cc:393) Dec 3 17:47:44 nickel: (NickelMenu) updating config revision property (src/nickelmenu.cc:425) Dec 3 17:48:17 nickel: (NickelMenu) checking for config updates (src/nickelmenu.cc:271) Dec 3 17:48:17 nickel: (NickelMenu) global: scanning for config files (src/config.c:856) Dec 3 17:48:17 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/. because it's a special file (src/config.c:43) Dec 3 17:48:17 nickel: (NickelMenu) config: skipping /mnt/onboard/.adds/nm/.. because it's a special file (src/config.c:43) Dec 3 17:48:17 nickel: (NickelMenu) ... error: scan for config files: scan for config files: scan for config files: parse config files: file /mnt/onboard/.adds/nm/test: line 19: field 1: unknown type 'menu_item' (src/config.c:300) (src/config.c:877) (src/config.c:864) (src/conf Dec 3 17:48:17 nickel: (NickelMenu) global: freeing old config and replacing with error item (src/config.c:861) Dec 3 17:48:17 nickel: (NickelMenu) revision = 5 (src/nickelmenu.cc:273) Dec 3 17:48:17 nickel: (NickelMenu) building menu (src/nickelmenu.cc:275) Dec 3 17:48:17 nickel: (NickelMenu) adding item 'Config Error'... (src/nickelmenu.cc:300) Dec 3 17:48:17 nickel: (NickelMenu) showing menu (src/nickelmenu.cc:349) Dec 3 17:50:25 dhcpcd[32199]: received signal TERM from PID 32397, stopping Dec 3 17:50:25 dhcpcd[32199]: eth0: removing interface Dec 3 17:50:25 dhcpcd[32199]: eth0: executing `/libexec/dhcpcd-run-hooks' STOPPED Dec 3 17:50:25 dhcpcd[32199]: exited Dec 3 17:50:25 dhcpcd-dbus: lost connection to dhcpcd Dec 3 17:50:25 dhcpcd-dbus: status changed to down Dec 3 17:50:25 dhcpcd-dbus: status changed to down Dec 3 17:50:25 wpa_supplicant[32185]: eth0: CTRL-EVENT-DISCONNECTED bssid=44:a5:6e:47:3e:f8 reason=3 locally_generated=1 Dec 3 17:50:25 wpa_supplicant[32185]: eth0: CTRL-EVENT-TERMINATING Dec 3 17:50:25 nickel: ( 269.796 @ 0x154adf0 / wifi.warning) QVector WirelessManager::knownNetworks() attempt to list known networks with wifi down Dec 3 17:50:25 nickel: ( 269.797 @ 0x154adf0 / wifi.warning) QVector WirelessManager::knownNetworks() attempt to list known networks with wifi down Dec 3 17:50:25 dhcpcd-dbus: lost connection to wpa_supplicant on interface eth0 ```
NiLuJe commented 3 years ago

I guess I could parse the scale from MainNavView.qss or one of the existing icons, then dynamically resize the pixmap. This would also allow me to easily add an option for SVG icons in the future, which would be a requirement for me to add a custom icon since I try to keep NM as forward-compatible as possible.

Just FYI... MainNavView doesn't contain the exact icon size it contains a min-/max-height value of 2.5 x icon height (for model), to also include height of label (plus some vertical padding???). So taking size from existing icons might be more reliable in the long run.

The stupid workaround I can think of is simply load the default one, and ask Qt about its size ;p.

pgaskin commented 3 years ago

Except, even if I fix it, NM tries to re-parse it (e.g., the ts change is detected, revision incremented and all that jazz), but it still fails to parse, and prints the line numbers from the old, broken file?

What did you do to attempt to fix the broken file?

NiLuJe commented 3 years ago

I started by commenting out the not-supported-in-this-build stuff (e.g., the two selection menu items that it was tripping on @ L19).

Then I fixed the actual extra syntax for the icons stuff.

Then I just added LFs a couple of times to try to see if that would help :D. (aka. muppet flail ^^)

FWIW, the config was untouched between that log, and the next Nickel restart, where it imploded (https://github.com/pgaskin/NickelMenu/pull/98#issuecomment-738135999).

pgaskin commented 3 years ago

@NiLuJe, I couldn't reproduce your issue, but I found a related regression which might have hidden the real cause of the parsing error you saw. See #99.

pgaskin commented 3 years ago

Ready for testing.

shermp commented 3 years ago

Code looks ok, once I figured out what it was doing. Just a minor comment.

NiLuJe commented 3 years ago

The giant PNGs test still implodes Nickel (but I do get the scaling notification from NM first). At a quick glance, GDB was fairly unhelpful, but it probably had a bit of trouble tracking threads properly.

The sane PNG test was successful, and it does indeed get scaled properly ;).

shermp commented 3 years ago

The giant PNGs test still implodes Nickel (but I do get the scaling notification from NM first). At a quick glance, GDB was fairly unhelpful, but it probably had a bit of trouble tracking threads properly.

The sane PNG test was successful, and it does indeed get scaled properly ;).

I wonder if this bug report is applicable here?

The safer thing to do might be to load the image file using QImage, scale it down and save it. Then it can be sure that QPixmap is never opening a large image.

NiLuJe commented 3 years ago

They're not that big, but, who knows, I did see mention of the pixmap cache in one of the least useless tracebacks...

resources/kfmon.png PNG 1440x1920 1440x1920+0+0 8-bit Gray 16c 106946B 0.000u 0:00.000
resources/plato.png PNG 1404x1872 1404x1872+0+0 8-bit Gray 16c 15108B 0.000u 0:00.000
pgaskin commented 3 years ago

Everything should be fixed now.

NiLuJe commented 3 years ago

Alas, giant PNGs still implode Nickel ;/.

NiLuJe commented 3 years ago

Not that it should matter, but this is what's generated by QImage:

Image:
  Filename: /tmp/nm_menu.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 31x42+0+0
  Resolution: 104.33x103.94
  Print size: 0.297134x0.404079
  Units: PixelsPerCentimeter
  Colorspace: sRGB
  Type: Grayscale
  Base type: Undefined
  Endianness: Undefined
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit

e.g., a standard PNG24. It displays just fine via FBInk FWIW.

Trying to only set a single icon instead of both (normal + active) doesn't help either.

pgaskin commented 3 years ago

I'm going to look into this more myself tomorrow. If I can't figure out the cause, I'll probably leave this feature for after v0.5.0.

NiLuJe commented 3 years ago

Good news: I'm an idiot.

Of course, if I'm pointing to icons that are being watched by KFMon... it'll trip their watch. So by using the KOReader icon, I was actually launching KOReader in the middle of Nickel's boot... -_-".

Suffice it to say, if I copy the icons elsewhere, everything's peachy :).

pgaskin commented 3 years ago

So by using the KOReader icon, I was actually launching KOReader in the middle of Nickel's boot... -_-".

That would probably do it. :rofl: How did that cause it to crash instead of terminating cleanly, though?

Suffice it to say, if I copy the icons elsewhere, everything's peachy

So this is ready to be merged?

NiLuJe commented 3 years ago

That would probably do it. rofl How did that cause it to crash instead of terminating cleanly, though?

Because nickel doesn't have a SIGTERM handler ;).

So this is ready to be merged?

Yep!

pgaskin commented 3 years ago

Yep!

One last question: did the failsafe trip properly, or did you need to manually remove NM? I'm asking since if it was too late for the failsafe, I'll add another for critical operations like this.

NiLuJe commented 3 years ago

No, it tripped just fine ;).

pgaskin commented 3 years ago

Done. I'll make a release sometime before the end of this week.