Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Save energy: be apathetic.


comp / comp.os.linux.advocacy / Re: The problem with not owning the software

Subject: Re: The problem with not owning the software
From: Lawrence D'Oliv
Newsgroups: comp.os.linux.advocacy
Organization: A noiseless patient Spider
Date: Sun, 5 Jan 2025 00:37 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.advocacy
Subject: Re: The problem with not owning the software
Date: Sun, 5 Jan 2025 00:37:32 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 252
Message-ID: <vlck8b$mcpa$8@dont-email.me>
References: <Tn39P.50437$%aWb.4583@fx18.iad>
<vk5vjq$3v34m$1@toylet.eternal-september.org>
<nuy9P.28629$aTp4.27488@fx09.iad>
<vkbuqd$18m92$2@toylet.eternal-september.org>
<9OCcnRW7grqkbPT6nZ2dnZfqnPUAAAAA@earthlink.com>
<vkfva1$28j6k$1@toylet.eternal-september.org> <vkhqif$2hvap$1@dont-email.me>
<vkmd9n$3l76a$4@toylet.eternal-september.org> <vkvc2e$1rt3s$2@dont-email.me>
<vkvfl8$1sirn$5@dont-email.me> <vl05rf$24iuj$1@dont-email.me>
<8wScP.111411$Uup4.82236@fx10.iad> <vl1buj$2bb09$1@dont-email.me>
<vl1ekg$2bq9k$2@dont-email.me> <ltiurbF2k4sU3@mid.individual.net>
<vl3da4$2ov5h$8@dont-email.me> <vlbkb2$h0k1$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 05 Jan 2025 01:37:32 +0100 (CET)
Injection-Info: dont-email.me; posting-host="c85702e5c6cceae706a35141fa55e6e0";
logging-data="733994"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+XM5WxRQnZD5/pe/0UO30"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:0PRA33w/Cpl/6Z9UIp2TKpZ++8g=
View all headers

On Sat, 4 Jan 2025 10:32:52 -0500, DFS wrote:

> I've been itching for the better part of 20 years for a cola-based MS
> Office detractor to do some significant LO/Basic coding so it could be
> compared to my Office/VBA.

Do you have an equivalent to this <https://github.com/eea/odfpy>?

Here’s just one part of my invoice-formatting code:

def write_invoice_header(self, invoice) :
self.doc = odf.opendocument.OpenDocumentText()
self.invoice_prefix = invoice["invoice_prefix"]

now = time.time()
for \
this_meta \
in \
(
odf.dc.Title(text = "Invoice for %s" % invoice["client_name"].split("\n", 1)[0]),
odf.dc.Creator(text = "Geek Central Business"),
odf.meta.CreationDate(text = format_odf_time(now)),
odf.dc.Date(text = format_odf_time(now)), # interpreted by OOo as modification date
) \
:
self.doc.meta.addElement(this_meta)
#end for

self.doc.fontfacedecls.addElement \
(
odf.style.FontFace
(
name = invoice_font,
fontfamilygeneric = "roman",
fontpitch = "variable"
)
)
default_text_properties = odf.style.TextProperties \
(
fontname = invoice_font,
fontfamilygeneric = "roman"
)
default_text_properties.setAttrNS(odf.namespaces.FONS, "font-family", invoice_font)
link_element \
(
construct = odf.style.DefaultStyle,
attrs = dict(family = "paragraph"),
parent = self.doc.styles,
children =
(
default_text_properties,
odf.style.ParagraphProperties
(
marginbottom = "0.21cm",
lineheight = "115%",
),
)
)

self.doc.text.addElement \
(
odf.text.P
(
stylename = link_element
(
construct = odf.style.Style,
attrs = dict(name = "top title", family = "paragraph"),
parent = self.doc.automaticstyles,
children =
(
odf.style.ParagraphProperties
(
textalign = "center",
marginbottom = "0.71cm"
),
)
),
text = "%(gst)sINVOICE" % {"gst" : ("", "TAX ")[self.gst_rate != None]}
)
)

cust_info_item_attrs = dict \
(
textindent = "-2.0cm", # counteract marginleft on first line
marginleft = "2.0cm", # indent for lines after first
)
cust_info_item_style = link_element \
(
construct = odf.style.Style,
attrs = dict(name = "cust info item", family = "paragraph"),
parent = self.doc.automaticstyles,
children =
(
odf.style.ParagraphProperties(**cust_info_item_attrs),
)
)
cust_info_item_attrs["breakbefore"] = "column"
cust_info_item_style_2 = link_element \
(
construct = odf.style.Style,
attrs = dict(name = "cust info item 2", family = "paragraph"),
parent = self.doc.automaticstyles,
children =
(
odf.style.ParagraphProperties(**cust_info_item_attrs),
)
)

cust_info_style = link_element \
(
construct = odf.style.Style,
attrs = dict(name = "cust info", family = "section"),
parent = self.doc.automaticstyles,
children =
(
link_element \
(
construct = odf.style.SectionProperties,
children =
(
odf.style.Columns(columncount = 2),
)
),
)
)
cust_info_name_style = link_element \
(
construct = odf.style.Style,
attrs = dict(name = "cust info name", family = "text"),
parent = self.doc.automaticstyles,
children =
(
odf.style.TextProperties(fontweight = "bold"),
)
)

cust_info = odf.text.Section(name = "cust info", stylename = cust_info_style)
for \
item_name, item_value, new_col \
in \
(
(
("Client", invoice["client_name"] + "\n" + invoice["client_address"], False),
("Contact", invoice["client_contact"], False),
("Date", format_pretty_date(invoice["when_generated"]), True),
(
"Pay to",
"\n".join((details.name, details.address_1, details.address_2))
+
(
"\n" + details.country_name,
"",
)[self.gst_rate != None],
False
),
("Bank a/c", details.bank_account, False),
)
+
(
(),
(
("GST No", details.ird_nr, False),
)
)[self.gst_rate != None]
) \
:
this_item = odf.text.P \
(
stylename = (cust_info_item_style, cust_info_item_style_2)[new_col]
)
add_elements \
(
this_item,
odf.text.Span(stylename = cust_info_name_style, text = item_name),
odf.text.Tab(),
)
first_line = True
for line in item_value.split("\n") :
if not first_line :
this_item.addElement(odf.text.LineBreak())
#end if
this_item.addElement \
(
odf.text.Span(text = line)
)
first_line = False
#end for
cust_info.addElement(this_item)
#end for
self.doc.text.addElement(cust_info)

link_element \
(
construct = odf.text.P,
attrs = dict
(
stylename = link_element
(
construct = odf.style.Style,
attrs = dict(name = "work header", family = "paragraph"),
parent = self.doc.automaticstyles,
children =
(
odf.style.TextProperties(fontweight = "bold"),
link_element
(
construct = odf.style.ParagraphProperties,
children =
(
make_tab_stops((dict(position = "15.1cm"),)),
)
),
)
)
),
parent = self.doc.text,
children =
(
odf.text.Span(text = "Description of Work"),
odf.text.Tab(),
odf.text.Span(text = "Charge"),
)
)
self.work_item_tabs = \
(
dict
(
type = "char",
char = ".",
position = "15.9cm"
),
) # I can't simply build one odf.style.TabStops object and reuse it
self.work_item_style = link_element \
(
construct = odf.style.Style,
attrs = dict(name = "work item", family = "paragraph"),
parent = self.doc.automaticstyles,
children =
(
link_element
(
construct = odf.style.ParagraphProperties,
children =
(
make_tab_stops(self.work_item_tabs),
)
),
)
)
#end write_invoice_header

I can post more, if you like.

SubjectRepliesAuthor
o The problem with not owning the software

By: CrudeSausage on Fri, 20 Dec 2024

250CrudeSausage

rocksolid light 0.9.8
clearnet tor