refactor
This commit is contained in:
parent
ccde42f988
commit
0dcd45f118
346 changed files with 3049 additions and 2968 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -127,3 +127,6 @@ dmypy.json
|
|||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
#backup file
|
||||
*~
|
2
MANIFEST.in
Normal file
2
MANIFEST.in
Normal file
|
@ -0,0 +1,2 @@
|
|||
include README.md
|
||||
|
55
setup.py
Normal file
55
setup.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
import os
|
||||
import pdb # 先 import 今天要介紹的套件
|
||||
|
||||
from glob import glob
|
||||
from setuptools import find_packages, setup
|
||||
from src.Editor import __about__
|
||||
|
||||
third_party_files_and_dir = glob('thirdparty/**',recursive=True)
|
||||
third_party_files = [x for x in third_party_files_and_dir if not os.path.isdir(x)]
|
||||
|
||||
setup(
|
||||
name="Clochur",
|
||||
version=__about__.version_no,
|
||||
author="Yoxem Chen",
|
||||
author_email="yoxem.tem98@nctu.edu.tw",
|
||||
description='''A S-expression like typesetting language powered by SILE engine
|
||||
with a simple editor''',
|
||||
|
||||
url="http://yoxem.github.com",
|
||||
|
||||
install_requires=['PyQt5>=5.15', 'QScintilla>=2.12'],
|
||||
|
||||
|
||||
|
||||
classifiers = [
|
||||
|
||||
'Development Status :: 2 - Pre-Alpha'
|
||||
'Environment :: X11 Applications :: Qt'
|
||||
'Programming Language :: Lisp'
|
||||
'Intended Audience :: Developers',
|
||||
'Topic :: Text Editors',
|
||||
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
|
||||
'Programming Language :: Python :: 3',
|
||||
|
||||
],
|
||||
|
||||
entry_points={
|
||||
'gui_scripts': [
|
||||
'clochur = Editor.__init__:entry_point'
|
||||
]
|
||||
},
|
||||
|
||||
packages=find_packages(where='src'),
|
||||
package_dir={'Editor': 'src/Editor'},
|
||||
package_data={'Editor': ['*.pdf', '*.qrc',
|
||||
'../resources/*.svg',
|
||||
'../thirdparty/pdfjs/**',
|
||||
'../thirdparty/pdfjs/**/**',
|
||||
'../thirdparty/pdfjs/**/**/**',
|
||||
'../thirdparty/pdfjs/**/**/**/**']},
|
||||
|
||||
|
||||
|
||||
|
||||
)
|
|
@ -1,7 +1,7 @@
|
|||
from PyQt5.QtGui import *
|
||||
from PyQt5.Qsci import QsciScintilla
|
||||
|
||||
from EditorOther.ClochurLexer import ClochurLexer
|
||||
from .ClochurLexer import ClochurLexer
|
||||
|
||||
class CustomQsciEditor(QsciScintilla):
|
||||
def __init__(self, parent=None):
|
4
src/Editor/__about__.py
Normal file
4
src/Editor/__about__.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
version_no = "0.0.1"
|
||||
about_info = '''A S-expression-like typesetting language powered by SILE engine with a simple text text editor.
|
||||
http://yoxem.github.com
|
||||
(c) 2021 Yoxem Chen <yoxem.tem98@nctu.edu.tw>'''
|
|
@ -10,8 +10,10 @@ from PyQt5 import QtWebEngineWidgets
|
|||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.Qsci import QsciScintilla
|
||||
|
||||
import qrc_resources
|
||||
from EditorOther import FindReplace, CustomQsciEditor
|
||||
from . import qrc_resources
|
||||
from . import FindReplace, CustomQsciEditor
|
||||
|
||||
from . import __about__
|
||||
|
||||
filename = None
|
||||
|
||||
|
@ -20,6 +22,7 @@ dirname = os.path.abspath(os.path.dirname(__file__)) #os.path.dirname('__file__'
|
|||
PDFJS = os.path.join(dirname, '../thirdparty/pdfjs/web/viewer.html')
|
||||
PDF = os.path.join(dirname, 'example.pdf')
|
||||
|
||||
app = None
|
||||
|
||||
|
||||
'''Widget for PDF file viewer'''
|
||||
|
@ -222,7 +225,7 @@ class Window(QMainWindow):
|
|||
if self.editor.isModified():
|
||||
reply = QMessageBox.question(self,'','Do You want to save this file? The text has been modified', QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel, QMessageBox.No)
|
||||
if reply == QMessageBox.Yes:
|
||||
file_path = QFileDialog.getSaveFileName(self, 'Save file as...', opened_file_dirname, "CLC typesetting format (*.clc)")
|
||||
file_path = QFileDialog.getSaveFileName(self, 'Save file as...', self.opened_file_dirname, "CLC typesetting format (*.clc)")
|
||||
if file_path[0] != '':
|
||||
self.file = open(file_path[0], 'w', encoding='utf-8')
|
||||
file_content = editor.text()
|
||||
|
@ -265,11 +268,9 @@ class Window(QMainWindow):
|
|||
self.editor.selectAll()
|
||||
|
||||
def about_call(self):
|
||||
about_content = '''A S-expression-like typesetting language powered by SILE engine with a simple text text editor.
|
||||
http://yoxem.github.com
|
||||
(c) 2021 Yoxem Chen <yoxem.tem98@nctu.edu.tw>'''
|
||||
|
||||
|
||||
self.about_dialog = QMessageBox.about(self, "About Clochur", about_content)
|
||||
self.about_dialog = QMessageBox.about(self, "About Clochur", __about__.version_no+"\n"+__about__.about_info)
|
||||
|
||||
|
||||
def _createEditToolBar(self):
|
||||
|
@ -362,10 +363,9 @@ http://yoxem.github.com
|
|||
|
||||
|
||||
|
||||
def entry_point():
|
||||
global app
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication([])
|
||||
window = Window()
|
||||
|
||||
|
@ -396,7 +396,7 @@ if __name__ == '__main__':
|
|||
untitled_title = window.generate_untitled_title()
|
||||
|
||||
if window.file != None:
|
||||
app.setApplicationName("Clochur - %s" % os.path.basename(window.file))
|
||||
app.setApplicationName("Clochur - %s" % os.path.basename(window.file))
|
||||
else:
|
||||
app.setApplicationName("Clochur - %s" % untitled_title)
|
||||
|
||||
|
@ -406,4 +406,4 @@ if __name__ == '__main__':
|
|||
window.setCentralWidget(main_widget)
|
||||
window.show()
|
||||
|
||||
sys.exit(app.exec_())
|
||||
sys.exit(app.exec_())
|
File diff suppressed because it is too large
Load diff
22
src/Editor/resources.qrc
Normal file
22
src/Editor/resources.qrc
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file alias="convert.svg">../resources/convert.svg</file>
|
||||
<file alias="copy.svg">../resources/copy.svg</file>
|
||||
<file alias="cut.svg">../resources/cut.svg</file>
|
||||
<file alias="find-replace.svg">../resources/find-replace.svg</file>
|
||||
<file alias="find.svg">../resources/find.svg</file>
|
||||
<file alias="new.svg">../resources/new.svg</file>
|
||||
<file alias="open.svg">../resources/open.svg</file>
|
||||
<file alias="paste.svg">../resources/paste.svg</file>
|
||||
<file alias="pdf.svg">../resources/pdf.svg</file>
|
||||
<file alias="redo.svg">../resources/redo.svg</file>
|
||||
<file alias="save-as.svg">../resources/save-as.svg</file>
|
||||
<file alias="save.svg">../resources/save.svg</file>
|
||||
<file alias="text-bold.svg">../resources/text-bold.svg</file>
|
||||
<file alias="text-italic.svg">../resources/text-italic.svg</file>
|
||||
<file alias="text-strikethrough.svg">../resources/text-strikethrough.svg</file>
|
||||
<file alias="text-underline.svg">../resources/text-underline.svg</file>
|
||||
<file alias="undo.svg">../resources/undo.svg</file>
|
||||
<file alias="logo.svg">../resources/logo.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,22 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file alias="convert.svg">resources/convert.svg</file>
|
||||
<file alias="copy.svg">resources/copy.svg</file>
|
||||
<file alias="cut.svg">resources/cut.svg</file>
|
||||
<file alias="find-replace.svg">resources/find-replace.svg</file>
|
||||
<file alias="find.svg">resources/find.svg</file>
|
||||
<file alias="new.svg">resources/new.svg</file>
|
||||
<file alias="open.svg">resources/open.svg</file>
|
||||
<file alias="paste.svg">resources/paste.svg</file>
|
||||
<file alias="pdf.svg">resources/pdf.svg</file>
|
||||
<file alias="redo.svg">resources/redo.svg</file>
|
||||
<file alias="save-as.svg">resources/save-as.svg</file>
|
||||
<file alias="save.svg">resources/save.svg</file>
|
||||
<file alias="text-bold.svg">resources/text-bold.svg</file>
|
||||
<file alias="text-italic.svg">resources/text-italic.svg</file>
|
||||
<file alias="text-strikethrough.svg">resources/text-strikethrough.svg</file>
|
||||
<file alias="text-underline.svg">resources/text-underline.svg</file>
|
||||
<file alias="undo.svg">resources/undo.svg</file>
|
||||
<file alias="logo.svg">resources/logo.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -86,6 +86,16 @@
|
|||
y1="89.247108"
|
||||
x2="-253.37338"
|
||||
y2="146.27638" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient966"
|
||||
id="linearGradient1521"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(-15.520809,211.33806)"
|
||||
x1="-117.96082"
|
||||
y1="89.247108"
|
||||
x2="-253.37338"
|
||||
y2="146.27638" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
|
@ -95,7 +105,7 @@
|
|||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.1767767"
|
||||
inkscape:cx="-988.26851"
|
||||
inkscape:cx="-2054.5855"
|
||||
inkscape:cy="922.11563"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="g858"
|
||||
|
@ -127,15 +137,18 @@
|
|||
transform="translate(-18.68452,14.904753)">
|
||||
<path
|
||||
style="opacity:1;fill:#b3b3b3;fill-opacity:0.94117647;fill-rule:nonzero;stroke:#b3b3b3;stroke-width:12;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;filter:url(#filter1075)"
|
||||
d="M 58.816139,107.981 H 178.55291 c 12.73379,0 22.98518,10.25139 22.98518,22.98518 v 118.13313 c 0,12.73379 -10.25139,22.98518 -22.98518,22.98518 H 58.816139 c -12.733787,0 -22.985176,-10.25139 -22.985176,-22.98518 V 130.96618 c 0,-12.73379 10.251389,-22.98518 22.985176,-22.98518 z"
|
||||
id="rect817-2" />
|
||||
d="M 62.520308,107.981 H 182.2571 c 12.73379,0 22.98518,10.25139 22.98518,22.98518 v 118.13313 c 0,12.73379 -10.25139,22.98518 -22.98518,22.98518 H 62.520308 c -12.733787,0 -22.985176,-10.25139 -22.985176,-22.98518 V 130.96618 c 0,-12.73379 10.251389,-22.98518 22.985176,-22.98518 z"
|
||||
id="rect817-2"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="opacity:1;fill:#d3d7cf;fill-opacity:0.94117647;fill-rule:nonzero;stroke:#888a85;stroke-width:12;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 55.59206,99.487816 h 119.73676 c 12.73378,0 22.98517,10.251384 22.98517,22.985174 v 118.13313 c 0,12.73379 -10.25139,22.98518 -22.98517,22.98518 H 55.59206 c -12.733787,0 -22.985176,-10.25139 -22.985176,-22.98518 V 122.47299 c 0,-12.73379 10.251389,-22.985174 22.985176,-22.985174 z"
|
||||
id="rect817" />
|
||||
d="M 59.296229,99.487816 H 179.03301 c 12.73378,0 22.98517,10.251384 22.98517,22.985174 v 118.13313 c 0,12.73379 -10.25139,22.98518 -22.98517,22.98518 H 59.296229 c -12.733787,0 -22.985176,-10.25139 -22.985176,-22.98518 V 122.47299 c 0,-12.73379 10.251389,-22.985174 22.985176,-22.985174 z"
|
||||
id="rect817"
|
||||
inkscape:connector-curvature="0" />
|
||||
<g
|
||||
style="fill:none;fill-opacity:1;stroke:#888a85;stroke-width:3;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="g851">
|
||||
id="g851"
|
||||
transform="translate(3.7041668)">
|
||||
<path
|
||||
style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 66.817381,222.16453 c 87.664399,0 97.286109,0 97.286109,0"
|
||||
|
@ -158,23 +171,25 @@
|
|||
style="stroke-width:0.85361797">
|
||||
<g
|
||||
aria-label=" Ċ"
|
||||
transform="matrix(0,-0.97974409,1.0206747,0,218.68981,17.050716)"
|
||||
transform="matrix(0,-0.97974409,1.0206747,0,221.85094,17.050716)"
|
||||
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:147.00419617px;line-height:1000%;font-family:'AR PL UMing TW';-inkscape-font-specification:'AR PL UMing TW Light';letter-spacing:0px;word-spacing:0px;writing-mode:tb-rl;fill:#3a5b1b;fill-opacity:0.36734697;stroke:none;stroke-width:0.22585309px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter1634)"
|
||||
id="text855-7">
|
||||
<path
|
||||
d="m -231.21484,147.54005 q -4.881,-4.59388 -8.25463,-8.82887 -3.30185,-4.1632 -5.31167,-8.11107 -2.00983,-3.87608 -2.87118,-7.68039 -0.86135,-3.73253 -0.86135,-7.46506 0,-6.67548 3.01473,-13.13563 3.01474,-6.388364 8.68531,-11.484701 5.67057,-5.096336 13.85342,-8.25463 8.25463,-3.086514 18.66264,-3.086514 11.48471,0 20.81603,3.445411 9.33132,3.517191 15.93502,9.47488 6.60371,5.95769 10.19268,13.853424 3.58897,7.89573 3.58897,16.7246 0,7.75217 -2.08161,13.5663 -2.0816,5.88591 -5.09633,9.61844 -0.3589,0.43068 -1.43559,-0.21534 -1.07669,-0.64601 -2.4405,-1.79448 -1.36381,-1.07669 -2.72762,-2.36872 -1.36381,-1.22025 -2.22516,-2.0816 l 0.43068,-2.51228 q 3.37363,-3.66075 5.52701,-8.68531 2.15338,-5.02456 2.15338,-11.55648 0,-2.4405 -0.93313,-5.38346 -0.86135,-2.87117 -2.7994,-5.81413 -1.93804,-2.94295 -5.09633,-5.67057 -3.08652,-2.727616 -7.53684,-4.880998 -4.45032,-2.081602 -10.33623,-3.373631 -5.81413,-1.22025 -13.27919,-1.22025 -9.54666,0 -16.7246,2.727617 -7.17794,2.799397 -11.98716,7.106162 -4.73744,4.37854 -7.17794,9.69022 -2.36872,5.38345 -2.36872,10.47979 0,3.87608 2.65584,10.12089 2.65584,6.24481 9.25954,14.14054 -0.14355,0.3589 -0.64601,0.7178 -0.43068,0.43067 -0.93313,0.78957 -0.50246,0.3589 -1.00491,0.64601 -0.43068,0.28712 -0.64602,0.50246 z m 95.46659,-21.82094 q -2.00982,0 -3.8043,-0.64601 -1.79449,-0.64601 -3.1583,-1.79449 -1.29203,-1.07669 -2.0816,-2.58405 -0.78957,-1.50737 -0.78957,-3.30186 0,-3.23007 1.79448,-4.66566 1.79449,-1.3638 5.09634,-1.3638 2.00982,0 3.80431,0.64601 1.79448,0.64601 3.08651,1.79449 1.36381,1.14847 2.0816,2.58405 0.78958,1.50737 0.78958,3.23008 0,6.10124 -6.81905,6.10124 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Gentium;-inkscape-font-specification:Gentium;stroke-width:0.22585309px"
|
||||
id="path845" />
|
||||
id="path845"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
aria-label=" Ċ"
|
||||
transform="matrix(0,-0.97974409,1.0206747,0,0,0)"
|
||||
transform="matrix(0,-0.97974409,1.0206747,0,3.1611509,0)"
|
||||
style="font-style:normal;font-variant:normal;font-weight:300;font-stretch:normal;font-size:147.00419617px;line-height:1000%;font-family:'AR PL UMing TW';-inkscape-font-specification:'AR PL UMing TW Light';letter-spacing:0px;word-spacing:0px;writing-mode:tb-rl;fill:url(#linearGradient862);fill-opacity:1;stroke:none;stroke-width:0.22585309px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
id="text855">
|
||||
<path
|
||||
d="m -245.79103,357.83443 q -4.88099,-4.59388 -8.25463,-8.82886 -3.30185,-4.16321 -5.31167,-8.11107 -2.00982,-3.87609 -2.87118,-7.6804 -0.86135,-3.73253 -0.86135,-7.46505 0,-6.67549 3.01474,-13.13563 3.01473,-6.38837 8.6853,-11.48471 5.67057,-5.09633 13.85342,-8.25463 8.25463,-3.08651 18.66265,-3.08651 11.4847,0 20.81602,3.44541 9.33132,3.51719 15.93503,9.47488 6.6037,5.95769 10.19267,13.85342 3.58897,7.89574 3.58897,16.7246 0,7.75218 -2.0816,13.56631 -2.08161,5.88591 -5.09634,9.61844 -0.3589,0.43067 -1.43559,-0.21534 -1.07669,-0.64602 -2.4405,-1.79449 -1.36381,-1.07669 -2.72761,-2.36872 -1.36381,-1.22025 -2.22517,-2.0816 l 0.43068,-2.51228 q 3.37363,-3.66075 5.52701,-8.68531 2.15339,-5.02455 2.15339,-11.55648 0,-2.4405 -0.93314,-5.38345 -0.86135,-2.87118 -2.79939,-5.81413 -1.93805,-2.94296 -5.09634,-5.67057 -3.08651,-2.72762 -7.53684,-4.881 -4.45032,-2.08161 -10.33623,-3.37364 -5.81413,-1.22024 -13.27919,-1.22024 -9.54666,0 -16.72459,2.72761 -7.17794,2.7994 -11.98716,7.10616 -4.73744,4.37855 -7.17794,9.69022 -2.36872,5.38345 -2.36872,10.47979 0,3.87609 2.65584,10.1209 2.65583,6.2448 9.25954,14.14054 -0.14356,0.35889 -0.64602,0.71779 -0.43067,0.43068 -0.93313,0.78957 -0.50246,0.3589 -1.00491,0.64602 -0.43068,0.28712 -0.64602,0.50245 z m 95.4666,-21.82093 q -2.00983,0 -3.80431,-0.64602 -1.79449,-0.64601 -3.15829,-1.79448 -1.29203,-1.07669 -2.08161,-2.58406 -0.78957,-1.50737 -0.78957,-3.30185 0,-3.23007 1.79448,-4.66566 1.79449,-1.36381 5.09634,-1.36381 2.00982,0 3.80431,0.64601 1.79448,0.64602 3.08651,1.79449 1.36381,1.14847 2.08161,2.58406 0.78957,1.50736 0.78957,3.23007 0,6.10125 -6.81904,6.10125 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Gentium;-inkscape-font-specification:Gentium;fill:url(#linearGradient862);stroke-width:0.22585309px"
|
||||
id="path842" />
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Gentium;-inkscape-font-specification:Gentium;fill:url(#linearGradient1521);stroke-width:0.22585309px"
|
||||
id="path842"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</g>
|
||||
<flowRoot
|
||||
|
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue