3e0e9239
—
pyros2097 13 years ago
saving
- Widget/editor.py +5 -5
- Widget/editor.pyc +0 -0
- config.yaml +5 -2
- globals.py +5 -6
- main.py +20 -14
Widget/editor.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from PyQt4.QtCore import SIGNAL
|
|
2
2
|
from PyQt4.QtGui import QFontMetrics, QFont, QPixmap, QColor
|
|
3
3
|
from PyQt4.Qsci import QsciScintilla, QsciLexerPython ,QsciAPIs ,QsciLexerCPP
|
|
4
|
-
from globals import ospathjoin,fontSize,fontName,
|
|
4
|
+
from globals import ospathjoin,fontSize,fontName,os_pixmap,apiDir
|
|
5
5
|
from lexersquirrel import LexerSquirrel
|
|
6
6
|
|
|
7
7
|
class Style:
|
|
@@ -35,9 +35,9 @@ class Editor(QsciScintilla):
|
|
|
35
35
|
self.setMarginSensitivity(1, True)
|
|
36
36
|
self.connect(self,SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),self.on_margin_clicked)
|
|
37
37
|
self.markerDefine(QsciScintilla.RightArrow,self.ARROW_MARKER_NUM)
|
|
38
|
-
self.registerImage(0,
|
|
38
|
+
self.registerImage(0,os_pixmap("class_obj"))
|
|
39
|
-
self.registerImage(1,
|
|
39
|
+
self.registerImage(1,os_pixmap("method_obj"))
|
|
40
|
-
self.registerImage(2,
|
|
40
|
+
self.registerImage(2,os_pixmap("field_public_obj"))
|
|
41
41
|
# Brace matching: enable for a brace immediately before or after
|
|
42
42
|
# the current position
|
|
43
43
|
self.setBraceMatching(QsciScintilla.SloppyBraceMatch)
|
|
@@ -64,7 +64,7 @@ class Editor(QsciScintilla):
|
|
|
64
64
|
self.lexer = LexerSquirrel(self.colorStyle,self)
|
|
65
65
|
self.lexer.setDefaultFont(self.font)
|
|
66
66
|
self.api = QsciAPIs(self.lexer)
|
|
67
|
-
self.api.load(ospathjoin(
|
|
67
|
+
self.api.load(ospathjoin(apiDir,"emo.api"))
|
|
68
68
|
self.api.prepare()
|
|
69
69
|
self.lexer.setAPIs(self.api) #Very important do not change line otherwise gg
|
|
70
70
|
self.setLexer(self.lexer) #Very important do not change line otherwise gg
|
Widget/editor.pyc
CHANGED
|
Binary file
|
config.yaml
CHANGED
|
@@ -5,8 +5,11 @@ 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/assetsdd/common.nut
|
|
9
|
-
- C:/CODE/assetsdd/
|
|
8
|
+
- C:/CODE/assetsdd/logoscene.nut
|
|
9
|
+
- C:/CODE/assetsdd/main.nut
|
|
10
|
+
- C:/CODE/assetsdd/creditscene.nut
|
|
11
|
+
- C:/CODE/assetsdd/titlescene.nut
|
|
12
|
+
- C:/CODE/assetsdd/Engine.cpp
|
|
10
13
|
Project:
|
|
11
14
|
- C:/CODE/data/
|
|
12
15
|
- C:/CODE/assetsdd/
|
globals.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import os
|
|
2
2
|
from platform import system,python_version
|
|
3
3
|
from PyQt4.QtGui import QIcon,QPixmap
|
|
4
|
+
from PyQt4.Qsci import QsciAPIs
|
|
4
5
|
from send2trash import send2trash
|
|
5
6
|
from config import Config
|
|
6
7
|
|
|
@@ -21,8 +22,8 @@ ossep = os.sep
|
|
|
21
22
|
OS_NAME = system()
|
|
22
23
|
|
|
23
24
|
workDir = os.getcwd()
|
|
24
|
-
apiDir = "api"
|
|
25
|
+
apiDir = ospathjoin(workDir,"api")
|
|
25
|
-
iconDir = ospathjoin(
|
|
26
|
+
iconDir = ospathjoin("Icons")
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
recycle = send2trash
|
|
@@ -37,8 +38,6 @@ colorStyle = config.colorStyle
|
|
|
37
38
|
adblist = config.adb()
|
|
38
39
|
|
|
39
40
|
def os_icon(name):
|
|
40
|
-
return QIcon(":/{0}.gif".format(
|
|
41
|
+
return QIcon(":/{0}.gif".format(ospathjoin(iconDir,name)))
|
|
41
42
|
def os_pixmap(name):
|
|
42
|
-
return QPixmap(":/{0}.gif".format(
|
|
43
|
+
return QPixmap(":/{0}.gif".format(ospathjoin(iconDir,name)))
|
|
43
|
-
def getApi(name):
|
|
44
|
-
return QPixmap(":/{0}.gif".format("Icons"+ossep+name))
|
main.py
CHANGED
|
@@ -90,23 +90,26 @@ class MainWindow(Window):
|
|
|
90
90
|
return
|
|
91
91
|
if type(nfile) == str:
|
|
92
92
|
if(ospathexists(nfile)):
|
|
93
|
+
text = ""
|
|
93
94
|
try:
|
|
94
95
|
infile = open(nfile, 'r')
|
|
95
|
-
|
|
96
|
+
text = infile.read()
|
|
97
|
+
infile.close()
|
|
96
98
|
config.addFile(nfile)
|
|
97
99
|
self.dirty.append(False)
|
|
98
|
-
tab = Editor(self,infile.read(),self.syntax(nfile))
|
|
99
|
-
infile.close()
|
|
100
|
-
self.
|
|
100
|
+
self.files.append(nfile)
|
|
101
|
-
tab.textChanged.connect(lambda:self.setDirty(nfile))
|
|
102
101
|
#print len(self.files)
|
|
103
|
-
if(self.files != None):
|
|
104
|
-
if(len(self.files)) != 0:
|
|
105
|
-
#This line sets the opened file to display first Important not checked
|
|
106
|
-
self.tabWidget.setCurrentIndex(len(self.files)-1)
|
|
107
102
|
except:
|
|
108
103
|
config.removeFile(nfile)
|
|
109
104
|
QMessageBox.about(self,"Can't Open","File Does Not Exist or Locked\n"+nfile)
|
|
105
|
+
|
|
106
|
+
tab = Editor(self,text,self.syntax(nfile))
|
|
107
|
+
self.tabWidget.addTab(tab,ospathbasename(nfile))
|
|
108
|
+
tab.textChanged.connect(lambda:self.setDirty(nfile))
|
|
109
|
+
if(self.files != None):
|
|
110
|
+
if(len(self.files)) != 0:
|
|
111
|
+
#This line sets the opened file to display first Important not checked
|
|
112
|
+
self.tabWidget.setCurrentIndex(len(self.files)-1)
|
|
110
113
|
else:
|
|
111
114
|
#dont know must check this the last file is not removed executes only
|
|
112
115
|
#twice when it has to remove 3 files
|
|
@@ -240,15 +243,18 @@ class MainWindow(Window):
|
|
|
240
243
|
def closeEvent(self, event):
|
|
241
244
|
#check this ine adb.exe process is always on
|
|
242
245
|
self.adb.close()
|
|
246
|
+
notSaved = False
|
|
243
|
-
for
|
|
247
|
+
for files in self.dirty:
|
|
248
|
+
if files == True:
|
|
249
|
+
notSaved = True
|
|
244
|
-
|
|
250
|
+
if notSaved:
|
|
245
|
-
|
|
251
|
+
reply = QMessageBox.question(self,
|
|
246
252
|
"Simple Editor - Unsaved Changes",
|
|
247
253
|
"Save unsaved changes?",
|
|
248
254
|
QMessageBox.Yes|QMessageBox.No|QMessageBox.Cancel)
|
|
249
|
-
|
|
255
|
+
if reply == QMessageBox.Cancel:
|
|
250
256
|
pass
|
|
251
|
-
|
|
257
|
+
elif reply == QMessageBox.Yes:
|
|
252
258
|
self.fileSaveAll()
|
|
253
259
|
|
|
254
260
|
def syntax(self,nfile):
|