Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 03-26-2021, 04:35 AM   #436
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: When using single field edit > marked, is there any way to just set an undefined mark? Mostly just out of curiosity, it's probably easier to just put in "cleanup" or "name of chain" in predefined.

Also, I am not sure what is going on here with the menus but it doesn't feel intended:

Click image for larger version

Name:	2021-03-26 05_36_32-Add actions.png
Views:	1759
Size:	23.2 KB
ID:	186156

Last edited by ownedbycats; 03-26-2021 at 04:41 AM.
ownedbycats is offline   Reply With Quote
Old 03-26-2021, 04:47 AM   #437
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by chaley View Post
I added the date format strings:
  • to_number : convert the date & time into a floating point number (a timestamp)
  • from_number : convert a floating point number (a timestamp) into an iso formatted date. If you want a different date format then add the desired formatting string after from_number and a colon ( : ). Example: from_number:MMM dd yyyy
These changes are in calibre 5.14.
chaley is offline   Reply With Quote
Advert
Old 03-26-2021, 04:57 AM   #438
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Now I am curious whether this is epoch time...
ownedbycats is offline   Reply With Quote
Old 03-26-2021, 04:58 AM   #439
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
These changes are in calibre 5.14.
Thank you.
capink is offline   Reply With Quote
Old 03-26-2021, 04:59 AM   #440
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Now I am curious whether this is epoch time...
Yes, but the meaning of that is platform dependent.
chaley is offline   Reply With Quote
Advert
Old 03-26-2021, 05:01 AM   #441
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Question: When using single field edit > marked, is there any way to just set an undefined mark? Mostly just out of curiosity, it's probably easier to just put in "cleanup" or "name of chain" in predefined.
I am not sure what you mean by undefined mark. Calibre marks books with "true". You can use that if want.

Quote:
Originally Posted by ownedbycats View Post
Also, I am not sure what is going on here with the menus but it doesn't feel intended:

Attachment 186156
That is certainly not intended and is not happening for me. I need your copy of [CALIBRE CONFIG DIR]/plugins/action_chains/action-chains-user-modules.json to investigate this.

Edit: I can replicate that now.

Last edited by capink; 03-26-2021 at 05:06 AM.
capink is offline   Reply With Quote
Old 03-26-2021, 05:06 AM   #442
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I was under the impression that epoch time was specifically *nix (January 1, 1970) while Windows uses FILETIME (January 1, 1601). I may be mistaken on the exact terms though
ownedbycats is offline   Reply With Quote
Old 03-26-2021, 05:07 AM   #443
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by capink View Post
That is certainly not intended and is not happening for me. I need your copy of [CALIBRE CONFIG DIR]/plugins/action_chains/action-chains-user-modules.json to investigate this.
Here both file and code

Code:
{
  "Confirmation": "from PyQt5.Qt import QWidget, QVBoxLayout, QGroupBox, QTextEdit\n\nfrom calibre.gui2 import question_dialog\nfrom calibre_plugins.action_chains.actions.base import ChainAction\n\nclass ConfirmConfigWidget(QWidget):\n    def __init__(self, plugin_action):\n        QWidget.__init__(self)\n        self._init_controls()\n\n    def _init_controls(self):\n\n        l = QVBoxLayout()\n        self.setLayout(l)\n\n        gb = QGroupBox('Confirm message')\n        gb_l = QVBoxLayout()\n        gb.setLayout(gb_l)\n\n        self.tb = QTextEdit()\n        self.tb.insertPlainText('Are you sure you want to proceed?')\n\n        gb_l.addWidget(self.tb)\n        l.addWidget(gb)\n\n    def load_settings(self, settings):\n        if settings:\n            self.tb.setText(settings['message'])\n\n    def save_settings(self):\n        settings = {}\n        settings['message'] = self.tb.toPlainText()\n        return settings\n\nclass MyAction(ChainAction):\n\n    name = 'Confirm'\n\n    def config_widget(self):\n        return ConfirmConfigWidget\n\n    def run(self, gui, settings, chain_loop):\n        message = settings.get('message', 'Are you sure you want to proceed?')\n        if not question_dialog(gui, _('Are you sure?'), message, show_copy_button=False):\n            raise chain_loop.UserInterrupt\n",
  "Open Tag Manager": "from PyQt5.Qt import (QApplication, Qt, QWidget, QVBoxLayout, QGroupBox, QComboBox)\n\nfrom calibre.gui2.dialogs.tag_editor import TagEditor\nfrom calibre_plugins.action_chains.actions.base import ChainAction\n\ndef get_possible_cols(db):\n    fm = db.field_metadata.custom_field_metadata()\n    cols = [ col for col, cmeta in fm.items() if cmeta['is_multiple'] ]\n    cols = [ col for col in cols if fm[col]['datatype'] not in ['composite',None] ]\n    cols.insert(0, 'tags')\n    return cols\n\nclass ItemEditorConfig(QWidget):\n    def __init__(self, plugin_action):\n        QWidget.__init__(self)\n        self.plugin_action = plugin_action\n        self.gui = plugin_action.gui\n        self.db = self.gui.current_db\n        self.possible_cols = self.get_possible_cols()\n        self._init_controls()\n\n    def _init_controls(self):\n        self.blockSignals(True)\n        l = QVBoxLayout()\n        self.setLayout(l)\n\n        col_box = QGroupBox(_('Choose column:'))\n        col_box_layout = QVBoxLayout()\n        col_box.setLayout(col_box_layout)\n        self.col_combobox = QComboBox()\n        self.col_combobox.addItems(self.possible_cols)\n        self.col_combobox.setCurrentText('tags')\n        col_box_layout.addWidget(self.col_combobox)\n        l.addWidget(col_box)   \n\n        l.addStretch(1)\n        self.setMinimumSize(300,200)\n        self.blockSignals(False)\n\n    def get_possible_cols(self):\n        return get_possible_cols(self.db)\n\n    def load_settings(self, settings):\n        if settings:\n            self.col_combobox.setCurrentText(settings['col_name'])\n\n    def save_settings(self):\n        settings = {}\n        settings['col_name'] = self.col_combobox.currentText()\n        return settings\n\nclass ItemEditorAction(ChainAction):\n\n    name = 'Open Tag Manager'\n\n    def run(self, gui, settings, chain_loop):\n        db = gui.current_db\n        rows = gui.current_view().selectionModel().selectedRows()\n        book_ids = [ gui.library_view.model().db.id(row.row()) for row in rows ]\n\n        col_name = settings['col_name']\n        if col_name == 'tags':\n            key = None\n        else:\n            key = col_name\n        \n        if len(book_ids) == 0:\n            return\n        elif len(book_ids) == 1:\n            book_id = book_ids[0]\n        else:\n            book_id = None\n\n        d = TagEditor(gui, db, book_id, key)\n        QApplication.setOverrideCursor(Qt.ArrowCursor)\n        try:\n            d.exec_()\n        finally:\n            QApplication.restoreOverrideCursor()\n        if d.result() == d.Accepted:\n            val = d.tags\n            id_map = {book_id: val for book_id in book_ids}\n            db.new_api.set_field(col_name, id_map)\n\n        del d\n\n    def config_widget(self):\n        return ItemEditorConfig\n\n    def validate(self, settings):\n        gui = self.plugin_action.gui\n        db = gui.current_db\n        if not settings:\n            return (_('Settings Error'), _('You must configure this action before running it'))\n        col_name = settings['col_name']\n        if not col_name in get_possible_cols(db):\n            return (_('Column Error'), _('Cannot find a column with name \"{}\" in current library'.format(col_name)))\n        return True",
  "Resort View": "from calibre_plugins.action_chains.actions.base import ChainAction\n\nclass RefreshAction(ChainAction):\n\n    name = 'Refresh View'\n\n    def run(self, gui, settings, chain_loop):\n        gui.current_view().resort()",
  "view_manager_last_view": "from calibre_plugins.action_chains.templates import TemplateFunction\n\nclass ViewManagerLastVIew(TemplateFunction):\n\n    name = 'view_manager_last_view'\n    arg_count = 0\n\n    def evaluate(self, formatter, kwargs, mi, locals):\n        import calibre_plugins.view_manager.config as cfg\n        gui = self.plugin_action.gui\n        library_config = cfg.get_library_config(gui.current_db)\n        return library_config.get(cfg.KEY_LAST_VIEW, '')"
}
Attached Files
File Type: zip action-chains-user-modules.zip (1.7 KB, 538 views)
ownedbycats is offline   Reply With Quote
Old 03-26-2021, 05:11 AM   #444
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Ok, I was able to replicate this and I can see the cause of this. It adds one extra level for every time you open the combobox. Will post a fix shortly.
capink is offline   Reply With Quote
Old 03-26-2021, 05:52 AM   #445
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Also, I am not sure what is going on here with the menus but it doesn't feel intended:

Attachment 186156
I posted a new version which fixes this issue. Please test and confirm.

Edit: Also remove to_timestamp() as format_date() now covers the same functionality.

Last edited by capink; 03-26-2021 at 06:24 AM.
capink is offline   Reply With Quote
Old 03-26-2021, 09:38 AM   #446
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,452
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I was under the impression that epoch time was specifically *nix (January 1, 1970) while Windows uses FILETIME (January 1, 1601). I may be mistaken on the exact terms though
According to https://searchdatacenter.techtarget....finition/epoch
Quote:
In a computing context, an epoch is the date and time relative to which a computer's clock and timestamp values are determined. The epoch traditionally corresponds to 0 hours, 0 minutes, and 0 seconds (00:00:00) Coordinated Universal Time (UTC) on a specific date, which varies from system to system. Most versions of Unix, for example, use January 1, 1970 as the epoch date; Windows uses January 1, 1601; Macintosh systems use January 1, 1904, and Digital Equipment Corporation's Virtual Memory System (VMS) uses November 17, 1858.
chaley is offline   Reply With Quote
Old 03-26-2021, 03:04 PM   #447
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by capink View Post
I posted a new version which fixes this issue. Please test and confirm.

Edit: Also remove to_timestamp() as format_date() now covers the same functionality.
Now it is working correctly.
ownedbycats is offline   Reply With Quote
Old 03-26-2021, 05:00 PM   #448
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Small UI suggestion: Change the tooltip of "Copy menu item row" to "duplicate chain." The wording seems a tiny bit unclear; I thought it would copy the name of the chain.

Also an option to duplicate a specific action in a chain would be helpful sometimes.
ownedbycats is offline   Reply With Quote
Old 03-26-2021, 05:02 PM   #449
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,037
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
That makes sense. I actually thought of a question but I will ask that in the template changelog thread.
ownedbycats is offline   Reply With Quote
Old 03-26-2021, 05:17 PM   #450
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,199
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by ownedbycats View Post
Small UI suggestion: Change the tooltip of "Copy menu item row" to "duplicate chain." The wording seems a tiny bit unclear; I thought it would copy the name of the chain.
I will change the tooltip. I am not really very good at these things, especially in English.

Quote:
Originally Posted by ownedbycats View Post
Also an option to duplicate a specific action in a chain would be helpful sometimes.
That will be simple to do. Should we keep the comments?
capink is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Action Chains Resources capink Plugins 78 08-05-2025 04:01 AM
[Editor Plugin] Editor Chains capink Plugins 106 06-17-2025 05:36 PM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[GUI Plugin] Save Virtual Libraries To Column (GUI) chaley Plugins 14 04-04-2021 05:25 AM


All times are GMT -4. The time now is 05:11 AM.


MobileRead.com is a privately owned, operated and funded community.