René's URL Explorer Experiment


Title: New feature: Software columns by belono · Pull Request #645 · python-escpos/python-escpos · GitHub

Open Graph Title: New feature: Software columns by belono · Pull Request #645 · python-escpos/python-escpos

X Title: New feature: Software columns by belono · Pull Request #645 · python-escpos/python-escpos

Description: Description This implements software_columns() as a new feature to help in the tricky task of printing texts in columns or aligning multiple texts in different alignments within the same line. The method receives a list of strings and formats them as horizontal columns by adding spaces between each element. If some text is too long it is wrapped to the column width by adding new lines and even truncating words that are too long by adding a placeholder. It is also possible to set the width and the text alignment of each column independently. The method is flexible enough to repeat the last width and/or alignment till the last element if there are more text elements than column widths or alignments. Example 1: The user passes a list of 4 text items and wants the first one to be 20 characters wide and 10 for the rest, then he/she only needs to pass the value widths=[20, 10] to the method so it will be expanded to '[20, 10, 10, 10]`. Example 2: The user passes a list of 4 text items and wants all them to be the same size along a maximum total width of 40 characters, then he/she simply passes the value widths=40 so it will be expanded to [10, 10, 10, 10]. This is also true for the alignment parameter: On a list of 4 text items align=['left', 'center', 'right'] would expand to ['left', 'center', 'right', 'right']. Alternatively a single value align='center' would expand to ['center', 'center', 'center', 'center']. At the moment, the user is responsible for not exceeding the width of the paper when passing the list of widths parameter, but this behavior could be modified by adding a check, an exception or whatever. As always all suggestions, corrections, etc. are very welcome. Closes #27 Closes #635 Tested with Epson TM-U210

Open Graph Description: Description This implements software_columns() as a new feature to help in the tricky task of printing texts in columns or aligning multiple texts in different alignments within the same line. The ...

X Description: Description This implements software_columns() as a new feature to help in the tricky task of printing texts in columns or aligning multiple texts in different alignments within the same line. The ...

Opengraph URL: https://github.com/python-escpos/python-escpos/pull/645

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:04c30f17-c281-1aef-ab18-8bcaf05f2273
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9C06:1CCA14:BEE9AF:1015438:6A531DE0
html-safe-nonceb8581d7f9ec06c2370dc0fc94cdc0920e6031d015a7affb946316d35a1964ef7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzA2OjFDQ0ExNDpCRUU5QUY6MTAxNTQzODo2QTUzMURFMCIsInZpc2l0b3JfaWQiOiI0MDkzNjIyNTM4MDcyMTY5OTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmace68d203348f7b2598819df1dd99cb0840d91eaab39a60bdd23d3d426cd9c06ff
hovercard-subject-tagpull_request:1899737901
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python-escpos/python-escpos/pull/645/files
twitter:imagehttps://avatars.githubusercontent.com/u/12175851?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/12175851?s=400&v=4
og:image:altDescription This implements software_columns() as a new feature to help in the tricky task of printing texts in columns or aligning multiple texts in different alignments within the same line. The ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python-escpos/python-escpos git https://github.com/python-escpos/python-escpos.git
octolytics-dimension-user_id16302939
octolytics-dimension-user_loginpython-escpos
octolytics-dimension-repository_id32363483
octolytics-dimension-repository_nwopython-escpos/python-escpos
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id32363483
octolytics-dimension-repository_network_root_nwopython-escpos/python-escpos
turbo-body-classeslogged-out env-production page-responsive
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release07a982c1d40157c619b364352b704c3ce66bb332
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-escpos/python-escpos/pull/645/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-escpos%2Fpython-escpos%2Fpull%2F645%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-escpos%2Fpython-escpos%2Fpull%2F645%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python-escpos%2Fpython-escpos
Reloadhttps://github.com/python-escpos/python-escpos/pull/645/files
Reloadhttps://github.com/python-escpos/python-escpos/pull/645/files
Reloadhttps://github.com/python-escpos/python-escpos/pull/645/files
Please reload this pagehttps://github.com/python-escpos/python-escpos/pull/645/files
python-escpos https://github.com/python-escpos
python-escposhttps://github.com/python-escpos/python-escpos
Notifications https://github.com/login?return_to=%2Fpython-escpos%2Fpython-escpos
Fork 313 https://github.com/login?return_to=%2Fpython-escpos%2Fpython-escpos
Star 1.3k https://github.com/login?return_to=%2Fpython-escpos%2Fpython-escpos
Code https://github.com/python-escpos/python-escpos
Issues 63 https://github.com/python-escpos/python-escpos/issues
Pull requests 24 https://github.com/python-escpos/python-escpos/pulls
Discussions https://github.com/python-escpos/python-escpos/discussions
Actions https://github.com/python-escpos/python-escpos/actions
Projects https://github.com/python-escpos/python-escpos/projects
Security and quality 0 https://github.com/python-escpos/python-escpos/security
Insights https://github.com/python-escpos/python-escpos/pulse
Code https://github.com/python-escpos/python-escpos
Issues https://github.com/python-escpos/python-escpos/issues
Pull requests https://github.com/python-escpos/python-escpos/pulls
Discussions https://github.com/python-escpos/python-escpos/discussions
Actions https://github.com/python-escpos/python-escpos/actions
Projects https://github.com/python-escpos/python-escpos/projects
Security and quality https://github.com/python-escpos/python-escpos/security
Insights https://github.com/python-escpos/python-escpos/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fpython-escpos%2Fpython-escpos%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython-escpos%2Fpython-escpos%2Fissues%2Fnew%2Fchoose
patkanhttps://github.com/patkan
python-escpos:masterhttps://github.com/python-escpos/python-escpos/tree/master
belono:belono/issue27https://github.com/belono/python-escpos/tree/belono/issue27
Conversation 2 https://github.com/python-escpos/python-escpos/pull/645
Commits 12 https://github.com/python-escpos/python-escpos/pull/645/commits
Checks 0 https://github.com/python-escpos/python-escpos/pull/645/checks
Files changed https://github.com/python-escpos/python-escpos/pull/645/files
Please reload this pagehttps://github.com/python-escpos/python-escpos/pull/645/files
New feature: Software columns https://github.com/python-escpos/python-escpos/pull/645/files#top
Show all changes 12 commits https://github.com/python-escpos/python-escpos/pull/645/files
546391c add type hint Alignment belono May 30, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/546391cb9c3d246d536cb5abb269ed4d36e175ce
3ec5cf9 Add static method padding() belono May 30, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/3ec5cf99735a46cbbdde50d6fba357f577cb53f0
0e794f4 Add static method truncate() belono May 30, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/0e794f4bf0d5e8ad54f6f39342cf6f4761bebe2e
673504e Add static method _repeat_last() belono May 30, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/673504e33198d267a6cef426380c2be34247d366
ecff7ea Add private method _rearrange_into_cols() belono May 30, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/ecff7ea417c56a0df874649732a8f2f26a914ada
c093d5f Add private method _add_padding_into_cols() belono May 30, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/c093d5f18a893b04a4b51670d019efb8165b10c0
ddda04e Add public method software_columns belono Jun 2, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/ddda04e3b55198bc2a0dc51a4c3414c93f91879b
5f18648 Make truncate and padding private staticmethods belono Jun 2, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/5f1864807bdac3afc43bfa48b92d89986eec8525
26c302a Revert "add type hint Alignment" belono Jun 3, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/26c302a186675b6a36a9f81836f69f2affa477e2
86fc0fe Add type hint Alignment belono Jun 3, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/86fc0fe69fd99c9ae9fa78846e5313f31470a581
c67ffe7 Fix typo in docstring belono Jun 3, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/c67ffe7b4fc4ffef4ac361b635222b2931e1bdb7
7470e58 Merge branch 'master' into belono/issue27 patkan Jul 11, 2024 https://github.com/python-escpos/python-escpos/pull/645/commits/7470e589cfb73511bb6a7cd3a807e7b797de334c
Clear filters https://github.com/python-escpos/python-escpos/pull/645/files
Please reload this pagehttps://github.com/python-escpos/python-escpos/pull/645/files
Please reload this pagehttps://github.com/python-escpos/python-escpos/pull/645/files
src/escpos/escpos.pyhttps://github.com/python-escpos/python-escpos/pull/645/files#diff-91425ded8755c4787655c26fd1d5c170d51b6953802ca2ba55ad9dd8bab0191e
View file https://github.com/belono/python-escpos/blob/7470e589cfb73511bb6a7cd3a807e7b797de334c/src/escpos/escpos.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python-escpos/python-escpos/pull/645/{{ revealButtonHref }}
https://github.com/python-escpos/python-escpos/pull/645/files#diff-91425ded8755c4787655c26fd1d5c170d51b6953802ca2ba55ad9dd8bab0191e
https://github.com/python-escpos/python-escpos/pull/645/files#diff-91425ded8755c4787655c26fd1d5c170d51b6953802ca2ba55ad9dd8bab0191e
https://github.com/python-escpos/python-escpos/pull/645/files#diff-91425ded8755c4787655c26fd1d5c170d51b6953802ca2ba55ad9dd8bab0191e
https://github.com/python-escpos/python-escpos/pull/645/files#diff-91425ded8755c4787655c26fd1d5c170d51b6953802ca2ba55ad9dd8bab0191e
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.