38e61771
—
pyros2097 13 years ago
v0.46
- Widget/adb.py +1 -1
- Widget/adb.pyc +0 -0
- Widget/tree.py +6 -9
- Widget/tree.pyc +0 -0
- build/exe.win32-2.7/Sabel.zip +0 -0
- build/exe.win32-2.7/config.yaml +5 -3
- build/exe.win32-2.7/library.zip +0 -0
- config.py +24 -11
- config.yaml +5 -3
- main.py +111 -69
- ui.py +1 -1
Widget/adb.py
CHANGED
|
@@ -45,7 +45,7 @@ class Adb(QWidget):
|
|
|
45
45
|
self.parent.tabWidget_3.setCurrentIndex(1)
|
|
46
46
|
self.parent.textEdit.clear()
|
|
47
47
|
self.parent.textEdit.append("Pushing main.nut\n")
|
|
48
|
-
self.adb_process = Popen(adblist[
|
|
48
|
+
self.adb_process = Popen(adblist[0], shell=False, stdout=PIPE,stderr=STDOUT)
|
|
49
49
|
t = threading.Thread(target=self.output, args=(self.adb_process.stdout,))
|
|
50
50
|
t.start()
|
|
51
51
|
t.join()
|
Widget/adb.pyc
CHANGED
|
Binary file
|
Widget/tree.py
CHANGED
|
@@ -128,15 +128,12 @@ class Tree(QTreeWidget):
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
def addProject(self,startDir):
|
|
131
|
-
if(ospathexists(startDir)):
|
|
132
|
-
|
|
131
|
+
self.projects.append(startDir)
|
|
133
|
-
|
|
132
|
+
self.closed.append(False)
|
|
134
|
-
|
|
133
|
+
i = Project(self,startDir)
|
|
135
|
-
|
|
134
|
+
self.addTopLevelItem(i)
|
|
136
|
-
|
|
135
|
+
self.readDir(i,startDir)
|
|
137
|
-
|
|
136
|
+
self.readMainFiles(i,startDir)
|
|
138
|
-
else:
|
|
139
|
-
QMessageBox.about(self,"Can't Open Project","Project Does Not Exist %s"%startDir)
|
|
140
137
|
|
|
141
138
|
def addClosedProject(self,startDir):
|
|
142
139
|
if(ospathexists(startDir)):
|
Widget/tree.pyc
CHANGED
|
Binary file
|
build/exe.win32-2.7/Sabel.zip
CHANGED
|
Binary file
|
build/exe.win32-2.7/config.yaml
CHANGED
|
@@ -5,11 +5,13 @@ 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/
|
|
8
|
+
- C:/CODE/assetsdd/creditscene.nut
|
|
9
|
+
- C:/CODE/assetsdd/howtoscene.nut
|
|
9
10
|
Project:
|
|
11
|
+
- C:/CODE/data/
|
|
10
|
-
- C:/CODE/
|
|
12
|
+
- C:/CODE/assetsdd/
|
|
11
13
|
Recent:
|
|
12
|
-
- C:\CODE\
|
|
14
|
+
- C:\CODE\main.nut
|
|
13
15
|
Setting:
|
|
14
16
|
fontname: Courier
|
|
15
17
|
fontsize: 10
|
build/exe.win32-2.7/library.zip
CHANGED
|
Binary file
|
config.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import yaml
|
|
2
2
|
import os
|
|
3
|
-
|
|
3
|
+
from PyQt4.QtGui import QMessageBox
|
|
4
4
|
class Config:
|
|
5
5
|
def __init__(self):
|
|
6
6
|
self.configfile = 'config.yaml'
|
|
@@ -30,6 +30,12 @@ class Config:
|
|
|
30
30
|
def files(self):
|
|
31
31
|
return self.read('File')
|
|
32
32
|
|
|
33
|
+
def setfiles(self,files):
|
|
34
|
+
self.data['File'] = files
|
|
35
|
+
|
|
36
|
+
def setProjects(self,pros):
|
|
37
|
+
self.data['Project'] = pros
|
|
38
|
+
|
|
33
39
|
def adb(self):
|
|
34
40
|
return self.read('ADB')
|
|
35
41
|
|
|
@@ -37,23 +43,27 @@ class Config:
|
|
|
37
43
|
#Python store reference to list so this points back to data
|
|
38
44
|
#so awesome and weird
|
|
39
45
|
#Must implement to add data not to rewrite data sad
|
|
46
|
+
if data != None:
|
|
40
|
-
|
|
47
|
+
for i in data:
|
|
41
|
-
|
|
48
|
+
if(i == nfile):
|
|
42
|
-
|
|
49
|
+
return False
|
|
43
50
|
return True
|
|
44
51
|
|
|
45
52
|
|
|
46
53
|
def addFile(self,nfile):
|
|
47
54
|
files = self.files()
|
|
55
|
+
if(files == None):
|
|
56
|
+
files = []
|
|
48
57
|
if(self.check(files,nfile)):
|
|
49
58
|
if(os.path.exists(nfile)):
|
|
50
59
|
files.append(nfile)
|
|
60
|
+
self.setfiles(files)
|
|
51
61
|
try:
|
|
52
62
|
yaml.dump(self.data,open(self.configfile,'w'),default_flow_style=False)
|
|
53
63
|
except:
|
|
54
|
-
|
|
64
|
+
QMessageBox.about(self,"Can't Open","cannot open config file\n"+self.configfile)
|
|
55
65
|
else:
|
|
56
|
-
|
|
66
|
+
QMessageBox.about(self,"Can't Open","File Does not Exist\n")
|
|
57
67
|
else:
|
|
58
68
|
#print "File is Already Saved" #need to fix this
|
|
59
69
|
pass
|
|
@@ -65,27 +75,30 @@ class Config:
|
|
|
65
75
|
try:
|
|
66
76
|
yaml.dump(self.data,open(self.configfile,'w'),default_flow_style=False)
|
|
67
77
|
except:
|
|
68
|
-
|
|
78
|
+
QMessageBox.about(self,"Can't Open","cannot open config file\n"+self.configfile)
|
|
69
79
|
|
|
70
80
|
def addProject(self,nfile):
|
|
71
81
|
pros = self.projects()
|
|
82
|
+
if pros == None:
|
|
83
|
+
pros = []
|
|
72
84
|
if(self.check(pros,nfile)):
|
|
73
85
|
if(os.path.exists(nfile)):
|
|
74
86
|
pros.append(nfile)
|
|
87
|
+
self.setProjects(pros)
|
|
75
88
|
try:
|
|
76
89
|
yaml.dump(self.data,open(self.configfile,'w'),default_flow_style=False)
|
|
77
90
|
except:
|
|
78
|
-
|
|
91
|
+
QMessageBox.about(self,"Can't Open","cannot open config file\n"+self.configfile)
|
|
79
92
|
else:
|
|
80
|
-
"Folder Does not
|
|
93
|
+
QMessageBox.about(self,"Can't Open","Folder Does not Exist\n")
|
|
81
94
|
else:
|
|
82
95
|
pass
|
|
83
96
|
|
|
84
97
|
def removeProject(self,nfile):
|
|
85
98
|
pros = self.projects()
|
|
86
|
-
if(self.check(pros,nfile)):
|
|
99
|
+
if not(self.check(pros,nfile)):
|
|
87
100
|
pros.remove(nfile)
|
|
88
101
|
try:
|
|
89
102
|
yaml.dump(self.data,open(self.configfile,'w'),default_flow_style=False)
|
|
90
103
|
except:
|
|
91
|
-
|
|
104
|
+
QMessageBox.about(self,"Can't Open","cannot open config file\n"+self.configfile)
|
config.yaml
CHANGED
|
@@ -5,11 +5,13 @@ 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/
|
|
8
|
+
- C:/CODE/assetsdd/creditscene.nut
|
|
9
|
+
- C:/CODE/assetsdd/howtoscene.nut
|
|
9
10
|
Project:
|
|
11
|
+
- C:/CODE/data/
|
|
10
|
-
- C:/CODE/
|
|
12
|
+
- C:/CODE/assetsdd/
|
|
11
13
|
Recent:
|
|
12
|
-
- C:\CODE\
|
|
14
|
+
- C:\CODE\main.nut
|
|
13
15
|
Setting:
|
|
14
16
|
fontname: Courier
|
|
15
17
|
fontsize: 10
|
main.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
__author__ = "pyros2097"
|
|
3
3
|
__license__ = "GPLv3"
|
|
4
|
-
__version__ = "0.
|
|
4
|
+
__version__ = "0.46"
|
|
5
5
|
__copyright__ = 'Copyright (c) 2012, pyros2097'
|
|
6
6
|
__credits__ = ['pyros2097', 'eclipse']
|
|
7
7
|
__email__ = 'pyros2097@gmail.com'
|
|
@@ -21,10 +21,9 @@ import icons_rc
|
|
|
21
21
|
|
|
22
22
|
from Widget import Editor,PyInterp,Adb
|
|
23
23
|
#from Dialog import *
|
|
24
|
-
from adb import Adb
|
|
25
24
|
from globals import (ospathsep,ospathjoin,ospathbasename,workDir,
|
|
26
25
|
OS_NAME,PY_VERSION,os_icon,config,workSpace,
|
|
27
|
-
iconSize,iconDir)
|
|
26
|
+
iconSize,iconDir,ospathexists)
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
|
|
@@ -35,7 +34,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
35
34
|
self.setupUi(self)
|
|
36
35
|
#Important must be empty this is a reference
|
|
37
36
|
self.files = []
|
|
38
|
-
self.projects =
|
|
37
|
+
self.projects = None
|
|
39
38
|
self.recent = None
|
|
40
39
|
self.dirty = None
|
|
41
40
|
self.isFull = False
|
|
@@ -56,14 +55,25 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
56
55
|
self.projects = config.projects()
|
|
57
56
|
self.recent = config.recent()
|
|
58
57
|
self.dirty = []
|
|
58
|
+
if(config.files() != None):
|
|
59
|
-
|
|
59
|
+
for i in config.files():
|
|
60
|
+
self.createTab(i)
|
|
60
61
|
self.tabWidget.tabCloseRequested.connect(self.closeTab)
|
|
61
62
|
self.treeWidget.itemDoubleClicked.connect(self.ss)
|
|
62
63
|
|
|
63
64
|
def initProjects(self):
|
|
65
|
+
if self.projects != None:
|
|
64
|
-
|
|
66
|
+
if len(self.projects) != 0:
|
|
65
|
-
|
|
67
|
+
for pro in self.projects:
|
|
68
|
+
self.createProject(pro)
|
|
69
|
+
|
|
70
|
+
#Important all projects must go through this
|
|
71
|
+
def createProject(self,startDir):
|
|
72
|
+
if(ospathexists(startDir)):
|
|
66
|
-
|
|
73
|
+
self.treeWidget.addProject(startDir)
|
|
74
|
+
else:
|
|
75
|
+
config.removeProject(startDir)
|
|
76
|
+
QMessageBox.about(self,"Can't Open Project","Project Does Not Exist %s"%startDir)
|
|
67
77
|
|
|
68
78
|
def ss(self,item):
|
|
69
79
|
if(item.isFile()):
|
|
@@ -79,30 +89,44 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
79
89
|
|
|
80
90
|
def createTab(self,nfile):
|
|
81
91
|
if(nfile != None):
|
|
92
|
+
if self.files != None:
|
|
82
|
-
|
|
93
|
+
if len(self.files) != 0:
|
|
83
|
-
|
|
94
|
+
for i in self.files:
|
|
84
|
-
|
|
95
|
+
if(i == nfile):
|
|
85
|
-
|
|
96
|
+
QMessageBox.about(self,"Can't Open","File Already Open\n"+nfile)
|
|
86
|
-
|
|
97
|
+
return
|
|
87
98
|
if type(nfile) == str:
|
|
99
|
+
if(ospathexists(nfile)):
|
|
88
|
-
|
|
100
|
+
try:
|
|
101
|
+
#print type(nfile)
|
|
102
|
+
#print "file: "+nfile
|
|
89
|
-
|
|
103
|
+
infile = open(nfile, 'r')
|
|
104
|
+
self.files.append(nfile)
|
|
90
|
-
|
|
105
|
+
config.addFile(nfile)
|
|
91
|
-
self.files.append(nfile)
|
|
92
|
-
|
|
106
|
+
self.dirty.append(False)
|
|
93
|
-
|
|
107
|
+
tab = Editor(self,infile.read())
|
|
108
|
+
infile.close()
|
|
94
|
-
|
|
109
|
+
self.tabWidget.addTab(tab,ospathbasename(nfile))
|
|
95
|
-
|
|
110
|
+
tab.textChanged.connect(lambda:self.setDirty(nfile))
|
|
111
|
+
#print len(self.files)
|
|
112
|
+
if(self.files != None):
|
|
113
|
+
if(len(self.files)) != 0:
|
|
114
|
+
#This line sets the opened file to display first Important not checked
|
|
115
|
+
self.tabWidget.setCurrentIndex(len(self.files)-1)
|
|
96
|
-
|
|
116
|
+
except:
|
|
117
|
+
config.removeFile(nfile)
|
|
97
|
-
|
|
118
|
+
QMessageBox.about(self,"Can't Open","File Does Not Exist or Locked\n"+nfile)
|
|
119
|
+
else:
|
|
120
|
+
#dont know must check this the last file is not removed executes only
|
|
121
|
+
#twice when it has to remove 3 files
|
|
122
|
+
#check sel.files
|
|
123
|
+
print len(config.files())
|
|
124
|
+
config.removeFile(nfile)
|
|
125
|
+
QMessageBox.about(self,"Can't Open","File Does Not Exist or Locked\n"+nfile)
|
|
98
126
|
else:
|
|
99
127
|
for i in nfile:
|
|
100
128
|
self.createTab(i)
|
|
101
|
-
|
|
129
|
+
|
|
102
|
-
self.tabWidget.setCurrentIndex(len(self.files)-1)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
130
|
def closeTab(self,index):
|
|
107
131
|
'''Boolean result invocation method.'''
|
|
108
132
|
done = True
|
|
@@ -117,6 +141,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
117
141
|
done = self.fileSave(index)
|
|
118
142
|
|
|
119
143
|
if(done):
|
|
144
|
+
#print index
|
|
120
145
|
config.removeFile(self.files[index])
|
|
121
146
|
self.files.remove(self.files[index])
|
|
122
147
|
self.tabWidget.removeTab(index)
|
|
@@ -139,59 +164,65 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
139
164
|
self.tabWidget.setTabText(index,flbase)
|
|
140
165
|
|
|
141
166
|
def newProject(self):
|
|
142
|
-
fname = str(QFileDialog.getExistingDirectory(self,"Open
|
|
167
|
+
fname = str(QFileDialog.getExistingDirectory(self,"Open Project Folder"))
|
|
143
168
|
if not (fname == ""):
|
|
144
169
|
fname = fname+"/"
|
|
145
170
|
#print fname
|
|
171
|
+
if self.projects != None:
|
|
146
|
-
|
|
172
|
+
for nfile in self.projects:
|
|
147
|
-
|
|
173
|
+
if(nfile != fname):
|
|
148
|
-
|
|
174
|
+
self.createProject(fname)
|
|
149
|
-
|
|
175
|
+
config.addProject(fname)
|
|
150
|
-
|
|
176
|
+
return
|
|
151
|
-
|
|
177
|
+
else:
|
|
152
|
-
|
|
178
|
+
QMessageBox.about(self, "Already Open","Project Already Open\n"+fname)
|
|
153
|
-
|
|
179
|
+
return
|
|
180
|
+
else:
|
|
181
|
+
self.treeWidget.addProject(fname)
|
|
182
|
+
config.addProject(fname)
|
|
154
183
|
return
|
|
155
184
|
|
|
156
|
-
def syntax(self):
|
|
157
|
-
pass
|
|
158
|
-
|
|
159
|
-
def style(self):
|
|
160
|
-
pass
|
|
161
|
-
|
|
162
|
-
def options(self):
|
|
163
|
-
pass
|
|
164
|
-
|
|
165
185
|
def fileOpen(self):
|
|
166
|
-
'''Open file'''
|
|
167
186
|
fname = str(QFileDialog.getOpenFileName(self,
|
|
168
187
|
"Open File", '.', "Files (*.*)"))
|
|
169
188
|
if not (fname == ""):
|
|
189
|
+
if self.files != None:
|
|
190
|
+
if len(self.files) != 0:
|
|
170
|
-
|
|
191
|
+
for file in self.files:
|
|
171
|
-
|
|
192
|
+
if(file != fname):
|
|
172
|
-
|
|
193
|
+
self.createTab(fname)
|
|
173
|
-
|
|
194
|
+
self.files.append(fname)
|
|
174
|
-
|
|
195
|
+
return
|
|
196
|
+
else:
|
|
197
|
+
QMessageBox.about(self, "Already Open","File Already Open")
|
|
198
|
+
return
|
|
175
199
|
else:
|
|
176
|
-
|
|
200
|
+
self.createTab(fname)
|
|
177
|
-
|
|
201
|
+
else:
|
|
202
|
+
print "not"
|
|
203
|
+
#this is when the files list is empty and None type
|
|
204
|
+
if(self.files == None):
|
|
205
|
+
self.files = []
|
|
206
|
+
self.createTab(fname)
|
|
178
207
|
else:
|
|
179
208
|
return
|
|
180
209
|
|
|
181
210
|
def fileSave(self):
|
|
211
|
+
if(self.files != None):
|
|
212
|
+
if len(self.files) != 0:
|
|
182
|
-
|
|
213
|
+
index = self.tabWidget.currentIndex()
|
|
183
|
-
|
|
214
|
+
if not self.dirty[index]:
|
|
184
|
-
|
|
215
|
+
return
|
|
185
|
-
|
|
216
|
+
fname = self.files[index]
|
|
186
|
-
|
|
217
|
+
fl = open(fname, 'w')
|
|
187
|
-
|
|
218
|
+
tempText = self.tabWidget.widget(index).text()
|
|
188
|
-
|
|
219
|
+
if tempText:
|
|
189
|
-
|
|
220
|
+
fl.write(tempText)
|
|
190
|
-
|
|
221
|
+
fl.close()
|
|
191
|
-
|
|
222
|
+
self.clearDirty(index)
|
|
192
|
-
|
|
223
|
+
else:
|
|
193
|
-
|
|
224
|
+
QMessageBox.about(self, "Can't Save","Failed to save ...")
|
|
194
|
-
|
|
225
|
+
self.statusBar().showMessage('Failed to save ...', 5000)
|
|
195
226
|
|
|
196
227
|
def fileSaveAll(self):
|
|
197
228
|
def fileSaveIndex(index):
|
|
@@ -207,8 +238,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
207
238
|
else:
|
|
208
239
|
QMessageBox.about(self, "Can't Save","Failed to save ...")
|
|
209
240
|
self.statusBar().showMessage('Failed to save ...', 5000)
|
|
241
|
+
if(self.files != None):
|
|
242
|
+
if len(self.files) != 0:
|
|
210
|
-
|
|
243
|
+
for file in self.files:
|
|
211
|
-
|
|
244
|
+
fileSaveIndex(self.files.index(file))
|
|
212
245
|
|
|
213
246
|
|
|
214
247
|
def closeEvent(self, event):
|
|
@@ -224,6 +257,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|
|
224
257
|
pass
|
|
225
258
|
elif reply == QMessageBox.Yes:
|
|
226
259
|
self.fileSaveAll()
|
|
260
|
+
|
|
261
|
+
def syntax(self):
|
|
262
|
+
pass
|
|
263
|
+
|
|
264
|
+
def style(self):
|
|
265
|
+
pass
|
|
266
|
+
|
|
267
|
+
def options(self):
|
|
268
|
+
pass
|
|
227
269
|
|
|
228
270
|
|
|
229
271
|
if __name__ == "__main__":
|
ui.py
CHANGED
|
@@ -9,7 +9,7 @@ from globals import (ospathsep,ospathjoin,ospathbasename,workDir,
|
|
|
9
9
|
iconSize,iconDir)
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
__version__ = "0.
|
|
12
|
+
__version__ = "0.46"
|
|
13
13
|
|
|
14
14
|
class Ui_MainWindow(object):
|
|
15
15
|
def setupUi(self, MainWindow):
|