cleaned, decorated, added headers to code source
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
# @Author: Bachir Soussi Chiadmi <bach>
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
# @Date: 23-05-2017
|
# @Date: 23-05-2017
|
||||||
# @Email: bachir@figureslibres.io
|
# @Email: bachir@figureslibres.io
|
||||||
# @Last modified by: bach
|
# @Last modified by: bach
|
||||||
# @Last modified time: 21-04-2017
|
# @Last modified time: 03-06-2017
|
||||||
# @License: GPL-V3
|
# @License: GPL-V3
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|||||||
+13
-7
@@ -1,6 +1,14 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
|
# @Date: 23-05-2017
|
||||||
|
# @Email: bachir@figureslibres.io
|
||||||
|
# @Filename: content.py
|
||||||
|
# @Last modified by: bach
|
||||||
|
# @Last modified time: 03-06-2017
|
||||||
|
# @License: GPL-V3
|
||||||
|
|
||||||
import os, re
|
import os, re
|
||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
@@ -127,7 +135,6 @@ class SummaryList(QListWidget):
|
|||||||
# print('onItemActivated', item.data)
|
# print('onItemActivated', item.data)
|
||||||
self.parent.parent.editor.openFile(self.currentRow())
|
self.parent.parent.editor.openFile(self.currentRow())
|
||||||
|
|
||||||
|
|
||||||
class SummaryListWidgetItem(QListWidgetItem):
|
class SummaryListWidgetItem(QListWidgetItem):
|
||||||
def __init__(self,parent,data):
|
def __init__(self,parent,data):
|
||||||
super(SummaryListWidgetItem, self).__init__(parent)
|
super(SummaryListWidgetItem, self).__init__(parent)
|
||||||
@@ -137,7 +144,6 @@ class SummaryListWidgetItem(QListWidgetItem):
|
|||||||
self.setText(data['title'])
|
self.setText(data['title'])
|
||||||
self.setToolTip(data['file'])
|
self.setToolTip(data['file'])
|
||||||
|
|
||||||
|
|
||||||
class SummaryActions(QWidget):
|
class SummaryActions(QWidget):
|
||||||
def __init__(self,parent):
|
def __init__(self,parent):
|
||||||
super(SummaryActions, self).__init__(parent)
|
super(SummaryActions, self).__init__(parent)
|
||||||
@@ -253,11 +259,11 @@ class MarkdownEditor(QWidget):
|
|||||||
# self.tabs.setTabText(i, re.sub(r'^\*\s', '', self.tabs.tabText(i)))
|
# self.tabs.setTabText(i, re.sub(r'^\*\s', '', self.tabs.tabText(i)))
|
||||||
# TODO: how to combine file save and project save
|
# TODO: how to combine file save and project save
|
||||||
|
|
||||||
# __ ___ _
|
# _____ __ __
|
||||||
# / |/ /___ _(_)___
|
# / ___// /_____ ______/ /__
|
||||||
# / /|_/ / __ `/ / __ \
|
# \__ \/ __/ __ `/ ___/ //_/
|
||||||
# / / / / /_/ / / / / /
|
# ___/ / /_/ /_/ / /__/ ,<
|
||||||
# /_/ /_/\__,_/_/_/ /_/
|
# /____/\__/\__,_/\___/_/|_|
|
||||||
class ContentStack(QWidget):
|
class ContentStack(QWidget):
|
||||||
def __init__(self, core):
|
def __init__(self, core):
|
||||||
super(ContentStack, self).__init__()
|
super(ContentStack, self).__init__()
|
||||||
|
|||||||
+1
-2
@@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
# @Author: Bachir Soussi Chiadmi <bach>
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
# @Date: 23-05-2017
|
# @Date: 23-05-2017
|
||||||
# @Email: bachir@figureslibres.io
|
# @Email: bachir@figureslibres.io
|
||||||
# @Last modified by: bach
|
# @Last modified by: bach
|
||||||
# @Last modified time: 21-04-2017
|
# @Last modified time: 03-06-2017
|
||||||
# @License: GPL-V3
|
# @License: GPL-V3
|
||||||
|
|
||||||
import os, re, shutil, tempfile
|
import os, re, shutil, tempfile
|
||||||
|
|||||||
+34
-5
@@ -1,6 +1,14 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
|
# @Date: 23-05-2017
|
||||||
|
# @Email: bachir@figureslibres.io
|
||||||
|
# @Filename: design.py
|
||||||
|
# @Last modified by: bach
|
||||||
|
# @Last modified time: 03-06-2017
|
||||||
|
# @License: GPL-V3
|
||||||
|
|
||||||
import os, re
|
import os, re
|
||||||
# sys,
|
# sys,
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
@@ -11,12 +19,14 @@ from PyQt5.QtWebKit import QWebSettings
|
|||||||
from PyQt5.QtWebKitWidgets import QWebView, QWebInspector
|
from PyQt5.QtWebKitWidgets import QWebView, QWebInspector
|
||||||
from PyQt5.QtPrintSupport import QPrintPreviewDialog, QPrinter
|
from PyQt5.QtPrintSupport import QPrintPreviewDialog, QPrinter
|
||||||
|
|
||||||
# from pygments import highlight
|
|
||||||
# from pygments.lexers import *
|
|
||||||
# from pygments.formatter import Formatter
|
|
||||||
from classes import highlighter
|
from classes import highlighter
|
||||||
|
|
||||||
|
|
||||||
|
# _ __ __ _ ___
|
||||||
|
# | | / /__ / /_| | / (_)__ _ __
|
||||||
|
# | | /| / / _ \/ __ \ | / / / _ \ | /| / /
|
||||||
|
# | |/ |/ / __/ /_/ / |/ / / __/ |/ |/ /
|
||||||
|
# |__/|__/\___/_.___/|___/_/\___/|__/|__/
|
||||||
class WebkitView(QWebView):
|
class WebkitView(QWebView):
|
||||||
def __init__(self, parent, core):
|
def __init__(self, parent, core):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
@@ -79,6 +89,12 @@ class WebkitView(QWebView):
|
|||||||
def evaluateJS(self, command):
|
def evaluateJS(self, command):
|
||||||
self.page().mainFrame().evaluateJavaScript(command)
|
self.page().mainFrame().evaluateJavaScript(command)
|
||||||
|
|
||||||
|
# ____ __
|
||||||
|
# / _/___ _________ ___ _____/ /_____ _____
|
||||||
|
# / // __ \/ ___/ __ \/ _ \/ ___/ __/ __ \/ ___/
|
||||||
|
# _/ // / / (__ ) /_/ / __/ /__/ /_/ /_/ / /
|
||||||
|
# /___/_/ /_/____/ .___/\___/\___/\__/\____/_/
|
||||||
|
# /_/
|
||||||
class WebkitInspector(QWebInspector):
|
class WebkitInspector(QWebInspector):
|
||||||
def __init__(self, parent, webkitview):
|
def __init__(self, parent, webkitview):
|
||||||
super(WebkitInspector, self).__init__(parent)
|
super(WebkitInspector, self).__init__(parent)
|
||||||
@@ -87,6 +103,11 @@ class WebkitInspector(QWebInspector):
|
|||||||
self.showMaximized()
|
self.showMaximized()
|
||||||
# TODO: webkitinspector is disappearing when chaging tabs
|
# TODO: webkitinspector is disappearing when chaging tabs
|
||||||
|
|
||||||
|
# ______ ______
|
||||||
|
# /_ __/___ ____ / / __ )____ ______
|
||||||
|
# / / / __ \/ __ \/ / __ / __ `/ ___/
|
||||||
|
# / / / /_/ / /_/ / / /_/ / /_/ / /
|
||||||
|
# /_/ \____/\____/_/_____/\__,_/_/
|
||||||
class WebViewToolBar(QWidget):
|
class WebViewToolBar(QWidget):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super(WebViewToolBar, self).__init__(parent)
|
super(WebViewToolBar, self).__init__(parent)
|
||||||
@@ -184,7 +205,11 @@ class WebViewToolBar(QWidget):
|
|||||||
print("onGenPDF")
|
print("onGenPDF")
|
||||||
self.parent.webkitview.ongenPDF()
|
self.parent.webkitview.ongenPDF()
|
||||||
|
|
||||||
|
# ______ ___ __
|
||||||
|
# / ____/___/ (_) /_____ _____
|
||||||
|
# / __/ / __ / / __/ __ \/ ___/
|
||||||
|
# / /___/ /_/ / / /_/ /_/ / /
|
||||||
|
# /_____/\__,_/_/\__/\____/_/
|
||||||
class CodeEditor(QPlainTextEdit):
|
class CodeEditor(QPlainTextEdit):
|
||||||
def __init__(self, core, tabs, file, mode):
|
def __init__(self, core, tabs, file, mode):
|
||||||
super(CodeEditor, self).__init__()
|
super(CodeEditor, self).__init__()
|
||||||
@@ -239,7 +264,6 @@ class CodeEditor(QPlainTextEdit):
|
|||||||
self.changed = False
|
self.changed = False
|
||||||
# TODO: how to combine file save and project save
|
# TODO: how to combine file save and project save
|
||||||
|
|
||||||
|
|
||||||
class Editor(QWidget):
|
class Editor(QWidget):
|
||||||
def __init__(self, parent, core):
|
def __init__(self, parent, core):
|
||||||
super(Editor, self).__init__()
|
super(Editor, self).__init__()
|
||||||
@@ -266,6 +290,11 @@ class Editor(QWidget):
|
|||||||
self.scsstab.setText()
|
self.scsstab.setText()
|
||||||
self.jstab.setText()
|
self.jstab.setText()
|
||||||
|
|
||||||
|
# _____ __ __
|
||||||
|
# / ___// /_____ ______/ /__
|
||||||
|
# \__ \/ __/ __ `/ ___/ //_/
|
||||||
|
# ___/ / /_/ /_/ / /__/ ,<
|
||||||
|
# /____/\__/\__,_/\___/_/|_|
|
||||||
class DesignStack(QWidget):
|
class DesignStack(QWidget):
|
||||||
def __init__(self, core):
|
def __init__(self, core):
|
||||||
super(DesignStack, self).__init__()
|
super(DesignStack, self).__init__()
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
# @Author: Bachir Soussi Chiadmi <bach>
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
# @Date: 23-05-2017
|
# @Date: 23-05-2017
|
||||||
# @Email: bachir@figureslibres.io
|
# @Email: bachir@figureslibres.io
|
||||||
# @Last modified by: bach
|
# @Last modified by: bach
|
||||||
# @Last modified time: 21-04-2017
|
# @Last modified time: 03-06-2017
|
||||||
# @License: GPL-V3
|
# @License: GPL-V3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
+16
-17
@@ -1,4 +1,17 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
|
# @Date: 02-06-2017
|
||||||
|
# @Email: bachir@figureslibres.io
|
||||||
|
# @Filename: highlighter.py
|
||||||
|
# @Last modified by: bach
|
||||||
|
# @Last modified time: 03-06-2017
|
||||||
|
# @License: GPL-V3
|
||||||
|
|
||||||
|
# TODO add link to the source
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
from PyQt5 import QtCore, QtGui
|
from PyQt5 import QtCore, QtGui
|
||||||
@@ -25,9 +38,11 @@ class QFormatter(Formatter):
|
|||||||
Formatter.__init__(self)
|
Formatter.__init__(self)
|
||||||
self.data=[]
|
self.data=[]
|
||||||
self.style = get_style_by_name(style)
|
self.style = get_style_by_name(style)
|
||||||
self.linenos = linenos
|
# self.linenos = linenos
|
||||||
|
|
||||||
# styles = list(get_all_styles())
|
# styles = list(get_all_styles())
|
||||||
# print(styles)
|
# print(styles)
|
||||||
|
|
||||||
# Create a dictionary of text styles, indexed
|
# Create a dictionary of text styles, indexed
|
||||||
# by pygments token names, containing QTextCharFormat
|
# by pygments token names, containing QTextCharFormat
|
||||||
# instances according to pygments' description
|
# instances according to pygments' description
|
||||||
@@ -114,19 +129,3 @@ class Highlighter(QtGui.QSyntaxHighlighter):
|
|||||||
# I may need to do something about this being called
|
# I may need to do something about this being called
|
||||||
# too quickly.
|
# too quickly.
|
||||||
self.tstamp=time.time()
|
self.tstamp=time.time()
|
||||||
|
|
||||||
|
|
||||||
# if __name__ == "__main__":
|
|
||||||
# app = QtGui.QApplication(sys.argv)
|
|
||||||
#
|
|
||||||
# rst = QtGui.QPlainTextEdit()
|
|
||||||
# rst.setWindowTitle('reSt')
|
|
||||||
# hl=Highlighter(rst.document(),"rest")
|
|
||||||
# rst.show()
|
|
||||||
#
|
|
||||||
# python = QtGui.QPlainTextEdit()
|
|
||||||
# python.setWindowTitle('python')
|
|
||||||
# hl=Highlighter(python.document(),"python")
|
|
||||||
# python.show()
|
|
||||||
#
|
|
||||||
# sys.exit(app.exec_())
|
|
||||||
|
|||||||
+11
-5
@@ -1,12 +1,11 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
# @Author: Bachir Soussi Chiadmi <bach>
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
# @Date: 23-05-2017
|
# @Date: 23-05-2017
|
||||||
# @Email: bachir@figureslibres.io
|
# @Email: bachir@figureslibres.io
|
||||||
# @Last modified by: bach
|
# @Last modified by: bach
|
||||||
# @Last modified time: 21-04-2017
|
# @Last modified time: 03-06-2017
|
||||||
# @License: GPL-V3
|
# @License: GPL-V3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -37,6 +36,11 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
# __ ___ ____
|
||||||
|
# / |/ /__ ____ __ __/ __ )____ ______
|
||||||
|
# / /|_/ / _ \/ __ \/ / / / __ / __ `/ ___/
|
||||||
|
# / / / / __/ / / / /_/ / /_/ / /_/ / /
|
||||||
|
# /_/ /_/\___/_/ /_/\__,_/_____/\__,_/_/
|
||||||
def initMenuBar(self):
|
def initMenuBar(self):
|
||||||
# menu bar
|
# menu bar
|
||||||
bar = self.menuBar()
|
bar = self.menuBar()
|
||||||
@@ -228,13 +232,11 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
self.core.quit()
|
self.core.quit()
|
||||||
|
|
||||||
|
|
||||||
def oneditmenutrigger(self, q):
|
def oneditmenutrigger(self, q):
|
||||||
print(q.text()+" is triggered")
|
print(q.text()+" is triggered")
|
||||||
if q.text() == "&Reload":
|
if q.text() == "&Reload":
|
||||||
self.designstack.webkitview.reload()
|
self.designstack.webkitview.reload()
|
||||||
|
|
||||||
|
|
||||||
def onviewmenutrigger(self, q):
|
def onviewmenutrigger(self, q):
|
||||||
print(q.text()+" is triggered")
|
print(q.text()+" is triggered")
|
||||||
if q.text() == "&Design":
|
if q.text() == "&Design":
|
||||||
@@ -244,7 +246,11 @@ class MainWindow(QMainWindow):
|
|||||||
elif q.text() == "&Version":
|
elif q.text() == "&Version":
|
||||||
self.mainstack.setCurrentIndex(2)
|
self.mainstack.setCurrentIndex(2)
|
||||||
|
|
||||||
|
# __ ___ _ _____ __ __
|
||||||
|
# / |/ /___ _(_)___ / ___// /_____ ______/ /__
|
||||||
|
# / /|_/ / __ `/ / __ \\__ \/ __/ __ `/ ___/ //_/
|
||||||
|
# / / / / /_/ / / / / /__/ / /_/ /_/ / /__/ ,<
|
||||||
|
# /_/ /_/\__,_/_/_/ /_/____/\__/\__,_/\___/_/|_|
|
||||||
def initMainStack(self):
|
def initMainStack(self):
|
||||||
self.mainstack = QStackedWidget()
|
self.mainstack = QStackedWidget()
|
||||||
|
|
||||||
|
|||||||
+8
-9
@@ -1,6 +1,14 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
|
# @Date: 23-05-2017
|
||||||
|
# @Email: bachir@figureslibres.io
|
||||||
|
# @Filename: md2html.py
|
||||||
|
# @Last modified by: bach
|
||||||
|
# @Last modified time: 03-06-2017
|
||||||
|
# @License: GPL-V3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from PyQt5.QtCore import QFileSystemWatcher
|
from PyQt5.QtCore import QFileSystemWatcher
|
||||||
@@ -99,12 +107,3 @@ class Compiler():
|
|||||||
book_html_f = os.path.join(self.core.cwd,'index.html')
|
book_html_f = os.path.join(self.core.cwd,'index.html')
|
||||||
with open(book_html_f, 'w') as fp:
|
with open(book_html_f, 'w') as fp:
|
||||||
fp.write(template_dom.prettify())
|
fp.write(template_dom.prettify())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
|
# @Date: 30-05-2017
|
||||||
|
# @Email: bachir@figureslibres.io
|
||||||
|
# @Filename: sasscompiler.py
|
||||||
|
# @Last modified by: bach
|
||||||
|
# @Last modified time: 03-06-2017
|
||||||
|
# @License: GPL-V3
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from PyQt5.QtCore import QFileSystemWatcher
|
from PyQt5.QtCore import QFileSystemWatcher
|
||||||
import sass
|
import sass
|
||||||
|
|||||||
+7
-2
@@ -1,6 +1,13 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# @Author: Bachir Soussi Chiadmi <bach>
|
||||||
|
# @Date: 23-05-2017
|
||||||
|
# @Email: bachir@figureslibres.io
|
||||||
|
# @Filename: server.py
|
||||||
|
# @Last modified by: bach
|
||||||
|
# @Last modified time: 03-06-2017
|
||||||
|
# @License: GPL-V3
|
||||||
|
|
||||||
import sys, os
|
import sys, os
|
||||||
from socket import socket
|
from socket import socket
|
||||||
@@ -8,9 +15,7 @@ import socketserver
|
|||||||
import http.server
|
import http.server
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
|
||||||
class Server():
|
class Server():
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
|
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
|||||||
Reference in New Issue
Block a user