|
@@ -19,7 +19,11 @@ import git
|
|
|
|
|
|
from classes import server, sasscompiler, md2html
|
|
from classes import server, sasscompiler, md2html
|
|
|
|
|
|
-
|
|
|
|
|
|
+# ______
|
|
|
|
+# / ____/___ ________
|
|
|
|
+# / / / __ \/ ___/ _ \
|
|
|
|
+# / /___/ /_/ / / / __/
|
|
|
|
+# \____/\____/_/ \___/
|
|
class Core():
|
|
class Core():
|
|
def __init__(self, parent=None):
|
|
def __init__(self, parent=None):
|
|
# restore previous preferences
|
|
# restore previous preferences
|
|
@@ -63,7 +67,11 @@ class Core():
|
|
if not self.tempcwd:
|
|
if not self.tempcwd:
|
|
self._mw.setWindowTitle("Cascade – "+self.cwd)
|
|
self._mw.setWindowTitle("Cascade – "+self.cwd)
|
|
|
|
|
|
-
|
|
|
|
|
|
+ # ____ ____
|
|
|
|
+ # / __ \________ / __/____
|
|
|
|
+ # / /_/ / ___/ _ \/ /_/ ___/
|
|
|
|
+ # / ____/ / / __/ __(__ )
|
|
|
|
+ # /_/ /_/ \___/_/ /____/
|
|
def restorePreferences(self):
|
|
def restorePreferences(self):
|
|
# print("restorePreferences")
|
|
# print("restorePreferences")
|
|
settings = QSettings('FiguresLibres', 'Cascade')
|
|
settings = QSettings('FiguresLibres', 'Cascade')
|
|
@@ -91,6 +99,12 @@ class Core():
|
|
settings.setValue('mainwindow/pos', self._mw.pos())
|
|
settings.setValue('mainwindow/pos', self._mw.pos())
|
|
settings.setValue('mainwindow/curstack', self._mw.mainstack.currentIndex())
|
|
settings.setValue('mainwindow/curstack', self._mw.mainstack.currentIndex())
|
|
|
|
|
|
|
|
+ # ____ _____ __ __ _
|
|
|
|
+ # / __ \____ _____ / ___/___ / /_/ /_(_)___ ____ ______
|
|
|
|
+ # / / / / __ \/ ___/ \__ \/ _ \/ __/ __/ / __ \/ __ `/ ___/
|
|
|
|
+ # / /_/ / /_/ / /__ ___/ / __/ /_/ /_/ / / / / /_/ (__ )
|
|
|
|
+ # /_____/\____/\___/ /____/\___/\__/\__/_/_/ /_/\__, /____/
|
|
|
|
+ # /____/
|
|
def loadDocSettings(self):
|
|
def loadDocSettings(self):
|
|
self.docsettings = json.loads(open(os.path.join(self.cwd,'.config/docsettings.json')).read())
|
|
self.docsettings = json.loads(open(os.path.join(self.cwd,'.config/docsettings.json')).read())
|
|
|
|
|
|
@@ -109,84 +123,48 @@ class Core():
|
|
sassfilepath = os.path.join(self.cwd,'assets/css/main.scss')
|
|
sassfilepath = os.path.join(self.cwd,'assets/css/main.scss')
|
|
# print(sassfilepath)
|
|
# print(sassfilepath)
|
|
sass = open(sassfilepath,"r").read()
|
|
sass = open(sassfilepath,"r").read()
|
|
-
|
|
|
|
- # $page-width: mm2pt(180);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$page-width:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$page-width: mm2pt('+self.docsettings['pw']+');',
|
|
|
|
- sass)
|
|
|
|
- # $page-height: mm2pt(287);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$page-height:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$page-height: mm2pt('+self.docsettings['ph']+');',
|
|
|
|
- sass)
|
|
|
|
-
|
|
|
|
- # $page-margin-outside: mm2pt(15);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$page-margin-outside:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$page-margin-outside: mm2pt('+self.docsettings['me']+');',
|
|
|
|
- sass)
|
|
|
|
- # $page-margin-inside: mm2pt(7.5);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$page-margin-inside:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$page-margin-inside: mm2pt('+self.docsettings['mi']+');',
|
|
|
|
- sass)
|
|
|
|
- # $page-margin-top: mm2pt(10);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$page-margin-top:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$page-margin-top: mm2pt('+self.docsettings['mt']+');',
|
|
|
|
- sass)
|
|
|
|
- # $page-margin-bottom: mm2pt(10);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$page-margin-bottom:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$page-margin-bottom: mm2pt('+self.docsettings['mb']+');',
|
|
|
|
- sass)
|
|
|
|
-
|
|
|
|
- # $crop-size: mm2pt(2);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$crop-size:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$crop-size: mm2pt('+self.docsettings['cs']+');',
|
|
|
|
- sass)
|
|
|
|
- # $bleed: mm2pt(3);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$bleed:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$bleed: mm2pt('+self.docsettings['bs']+');',
|
|
|
|
- sass)
|
|
|
|
|
|
+ sets = {
|
|
|
|
+ 'pw':'page-width',
|
|
|
|
+ 'ph':'page-height',
|
|
|
|
+ 'mt':'page-margin-top',
|
|
|
|
+ 'mb':'page-margin-bottom',
|
|
|
|
+ 'me':'page-margin-outside',
|
|
|
|
+ 'mi':'page-margin-inside',
|
|
|
|
+ 'cs':'crop-size',
|
|
|
|
+ 'bs':'bleed',
|
|
|
|
+ 'cg':'col-gutter',
|
|
|
|
+ 'rg':'row-gutter',
|
|
|
|
+ 'lh':'line-height'
|
|
|
|
+ }
|
|
|
|
+ for s in sets:
|
|
|
|
+ sass = re.sub(
|
|
|
|
+ r'\$'+sets[s]+':\smm2pt\([0-9|\.]+\);',
|
|
|
|
+ '$'+sets[s]+': mm2pt('+self.docsettings[s]+');',
|
|
|
|
+ sass)
|
|
|
|
|
|
# $col-number: 9;
|
|
# $col-number: 9;
|
|
sass = re.sub(
|
|
sass = re.sub(
|
|
- r'\$col-number:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$col-number: mm2pt('+self.docsettings['cn']+');',
|
|
|
|
- sass)
|
|
|
|
- # $col-gutter: mm2pt(3);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$col-butter:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$col-butter: mm2pt('+self.docsettings['cg']+');',
|
|
|
|
|
|
+ r'\$col-number:\s[0-9|\.]+;',
|
|
|
|
+ '$col-number: '+self.docsettings['cn']+';',
|
|
sass)
|
|
sass)
|
|
- #
|
|
|
|
# $row-number: 12;
|
|
# $row-number: 12;
|
|
sass = re.sub(
|
|
sass = re.sub(
|
|
- r'\$row-number:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$row-number: mm2pt('+self.docsettings['rn']+');',
|
|
|
|
- sass)
|
|
|
|
- # $row-gutter: mm2pt(4);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$row-butter:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$row-butter: mm2pt('+self.docsettings['rg']+');',
|
|
|
|
|
|
+ r'\$row-number:\s[0-9|\.]+;',
|
|
|
|
+ '$row-number: '+self.docsettings['rn']+';',
|
|
sass)
|
|
sass)
|
|
#
|
|
#
|
|
- # $line-height: mm2pt(4);
|
|
|
|
- sass = re.sub(
|
|
|
|
- r'\$line-height:\smm2pt\([0-9|\.]+\);',
|
|
|
|
- '$line-height: mm2pt('+self.docsettings['lh']+');',
|
|
|
|
- sass)
|
|
|
|
|
|
|
|
# print('sass', sass)
|
|
# print('sass', sass)
|
|
open(sassfilepath,"w").write(sass)
|
|
open(sassfilepath,"w").write(sass)
|
|
|
|
|
|
self._mw.designstack.webkitview.reload()
|
|
self._mw.designstack.webkitview.reload()
|
|
|
|
|
|
-
|
|
|
|
|
|
+ # ____ _ __
|
|
|
|
+ # / __ \_________ (_)__ _____/ /_
|
|
|
|
+ # / /_/ / ___/ __ \ / / _ \/ ___/ __/
|
|
|
|
+ # / ____/ / / /_/ / / / __/ /__/ /_
|
|
|
|
+ # /_/ /_/ \____/_/ /\___/\___/\__/
|
|
|
|
+ # /___/
|
|
def initnewproject(self, cwd = None):
|
|
def initnewproject(self, cwd = None):
|
|
print('initnewproject')
|
|
print('initnewproject')
|
|
if cwd == None :
|
|
if cwd == None :
|
|
@@ -212,6 +190,12 @@ class Core():
|
|
if not cwd == None:
|
|
if not cwd == None:
|
|
self.changeCWD(cwd)
|
|
self.changeCWD(cwd)
|
|
|
|
|
|
|
|
+ # __ _______ ______
|
|
|
|
+ # _____/ /_ ____ _____ ____ ____ / ____/ | / / __ \
|
|
|
|
+ # / ___/ __ \/ __ `/ __ \/ __ `/ _ \/ / | | /| / / / / /
|
|
|
|
+ # / /__/ / / / /_/ / / / / /_/ / __/ /___ | |/ |/ / /_/ /
|
|
|
|
+ # \___/_/ /_/\__,_/_/ /_/\__, /\___/\____/ |__/|__/_____/
|
|
|
|
+ # /____/
|
|
def changeCWD(self, cwd):
|
|
def changeCWD(self, cwd):
|
|
if not cwd == self.cwd:
|
|
if not cwd == self.cwd:
|
|
self.cwd = cwd
|
|
self.cwd = cwd
|
|
@@ -227,6 +211,11 @@ class Core():
|
|
self._mw.designstack.refresh()
|
|
self._mw.designstack.refresh()
|
|
self._mw.contentstack.refresh()
|
|
self._mw.contentstack.refresh()
|
|
|
|
|
|
|
|
+ # ____ _ __
|
|
|
|
+ # / __ \__ __(_) /_
|
|
|
|
+ # / / / / / / / / __/
|
|
|
|
+ # / /_/ / /_/ / / /_
|
|
|
|
+ # \___\_\__,_/_/\__/
|
|
def quit(self):
|
|
def quit(self):
|
|
self.savePreferences()
|
|
self.savePreferences()
|
|
shutil.rmtree(self.temp, ignore_errors=True)
|
|
shutil.rmtree(self.temp, ignore_errors=True)
|