881642a5
—
pyros2097 13 years ago
saves
- Widget/__init__.py +2 -1
- Widget/__init__.pyc +0 -0
- Widget/editor.py +14 -15
- Widget/editor.pyc +0 -0
- Widget/style.py +65 -6
- config.yaml +2 -3
- main.py +2 -5
- window.py +41 -6
Widget/__init__.py
CHANGED
|
@@ -2,4 +2,5 @@ from editor import Editor
|
|
|
2
2
|
from tab import Tab
|
|
3
3
|
from tree import Tree
|
|
4
4
|
from adb import Adb
|
|
5
|
-
from ipython import PyInterp
|
|
5
|
+
from ipython import PyInterp
|
|
6
|
+
from style import *
|
Widget/__init__.pyc
CHANGED
|
Binary file
|
Widget/editor.py
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
from globals import ospathjoin,os_pixmap,apiDir
|
|
1
|
+
from globals import fontSize,fontName,ospathjoin,os_pixmap,apiDir
|
|
2
2
|
|
|
3
3
|
from PyQt4.QtCore import SIGNAL
|
|
4
|
-
from PyQt4.QtGui import QFontMetrics, QFont, QPixmap, QColor
|
|
4
|
+
from PyQt4.QtGui import QFontMetrics, QFont, QPixmap, QColor ,QPalette
|
|
5
5
|
from PyQt4.Qsci import QsciScintilla, QsciLexerPython ,QsciAPIs ,QsciLexerCPP
|
|
6
6
|
from lexersquirrel import LexerSquirrel
|
|
7
|
-
from style import Style
|
|
8
|
-
|
|
9
|
-
|
|
10
7
|
|
|
11
8
|
class Editor(QsciScintilla):
|
|
12
9
|
ARROW_MARKER_NUM = 8
|
|
13
|
-
def __init__(self,parent,text,lang
|
|
10
|
+
def __init__(self,parent,text,lang,colorStyle):
|
|
14
11
|
QsciScintilla.__init__(self,parent)
|
|
15
12
|
self.parent = parent
|
|
16
|
-
self.styleIndex = styleIndex
|
|
17
13
|
self.lang = lang
|
|
18
|
-
self.colorStyle =
|
|
14
|
+
self.colorStyle = colorStyle
|
|
19
15
|
self.init()
|
|
20
16
|
self.setText(text)
|
|
21
17
|
#self.addAction(QAction("gg",self))
|
|
@@ -39,8 +35,13 @@ class Editor(QsciScintilla):
|
|
|
39
35
|
#self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, 1, 'Courier')
|
|
40
36
|
|
|
41
37
|
def init(self):
|
|
42
|
-
self.
|
|
38
|
+
self.setCaretLineBackgroundColor(self.colorStyle.caret)
|
|
39
|
+
self.setMarginsBackgroundColor(self.colorStyle.margin)
|
|
40
|
+
self.setMarkerBackgroundColor(self.colorStyle.marker,self.ARROW_MARKER_NUM)
|
|
41
|
+
self.font = QFont()
|
|
42
|
+
self.font.setFamily(fontName)
|
|
43
|
+
self.font.setFixedPitch(True)
|
|
43
|
-
self.font
|
|
44
|
+
self.font.setPointSize(fontSize)
|
|
44
45
|
self.setFont(self.font)
|
|
45
46
|
self.fontmetrics = QFontMetrics(self.font)
|
|
46
47
|
self.setMarginsFont(self.font)
|
|
@@ -60,13 +61,11 @@ class Editor(QsciScintilla):
|
|
|
60
61
|
self.api.prepare()
|
|
61
62
|
self.lexer.setAPIs(self.api) #Very important do not change line otherwise gg
|
|
62
63
|
self.setLexer(self.lexer) #Very important do not change line otherwise gg
|
|
64
|
+
self.font.setPointSize(15)
|
|
63
65
|
|
|
64
66
|
|
|
65
|
-
def setColorStyle(self,
|
|
67
|
+
def setColorStyle(self,colorStyle):
|
|
66
|
-
if styleIndex == 0:
|
|
67
|
-
|
|
68
|
+
self.colorStyle = colorStyle
|
|
68
|
-
elif styleIndex == 1:
|
|
69
|
-
self.colorStyle = Style()
|
|
70
69
|
self.setCaretLineBackgroundColor(self.colorStyle.caret)
|
|
71
70
|
self.setMarginsBackgroundColor(self.colorStyle.margin)
|
|
72
71
|
self.setMarkerBackgroundColor(self.colorStyle.marker,self.ARROW_MARKER_NUM)
|
Widget/editor.pyc
CHANGED
|
Binary file
|
Widget/style.py
CHANGED
|
@@ -1,14 +1,73 @@
|
|
|
1
|
-
from globals import fontSize,fontName
|
|
2
1
|
from PyQt4.QtGui import QColor, QFont
|
|
3
2
|
|
|
4
|
-
class
|
|
3
|
+
class Style0:
|
|
5
4
|
def __init__(self):
|
|
6
5
|
self.color = QColor('#000000')
|
|
7
6
|
self.paper = QColor('#FFFFFF')
|
|
8
7
|
self.caret = QColor('#ffe4e4')
|
|
9
8
|
self.marker = QColor('#ee1111')
|
|
10
9
|
self.margin = QColor('#cccccc')
|
|
10
|
+
|
|
11
|
+
class Style1:
|
|
11
|
-
|
|
12
|
+
def __init__(self):
|
|
12
|
-
self.
|
|
13
|
+
self.color = QColor('#FFFFFF')
|
|
14
|
+
self.paper = QColor('#000000')
|
|
13
|
-
self.
|
|
15
|
+
self.caret = QColor('#000000')
|
|
16
|
+
self.marker = QColor('#000000')
|
|
17
|
+
self.margin = QColor('#000000')
|
|
18
|
+
|
|
19
|
+
class Style2:
|
|
20
|
+
def __init__(self):
|
|
14
|
-
self.
|
|
21
|
+
self.color = QColor('#eeeeee')
|
|
22
|
+
self.paper = QColor('#aaaaaa')
|
|
23
|
+
self.caret = QColor('#000000')
|
|
24
|
+
self.marker = QColor('#000000')
|
|
25
|
+
self.margin = QColor('#000000')
|
|
26
|
+
|
|
27
|
+
class Style3:
|
|
28
|
+
def __init__(self):
|
|
29
|
+
self.color = QColor('#FFFFFF')
|
|
30
|
+
self.paper = QColor('#ff0000')
|
|
31
|
+
self.caret = QColor('#000000')
|
|
32
|
+
self.marker = QColor('#000000')
|
|
33
|
+
self.margin = QColor('#000000')
|
|
34
|
+
|
|
35
|
+
class Style4:
|
|
36
|
+
def __init__(self):
|
|
37
|
+
self.color = QColor('#FFFFFF')
|
|
38
|
+
self.paper = QColor('#00ff00')
|
|
39
|
+
self.caret = QColor('#000000')
|
|
40
|
+
self.marker = QColor('#000000')
|
|
41
|
+
self.margin = QColor('#000000')
|
|
42
|
+
|
|
43
|
+
class Style5:
|
|
44
|
+
def __init__(self):
|
|
45
|
+
self.color = QColor('#FFFFFF')
|
|
46
|
+
self.paper = QColor('#0000ff')
|
|
47
|
+
self.caret = QColor('#000000')
|
|
48
|
+
self.marker = QColor('#000000')
|
|
49
|
+
self.margin = QColor('#000000')
|
|
50
|
+
|
|
51
|
+
class Style6:
|
|
52
|
+
def __init__(self):
|
|
53
|
+
self.color = QColor('#FFFFFF')
|
|
54
|
+
self.paper = QColor('#0f0f0f')
|
|
55
|
+
self.caret = QColor('#000000')
|
|
56
|
+
self.marker = QColor('#000000')
|
|
57
|
+
self.margin = QColor('#000000')
|
|
58
|
+
|
|
59
|
+
class Style7:
|
|
60
|
+
def __init__(self):
|
|
61
|
+
self.color = QColor('#0f00f0')
|
|
62
|
+
self.paper = QColor('#0f0f00')
|
|
63
|
+
self.caret = QColor('#000000')
|
|
64
|
+
self.marker = QColor('#000000')
|
|
65
|
+
self.margin = QColor('#000000')
|
|
66
|
+
|
|
67
|
+
class Style8:
|
|
68
|
+
def __init__(self):
|
|
69
|
+
self.color = QColor('#eeFeFe')
|
|
70
|
+
self.paper = QColor('#0f0f00')
|
|
71
|
+
self.caret = QColor('#000000')
|
|
72
|
+
self.marker = QColor('#000000')
|
|
73
|
+
self.margin = QColor('#000000')
|
config.yaml
CHANGED
|
@@ -5,9 +5,8 @@ ADB:
|
|
|
5
5
|
- adb -d shell ps | grep com.emo_framework.examples | awk '{print $2}' | xargs adb
|
|
6
6
|
shell kill
|
|
7
7
|
File:
|
|
8
|
-
- C:/CODE/assets/howtoscene.nut
|
|
9
|
-
- C:/CODE/assets/logoscene.nut
|
|
10
8
|
- C:/CODE/assets/creditscene.nut
|
|
9
|
+
- C:/CODE/assets/main.nut
|
|
11
10
|
Project:
|
|
12
11
|
- C:/CODE/data/
|
|
13
12
|
- C:/CODE/assets/
|
|
@@ -17,7 +16,7 @@ Setting:
|
|
|
17
16
|
fontname: Courier New
|
|
18
17
|
fontsize: 10
|
|
19
18
|
iconsize: 16
|
|
20
|
-
styleindex:
|
|
19
|
+
styleindex: 0
|
|
21
20
|
thresh: 1
|
|
22
21
|
workspace: C:/CODE/
|
|
23
22
|
Style: 0
|
main.py
CHANGED
|
@@ -19,7 +19,7 @@ from window import Window
|
|
|
19
19
|
from Widget import Editor,PyInterp,Adb
|
|
20
20
|
from globals import (ospathsep,ospathjoin,ospathbasename,workDir,
|
|
21
21
|
OS_NAME,PY_VERSION,os_icon,config,workSpace,
|
|
22
|
-
iconSize,iconDir,ospathexists,os_pixmap)
|
|
22
|
+
iconSize,iconDir,ospathexists,os_pixmap)
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class MainWindow(Window):
|
|
@@ -102,7 +102,7 @@ class MainWindow(Window):
|
|
|
102
102
|
config.removeFile(nfile)
|
|
103
103
|
QMessageBox.about(self,"Can't Open","File Does Not Exist or Locked\n"+nfile)
|
|
104
104
|
|
|
105
|
-
tab = Editor(self,text,self.syntax(nfile))
|
|
105
|
+
tab = Editor(self,text,self.syntax(nfile),self.colorStyle)
|
|
106
106
|
self.tabWidget.addTab(tab,ospathbasename(nfile))
|
|
107
107
|
tab.textChanged.connect(lambda:self.setDirty(nfile))
|
|
108
108
|
if(self.files != None):
|
|
@@ -265,9 +265,6 @@ class MainWindow(Window):
|
|
|
265
265
|
elif nfile.endswith(".nut"):
|
|
266
266
|
lang = 0
|
|
267
267
|
return lang
|
|
268
|
-
|
|
269
|
-
def style(self):
|
|
270
|
-
pass
|
|
271
268
|
|
|
272
269
|
def options(self):
|
|
273
270
|
pass
|
window.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from PyQt4.QtGui import (QAction,QIcon,QMessageBox,QWidgetAction,QMenu,QWidget,
|
|
2
2
|
QHBoxLayout,QVBoxLayout,QTabWidget,QToolBar,QTextEdit,
|
|
3
3
|
QLineEdit,QPushButton,QToolButton,QSplitter,QStatusBar,
|
|
4
|
-
QMainWindow)
|
|
4
|
+
QMainWindow,QPalette,QColor)
|
|
5
5
|
from PyQt4.QtCore import QSize,Qt, QT_VERSION_STR,PYQT_VERSION_STR
|
|
6
6
|
from Widget import Tab,Tree
|
|
7
|
+
from Widget.style import *
|
|
7
8
|
|
|
8
9
|
from globals import (ospathsep,ospathjoin,ospathbasename,workDir,
|
|
9
10
|
OS_NAME,PY_VERSION,os_icon,config,workSpace,
|
|
@@ -24,7 +25,6 @@ class Window(QMainWindow):
|
|
|
24
25
|
self.horizontalLayout = QHBoxLayout(self.centralwidget)
|
|
25
26
|
self.horizontalLayout.setObjectName("horizontalLayout")
|
|
26
27
|
self.styleIndex = styleIndex
|
|
27
|
-
|
|
28
28
|
#TabWidgets
|
|
29
29
|
self.tab_1 = QWidget(self)
|
|
30
30
|
self.tab_1.setObjectName("tab_1")
|
|
@@ -42,6 +42,7 @@ class Window(QMainWindow):
|
|
|
42
42
|
self.tabWidget_3 = QTabWidget(self)
|
|
43
43
|
self.tabWidget_3.setMaximumHeight(200)
|
|
44
44
|
self.tabWidget_3.setObjectName("tabWidget_3")
|
|
45
|
+
|
|
45
46
|
|
|
46
47
|
#Tree
|
|
47
48
|
self.tab_5 = QWidget()
|
|
@@ -185,6 +186,9 @@ class Window(QMainWindow):
|
|
|
185
186
|
self.statusbar.addWidget(self.aboutButton)
|
|
186
187
|
self.statusbar.setFixedHeight(18)
|
|
187
188
|
|
|
189
|
+
#Init colorstyling
|
|
190
|
+
self.colorStyle = None
|
|
191
|
+
self.initColorStyle()
|
|
188
192
|
#Init
|
|
189
193
|
self.setCentralWidget(self.centralwidget)
|
|
190
194
|
self.setStatusBar(self.statusbar)
|
|
@@ -195,6 +199,14 @@ class Window(QMainWindow):
|
|
|
195
199
|
self.tab_8.show()
|
|
196
200
|
else:
|
|
197
201
|
self.tab_8.hide()
|
|
202
|
+
|
|
203
|
+
def initColorStyle(self):
|
|
204
|
+
self.colorStyle = self.checkColorStyle(self.styleIndex)
|
|
205
|
+
pal = QPalette(self.tabWidget_2.palette())
|
|
206
|
+
pal.setColor(QPalette.Base,self.colorStyle.paper)
|
|
207
|
+
pal.setColor(QPalette.Text,self.colorStyle.color)
|
|
208
|
+
self.tabWidget_2.setPalette(pal)
|
|
209
|
+
self.tabWidget_3.setPalette(pal)
|
|
198
210
|
|
|
199
211
|
def initToolBar(self):
|
|
200
212
|
self.action_NewProject = QAction(os_icon('newprj_wiz'), 'Project', self)
|
|
@@ -293,8 +305,6 @@ class Window(QMainWindow):
|
|
|
293
305
|
men1.addActions(self.styleslist)
|
|
294
306
|
self.action_Style.setMenu(men1)
|
|
295
307
|
self.styleslist[self.styleIndex-1].setChecked(True)
|
|
296
|
-
#men1.triggered.connect(lambda:self.style_clicked(men1.childEvent()))
|
|
297
|
-
|
|
298
308
|
|
|
299
309
|
|
|
300
310
|
self.action_Stop.setDisabled(True)
|
|
@@ -386,12 +396,37 @@ class Window(QMainWindow):
|
|
|
386
396
|
edt = self.tabWidget.widget(self.tabWidget.currentIndex())
|
|
387
397
|
while(edt.findText(self.lineEdit.text(),self.regex.isChecked(),self.caseSensitive.isChecked(),self.wholeWord.isChecked(),self.backward.isChecked())):
|
|
388
398
|
edt.replaceText(self.lineEdit_2.text())
|
|
399
|
+
|
|
400
|
+
def checkColorStyle(self,ind):
|
|
401
|
+
if ind == 0:
|
|
402
|
+
return Style0()
|
|
403
|
+
elif ind == 1:
|
|
404
|
+
return Style1()
|
|
405
|
+
elif ind == 2:
|
|
406
|
+
return Style2()
|
|
407
|
+
elif ind == 3:
|
|
408
|
+
return Style3()
|
|
409
|
+
elif ind == 4:
|
|
410
|
+
return Style4()
|
|
411
|
+
elif ind == 5:
|
|
412
|
+
return Style5()
|
|
413
|
+
elif ind == 6:
|
|
414
|
+
return Style6()
|
|
415
|
+
elif ind == 7:
|
|
416
|
+
return Style7()
|
|
417
|
+
elif ind == 8:
|
|
418
|
+
return Style8()
|
|
419
|
+
|
|
389
420
|
|
|
390
421
|
def style_clicked(self,no):
|
|
391
|
-
self.styleIndex = no
|
|
422
|
+
self.styleIndex = no -1
|
|
423
|
+
#print self.styleIndex
|
|
392
424
|
for i in self.styleslist:
|
|
393
|
-
if self.styleslist.index(i) == self.styleIndex
|
|
425
|
+
if self.styleslist.index(i) == self.styleIndex:
|
|
394
426
|
i.setChecked(True)
|
|
395
427
|
else:
|
|
396
428
|
i.setChecked(False)
|
|
397
429
|
config.setstyleIndex(self.styleIndex)
|
|
430
|
+
self.initColorStyle()
|
|
431
|
+
for i in range(len(self.files)):
|
|
432
|
+
self.tabWidget.widget(i).setColorStyle(self.colorStyle)
|