[GNC] How to Return a GDate?

John Ralls jralls at ceridwen.us
Mon Aug 8 20:58:10 EDT 2022


GDates are provided by GLib, and its python bindings are provided by PyGobjectIntrospection. The Debian package is https://packages.debian.org/buster/gobject-introspection. The documentation is at https://pygobject.readthedocs.io/en/latest/.

Regards,
John Ralls


> On Aug 8, 2022, at 3:50 PM, Robert Simmons <rsimmons0 at gmail.com> wrote:
> 
> Following the documentation:
> https://code.gnucash.org/docs/MAINT/gncEntry_8h.html
> 
> When creating an Entry (for a Bill or Invoice), the date is to be set using
> a GDate:
> "DEPRECATED - use gncEntrySetDateGDate() instead!"
> 
> I see a number of functions that return an existing GDate, so something
> like this returns a GDate object:
> gdate = entry.GetDateGDate()
> 
> However, again grepping for "GDate" in the whole Python bindings shows
> nothing that lets me create a GDate object denovo.
> 
> I can use the deprecated SetDate() and it works, but how should I use the
> non-deprecated function?
> 
> The following are all the results from the grep.
> 
> gnucash/gnucash_core_c.py:def xaccTransSetDatePostedGDate(trans:
> "Transaction *", date: "GDate") -> "void":
> gnucash/gnucash_core_c.py:    r"""xaccTransSetDatePostedGDate(Transaction *
> trans, GDate date)"""
> gnucash/gnucash_core_c.py:    return
> _gnucash_core_c.xaccTransSetDatePostedGDate(trans, date)
> gnucash/gnucash_core_c.py:def xaccTransGetDatePostedGDate(trans:
> "Transaction const *") -> "GDate":
> gnucash/gnucash_core_c.py:    r"""xaccTransGetDatePostedGDate(Transaction
> const * trans) -> GDate"""
> gnucash/gnucash_core_c.py:    return
> _gnucash_core_c.xaccTransGetDatePostedGDate(trans)
> gnucash/gnucash_core_c.py:def qof_book_get_autoreadonly_gdate(book:
> "QofBook const *") -> "GDate *":
> gnucash/gnucash_core_c.py:    r"""qof_book_get_autoreadonly_gdate(QofBook
> const * book) -> GDate *"""
> gnucash/gnucash_core_c.py:def gncInvoiceSetDateOpenedGDate(invoice:
> "GncInvoice *", date: "GDate const *") -> "void":
> gnucash/gnucash_core_c.py:    r"""gncInvoiceSetDateOpenedGDate(GncInvoice *
> invoice, GDate const * date)"""
> gnucash/gnucash_core_c.py:    return
> _gnucash_core_c.gncInvoiceSetDateOpenedGDate(invoice, date)
> gnucash/gnucash_core_c.py:def gncEntrySetDateGDate(entry: "GncEntry *",
> date: "GDate const *") -> "void":
> gnucash/gnucash_core_c.py:    r"""gncEntrySetDateGDate(GncEntry * entry,
> GDate const * date)"""
> gnucash/gnucash_core_c.py:    return
> _gnucash_core_c.gncEntrySetDateGDate(entry, date)
> gnucash/gnucash_core_c.py:def gncEntryGetDateGDate(entry: "GncEntry const
> *") -> "GDate":
> gnucash/gnucash_core_c.py:    r"""gncEntryGetDateGDate(GncEntry const *
> entry) -> GDate"""
> gnucash/gnucash_core_c.py:    return
> _gnucash_core_c.gncEntryGetDateGDate(entry)
> gnucash/gnucash_core_c.py:def gnc_pricedb_remove_old_prices(db: "GNCPriceDB
> *", comm_list: "GList *", fiscal_end_date: "GDate *", cutoff: "time64",
> source: "PriceRemoveSourceFlags", keep: "PriceRemoveKeepOptions") ->
> "gboolean":
> gnucash/gnucash_core_c.py:    r"""gnc_pricedb_remove_old_prices(GNCPriceDB
> * db, GList * comm_list, GDate * fiscal_end_date, time64 cutoff,
> PriceRemoveSourceFlags source, PriceRemoveKeepOptions keep) -> gboolean"""
> _______________________________________________
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.



More information about the gnucash-user mailing list