miniword 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- miniword-0.1.0/LICENSE +165 -0
- miniword-0.1.0/PKG-INFO +167 -0
- miniword-0.1.0/README.md +154 -0
- miniword-0.1.0/miniword/__init__.py +1 -0
- miniword-0.1.0/miniword/__main__.py +76 -0
- miniword-0.1.0/miniword/core/__init__.py +0 -0
- miniword-0.1.0/miniword/core/config.py +34 -0
- miniword-0.1.0/miniword/core/document.py +90 -0
- miniword-0.1.0/miniword/core/documentnode.py +22 -0
- miniword-0.1.0/miniword/core/fontfinder.py +274 -0
- miniword-0.1.0/miniword/core/papersizes.py +13 -0
- miniword-0.1.0/miniword/core/styles.py +158 -0
- miniword-0.1.0/miniword/core/stylesheet.py +58 -0
- miniword-0.1.0/miniword/core/texels.py +9 -0
- miniword-0.1.0/miniword/core/units.py +4 -0
- miniword-0.1.0/miniword/core/utils.py +195 -0
- miniword-0.1.0/miniword/footnotes/footnotes.py +81 -0
- miniword-0.1.0/miniword/icons/border_all.svg +9 -0
- miniword-0.1.0/miniword/icons/border_bottom.svg +9 -0
- miniword-0.1.0/miniword/icons/border_inner.svg +9 -0
- miniword-0.1.0/miniword/icons/border_inner_h.svg +9 -0
- miniword-0.1.0/miniword/icons/border_inner_v.svg +9 -0
- miniword-0.1.0/miniword/icons/border_left.svg +9 -0
- miniword-0.1.0/miniword/icons/border_none.svg +9 -0
- miniword-0.1.0/miniword/icons/border_outer.svg +9 -0
- miniword-0.1.0/miniword/icons/border_right.svg +9 -0
- miniword-0.1.0/miniword/icons/border_top.svg +9 -0
- miniword-0.1.0/miniword/icons/format_align_center_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_align_justify_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_align_left_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_align_right_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_bold_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_indent_decrease_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_indent_increase_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_italic_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/format_underlined_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg +1 -0
- miniword-0.1.0/miniword/icons/image.svg +4 -0
- miniword-0.1.0/miniword/icons/image_active.svg +5 -0
- miniword-0.1.0/miniword/icons/image_hover.svg +5 -0
- miniword-0.1.0/miniword/icons/links.svg +4 -0
- miniword-0.1.0/miniword/icons/miniword.svg +17 -0
- miniword-0.1.0/miniword/icons/outline.svg +4 -0
- miniword-0.1.0/miniword/icons/search.svg +4 -0
- miniword-0.1.0/miniword/icons/search_active.svg +1 -0
- miniword-0.1.0/miniword/icons/search_hover.svg +1 -0
- miniword-0.1.0/miniword/icons/settings.svg +4 -0
- miniword-0.1.0/miniword/icons/settings_active.svg +1 -0
- miniword-0.1.0/miniword/icons/settings_hover.svg +1 -0
- miniword-0.1.0/miniword/icons/style.svg +4 -0
- miniword-0.1.0/miniword/icons/style_active.svg +43 -0
- miniword-0.1.0/miniword/icons/style_hover.svg +43 -0
- miniword-0.1.0/miniword/icons/table.svg +4 -0
- miniword-0.1.0/miniword/icons/table_active.svg +5 -0
- miniword-0.1.0/miniword/icons/table_cursor.svg +7 -0
- miniword-0.1.0/miniword/icons/table_cursor_active.svg +6 -0
- miniword-0.1.0/miniword/icons/table_cursor_hover.svg +6 -0
- miniword-0.1.0/miniword/icons/table_hover.svg +5 -0
- miniword-0.1.0/miniword/icons/table_matrix.svg +9 -0
- miniword-0.1.0/miniword/icons/table_matrix_active.svg +7 -0
- miniword-0.1.0/miniword/icons/table_matrix_hover.svg +7 -0
- miniword-0.1.0/miniword/images/__init__.py +2 -0
- miniword-0.1.0/miniword/images/image_controllers.py +341 -0
- miniword-0.1.0/miniword/images/image_panel.py +381 -0
- miniword-0.1.0/miniword/images/imageio.py +45 -0
- miniword-0.1.0/miniword/images/images.py +269 -0
- miniword-0.1.0/miniword/io/__init__.py +0 -0
- miniword-0.1.0/miniword/io/importexport.py +259 -0
- miniword-0.1.0/miniword/io/texeltreeformat.py +803 -0
- miniword-0.1.0/miniword/io/txlio.py +286 -0
- miniword-0.1.0/miniword/layout/__init__.py +0 -0
- miniword-0.1.0/miniword/layout/annotation.py +227 -0
- miniword-0.1.0/miniword/layout/boxes.py +926 -0
- miniword-0.1.0/miniword/layout/builderbase.py +177 -0
- miniword-0.1.0/miniword/layout/cache.py +23 -0
- miniword-0.1.0/miniword/layout/cairodevice.py +862 -0
- miniword-0.1.0/miniword/layout/counters.py +65 -0
- miniword-0.1.0/miniword/layout/factory.py +98 -0
- miniword-0.1.0/miniword/layout/layoutbase.py +155 -0
- miniword-0.1.0/miniword/layout/linewrap.py +232 -0
- miniword-0.1.0/miniword/layout/page.py +119 -0
- miniword-0.1.0/miniword/layout/pagebuilder.py +708 -0
- miniword-0.1.0/miniword/layout/pagegen.py +675 -0
- miniword-0.1.0/miniword/layout/rect.py +44 -0
- miniword-0.1.0/miniword/layout/simplelayout.py +278 -0
- miniword-0.1.0/miniword/layout/stretchable.py +335 -0
- miniword-0.1.0/miniword/layout/testdevice.py +52 -0
- miniword-0.1.0/miniword/plugins/__init__.py +1 -0
- miniword-0.1.0/miniword/plugins/mdfilter.py +1482 -0
- miniword-0.1.0/miniword/tables/__init__.py +3 -0
- miniword-0.1.0/miniword/tables/table_boxes.py +447 -0
- miniword-0.1.0/miniword/tables/table_controllers.py +586 -0
- miniword-0.1.0/miniword/tables/table_factory.py +118 -0
- miniword-0.1.0/miniword/tables/table_panel.py +632 -0
- miniword-0.1.0/miniword/tables/tables.py +490 -0
- miniword-0.1.0/miniword/texteditor/__init__.py +0 -0
- miniword-0.1.0/miniword/texteditor/actions.py +371 -0
- miniword-0.1.0/miniword/texteditor/boxcontroller.py +220 -0
- miniword-0.1.0/miniword/texteditor/controller.py +81 -0
- miniword-0.1.0/miniword/texteditor/editor.py +870 -0
- miniword-0.1.0/miniword/texteditor/textcanvas.py +650 -0
- miniword-0.1.0/miniword/texteditor/undoredo.py +88 -0
- miniword-0.1.0/miniword/textmodel/__init__.py +2 -0
- miniword-0.1.0/miniword/textmodel/iterators.py +64 -0
- miniword-0.1.0/miniword/textmodel/modelbase.py +91 -0
- miniword-0.1.0/miniword/textmodel/properties.py +46 -0
- miniword-0.1.0/miniword/textmodel/styles.py +348 -0
- miniword-0.1.0/miniword/textmodel/submodel.py +147 -0
- miniword-0.1.0/miniword/textmodel/texeltree.py +1125 -0
- miniword-0.1.0/miniword/textmodel/textmodel.py +983 -0
- miniword-0.1.0/miniword/textmodel/utils.py +580 -0
- miniword-0.1.0/miniword/textmodel/viewbase.py +93 -0
- miniword-0.1.0/miniword/textmodel/weights.py +195 -0
- miniword-0.1.0/miniword/ui/__init__.py +0 -0
- miniword-0.1.0/miniword/ui/buttonbar.py +76 -0
- miniword-0.1.0/miniword/ui/colours.py +86 -0
- miniword-0.1.0/miniword/ui/design.py +151 -0
- miniword-0.1.0/miniword/ui/flatbutton.py +105 -0
- miniword-0.1.0/miniword/ui/fontctrl.py +249 -0
- miniword-0.1.0/miniword/ui/icons.py +19 -0
- miniword-0.1.0/miniword/ui/linkpanel.py +195 -0
- miniword-0.1.0/miniword/ui/mainwindow.py +1016 -0
- miniword-0.1.0/miniword/ui/outlinepanel.py +160 -0
- miniword-0.1.0/miniword/ui/searchtool.py +618 -0
- miniword-0.1.0/miniword/ui/settingsinspector.py +155 -0
- miniword-0.1.0/miniword/ui/sidepanel.py +160 -0
- miniword-0.1.0/miniword/ui/styleinspector.py +1137 -0
- miniword-0.1.0/miniword/ui/stylemenu.py +660 -0
- miniword-0.1.0/miniword/ui/testing.py +30 -0
- miniword-0.1.0/miniword/ui/threestate.py +157 -0
- miniword-0.1.0/miniword/ui/unitentry.py +221 -0
- miniword-0.1.0/miniword.egg-info/PKG-INFO +167 -0
- miniword-0.1.0/miniword.egg-info/SOURCES.txt +136 -0
- miniword-0.1.0/miniword.egg-info/dependency_links.txt +1 -0
- miniword-0.1.0/miniword.egg-info/entry_points.txt +2 -0
- miniword-0.1.0/miniword.egg-info/requires.txt +2 -0
- miniword-0.1.0/miniword.egg-info/top_level.txt +1 -0
- miniword-0.1.0/pyproject.toml +27 -0
- miniword-0.1.0/setup.cfg +4 -0
miniword-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
miniword-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: miniword
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A minimal word processor in Python
|
|
5
|
+
License-Expression: LGPL-3.0-or-later
|
|
6
|
+
Project-URL: Homepage, https://codeberg.org/chrisecker/miniword
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: wxPython>=4.0
|
|
11
|
+
Requires-Dist: cairocffi
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# MiniWord
|
|
15
|
+
|
|
16
|
+
A minimal word processor in python. In development but already great.
|
|
17
|
+
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
## Key Aspects
|
|
21
|
+
|
|
22
|
+
- Real WYSIWYG editing (no HTML layer, no embedded browser)
|
|
23
|
+
- Lightweight and fast startup
|
|
24
|
+
- Clean, simple file format (human-readable, diff-friendly, git-friendly, AI-friendly)
|
|
25
|
+
- Good Markdown support
|
|
26
|
+
- Extensible via Python-plugins
|
|
27
|
+
|
|
28
|
+
## Download
|
|
29
|
+
|
|
30
|
+
Pre-built installers for Windows (`.exe`) and macOS (`.dmg`) are published on the [Releases page](https://github.com/chrisecker/miniword/releases) for each tagged version. On Linux, install from source via `pip` (see below) — no separate installer is provided there.
|
|
31
|
+
|
|
32
|
+
## Dependencies
|
|
33
|
+
|
|
34
|
+
Miniword is developed under Linux. In principle it should run under Windows and Mac as well.
|
|
35
|
+
|
|
36
|
+
Dependencies vary between platforms and prefered features. You always need Python >= 3.9 and wxPython >= 4.0.
|
|
37
|
+
|
|
38
|
+
| Dependency | Linux | Windows | macOS | Notes |
|
|
39
|
+
| ---------- | -------- | -------- | -------- | ------------------------------------------ |
|
|
40
|
+
| cairocffi | required | required | required | pulled in automatically by `pip install .` |
|
|
41
|
+
| fontconfig | required | — | required | system CLI-tool |
|
|
42
|
+
| uharfbuzz | optional | optional | optional | needed for ligatures and non-Latin scripts |
|
|
43
|
+
| fonttools | — | optional | — | needed for non-Latin scripts on Windows |
|
|
44
|
+
| mistune | optional | optional | optional | richer Markdown import; falls back to a built-in parser |
|
|
45
|
+
|
|
46
|
+
## Running without installation
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
python miniword.py
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Alternatively, double-click `miniword.py` in your file explorer.
|
|
53
|
+
|
|
54
|
+
## Install (Linux)
|
|
55
|
+
|
|
56
|
+
Install system dependencies:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
sudo apt install python3-wxgtk4.0 fontconfig
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For ligature support, non-Latin scripts, and richer Markdown import, install the optional extras:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
pip install uharfbuzz mistune
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then install miniword (this also pulls in `cairocffi`):
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
cd miniword
|
|
72
|
+
pip install .
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If you want to register MiniWord to the desktop (you probably will):
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
cp miniword/icons/miniword.svg ~/.local/share/icons/
|
|
79
|
+
cp miniword.desktop ~/.local/share/applications/
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Install (Windows)
|
|
83
|
+
|
|
84
|
+
Prefer a ready-made installer? Download the `.exe` from the [Releases page](https://github.com/chrisecker/miniword/releases) instead of building from source.
|
|
85
|
+
|
|
86
|
+
No separate Cairo installation is needed — wxPython already bundles `libcairo-2.dll`, and `pip install .` pulls in `cairocffi` to bind to it.
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
cd miniword
|
|
90
|
+
pip install .
|
|
91
|
+
pip install uharfbuzz fonttools mistune # optional: ligatures, non-Latin scripts, richer Markdown import
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
MiniWord stores its configuration and plugins in `%APPDATA%\miniword\` (e.g. `C:\Users\<you>\AppData\Roaming\miniword\`).
|
|
95
|
+
|
|
96
|
+
**Note** that MiniWord is not yet **optimised** for Windows. While it mostly works, the GUI is less polished and startup takes a bit longer.
|
|
97
|
+
|
|
98
|
+
## Install (macOS)
|
|
99
|
+
|
|
100
|
+
Prefer a ready-made installer? Download the `.dmg` from the [Releases page](https://github.com/chrisecker/miniword/releases) instead of building from source.
|
|
101
|
+
|
|
102
|
+
On macOS, `fontconfig` must be installed via Homebrew:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
brew install fontconfig
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Then install miniword (this also pulls in `cairocffi`):
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
cd miniword
|
|
112
|
+
pip install .
|
|
113
|
+
pip install uharfbuzz mistune # optional: ligatures, non-Latin scripts, richer Markdown import
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
MiniWord stores its configuration and plugins in `~/Library/Application Support/miniword/`.
|
|
117
|
+
|
|
118
|
+
**Note** that MiniWord has not been tested on macOS.
|
|
119
|
+
|
|
120
|
+
## Hacking
|
|
121
|
+
|
|
122
|
+
Run the full test suite:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
python test_all.py
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Run tests for a single module:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
python runtests.py miniword/layout/pagegen.py
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Run a specific test or demo:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
python runtests.py miniword/ui/searchtool.py test_00
|
|
138
|
+
python runtests.py miniword/texteditor/textcanvas.py demo_00
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Plugins
|
|
142
|
+
|
|
143
|
+
MiniWord is extensible via Python plugins. To install a plugin, copy the `.py` file into the plugins directory for your platform:
|
|
144
|
+
|
|
145
|
+
| Platform | Plugins directory |
|
|
146
|
+
| -------- | ------------------------------------------------- |
|
|
147
|
+
| Linux | `~/.config/miniword/plugins/` |
|
|
148
|
+
| macOS | `~/Library/Application Support/miniword/plugins/` |
|
|
149
|
+
| Windows | `%APPDATA%\miniword\plugins\` |
|
|
150
|
+
|
|
151
|
+
Example plugins are provided in the `examples/` directory:
|
|
152
|
+
|
|
153
|
+
| File | Description |
|
|
154
|
+
| --------------- | ------------------------------------- |
|
|
155
|
+
| `wordcount.py` | Shows a live word count |
|
|
156
|
+
| `txtfilter.py` | Filter for importing plain text files |
|
|
157
|
+
|
|
158
|
+
To install all example plugins on Linux:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
mkdir -p ~/.config/miniword/plugins
|
|
162
|
+
cp examples/*.py ~/.config/miniword/plugins
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## License
|
|
166
|
+
|
|
167
|
+
This project is licensed under the GNU General Public License v3.0 - see LICENSE for details. Contact me if you need something else.
|
miniword-0.1.0/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# MiniWord
|
|
2
|
+
|
|
3
|
+
A minimal word processor in python. In development but already great.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Key Aspects
|
|
8
|
+
|
|
9
|
+
- Real WYSIWYG editing (no HTML layer, no embedded browser)
|
|
10
|
+
- Lightweight and fast startup
|
|
11
|
+
- Clean, simple file format (human-readable, diff-friendly, git-friendly, AI-friendly)
|
|
12
|
+
- Good Markdown support
|
|
13
|
+
- Extensible via Python-plugins
|
|
14
|
+
|
|
15
|
+
## Download
|
|
16
|
+
|
|
17
|
+
Pre-built installers for Windows (`.exe`) and macOS (`.dmg`) are published on the [Releases page](https://github.com/chrisecker/miniword/releases) for each tagged version. On Linux, install from source via `pip` (see below) — no separate installer is provided there.
|
|
18
|
+
|
|
19
|
+
## Dependencies
|
|
20
|
+
|
|
21
|
+
Miniword is developed under Linux. In principle it should run under Windows and Mac as well.
|
|
22
|
+
|
|
23
|
+
Dependencies vary between platforms and prefered features. You always need Python >= 3.9 and wxPython >= 4.0.
|
|
24
|
+
|
|
25
|
+
| Dependency | Linux | Windows | macOS | Notes |
|
|
26
|
+
| ---------- | -------- | -------- | -------- | ------------------------------------------ |
|
|
27
|
+
| cairocffi | required | required | required | pulled in automatically by `pip install .` |
|
|
28
|
+
| fontconfig | required | — | required | system CLI-tool |
|
|
29
|
+
| uharfbuzz | optional | optional | optional | needed for ligatures and non-Latin scripts |
|
|
30
|
+
| fonttools | — | optional | — | needed for non-Latin scripts on Windows |
|
|
31
|
+
| mistune | optional | optional | optional | richer Markdown import; falls back to a built-in parser |
|
|
32
|
+
|
|
33
|
+
## Running without installation
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
python miniword.py
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Alternatively, double-click `miniword.py` in your file explorer.
|
|
40
|
+
|
|
41
|
+
## Install (Linux)
|
|
42
|
+
|
|
43
|
+
Install system dependencies:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
sudo apt install python3-wxgtk4.0 fontconfig
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
For ligature support, non-Latin scripts, and richer Markdown import, install the optional extras:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
pip install uharfbuzz mistune
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then install miniword (this also pulls in `cairocffi`):
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
cd miniword
|
|
59
|
+
pip install .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If you want to register MiniWord to the desktop (you probably will):
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
cp miniword/icons/miniword.svg ~/.local/share/icons/
|
|
66
|
+
cp miniword.desktop ~/.local/share/applications/
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Install (Windows)
|
|
70
|
+
|
|
71
|
+
Prefer a ready-made installer? Download the `.exe` from the [Releases page](https://github.com/chrisecker/miniword/releases) instead of building from source.
|
|
72
|
+
|
|
73
|
+
No separate Cairo installation is needed — wxPython already bundles `libcairo-2.dll`, and `pip install .` pulls in `cairocffi` to bind to it.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
cd miniword
|
|
77
|
+
pip install .
|
|
78
|
+
pip install uharfbuzz fonttools mistune # optional: ligatures, non-Latin scripts, richer Markdown import
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
MiniWord stores its configuration and plugins in `%APPDATA%\miniword\` (e.g. `C:\Users\<you>\AppData\Roaming\miniword\`).
|
|
82
|
+
|
|
83
|
+
**Note** that MiniWord is not yet **optimised** for Windows. While it mostly works, the GUI is less polished and startup takes a bit longer.
|
|
84
|
+
|
|
85
|
+
## Install (macOS)
|
|
86
|
+
|
|
87
|
+
Prefer a ready-made installer? Download the `.dmg` from the [Releases page](https://github.com/chrisecker/miniword/releases) instead of building from source.
|
|
88
|
+
|
|
89
|
+
On macOS, `fontconfig` must be installed via Homebrew:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
brew install fontconfig
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Then install miniword (this also pulls in `cairocffi`):
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
cd miniword
|
|
99
|
+
pip install .
|
|
100
|
+
pip install uharfbuzz mistune # optional: ligatures, non-Latin scripts, richer Markdown import
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
MiniWord stores its configuration and plugins in `~/Library/Application Support/miniword/`.
|
|
104
|
+
|
|
105
|
+
**Note** that MiniWord has not been tested on macOS.
|
|
106
|
+
|
|
107
|
+
## Hacking
|
|
108
|
+
|
|
109
|
+
Run the full test suite:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
python test_all.py
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Run tests for a single module:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
python runtests.py miniword/layout/pagegen.py
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Run a specific test or demo:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
python runtests.py miniword/ui/searchtool.py test_00
|
|
125
|
+
python runtests.py miniword/texteditor/textcanvas.py demo_00
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Plugins
|
|
129
|
+
|
|
130
|
+
MiniWord is extensible via Python plugins. To install a plugin, copy the `.py` file into the plugins directory for your platform:
|
|
131
|
+
|
|
132
|
+
| Platform | Plugins directory |
|
|
133
|
+
| -------- | ------------------------------------------------- |
|
|
134
|
+
| Linux | `~/.config/miniword/plugins/` |
|
|
135
|
+
| macOS | `~/Library/Application Support/miniword/plugins/` |
|
|
136
|
+
| Windows | `%APPDATA%\miniword\plugins\` |
|
|
137
|
+
|
|
138
|
+
Example plugins are provided in the `examples/` directory:
|
|
139
|
+
|
|
140
|
+
| File | Description |
|
|
141
|
+
| --------------- | ------------------------------------- |
|
|
142
|
+
| `wordcount.py` | Shows a live word count |
|
|
143
|
+
| `txtfilter.py` | Filter for importing plain text files |
|
|
144
|
+
|
|
145
|
+
To install all example plugins on Linux:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
mkdir -p ~/.config/miniword/plugins
|
|
149
|
+
cp examples/*.py ~/.config/miniword/plugins
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
This project is licensed under the GNU General Public License v3.0 - see LICENSE for details. Contact me if you need something else.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import wx.lib.wxcairo as wxcairo
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import wx
|
|
3
|
+
from .core.document import Document
|
|
4
|
+
from .core.config import get_config
|
|
5
|
+
from .ui.mainwindow import MainFrame
|
|
6
|
+
from .ui.unitentry import LengthInput, UnitPrefs
|
|
7
|
+
from .layout import pagebuilder
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _enable_dpi_awareness():
|
|
11
|
+
"""Enable Per-Monitor DPI awareness on Windows to avoid blurry rendering."""
|
|
12
|
+
if sys.platform != 'win32':
|
|
13
|
+
return
|
|
14
|
+
try:
|
|
15
|
+
import ctypes
|
|
16
|
+
ctypes.windll.shcore.SetProcessDpiAwareness(2) # Per-Monitor DPI aware
|
|
17
|
+
except Exception:
|
|
18
|
+
try:
|
|
19
|
+
ctypes.windll.user32.SetProcessDPIAware()
|
|
20
|
+
except Exception:
|
|
21
|
+
pass
|
|
22
|
+
|
|
23
|
+
def _enable_dpi_awareness():
|
|
24
|
+
"""Enable Per-Monitor DPI awareness v2 on Windows."""
|
|
25
|
+
if sys.platform != 'win32':
|
|
26
|
+
return
|
|
27
|
+
try:
|
|
28
|
+
# Windows 10 v1703+: Using SetProcessDpiAwarenessContext mit v2
|
|
29
|
+
# -4 entspricht DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
|
|
30
|
+
ctypes.windll.user32.SetProcessDpiAwarenessContext(-4)
|
|
31
|
+
except Exception:
|
|
32
|
+
try:
|
|
33
|
+
# Fallback for Windows 8.1 / early Win 10 (2 = Process_Per_Monitor_DPI_Aware)
|
|
34
|
+
ctypes.windll.shcore.SetProcessDpiAwareness(2)
|
|
35
|
+
except Exception:
|
|
36
|
+
try:
|
|
37
|
+
# Fallback for Windows Vista / 7
|
|
38
|
+
ctypes.windll.user32.SetProcessDPIAware()
|
|
39
|
+
except Exception:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
def main():
|
|
43
|
+
args = sys.argv[1:]
|
|
44
|
+
if '--debug' in args:
|
|
45
|
+
pagebuilder.DEBUG = True
|
|
46
|
+
args = [a for a in args if a != '--debug']
|
|
47
|
+
path = args[0] if args else None
|
|
48
|
+
|
|
49
|
+
_enable_dpi_awareness()
|
|
50
|
+
config = get_config()
|
|
51
|
+
LengthInput.prefs = UnitPrefs(
|
|
52
|
+
layout=config.get("layout_unit"),
|
|
53
|
+
typographic=config.get("typographic_unit"),
|
|
54
|
+
)
|
|
55
|
+
app = wx.App(redirect=False)
|
|
56
|
+
app.SetAppName("miniword")
|
|
57
|
+
from .ui.mainwindow import load_plugins
|
|
58
|
+
load_plugins()
|
|
59
|
+
if path:
|
|
60
|
+
from .io import importexport
|
|
61
|
+
try:
|
|
62
|
+
doc = importexport.open_file(path)
|
|
63
|
+
except Exception as e:
|
|
64
|
+
print("Error opening '%s': %s" % (path, e))
|
|
65
|
+
return
|
|
66
|
+
frame = MainFrame(doc)
|
|
67
|
+
frame._current_path = path
|
|
68
|
+
frame._update_title()
|
|
69
|
+
else:
|
|
70
|
+
frame = MainFrame(Document())
|
|
71
|
+
frame.Show()
|
|
72
|
+
app.MainLoop()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == '__main__':
|
|
76
|
+
main()
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
_path = Path.home() / ".config" / "miniword" / "config.json"
|
|
5
|
+
_defaults = {"layout_unit": "mm", "typographic_unit": "mm"}
|
|
6
|
+
|
|
7
|
+
_instance = None
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_config():
|
|
11
|
+
global _instance
|
|
12
|
+
if _instance is None:
|
|
13
|
+
_instance = Config()
|
|
14
|
+
return _instance
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Config:
|
|
18
|
+
"""Persistent user preferences, stored in ~/.config/miniword/config.json."""
|
|
19
|
+
|
|
20
|
+
def __init__(self):
|
|
21
|
+
self._data = {**_defaults}
|
|
22
|
+
if _path.exists():
|
|
23
|
+
try:
|
|
24
|
+
self._data.update(json.loads(_path.read_text()))
|
|
25
|
+
except Exception:
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
def get(self, key):
|
|
29
|
+
return self._data.get(key, _defaults.get(key))
|
|
30
|
+
|
|
31
|
+
def set(self, key, value):
|
|
32
|
+
self._data[key] = value
|
|
33
|
+
_path.parent.mkdir(parents=True, exist_ok=True)
|
|
34
|
+
_path.write_text(json.dumps(self._data, indent=2))
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from ..textmodel.modelbase import Model
|
|
2
|
+
from ..textmodel.textmodel import TextModel
|
|
3
|
+
from .stylesheet import StyleSheet
|
|
4
|
+
from .units import cm, mm
|
|
5
|
+
from .styles import normal as _normal_style
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
settings_default = {
|
|
9
|
+
"title": "",
|
|
10
|
+
"author": "",
|
|
11
|
+
"paper": "A4", # "A4" / "Letter" / "custom"
|
|
12
|
+
"paper_width": 210 * mm, # used when paper == "custom"
|
|
13
|
+
"paper_height": 297 * mm,
|
|
14
|
+
"margin_top": 2.5 * cm,
|
|
15
|
+
"margin_right": 2.5 * cm,
|
|
16
|
+
"margin_bottom": 2.5 * cm,
|
|
17
|
+
"margin_left": 2.5 * cm,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Document(Model):
|
|
22
|
+
def __init__(self):
|
|
23
|
+
self.basestyles = StyleSheet()
|
|
24
|
+
self.basestyles.set_owner(self, 'basestyles')
|
|
25
|
+
self.basestyles.set('normal', _normal_style)
|
|
26
|
+
self.textmodel = TextModel()
|
|
27
|
+
self.settings = {}
|
|
28
|
+
self.blobs = {} # {blob_id: bytes}
|
|
29
|
+
self.home_format = 'txl' # native format; set to ext on import
|
|
30
|
+
|
|
31
|
+
def set_setting(self, name, value):
|
|
32
|
+
if name in self.settings:
|
|
33
|
+
old = self.settings[name]
|
|
34
|
+
else:
|
|
35
|
+
old = settings_default[name]
|
|
36
|
+
if value != old:
|
|
37
|
+
if settings_default[name] == value:
|
|
38
|
+
del self.settings[name]
|
|
39
|
+
else:
|
|
40
|
+
self.settings[name] = value
|
|
41
|
+
self.notify_views('setting_changed', name, old)
|
|
42
|
+
return old
|
|
43
|
+
|
|
44
|
+
def save(self, path):
|
|
45
|
+
from ..io import txlio
|
|
46
|
+
txlio.save(self, path)
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def load(cls, path):
|
|
50
|
+
from ..io.importexport import open_file
|
|
51
|
+
return open_file(path)
|
|
52
|
+
|
|
53
|
+
def basestyles_changed(self, *args, **kwds):
|
|
54
|
+
self.notify_views('basestyles_changed')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class TestDocument(Document):
|
|
59
|
+
def attribute_changed(self, *args, **kwds):
|
|
60
|
+
self.msg = args, kwds
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_00():
|
|
64
|
+
"receiving child messages via fallback handler"
|
|
65
|
+
doc = TestDocument()
|
|
66
|
+
doc.xyzstyles = StyleSheet()
|
|
67
|
+
doc.xyzstyles.set_owner(doc, 'xyzstyles')
|
|
68
|
+
doc.msg = None
|
|
69
|
+
doc.xyzstyles.set("x", {})
|
|
70
|
+
assert doc.msg == ((doc.xyzstyles,), {})
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_01():
|
|
74
|
+
"forwarding basestyles changes to views"
|
|
75
|
+
from ..textmodel.viewbase import ViewBase
|
|
76
|
+
|
|
77
|
+
class TestView(ViewBase):
|
|
78
|
+
def basestyles_changed(self, *args, **kwds):
|
|
79
|
+
self.msg = "basestyles_changed", args, kwds
|
|
80
|
+
|
|
81
|
+
def model_changed(self, *args, **kwds):
|
|
82
|
+
self.msg = "model_changed", args, kwds
|
|
83
|
+
|
|
84
|
+
doc = Document()
|
|
85
|
+
view = TestView()
|
|
86
|
+
view.model = doc
|
|
87
|
+
|
|
88
|
+
doc.basestyles.set('normal', dict(fontsize=9, dolor="black"))
|
|
89
|
+
assert view.msg == ('basestyles_changed', (doc,), {})
|
|
90
|
+
|