49a09f9c pyros2097

13 years ago
v0.45
Dialog/__init__.pyc ADDED
Binary file
Dialog/dialogs.pyc ADDED
Binary file
Widget/adb.py ADDED
@@ -0,0 +1,72 @@
1
+ from globals import adblist
2
+ from PyQt4.QtGui import QWidget
3
+ import threading
4
+ from subprocess import PIPE,Popen,STDOUT
5
+ from PyQt4.QtCore import pyqtSignal,SIGNAL
6
+
7
+
8
+ class Adb(QWidget):
9
+ def __init__(self,parent):
10
+ QWidget.__init__(self,parent)
11
+ self.parent = parent
12
+ self.adb_process = None
13
+ self.isRunning = False
14
+ self.connect(self, SIGNAL("didSomething"),self.update)
15
+
16
+ def update(self,line):
17
+ self.parent.textEdit.append(line)
18
+
19
+ def setCommand(self,comlist):
20
+ pass
21
+
22
+ def output(self,pipe):
23
+ while True:
24
+ try:
25
+ if self.adb_process.poll() != None:
26
+ break
27
+ line = pipe.readline().strip()
28
+
29
+ if len(line) > 0:
30
+ self.emit(SIGNAL("didSomething"),line)
31
+ except:
32
+ print "except"
33
+ #traceback.print_exc()
34
+
35
+
36
+ def run(self):
37
+ if self.isRunning == False:
38
+ if self.adb_process != None and self.adb_process.poll() == None:
39
+ self.adb_process.kill()
40
+ self.isRunning = True
41
+ self.parent.action_Run.setDisabled(True)
42
+ self.parent.action_Stop.setEnabled(True)
43
+ if(self.parent.tabWidget_3.isHidden()):
44
+ self.parent.tabWidget_3.show()
45
+ self.parent.tabWidget_3.setCurrentIndex(1)
46
+ self.parent.textEdit.clear()
47
+ self.parent.textEdit.append("Pushing main.nut\n")
48
+ self.adb_process = Popen(adblist[3], shell=False, stdout=PIPE,stderr=STDOUT)
49
+ t = threading.Thread(target=self.output, args=(self.adb_process.stdout,))
50
+ t.start()
51
+ t.join()
52
+ #adb_process.wait()
53
+ #self.parent.textEdit.append("Starting Activity\n")
54
+ #adb_process = subprocess.Popen(adb[1], shell=False, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
55
+ #self.parent.textEdit.append("Logging")
56
+ #adb_process.wait()
57
+ #adb_process = subprocess.Popen(adb[2], shell=False, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
58
+
59
+ def stop(self):
60
+ if self.isRunning == True:
61
+ self.isRunning = False
62
+ if self.adb_process != None and self.adb_process.poll() == None:
63
+ self.adb_process.kill()
64
+ self.parent.action_Stop.setDisabled(True)
65
+ self.parent.textEdit.append("Stopped")
66
+ if not(self.parent.tabWidget_3.isHidden()):
67
+ self.parent.tabWidget_3.hide()
68
+ self.parent.action_Run.setEnabled(True)
69
+
70
+ def close(self):
71
+ if self.adb_process != None and self.adb_process.poll() == None:
72
+ self.adb_process.kill()
Widget/adb.pyc ADDED
Binary file
Widget/editor.py CHANGED
@@ -1,21 +1,21 @@
1
1
  from PyQt4.QtCore import *
2
2
  from PyQt4.QtGui import *
3
3
  from PyQt4.Qsci import QsciScintilla, QsciLexerPython ,QsciAPIs
4
- from globals import ospathjoin,workDir
4
+ from globals import ospathjoin,workDir,fontSize,fontName
5
5
 
6
6
  class Editor(QsciScintilla):
7
7
  ARROW_MARKER_NUM = 8
8
8
 
9
- def __init__(self,fontSize=10,fontName='Courier',parent=None):
9
+ def __init__(self,parent,text):
10
10
  super(Editor, self).__init__(parent)
11
-
11
+ self.parent = parent
12
-
13
12
  font = QFont()
14
13
  font.setFamily(fontName)
15
14
  font.setFixedPitch(True)
16
15
  font.setPointSize(fontSize)
17
16
  self.setFont(font)
18
17
  self.setMarginsFont(font)
18
+ self.setText(text)
19
19
  #self.addAction(QAction("gg",self))
20
20
  #self.findFirst("function",False,True,True,True)
21
21
  #self.setEdgeColumn(70)
@@ -27,6 +27,7 @@ class Editor(QsciScintilla):
27
27
  self.setMarginWidth(0, fontmetrics.width("00000") + 6)
28
28
  self.setMarginLineNumbers(0, True)
29
29
  self.setMarginsBackgroundColor(QColor("#cccccc"))
30
+
30
31
  # Clickable margin 1 for showing markers
31
32
  self.setMarginSensitivity(1, True)
32
33
  self.connect(self,SIGNAL('marginClicked(int, int, Qt::KeyboardModifiers)'),self.on_margin_clicked)
Widget/editor.pyc CHANGED
Binary file
Widget/ipython.py ADDED
@@ -0,0 +1,259 @@
1
+ import os
2
+ import re
3
+ import sys
4
+ import code
5
+
6
+ from PyQt4.QtGui import *
7
+ from PyQt4.QtCore import *
8
+
9
+ class MyInterpreter(QWidget):
10
+
11
+ def __init__(self, parent):
12
+
13
+ super(MyInterpreter, self).__init__(parent)
14
+ hBox = QHBoxLayout()
15
+
16
+ self.setLayout(hBox)
17
+ self.textEdit = PyInterp(self)
18
+
19
+ # this is how you pass in locals to the interpreter
20
+ self.textEdit.initInterpreter(locals())
21
+
22
+ self.resize(650, 300)
23
+ self.centerOnScreen()
24
+
25
+ hBox.addWidget(self.textEdit)
26
+ hBox.setMargin(0)
27
+ hBox.setSpacing(0)
28
+
29
+ def centerOnScreen(self):
30
+ # center the widget on the screen
31
+ resolution = QDesktopWidget().screenGeometry()
32
+ self.move((resolution.width() / 2) - (self.frameSize().width() / 2),
33
+ (resolution.height() / 2) - (self.frameSize().height() / 2))
34
+
35
+ class PyInterp(QTextEdit):
36
+
37
+ class InteractiveInterpreter(code.InteractiveInterpreter):
38
+
39
+ def __init__(self, locals):
40
+ code.InteractiveInterpreter.__init__(self, locals)
41
+
42
+ def runIt(self, command):
43
+ code.InteractiveInterpreter.runsource(self, command)
44
+
45
+
46
+ def __init__(self, parent):
47
+ super(PyInterp, self).__init__(parent)
48
+
49
+ sys.stdout = self
50
+ sys.stderr = self
51
+ self.refreshMarker = False # to change back to >>> from ...
52
+ self.multiLine = False # code spans more than one line
53
+ self.command = '' # command to be ran
54
+ self.printBanner() # print sys info
55
+ self.marker() # make the >>> or ... marker
56
+ self.history = [] # list of commands entered
57
+ self.historyIndex = -1
58
+ self.interpreterLocals = {}
59
+
60
+ # setting the color for bg and text
61
+ palette = QPalette()
62
+ palette.setColor(QPalette.Base, QColor(0, 0, 0))
63
+ palette.setColor(QPalette.Text, QColor(0, 255, 0))
64
+ self.setPalette(palette)
65
+ self.setFont(QFont('Courier', 12))
66
+
67
+ # initilize interpreter with self locals
68
+ self.initInterpreter(locals())
69
+
70
+
71
+ def printBanner(self):
72
+ self.write(sys.version)
73
+ self.write(' on ' + sys.platform + '\n')
74
+ self.write('PyQt4 ' + PYQT_VERSION_STR + '\n')
75
+ msg = 'Type !hist for a history view and !hist(n) history index recall'
76
+ self.write(msg + '\n')
77
+
78
+
79
+ def marker(self):
80
+ if self.multiLine:
81
+ self.insertPlainText('... ')
82
+ else:
83
+ self.insertPlainText('>>> ')
84
+
85
+ def initInterpreter(self, interpreterLocals=None):
86
+ if interpreterLocals:
87
+ # when we pass in locals, we don't want it to be named "self"
88
+ # so we rename it with the name of the class that did the passing
89
+ # and reinsert the locals back into the interpreter dictionary
90
+ selfName = interpreterLocals['self'].__class__.__name__
91
+ interpreterLocalVars = interpreterLocals.pop('self')
92
+ self.interpreterLocals[selfName] = interpreterLocalVars
93
+ else:
94
+ self.interpreterLocals = interpreterLocals
95
+ self.interpreter = self.InteractiveInterpreter(self.interpreterLocals)
96
+
97
+ def updateInterpreterLocals(self, newLocals):
98
+ className = newLocals.__class__.__name__
99
+ self.interpreterLocals[className] = newLocals
100
+
101
+ def write(self, line):
102
+ self.insertPlainText(line)
103
+ self.ensureCursorVisible()
104
+
105
+ def clearCurrentBlock(self):
106
+ # block being current row
107
+ length = len(self.document().lastBlock().text()[4:])
108
+ if length == 0:
109
+ return None
110
+ else:
111
+ # should have a better way of doing this but I can't find it
112
+ [self.textCursor().deletePreviousChar() for x in xrange(length)]
113
+ return True
114
+
115
+ def recallHistory(self):
116
+ # used when using the arrow keys to scroll through history
117
+ self.clearCurrentBlock()
118
+ if self.historyIndex <> -1:
119
+ self.insertPlainText(self.history[self.historyIndex])
120
+ return True
121
+
122
+ def customCommands(self, command):
123
+
124
+ if command == '!hist': # display history
125
+ self.append('') # move down one line
126
+ # vars that are in the command are prefixed with ____CC and deleted
127
+ # once the command is done so they don't show up in dir()
128
+ backup = self.interpreterLocals.copy()
129
+ history = self.history[:]
130
+ history.reverse()
131
+ for i, x in enumerate(history):
132
+ iSize = len(str(i))
133
+ delta = len(str(len(history))) - iSize
134
+ line = line = ' ' * delta + '%i: %s' % (i, x) + '\n'
135
+ self.write(line)
136
+ self.updateInterpreterLocals(backup)
137
+ self.marker()
138
+ return True
139
+
140
+ if re.match('!hist\(\d+\)', command): # recall command from history
141
+ backup = self.interpreterLocals.copy()
142
+ history = self.history[:]
143
+ history.reverse()
144
+ index = int(command[6:-1])
145
+ self.clearCurrentBlock()
146
+ command = history[index]
147
+ if command[-1] == ':':
148
+ self.multiLine = True
149
+ self.write(command)
150
+ self.updateInterpreterLocals(backup)
151
+ return True
152
+
153
+ return False
154
+
155
+ def keyPressEvent(self, event):
156
+
157
+ if event.key() == Qt.Key_Escape:
158
+ # proper exit
159
+ self.interpreter.runIt('exit()')
160
+
161
+ if event.key() == Qt.Key_Down:
162
+ if self.historyIndex == len(self.history):
163
+ self.historyIndex -= 1
164
+ try:
165
+ if self.historyIndex > -1:
166
+ self.historyIndex -= 1
167
+ self.recallHistory()
168
+ else:
169
+ self.clearCurrentBlock()
170
+ except:
171
+ pass
172
+ return None
173
+
174
+ if event.key() == Qt.Key_Up:
175
+ try:
176
+ if len(self.history) - 1 > self.historyIndex:
177
+ self.historyIndex += 1
178
+ self.recallHistory()
179
+ else:
180
+ self.historyIndex = len(self.history)
181
+ except:
182
+ pass
183
+ return None
184
+
185
+ if event.key() == Qt.Key_Home:
186
+ # set cursor to position 4 in current block. 4 because that's where
187
+ # the marker stops
188
+ blockLength = len(self.document().lastBlock().text()[4:])
189
+ lineLength = len(self.document().toPlainText())
190
+ position = lineLength - blockLength
191
+ textCursor = self.textCursor()
192
+ textCursor.setPosition(position)
193
+ self.setTextCursor(textCursor)
194
+ return None
195
+
196
+ if event.key() in [Qt.Key_Left, Qt.Key_Backspace]:
197
+ # don't allow deletion of marker
198
+ if self.textCursor().positionInBlock() == 4:
199
+ return None
200
+
201
+ if event.key() in [Qt.Key_Return, Qt.Key_Enter]:
202
+ # set cursor to end of line to avoid line splitting
203
+ textCursor = self.textCursor()
204
+ position = len(self.document().toPlainText())
205
+ textCursor.setPosition(position)
206
+ self.setTextCursor(textCursor)
207
+
208
+ line = str(self.document().lastBlock().text())[4:] # remove marker
209
+ line.rstrip()
210
+ self.historyIndex = -1
211
+
212
+ if self.customCommands(line):
213
+ return None
214
+ else:
215
+ try:
216
+ line[-1]
217
+ self.haveLine = True
218
+ if line[-1] == ':':
219
+ self.multiLine = True
220
+ self.history.insert(0, line)
221
+ except:
222
+ self.haveLine = False
223
+
224
+ if self.haveLine and self.multiLine: # multi line command
225
+ self.command += line + '\n' # + command and line
226
+ self.append('') # move down one line
227
+ self.marker() # handle marker style
228
+ return None
229
+
230
+ if self.haveLine and not self.multiLine: # one line command
231
+ self.command = line # line is the command
232
+ self.append('') # move down one line
233
+ self.interpreter.runIt(self.command)
234
+ self.command = '' # clear command
235
+ self.marker() # handle marker style
236
+ return None
237
+
238
+ if self.multiLine and not self.haveLine: # multi line done
239
+ self.append('') # move down one line
240
+ self.interpreter.runIt(self.command)
241
+ self.command = '' # clear command
242
+ self.multiLine = False # back to single line
243
+ self.marker() # handle marker style
244
+ return None
245
+
246
+ if not self.haveLine and not self.multiLine: # just enter
247
+ self.append('')
248
+ self.marker()
249
+ return None
250
+ return None
251
+
252
+ # allow all other key events
253
+ super(PyInterp, self).keyPressEvent(event)
254
+
255
+ if __name__ == '__main__':
256
+ app = QApplication(sys.argv)
257
+ win = MyInterpreter(None)
258
+ win.show()
259
+ sys.exit(app.exec_())
Widget/ipython.pyc ADDED
Binary file
Widget/tab.pyc CHANGED
Binary file
Widget/tree.py CHANGED
@@ -1,9 +1,9 @@
1
1
  from PyQt4.QtGui import (QTreeWidgetItem,QTreeWidget,QMessageBox,
2
2
  QIcon,QDrag,QMenu,QAction,QInputDialog,QCursor,QToolBar)
3
- from PyQt4.QtCore import SIGNAL,Qt,QMimeData
3
+ from PyQt4.QtCore import SIGNAL,Qt,QMimeData,QUrl
4
4
  from globals import (oslistdir,ospathisdir,ospathsep,ospathjoin,ospathexists,
5
5
  ospathbasename,os_icon,osremove,osrename,ospathdirname,
6
- recycle)
6
+ recycle,ospathnormpath,oswalk)
7
7
 
8
8
 
9
9
  class Dir(QTreeWidgetItem):
@@ -27,18 +27,27 @@ class File(QTreeWidgetItem):
27
27
  QTreeWidgetItem.__init__(self,parent)
28
28
  self.path = ospathjoin(path,name)
29
29
  self.setText (0, name)
30
+ self.doc = False
31
+ self.pic = False
30
32
  #mime = QMimeData()
31
- #print mime.hasFormat(path)
33
+ #mime.setUrls([QUrl.fromLocalFile(self.path)])
32
- if(name.endswith(".txt")):
34
+ #print self.path+":"+str(mime.hasUrls())
35
+ self.Doc(name)
36
+ self.Pic(name)
37
+ if not (self.doc and self.pic):
33
38
  self.setIcon(0,os_icon("file_obj"))
39
+
40
+
41
+ def Doc(self,name):
34
- elif(name.endswith(".nut")):
42
+ if(name.endswith(".txt") or name.endswith(".nut") or name.endswith(".py")):
35
- self.setIcon(0,os_icon("file_obj"))
36
- elif(name.endswith(".py")):
37
- self.setIcon(0,os_icon("file_obj"))
38
- elif(name.endswith(".c")):
39
43
  self.setIcon(0,os_icon("file_obj"))
44
+ self.doc = True
45
+
40
- else:
46
+ def Pic(self,name):
47
+ if(name.endswith(".png") or name.endswith(".gif") or name.endswith(".jpg")):
41
48
  self.setIcon(0,os_icon("file_obj"))
49
+ self.pic = True
50
+
42
51
  def getPath(self):
43
52
  return self.path
44
53
  def isProject(self):
@@ -48,7 +57,9 @@ class File(QTreeWidgetItem):
48
57
  def isFile(self):
49
58
  return True
50
59
  def isDoc(self):
51
- return True
60
+ return self.doc
61
+ def isPic(self):
62
+ return self.pic
52
63
 
53
64
  class Project(QTreeWidgetItem):
54
65
  Count = 0
@@ -60,9 +71,11 @@ class Project(QTreeWidgetItem):
60
71
  self.setIcon(0,os_icon('cprj_obj'))
61
72
  else:
62
73
  self.setIcon(0,os_icon('prj_obj'))
63
- self.setText (0, startDir) # set the text of the first 0
74
+ self.setText (0, ospathbasename(ospathnormpath(startDir))) # set the text of the first 0
64
75
  self.setToolTip(0,startDir)
65
76
  self.Count += 1
77
+ self.setExpanded(True)
78
+
66
79
 
67
80
 
68
81
  def getPath(self):
@@ -89,21 +102,30 @@ class Tree(QTreeWidget):
89
102
  self.connect(self, SIGNAL("dropped"), self.addItem)
90
103
  self.projects = []
91
104
  self.closed = []
92
-
105
+
93
106
  def readDir(self,parent,path):
94
107
  for d in oslistdir(path):
95
- if ospathisdir(ospathjoin(path+d)) is True:
108
+ if ospathisdir(ospathjoin(path,d)):
96
109
  if not ospathjoin(d).startswith('.'):
97
- i = Dir(parent,d,path) # create QTreeWidget the sub i
110
+ i = Dir(parent,d,path)
98
- self.readFiles(ospathjoin(path,d),i)
111
+ self.readFiles(i,ospathjoin(path,d))
99
- self.readFiles(path,parent)
112
+
100
-
101
-
102
- def readFiles(self,path,i):
113
+ def readFiles(self,parent,path):
114
+ for f in oslistdir(path):
115
+ if ospathisdir(ospathjoin(path,f)):
116
+ d = Dir(parent,f,path)
117
+ self.readFiles(d,ospathjoin(path,f))
118
+ else:
119
+ if not ospathjoin(f).startswith('.'):
120
+ File(parent,f,path)
121
+
122
+
123
+ def readMainFiles(self,parent,path):
103
124
  for f in oslistdir(path):
104
- if ospathisdir(ospathjoin(path+f)) is False:
125
+ if not ospathisdir(ospathjoin(path,f)):
105
126
  if not ospathjoin(f).startswith('.'):
106
- File(i,f,path)
127
+ File(parent,f,path)
128
+
107
129
 
108
130
  def addProject(self,startDir):
109
131
  if(ospathexists(startDir)):
@@ -112,6 +134,7 @@ class Tree(QTreeWidget):
112
134
  i = Project(self,startDir)
113
135
  self.addTopLevelItem(i)
114
136
  self.readDir(i,startDir)
137
+ self.readMainFiles(i,startDir)
115
138
  else:
116
139
  QMessageBox.about(self,"Can't Open Project","Project Does Not Exist %s"%startDir)
117
140
 
@@ -121,7 +144,7 @@ class Tree(QTreeWidget):
121
144
  i = Project(self,startDir,True)
122
145
  self.addTopLevelItem(i)
123
146
  else:
124
- QMessageBox.about(self,"Can't Open Project","Project Does Not Exist %s"%startDir)
147
+ QMessageBox.about(self,"Can't Close Project","Project Does Not Exist %s"%startDir)
125
148
 
126
149
  def addItem(self,links):
127
150
  print links
@@ -173,49 +196,48 @@ class Tree(QTreeWidget):
173
196
  menu = QMenu(self)
174
197
  action_Folder = QAction(os_icon('newfolder_wiz'),'New Folder', self)
175
198
  action_Folder.triggered.connect(lambda:self.newFolder(item))
176
- action_addFolder = QAction(os_icon('importdir_wiz'),'Add Folder', self)
177
- action_addFolder.triggered.connect(lambda:self.addFolder(item))
178
199
  action_File = QAction(os_icon('new_untitled_text_file'),'New File', self)
179
200
  action_File.triggered.connect(lambda:self.newFile(item))
180
- action_addFile = QAction(os_icon('__imp_obj'),'Add File', self)
181
- action_addFile.triggered.connect(lambda:self.addFile(item))
182
201
  action_Open = QAction('Open', self)
183
202
  action_Open.triggered.connect(lambda:self.openProject(item))
184
203
  action_Close = QAction('Close', self)
185
204
  action_Close.triggered.connect(lambda:self.closeProject(item))
186
- action_Refresh = QAction('Refresh', self)
205
+ action_RefreshProject = QAction('Refresh', self)
187
- action_Refresh.triggered.connect(lambda:self.refreshProject(item))
206
+ action_RefreshProject.triggered.connect(lambda:self.refreshProject(item))
207
+ action_RemoveProject = QAction('Remove', self)
208
+ action_RemoveProject.triggered.connect(lambda:self.removeProject(item))
188
- action_RenameProject = QAction('Rename Project', self)
209
+ action_RenameProject = QAction('Rename...', self)
189
210
  action_RenameProject.triggered.connect(lambda:self.renameProject(item))
190
- action_RenameDir = QAction('Rename Dir', self)
211
+ action_RenameDir = QAction('Rename...', self)
191
212
  action_RenameDir.triggered.connect(lambda:self.renameDir(item))
192
- action_Rename = QAction('Rename...', self)
213
+ action_RenameFile = QAction('Rename...', self)
193
- action_Rename.triggered.connect(lambda:self.rename(item))
214
+ action_RenameFile.triggered.connect(lambda:self.renameFile(item))
215
+ action_DeleteFile = QAction(os_icon('trash'),'Delete', self)
216
+ action_DeleteFile.triggered.connect(lambda:self.deleteFile(item))
194
- action_Delete = QAction(os_icon('trash'),'Delete', self)
217
+ action_DeleteDir = QAction(os_icon('trash'),'Delete', self)
195
- action_Delete.triggered.connect(lambda:self.delete(item))
218
+ action_DeleteDir.triggered.connect(lambda:self.deleteDir(item))
219
+ action_DeleteProject = QAction(os_icon('trash'),'Delete', self)
220
+ action_DeleteProject.triggered.connect(lambda:self.deleteProject(item))
196
221
  if(item.isProject()):
197
222
  if not(item.isClosed()):
198
223
  menu.addAction(action_Folder)
199
- menu.addAction(action_addFolder)
200
224
  menu.addAction(action_File)
201
- menu.addAction(action_addFile)
202
225
  menu.addSeparator()
203
226
  menu.addAction(action_RenameProject)
227
+ menu.addAction(action_RemoveProject)
204
- menu.addAction(action_Delete)
228
+ menu.addAction(action_DeleteProject)
205
229
  menu.addSeparator()
206
- menu.addAction(action_Refresh)
230
+ menu.addAction(action_RefreshProject)
207
231
  menu.addAction(action_Close)
208
232
  else:
209
233
  menu.addAction(action_Open)
210
234
  else:
211
235
  if(item.isDir()):
212
236
  menu.addAction(action_Folder)
213
- menu.addAction(action_addFolder)
214
237
  menu.addAction(action_File)
215
- menu.addAction(action_addFile)
216
238
  menu.addSeparator()
217
239
  menu.addAction(action_RenameDir)
218
- menu.addAction(action_Delete)
240
+ menu.addAction(action_DeleteDir)
219
241
  else:
220
242
  menu.addAction(action_Rename)
221
243
  menu.addAction(action_Delete)
@@ -223,75 +245,117 @@ class Tree(QTreeWidget):
223
245
  menu.popup(QCursor.pos())
224
246
 
225
247
  def openProject(self,item):
226
- itempath = item.getPath()[0]
248
+ itempath = item.getPath()
227
249
  self.closed[self.projects.index(itempath)] = False
228
250
  self.takeTopLevelItem(self.indexOfTopLevelItem(item))
229
251
  self.addProject(itempath)
230
252
 
231
253
  def closeProject(self,item):
232
254
  self.takeTopLevelItem(self.indexOfTopLevelItem(item))
233
- self.addClosedProject(item.getPath()[0])
255
+ self.addClosedProject(item.getPath())
234
-
235
- def renameProject(self,item):
236
- text,ok = QInputDialog.getText(self,"QInputDialog::getText()","New Name:")
237
- if (ok and text != ''):
238
- newname = ospathjoin(ospathdirname(item.getPath()),str(text))
239
- try:
240
- #print newname
241
- osrename(item.getPath(),newname)
242
- except:
243
- QMessageBox.about(self,"Error","Could Not Rename The File")
244
256
 
245
257
  def refreshProject(self,item):
246
- pass
258
+ #must check this
247
-
259
+ itempath = item.getPath()
260
+ self.takeTopLevelItem(self.indexOfTopLevelItem(item))
261
+ self.addProject(itempath)
248
262
 
263
+ def removeProject(self,item):
264
+ pass
265
+
249
266
  def newFolder(self,item):
250
267
  text,ok = QInputDialog.getText(self,"QInputDialog::getText()","Name:")
251
268
  if (ok and text != ''):
252
269
  fname = ospathdirname(item.getPath())
253
-
254
270
  try:
255
271
  print fname+'/'+text
256
- osmkdir(fname+'/'+text,0755)
272
+ #osmkdir(fname+'/'+text,0755)
257
273
  except:
258
274
  QMessageBox.about(self,"Error","Could Not Create The File")
259
- def addFolder(self,item):
260
- pass
261
275
  def newFile(self,item):
276
+ itempath = item.getPath()
262
- text,ok = QInputDialog.getText(self,"QInputDialog::getText()","Name:")
277
+ text,ok = QInputDialog.getText(self,"QInputDialog::getText()","Name:")
263
278
  if (ok and text != ''):
264
- fname = ospathjoin(ospathdirname(item.getPath()),str(text))
279
+ fname = ospathjoin(ospathdirname(itempath),str(text))
265
280
  try:
266
281
  nfile = open(fname,'w')
267
282
  nfile.close()
283
+ f = File(item,ospathbasename(fname),ospathdirname(fname))
284
+ item.addChild(f)
268
285
  except:
269
286
  QMessageBox.about(self,"Error","Could Not Create The File")
270
-
287
+
271
- def addFile(self,item):
288
+ def renameProject(self,item):
289
+ itempath = item.getPath()
290
+ text,ok = QInputDialog.getText(self,"QInputDialog::getText()","New Name:")
291
+ if (ok and text != ''):
292
+ newname = ospathjoin(ospathdirname(itempath),str(text))
272
- pass
293
+ try:
294
+ #print newname
295
+ osrename(itempath,newname)
296
+ self.takeTopLevelItem(self.indexOfTopLevelItem(item))
297
+ self.addProject(newname)
298
+ except:
299
+ QMessageBox.about(self,"Error","Could Not Rename The File")
273
300
 
274
301
  def renameDir(self,item):
302
+ itempath = item.getPath()
275
303
  text,ok = QInputDialog.getText(self,"QInputDialog::getText()","New Name:")
276
304
  if (ok and text != ''):
277
- newname = ospathjoin(ospathdirname(item.getPath()),str(text))
305
+ newname = ospathjoin(ospathdirname(itempath),str(text))
278
306
  try:
279
307
  #print newname
280
- osrename(item.getPath(),newname)
308
+ osrename(itempath,newname)
309
+ p = item.parent()
310
+ p.removeChild(item)
311
+ self.readDir(p,ospathdirname(newname))
281
312
  except:
282
313
  QMessageBox.about(self,"Error","Could Not Rename The File")
283
314
 
284
- def rename(self,item):
315
+ def renameFile(self,item):
285
316
  text,ok = QInputDialog.getText(self,"QInputDialog::getText()","New Name:")
317
+ itempath = item.getPath()
286
318
  if (ok and text != ''):
287
- newname = ospathjoin(ospathdirname(item.getPath()),str(text))
319
+ newname = ospathjoin(ospathdirname(itempath),str(text))
288
320
  try:
289
321
  #print newname
290
- osrename(item.getPath(),newname)
322
+ osrename(itempath,newname)
323
+ p = item.parent()
324
+ p.removeChild(item)
325
+ f = File(p,ospathbasename(newname),ospathdirname(newname))
326
+ p.addChild(f)
291
327
  except:
292
328
  QMessageBox.about(self,"Error","Could Not Rename The File")
329
+
330
+ def deleteDir(self,item):
331
+ reply = QMessageBox.question(self,
332
+ "Delete",
333
+ "Are you sure you want to Delete,This Will Send To Recycle Bin?",
334
+ QMessageBox.Yes|QMessageBox.No)
335
+ if reply == QMessageBox.No:
336
+ return
337
+ elif reply == QMessageBox.Yes:
338
+ try:
339
+ pass
340
+ #implement
341
+ except:
342
+ QMessageBox.about(self,"Error","Could Not Delete The File")
343
+
344
+ def deleteProject(self,item):
345
+ reply = QMessageBox.question(self,
346
+ "Delete",
347
+ "Are you sure you want to Delete,This Will Send To Recycle Bin?",
348
+ QMessageBox.Yes|QMessageBox.No)
349
+ if reply == QMessageBox.No:
350
+ return
351
+ elif reply == QMessageBox.Yes:
352
+ try:
353
+ pass
354
+ #implement
355
+ except:
356
+ QMessageBox.about(self,"Error","Could Not Delete The File")
293
357
 
294
- def delete(self,item):
358
+ def deleteFile(self,item):
295
359
  reply = QMessageBox.question(self,
296
360
  "Delete",
297
361
  "Are you sure you want to Delete,This Will Send To Recycle Bin?",
@@ -300,7 +364,9 @@ class Tree(QTreeWidget):
300
364
  return
301
365
  elif reply == QMessageBox.Yes:
302
366
  try:
303
- #print item.getPath()
367
+ itempath = item.getPath()
368
+ p = item.parent()
369
+ p.removeChild(item)
304
- recycle(item.getPath())
370
+ recycle(itempath)
305
371
  except:
306
372
  QMessageBox.about(self,"Error","Could Not Delete The File")
Widget/tree.pyc CHANGED
Binary file
app.py ADDED
@@ -0,0 +1,19 @@
1
+ """
2
+ This is a setup.py script generated by py2applet
3
+
4
+ Usage:
5
+ python setup.py py2app
6
+ """
7
+
8
+ from setuptools import setup
9
+
10
+ APP = ['C:\CODE\Sabel\main.py']
11
+ DATA_FILES = []
12
+ OPTIONS = {'argv_emulation': True}
13
+
14
+ setup(
15
+ app=APP,
16
+ data_files=DATA_FILES,
17
+ options={'py2app': OPTIONS},
18
+ setup_requires=['py2app'],
19
+ )
build/exe.win32-2.7/Sabel.zip CHANGED
Binary file
build/exe.win32-2.7/config.yaml CHANGED
@@ -6,7 +6,6 @@ ADB:
6
6
  shell kill
7
7
  File:
8
8
  - C:/CODE/assets/main.nut
9
- - C:/CODE/Sabel/main.py
10
9
  Project:
11
10
  - C:/CODE/assets/
12
11
  Recent:
@@ -15,4 +14,10 @@ Setting:
15
14
  fontname: Courier
16
15
  fontsize: 10
17
16
  iconsize: 16
17
+ style: 0
18
+ thresh: 1
18
19
  workspace: C:/CODE/
20
+ Styles:
21
+ default:
22
+ bg: white
23
+ color: black
build/exe.win32-2.7/library.zip CHANGED
Binary file
build/exe.win32-2.7/yaml/__init__.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/_yaml.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/composer.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/constructor.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/cyaml.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/dumper.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/emitter.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/error.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/events.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/loader.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/nodes.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/parser.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/reader.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/representer.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/resolver.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/scanner.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/serializer.pyc ADDED
Binary file
build/exe.win32-2.7/yaml/tokens.pyc ADDED
Binary file
config.yaml CHANGED
@@ -6,7 +6,6 @@ ADB:
6
6
  shell kill
7
7
  File:
8
8
  - C:/CODE/assets/main.nut
9
- - C:/CODE/assets/howtoscene.nut
10
9
  Project:
11
10
  - C:/CODE/assets/
12
11
  Recent:
@@ -15,4 +14,10 @@ Setting:
15
14
  fontname: Courier
16
15
  fontsize: 10
17
16
  iconsize: 16
17
+ style: 0
18
+ thresh: 1
18
19
  workspace: C:/CODE/
20
+ Styles:
21
+ default:
22
+ bg: white
23
+ color: black
emo.api DELETED
@@ -1,212 +0,0 @@
1
- emo.Runtime?0(use = runtime)
2
- runtime.import?1(filename)
3
- emo.Runtime.import?1(filename)
4
- runtime.log?1(LOG_INFO,msg)
5
- runtime.info?1(msg)
6
- runtime.error?1(msg)
7
- runtime.warn?1(msg)
8
- runtime.setLogLevel?1(LOG_WARN);
9
- runtime.setOptions?1(OPT_ORIENTATION_PORTRAIT)
10
- OPT_ORIENTATION_PORTRAIT?2
11
- OPT_ORIENTATION_LANDSCAPE?2
12
- OPT_ORIENTATION_LANDSCAPE_LEFT?2 (*iOS Only*)
13
- OPT_ORIENTATION_LANDSCAPE_RIGHT?2 (*iOS Only*)
14
- runtime.os?1()
15
- OS_ANDROID?2
16
- OS_IOS?2
17
- runtime.device?1()
18
- runtime.isSimulator?1()
19
- runtime.finish(?1Finshes activity *android)
20
- emo.Runtime.clearTextureCache?1()
21
- emo.Runtime.compilebuffer?1(script)
22
- emo.Runtime.compile?1(script, TYPE_ASSET)
23
- emo.Runtime.compile?1script, TYPE_DOCUMENT)
24
- emo.Runtime.compile?1(script)
25
- emo.Runtime.getDocumentDir?1()
26
- emo.Runtime.enableSimpleLog?1(enable = true *iOS)
27
- emo.Runtime.enableSimpleLogWithLevel?1(enable = true);
28
- emo.Runtime.random?1()
29
- emo.Runtime.random?1(max)
30
- emo.Runtime.getDefaultLocale?1()
31
- emo.Runtime().uptime?1()
32
- emo.Stage?0(use = stage)
33
- stage.load?1()
34
- stage.load?1(nextScene, currentSceneModifier, nextSceneModifier, immediate)
35
- stage.getWindowWidth?1()
36
- stage.windowWidth?1(value)
37
- stage.getWindowHeight?1()
38
- stage.windowHeight?1(value)
39
- stage.viewport?1(width, height)
40
- stage.ortho?1(width, height)
41
- stage.interval?1(100)
42
- stage.getCenterX?1()
43
- stage.getCenterY?1()
44
- stage.setContentScale?1()
45
- emo.Sprite?0(imageFile)
46
- sprite.load?1()
47
- sprite.hide?1()
48
- sprite.show?1()
49
- sprite.alpha?1(value)
50
- sprite.red?1(1)
51
- sprite.green?1(1)
52
- sprite.blue?1(1)
53
- sprite.color?1(0, 0, 0, 1)
54
- sprite.red?1()
55
- sprite.green?1()
56
- sprite.blue?1()
57
- sprite.isLoaded?1()
58
- sprite.move?1(x,y)
59
- sprite.getX?1()
60
- sprite.getY?1()
61
- sprite.getZ?1()
62
- sprite.setZ?1()
63
- sprite.getWidth?1()
64
- sprite.getHeight?1()
65
- sprite.setWidth?1(width)
66
- sprite.setHeight?1(height)
67
- sprite.setSize?1(width,height)
68
- sprite.scale?1(scaleX, scaleY)
69
- sprite.scale?1(scaleX, scaleY, centerX, centerY)
70
- sprite.getScale?1()
71
- sprite.getScaleX?1()
72
- sprite.getScaleY?1()
73
- sprite.rotate?1(angle)
74
- sprite.rotate?1(angle, centerX, centerY)
75
- sprite.getAngle?1()
76
- sprite.remove?1()
77
- sprite.contains?1(x,y)
78
- sprite.collidesWith?1(otherSprite)
79
- sprite.getName?1()
80
- sprite.addModifier?1(modifier(from, to, duration, equation, repeatCount=0, startTime = null))
81
- emo.Rectangle?0(use = rectangle)
82
- rectangle.load?1()
83
- rectangle.setSize?1()
84
- emo.Line?0()
85
- line.setWidth?1(value)
86
- line.move?1(startX, startY, endX, endY);
87
- line.load?1()
88
- emo.TextSprite?0(name,textbase,width,height,border = null,margin = null)
89
- text.setText?1()
90
- emo.FontSprite?0(name,fontsize = null,fontface = null,isBold = false,isItalic = false)
91
- text.setParam?1()
92
- text.reload?1()
93
- text.reload?1(name)
94
- emo.SpriteSheet?0(name, width, height, border = 0, margin=0, frameIndex=0) use = spritesheet
95
- emo.SpriteSheet?0(xml_formatted_texture_atlas_data)
96
- spritesheet.setFrame?1(1)
97
- spritesheet.selectFrame?1()
98
- spritesheet.animate?1(startFrame, frameCount, interval, loopCount = 0)
99
- spritesheet.animate?1(frame indices, null, interval, loopCount = 0)
100
- spritesheet.pause?1()
101
- spritesheet.pauseAt?1(frame)
102
- spritesheet.stop?1()
103
- spritesheet.load?1()
104
- spritesheet.load?1(x, y, frameIndex)
105
- spritesheet.getFrameIndex?1()
106
- spritesheet.getFrameCount?1()
107
- spritesheet.isAnimationFinished?1()
108
- emo.MapSprite?0(name, frameWidth, frameHeight, border = 0, margin = 0)
109
- mapsprite.setTile?1(tiles)
110
- mapsprite.clearTiles?1()
111
- mapsprite.addRow?1(tile)
112
- mapsprite.setTileAt?1(row, column, value)
113
- mapsprite.getTileAt?1(row, column)
114
- mapsprite.getTileIndexAtCoord?1(x, y)
115
- mapsprite.getTilePositionAtCoord?1(x, y)
116
- mapsprite.load?1()
117
- mapsprite.load?1(x, y)
118
- emo.AnalogOnScreenController?0(base_name ='controller_base.png', knob_name='controller_knob.png', alpha=0.5) use=controller
119
- emo.DigitalOnScreenController?0(base_name ='controller_base.png', knob_name='controller_knob.png', alpha=0.5) use=controller
120
- controller.updateInterval = 16
121
- onControlEvent?1(controller, controlX, controlY, hasChanged)
122
- emo.AlphaModifier?0(from, to, duration, equation, repeatCount=0, startTime = null)
123
- emo.ScaleModifier?0(from, to, duration, equation, repeatCount=0, startTime = null)
124
- emo.RotateModifier?0(from, to, duration, equation, repeatCount=0, startTime = null)
125
- emo.MoveModifier?0(from, to, duration, equation, repeatCount=0, startTime = null)
126
- emo.MoveCenterModifier?0(from, to, duration, equation, repeatCount=0, startTime = null)
127
- emo.ColorModifier?0(from, to, duration, equation, repeatCount=0, startTime = null)
128
- emo.easing?0
129
- emo.easing.Linear?2
130
- emo.easing.CubicIn?2
131
- emo.easing.CubicOut?2
132
- emo.easing.CubicInOut?2
133
- emo.easing.BackIn?2
134
- emo.easing.BackOut?2
135
- emo.easing.BackInOut?2
136
- emo.easing.ElasticIn?2
137
- emo.easing.ElasticOut?2
138
- emo.easing.ElasticInOut?2
139
- emo.easing.BounceOut?2
140
- emo.easing.BounceIn?2
141
- emo.easing.BounceInOut?2
142
- emo.easing.ExpoIn?2
143
- emo.easing.ExpoOut?2
144
- emo.easing.ExpoInOut?2
145
- emo.easing.QuadIn?2
146
- emo.easing.QuadOut?2
147
- emo.easing.QuadInOut?2
148
- emo.easing.SineIn?2
149
- emo.easing.SineOut?2
150
- emo.easing.SineInOut?2
151
- emo.easing.CircIn?2
152
- emo.easing.CircOut?2
153
- emo.easing.CircInOut?2
154
- emo.easing.QuintIn?2
155
- emo.easing.QuintOut?2
156
- emo.easing.QuintInOut?2
157
- emo.easing.QuartIn?2
158
- emo.easing.QuartOut?2
159
- emo.easing.QuartInOut?2
160
- emo.Audio?0(channelCount)
161
- audio.createChannel?1(channelIndex) use=ch0
162
- emo.Audio?0.vibrate?1(vibration requires android.permission.VIBRATE permission)
163
- emo.Database?0(use = database)
164
- database.getPath?1(DEFAULT_DATABASE_NAME)
165
- database.getLastError?1()
166
- database.getLastErrorMessage?1()
167
- database.deleteDatabase?1(DEFAULT_DATABASE_NAME)
168
- emo.Preference?0(use = preference)
169
- preference.openOrCreate?1() == EMO_NO_ERROR
170
- preference.open?1() == EMO_NO_ERROR
171
- preference.set?1(key, value)
172
- preference.get?1(key)
173
- preference.keys?1()
174
- preference.del?1(key)
175
- preference.close?1()
176
- onMotionEvent?1(mevent)
177
- mevent.getAction?1() = MOTION_EVENT_ACTION_DOWN
178
- mevent.getPointerId?1(Android Only)
179
- mevent.getX?1()
180
- mevent.getY?1()
181
- MOTION_EVENT_ACTION_DOWN?2
182
- MOTION_EVENT_ACTION_UP?2
183
- MOTION_EVENT_ACTION_MOVE?2
184
- MOTION_EVENT_ACTION_CANCEL?2
185
- MOTION_EVENT_ACTION_OUTSIDE?2
186
- MOTION_EVENT_ACTION_POINTER_DOWN?2
187
- MOTION_EVENT_ACTION_POINTER_UP?2
188
- onKeyEvent?1(kevent)
189
- kevent.getAction(?1) = KEY_EVENT_ACTION_DOWN
190
- kevent.getKeyCode?1()
191
- kevent.getRepeatCount?1()
192
- kevent.MetaState?1()
193
- KEY_EVENT_ACTION_DOWN
194
- emo.Event?0(use = event)
195
- event.registerSensors?1(SENSOR_TYPE_ACCELEROMETER) onLoad
196
- event.enableSensor?1(SENSOR_TYPE_ACCELEROMETER, 100) onGainedFocus
197
- event.disableSensor?1(SENSOR_TYPE_ACCELEROMETER) onLostFocus
198
- onSensorEvent?1(sevent)
199
- SENSOR_TYPE_ACCELEROMETER?2
200
- sevent.getType?1() == SENSOR_TYPE_ACCELEROMETER
201
- sevent.getAccelerationX?1()
202
- sevent.getAccelerationY?1()
203
- sevent.getAccelerationZ?1()
204
- event.enableOnDrawCallback?1(5000)
205
- onDrawFrame?1(dt)
206
- event.disableOnDrawCallback?1()
207
- onLowMemory?1()
208
- onError?1(message)
209
- emo.Net.request?1(MY_REQUEST_NAME, 'http://www.example.com/')
210
- emo.Net.request?1(MY_REQUEST_NAME_BY_GET, 'http://www.example.com/', 'GET'', 1000)
211
- emo.Net.request?1(MY_REQUEST_NAME_BY_POST, 'http://www.example.com/','POST', 1000, 'key1', 'value1', 'key2', 'value2')
212
- onNetCallback?1(name, response, err)
globals.py CHANGED
@@ -3,6 +3,7 @@ from platform import system,python_version
3
3
  from PyQt4.QtGui import QIcon
4
4
  from send2trash import send2trash
5
5
  from config import Config
6
+
6
7
  #Python accesses local variables much more efficiently than global variables.
7
8
  oslistdir = os.listdir
8
9
  ospathisdir = os.path.isdir
@@ -11,12 +12,14 @@ ospathjoin = os.path.join
11
12
  ospathexists = os.path.exists
12
13
  ospathbasename = os.path.basename
13
14
  ospathdirname = os.path.dirname
15
+ ospathnormpath = os.path.normpath
16
+ oswalk = os.walk
14
17
  osmkdir = os.mkdir
15
18
  osremove = os.remove
16
19
  osrename = os.rename
17
20
  workDir = os.getcwd()
18
21
  recycle = send2trash
19
-
22
+ ossep = os.sep
20
23
  OS_NAME = system()
21
24
  PY_VERSION = python_version()
22
25
 
@@ -26,7 +29,7 @@ fontSize = config.fontSize()
26
29
  fontName = config.fontName()
27
30
  iconSize = config.iconSize()
28
31
  iconDir = ospathjoin(workDir,"Icons")
29
- adb = config.adb()
32
+ adblist = config.adb()
30
33
 
31
34
  def os_icon(name):
32
35
  return QIcon(":/{0}.gif".format("Icons"+ospathsep+name))
main.py CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  __author__ = "pyros2097"
3
3
  __license__ = "GPLv3"
4
- __version__ = "0.43"
4
+ __version__ = "0.45"
5
5
  __copyright__ = 'Copyright (c) 2012, pyros2097'
6
6
  __credits__ = ['pyros2097', 'eclipse']
7
7
  __email__ = 'pyros2097@gmail.com'
@@ -11,22 +11,20 @@ __email__ = 'pyros2097@gmail.com'
11
11
  #Add Project Options
12
12
  #Add error markers
13
13
 
14
- from PyQt4.QtGui import (QMainWindow,QApplication,QPixmap,QSplashScreen,
14
+ from PyQt4.QtGui import (QMainWindow,QApplication,QPixmap,QSplashScreen,QMessageBox,
15
- QIcon,QAction,QMenu,QMessageBox,QWidgetAction,
15
+ QIcon,QAction,QCheckBox,QFileDialog)
16
- QCheckBox,QFileDialog,QToolButton,QPushButton)
17
- from PyQt4.QtCore import (SIGNAL,Qt,QStringList,QString,
16
+ from PyQt4.QtCore import SIGNAL,Qt,QStringList,QString
18
- QT_VERSION_STR,PYQT_VERSION_STR,QSize)
17
+
19
18
 
20
19
  from ui import Ui_MainWindow
21
20
  import icons_rc
22
21
 
23
22
  from Widget import Editor,PyInterp,Adb
24
23
  #from Dialog import *
25
- from config import Config
26
24
  from adb import Adb
27
25
  from globals import (ospathsep,ospathjoin,ospathbasename,workDir,
28
- OS_NAME,PY_VERSION,os_icon,config,workSpace,fontSize,fontName,
26
+ OS_NAME,PY_VERSION,os_icon,config,workSpace,
29
- iconSize,iconDir,adb)
27
+ iconSize,iconDir)
30
28
 
31
29
 
32
30
 
@@ -35,13 +33,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
35
33
  def __init__(self, parent=None):
36
34
  QMainWindow.__init__(self,parent)
37
35
  self.setupUi(self)
38
- #Important must be empty
36
+ #Important must be empty this is a reference
39
37
  self.files = []
40
38
  self.projects = []
41
39
  self.recent = None
42
40
  self.dirty = None
43
41
  self.isFull = False
44
- self.aaa = Adb(self)
42
+ self.adb = Adb(self)
45
43
  self.setWindowTitle("Sabel")
46
44
  self.setWindowIcon(os_icon("sample"))
47
45
  self.init()
@@ -49,184 +47,54 @@ class MainWindow(QMainWindow, Ui_MainWindow):
49
47
  def init(self):
50
48
  self.initConfig()
51
49
  self.initToolBar()
52
- self.initTree()
53
50
  self.initProjects()
54
- #self.initStyles()
55
51
  self.connect(self, SIGNAL('triggered()'), self.closeEvent)
56
52
  self.connect(self.tabWidget,SIGNAL("dropped"), self.createTab)
57
53
  #self.initInterpreter()
58
54
 
59
55
  def initConfig(self):
60
- self.tabWidget.setTabsClosable(True)
61
56
  self.projects = config.projects()
62
57
  self.recent = config.recent()
63
58
  self.dirty = []
64
59
  self.createTab(config.files())
65
60
  self.tabWidget.tabCloseRequested.connect(self.closeTab)
66
- self.tabWidget.setTabShape(1)
67
-
68
- def initTree(self):
69
61
  self.treeWidget.itemDoubleClicked.connect(self.ss)
70
-
62
+
71
63
  def initProjects(self):
72
64
  if len(self.projects) != 0:
73
- for i in self.projects:
65
+ for pro in self.projects:
74
- self.createProjects(i)
75
-
76
-
77
- def createProjects(self,startDir):
78
- self.treeWidget.addProject(startDir)
66
+ self.treeWidget.addProject(pro)
79
67
 
80
68
  def ss(self,item):
81
69
  if(item.isFile()):
70
+ if(item.isDoc()):
82
- self.createTab(item.getPath())
71
+ self.createTab(item.getPath())
83
-
84
- def initStyles(self):
72
+ elif(item.isPic()):
85
- self.tabWidget.setStyleSheet(stl)
86
- #self.statusBar().setStyleSheet(statl)
73
+ self.createTab(item.getPath())
87
- #self.textEdit.setStyleSheet(scl)
88
- #self.toolbar.setStyleSheet(ttl)
89
74
 
90
75
  def initInterpreter(self):
91
76
  self.ipy = PyInterp(self)
92
77
  self.ipy.initInterpreter(locals())
93
78
  self.tabWidget_3.addTab(self.ipy, "Python")
94
79
 
95
-
96
- def initToolBar(self):
97
- self.action_NewProject = QAction(os_icon('newprj_wiz'), 'Project', self)
98
- self.action_NewProject.setShortcut('Ctrl+P')
99
- self.action_NewProject.triggered.connect(self.newProject)
100
- self.action_NewProject.setToolTip("Create a New Project")
101
- self.action_NewProject.setStatusTip("Create a New Project")
102
-
103
- self.action_Open = QAction(os_icon('__imp_obj'), 'Open', self)
104
- self.action_Open.setShortcut('Ctrl+O')
105
- self.action_Open.triggered.connect(self.fileOpen)
106
- self.action_Open.setToolTip("Open File")
107
- self.action_Open.setStatusTip("Open File")
108
-
109
- self.action_Save = QAction(os_icon('save_edit'), 'Save', self)
110
- self.action_Save.setShortcut('Ctrl+S')
111
- self.action_Save.triggered.connect(self.fileSave)
112
- self.action_Save.setToolTip("Save Current File")
113
- self.action_Save.setStatusTip("Save Current File")
114
-
115
- self.action_SaveAll = QAction(os_icon('saveall_edit'), 'SaveAll', self)
116
- self.action_SaveAll.setShortcut('Ctrl+A')
117
- self.action_SaveAll.triggered.connect(self.fileSaveAll)
118
- self.action_SaveAll.setToolTip("Save All Files")
119
- self.action_SaveAll.setStatusTip("Save All Files")
120
- self.action_Help = QAction(os_icon('toc_open'), 'Help', self)
121
- self.action_Help.triggered.connect(self.help)
122
- self.action_About = QAction(os_icon('alert_obj'), 'About', self)
123
- self.action_About.triggered.connect(self.about)
124
- self.action_Run = QAction(os_icon('lrun_obj'), 'Run', self)
125
- self.action_Run.setShortcut('Ctrl+R')
126
- self.action_Run.triggered.connect(self.aaa.run)
127
- self.action_RunFile = QAction(os_icon('start_ccs_task'), 'File', self)
128
- self.action_Stop = QAction(os_icon('term_sbook'), 'Stop', self)
129
- self.action_Stop.setShortcut('Ctrl+Q')
130
- self.action_Stop.triggered.connect(self.aaa.stop)
131
- self.action_Design = QAction(os_icon('task_set'), 'Design', self)
132
- #self.action_Design.triggered.connect(self.stop)
133
- self.action_Todo = QAction(os_icon('task_set'), 'Todo', self)
134
- #self.action_Todo.triggered.connect(self.stop)
135
- #Only variation CHeck Later
136
- self.action_Options = QAction(QIcon(":/{0}.png".format("Icons"+ospathsep+'emblem-system')), 'Options', self)
137
- self.action_Options.triggered.connect(self.options)
138
- self.action_Full = QAction(os_icon('task_set'), 'Full', self)
139
- self.action_Full.setShortcut('Shift+Enter')
140
- self.action_Full.triggered.connect(self.full)
141
-
142
- self.action_Syntax = QAction(os_icon('task_set'), 'Syntax', self)
143
- men = QMenu()#public_co.gif
144
- #chkBox =QCheckBox(men)
145
- #chkBox.setText("MyCheckBox")
146
- chkBoxAction=QWidgetAction(men)
147
- #chkBoxAction.setDefaultWidget(QPixmap(":/Icons/public_co"))
148
- men.addAction(chkBoxAction)
149
-
150
- men.addAction(QAction("C",self))
151
- men.addAction(QAction("C++",self))
152
- men.addAction(QAction("C#",self))
153
- men.addAction(QAction("Java",self))
154
- men.addAction(QAction("Lua",self))
155
- men.addAction(QAction("Python",self))
156
- men.addAction(QAction("Ruby",self))
157
- men.addAction(QAction("Squirrel",self))
158
- self.action_Syntax.setMenu(men)
159
-
160
-
161
-
162
- self.action_Style = QAction(os_icon('welcome16'), 'Style', self)
163
- self.action_Style.triggered.connect(self.style)
164
- men1 = QMenu()
165
- men1.addAction(QAction("All Hallow's Eve",self))
166
- men1.addAction(QAction("Amy",self))
167
- men1.addAction(QAction("Aptana Studio",self))
168
- men1.addAction(QAction("Bespin",self))
169
- men1.addAction(QAction("Blackboard",self))
170
- men1.addAction(QAction("Choco",self))
171
- men1.addAction(QAction("Cobalt",self))
172
- men1.addAction(QAction("Dawn",self))
173
- men1.addAction(QAction("Eclipse",self))
174
- men1.addAction(QAction("IDLE",self))
175
- men1.addAction(QAction("Mac Classic",self))
176
- men1.addAction(QAction("Monokai",self))
177
- men1.addAction(QAction("Monokai Dark",self))
178
- men1.addAction(QAction("Pastels on Dark",self))
179
- men1.addAction(QAction("Sunburst",self))
180
- men1.addAction(QAction("Twilight",self))
181
- self.action_Style.setMenu(men1)
182
-
183
-
184
-
185
- self.action_Stop.setDisabled(True)
186
- self.toolbar = self.addToolBar('ToolBar')
187
- self.toolbar.setIconSize(QSize(16,16))
188
- self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
189
- self.toolbar.setAllowedAreas(Qt.AllToolBarAreas)
190
-
191
- self.toolbar.addAction(self.action_NewProject)
192
- self.toolbar.addAction(self.action_Open)
193
- self.toolbar.addAction(self.action_Save)
194
- self.toolbar.addAction(self.action_SaveAll)
195
- self.toolbar.addSeparator()
196
- self.toolbar.addAction(self.action_Run)
197
- self.toolbar.addAction(self.action_RunFile)
198
- self.toolbar.addAction(self.action_Stop)
199
- self.toolbar.addSeparator()
200
- self.toolbar.addAction(self.action_Design)
201
- self.toolbar.addAction(self.action_Todo)
202
- self.toolbar.addAction(self.action_Options)
203
- self.toolbar.addAction(self.action_Syntax)
204
- self.toolbar.addAction(self.action_Style)
205
- self.toolbar.addSeparator()
206
- self.toolbar.addAction(self.action_Help)
207
- self.toolbar.addAction(self.action_About)
208
- self.toolbar.addAction(self.action_Full)
209
-
210
80
  def createTab(self,nfile):
211
81
  if(nfile != None):
212
82
  if len(self.files) != 0:
213
83
  for i in self.files:
214
84
  if(i == nfile):
215
- QMessageBox.about(self,"Can't Open","File Already Open")
85
+ QMessageBox.about(self,"Can't Open","File Already Open\n"+nfile)
216
86
  return
217
87
  if type(nfile) == str:
218
- config.addFile(nfile)
219
- self.files.append(nfile)
220
- self.dirty.append(False)
221
88
  try:
222
89
  infile = open(nfile, 'r')
90
+ config.addFile(nfile)
91
+ self.files.append(nfile)
92
+ self.dirty.append(False)
223
- tab = Editor(fontSize,fontName)
93
+ tab = Editor(self,infile.read())
224
- tab.setObjectName("tab"+nfile)
225
94
  self.tabWidget.addTab(tab,ospathbasename(nfile))
226
- tab.setText(infile.read())
227
95
  tab.textChanged.connect(lambda:self.setDirty(nfile))
228
96
  except:
229
- QMessageBox.about(self,"Can't Open","File Does Not Exist")
97
+ QMessageBox.about(self,"Can't Open","File Does Not Exist\n"+nfile)
230
98
  else:
231
99
  for i in nfile:
232
100
  self.createTab(i)
@@ -270,41 +138,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
270
138
  flbase = ospathbasename(self.files[index])
271
139
  self.tabWidget.setTabText(index,flbase)
272
140
 
273
- def about(self):
274
- QMessageBox.about(self, "About Sabel IDE",
275
- """
276
- <b>Sabel</b> v%s
277
- <p>
278
- All rights reserved in accordance with
279
- GPL v3 or later.
280
- <p>This application can be used for Squirrel and EmoFramework Projects.
281
- <p>Squirrel Shell (c) 2006-2011, Constantin Makshin
282
- <p>Squirrel (c) Alberto Demichelis
283
- <p>zlib (c) Jean-loup Gailly and Mark Adler
284
- <p>Icons (c) Eclipse EPL
285
- <p>Python %s - Qt %s - PyQt %s on %s
286
- <p>Copyright (c) 2011 emo-framework project
287
- <p>Created By: pyros2097
288
- <p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
289
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING, BUT NOT
290
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
291
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
292
- EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
293
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
294
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
295
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
296
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
297
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
298
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
299
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
300
- POSSIBILITY OF SUCH DAMAGE.
301
- """ % (
302
- __version__,PY_VERSION,
303
- QT_VERSION_STR, PYQT_VERSION_STR,OS_NAME))
304
-
305
- def help(self):
306
- QMessageBox.about(self, "About Simple Editor","This is The Help")
307
-
308
141
  def newProject(self):
309
142
  fname = str(QFileDialog.getExistingDirectory(self,"Open File"))
310
143
  if not (fname == ""):
@@ -316,7 +149,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
316
149
  config.addProject(fname)
317
150
  return
318
151
  else:
319
- QMessageBox.about(self, "Already Open","Project Already Open")
152
+ QMessageBox.about(self, "Already Open","Project Already Open\n"+fname)
320
153
  return
321
154
  return
322
155
 
@@ -325,21 +158,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
325
158
 
326
159
  def style(self):
327
160
  pass
328
-
329
- def full(self):
330
- if not self.isFull:
331
- self.setWindowState(Qt.WindowFullScreen)
332
- self.isFull = True
333
- else:
334
- self.setWindowState(Qt.WindowMaximized)
335
- self.isFull = False
336
161
 
337
- def cmd(self):
338
- if(self.tabWidget_3.isHidden()):
339
- self.tabWidget_3.show()
340
- else:
341
- self.tabWidget_3.hide()
342
-
343
162
  def options(self):
344
163
  pass
345
164
 
@@ -394,7 +213,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
394
213
 
395
214
  def closeEvent(self, event):
396
215
  #check this ine adb.exe process is always on
397
- self.aaa.close()
216
+ self.adb.close()
398
217
  for i in self.dirty:
399
218
  if i:
400
219
  reply = QMessageBox.question(self,
@@ -405,28 +224,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
405
224
  pass
406
225
  elif reply == QMessageBox.Yes:
407
226
  self.fileSaveAll()
408
-
409
- def findCurrentText(self):
410
- #print self.caseSensitive.isChecked()
411
- #print self.wholeWord.isChecked()
412
- #print self.regex.isChecked()
413
- #print self.backward.isChecked()
414
- edt = self.tabWidget.widget(self.tabWidget.currentIndex())
415
- edt.findText(self.lineEdit.text(),self.regex.isChecked(),self.caseSensitive.isChecked(),self.wholeWord.isChecked(),self.backward.isChecked())
416
-
417
- def replaceCurrentText(self):
418
- edt = self.tabWidget.widget(self.tabWidget.currentIndex())
419
- done = edt.findText(self.lineEdit.text(),self.regex.isChecked(),self.caseSensitive.isChecked(),self.wholeWord.isChecked(),self.backward.isChecked())
420
- if(done):
421
- edt.replaceText(self.lineEdit_2.text())
422
- else:
423
- QMessageBox.about(self, "About Sabel IDE","Could Not Find Text")
424
- return done
425
-
426
- def replaceAllText(self):
427
- edt = self.tabWidget.widget(self.tabWidget.currentIndex())
428
- while(edt.findText(self.lineEdit.text(),self.regex.isChecked(),self.caseSensitive.isChecked(),self.wholeWord.isChecked(),self.backward.isChecked())):
429
- edt.replaceText(self.lineEdit_2.text())
430
227
 
431
228
 
432
229
  if __name__ == "__main__":
@@ -435,8 +232,7 @@ if __name__ == "__main__":
435
232
  splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
436
233
  splash.setMask(splash_pix.mask())
437
234
  splash.show()
438
- app.processEvents()
235
+ #app.processEvents()
439
-
440
236
  # Simulate something that takes time
441
237
  frame = MainWindow()
442
238
  frame.showMaximized()
ui.py CHANGED
@@ -1,95 +1,111 @@
1
+ from PyQt4.QtGui import (QAction,QIcon,QMessageBox,QWidgetAction,QMenu,QWidget,
2
+ QHBoxLayout,QVBoxLayout,QTabWidget,QToolBar,QTextEdit,
3
+ QLineEdit,QPushButton,QToolButton,QSplitter,QStatusBar)
1
- from PyQt4 import QtCore, QtGui
4
+ from PyQt4.QtCore import QSize,Qt, QT_VERSION_STR,PYQT_VERSION_STR
2
5
  from Widget import Tab,Tree
6
+
3
- from globals import os_icon
7
+ from globals import (ospathsep,ospathjoin,ospathbasename,workDir,
8
+ OS_NAME,PY_VERSION,os_icon,config,workSpace,
9
+ iconSize,iconDir)
10
+
11
+
12
+ __version__ = "0.45"
4
13
 
5
14
  class Ui_MainWindow(object):
6
15
  def setupUi(self, MainWindow):
7
16
  MainWindow.setObjectName("MainWindow")
8
17
  MainWindow.resize(758, 673)
9
- self.centralwidget = QtGui.QWidget(MainWindow)
18
+ self.centralwidget = QWidget(MainWindow)
10
19
  self.centralwidget.setObjectName("centralwidget")
11
- self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget)
20
+ self.horizontalLayout = QHBoxLayout(self.centralwidget)
12
21
  self.horizontalLayout.setObjectName("horizontalLayout")
13
22
 
14
23
  #TabWidgets
24
+ self.tab_1 = QWidget(self)
25
+ self.tab_1.setObjectName("tab_1")
26
+ self.tab_1.setMinimumWidth(500)
15
- self.tabWidget = Tab(self)
27
+ self.tabWidget = Tab(self.tab_1)
16
- self.tabWidget.setMinimumSize(QtCore.QSize(500, 0))
17
28
  self.tabWidget.setObjectName("tabWidget")
29
+ self.VericalLayout = QVBoxLayout(self.tab_1)
30
+ self.VericalLayout.setMargin(0)
31
+ self.VericalLayout.setObjectName("VericalLayout")
32
+ self.VericalLayout.addWidget(self.tabWidget)
33
+
18
- self.tabWidget_2 = QtGui.QTabWidget(self)
34
+ self.tabWidget_2 = QTabWidget(self)
19
- self.tabWidget_2.setMaximumSize(QtCore.QSize(200, 16777215))
35
+ self.tabWidget_2.setMaximumWidth(200)
20
36
  self.tabWidget_2.setObjectName("tabWidget_2")
21
- self.tabWidget_3 = QtGui.QTabWidget(self)
37
+ self.tabWidget_3 = QTabWidget(self)
22
- self.tabWidget_3.setMaximumSize(16777215,200)
23
- self.tabWidget_3.setMinimumSize(0,75)
38
+ self.tabWidget_3.setMaximumHeight(200)
24
39
  self.tabWidget_3.setObjectName("tabWidget_3")
25
40
 
26
41
  #Tree
27
- self.tab_5 = QtGui.QWidget()
42
+ self.tab_5 = QWidget()
28
43
  self.tab_5.setObjectName("tab_5")
29
- self.tab_5.setMaximumSize(QtCore.QSize(200, 16777215))
44
+ self.tab_5.setMaximumWidth(200)
30
- self.horizontalLayout_3 = QtGui.QVBoxLayout(self.tab_5)#QHBoxLayout(self.tab_5)
45
+ self.VerticalLayout_2 = QVBoxLayout(self.tab_5)#QHBoxLayout(self.tab_5)
31
- self.horizontalLayout_3.setMargin(0)
46
+ self.VerticalLayout_2.setMargin(0)
32
- self.horizontalLayout_3.setObjectName("horizontalLayout_3")
47
+ self.VerticalLayout_2.setObjectName("horizontalLayout_3")
33
48
  self.treeWidget = Tree(self.tab_5)
34
49
  self.treeWidget.setObjectName("treeWidget")
35
- self.treebar = QtGui.QToolBar()
50
+ self.treebar = QToolBar()
36
- action_Folder = QtGui.QAction(os_icon('newfolder_wiz'),'New Folder', self)
51
+ action_Folder = QAction(os_icon('newfolder_wiz'),'New Folder', self)
37
52
  self.treebar.addAction(action_Folder)
53
+ self.treebar.setIconSize(QSize(16,16))
54
+ self.treebar.setMaximumHeight(23)
38
- self.horizontalLayout_3.addWidget(self.treebar)
55
+ self.VerticalLayout_2.addWidget(self.treebar)
39
- self.horizontalLayout_3.addWidget(self.treeWidget)
56
+ self.VerticalLayout_2.addWidget(self.treeWidget)
40
-
41
57
 
42
58
  #Output
43
- self.tab_6 = QtGui.QWidget()
59
+ self.tab_6 = QWidget()
44
60
  self.tab_6.setObjectName("tab_6")
45
61
  #GGGGGGGGGGGGGGGGGGGG AWESOME
46
- self.horizontalLayout_2 = QtGui.QHBoxLayout(self.tab_6)
62
+ self.horizontalLayout_2 = QHBoxLayout(self.tab_6)
47
63
  self.horizontalLayout_2.setMargin(0)
48
64
  self.horizontalLayout_2.setObjectName("horizontalLayout_2")
49
- self.textEdit = QtGui.QTextEdit(self.tab_6)
65
+ self.textEdit = QTextEdit(self.tab_6)
50
66
  self.textEdit.setObjectName("textEdit")
51
67
  self.horizontalLayout_2.addWidget(self.textEdit)
52
68
 
53
69
  #Error
54
- self.tab_7 = QtGui.QWidget()
70
+ self.tab_7 = QWidget()
55
71
  self.tab_7.setObjectName("tab_7")
56
- self.horizontalLayout_4 = QtGui.QHBoxLayout(self.tab_7)
72
+ self.horizontalLayout_4 = QHBoxLayout(self.tab_7)
57
73
  self.horizontalLayout_4.setMargin(0)
58
74
  self.horizontalLayout_4.setObjectName("horizontalLayout_4")
59
- self.textEdit_2 = QtGui.QTextEdit(self.tab_7)
75
+ self.textEdit_2 = QTextEdit(self.tab_7)
60
76
  self.textEdit_2.setObjectName("textEdit_2")
61
77
  self.horizontalLayout_4.addWidget(self.textEdit_2)
62
78
 
63
79
  #Find
64
- self.tab_8 = QtGui.QWidget()
80
+ self.tab_8 = QWidget()
65
81
  self.tab_8.setObjectName("tab_8")
66
- self.horizontalLayout_5 = QtGui.QHBoxLayout(self.tab_8)
82
+ self.horizontalLayout_5 = QHBoxLayout(self.tab_8)
67
83
  self.horizontalLayout_5.setObjectName("horizontalLayout_5")
68
- self.lineEdit = QtGui.QLineEdit(self.tab_8)
84
+ self.lineEdit = QLineEdit(self.tab_8)
69
85
  self.lineEdit.setObjectName("lineEdit")
70
- self.lineEdit_2 = QtGui.QLineEdit(self.tab_8)
86
+ self.lineEdit_2 = QLineEdit(self.tab_8)
71
87
  self.lineEdit_2.setObjectName("lineEdit_2")
72
- self.find = QtGui.QPushButton(self.tab_8)
88
+ self.find = QPushButton(self.tab_8)
73
89
  self.find.setText("Find")
74
90
  self.find.clicked.connect(self.findCurrentText)
75
- self.replacefind = QtGui.QPushButton(self.tab_8)
91
+ self.replacefind = QPushButton(self.tab_8)
76
92
  self.replacefind.setText("Replace/Find")
77
- self.replace = QtGui.QPushButton(self.tab_8)
93
+ self.replace = QPushButton(self.tab_8)
78
94
  self.replace.setText("Replace")
79
95
  self.replace.clicked.connect(self.replaceCurrentText)
80
- self.replaceAll = QtGui.QPushButton(self.tab_8)
96
+ self.replaceAll = QPushButton(self.tab_8)
81
97
  self.replaceAll.setText("Replace All")
82
98
  self.replaceAll.clicked.connect(self.replaceAllText)
83
- self.caseSensitive = QtGui.QToolButton(self.tab_8)
99
+ self.caseSensitive = QToolButton(self.tab_8)
84
100
  self.caseSensitive.setText("cs")
85
101
  self.caseSensitive.setCheckable(True)
86
- self.wholeWord = QtGui.QToolButton(self.tab_8)
102
+ self.wholeWord = QToolButton(self.tab_8)
87
103
  self.wholeWord.setText("ww")
88
104
  self.wholeWord.setCheckable(True)
89
- self.regex = QtGui.QToolButton(self.tab_8)
105
+ self.regex = QToolButton(self.tab_8)
90
106
  self.regex.setText("re")
91
107
  self.regex.setCheckable(True)
92
- self.backward = QtGui.QToolButton(self.tab_8)
108
+ self.backward = QToolButton(self.tab_8)
93
109
  self.backward.setText("bk")
94
110
  self.backward.setCheckable(True)
95
111
  self.backward.setDisabled(True)
@@ -104,7 +120,10 @@ class Ui_MainWindow(object):
104
120
  self.horizontalLayout_5.addWidget(self.replace)
105
121
  self.horizontalLayout_5.addWidget(self.replaceAll)
106
122
  self.horizontalLayout_5.setMargin(0)
107
- self.tab_8.setMaximumSize(16777215, 25)
123
+ self.tab_8.setMaximumHeight(25)
124
+ self.VericalLayout.addWidget(self.tab_8)
125
+ self.tab_8.hide()
126
+
108
127
 
109
128
  self.tabWidget_2.addTab(self.tab_5,"Projects")
110
129
  self.tabWidget_3.addTab(self.tab_7,"Error")
@@ -112,34 +131,29 @@ class Ui_MainWindow(object):
112
131
  self.tabWidget_3.setTabIcon(0,os_icon("message_error"))
113
132
  self.tabWidget_3.setTabIcon(1,os_icon("monitor_obj"))
114
133
 
134
+
115
135
  #Splitters
116
- self.split1 = QtGui.QSplitter(QtCore.Qt.Horizontal)
136
+ self.split1 = QSplitter(Qt.Horizontal)
117
- self.split1.addWidget(self.tabWidget)
137
+ self.split1.addWidget(self.tab_1)
118
138
  #self.split1.addWidget(self.tab_5)
119
139
  self.split1.addWidget(self.tabWidget_2)
120
- self.split2 = QtGui.QSplitter(QtCore.Qt.Vertical)
140
+ self.split2 = QSplitter(Qt.Vertical)
121
141
  self.split2.addWidget(self.split1)
122
- self.split2.addWidget(self.tab_8)
123
142
  self.split2.addWidget(self.tabWidget_3)
124
143
  self.tabWidget_3.hide()
125
144
  self.horizontalLayout.addWidget(self.split2)
126
145
 
127
- #Init
128
- MainWindow.setCentralWidget(self.centralwidget)
129
- self.statusbar = QtGui.QStatusBar(MainWindow)
130
- self.statusbar.setObjectName("statusbar")
131
- MainWindow.setStatusBar(self.statusbar)
132
- self.tabWidget.setCurrentIndex(-1)
133
- self.tab_8.hide()
134
146
 
135
147
  #Status
148
+ self.statusbar = QStatusBar(MainWindow)
149
+ self.statusbar.setObjectName("statusbar")
136
- self.cmdButton = QtGui.QPushButton(self)
150
+ self.cmdButton = QPushButton(self)
137
151
  self.cmdButton.setFlat(True)
138
152
  self.cmdButton.setIcon(os_icon('monitor_obj'))
139
153
  self.cmdButton.clicked.connect(self.cmd)
140
154
  self.cmdButton.setShortcut('Ctrl+O')
141
155
  #self.cmdButton.setToolTip("Opens Console Ctrl+O")
142
- self.findButton = QtGui.QPushButton(self)
156
+ self.findButton = QPushButton(self)
143
157
  self.findButton.setFlat(True)
144
158
  self.findButton.setIcon(os_icon('find_obj'))
145
159
  self.findButton.setShortcut("Ctrl+F")
@@ -147,6 +161,13 @@ class Ui_MainWindow(object):
147
161
  self.findButton.clicked.connect(self.findBarShow)
148
162
  self.statusbar.addWidget(self.cmdButton)
149
163
  self.statusbar.addWidget(self.findButton)
164
+ self.statusbar.setFixedHeight(18)
165
+
166
+ #Init
167
+ MainWindow.setCentralWidget(self.centralwidget)
168
+ MainWindow.setStatusBar(self.statusbar)
169
+ self.tabWidget.setTabsClosable(True)
170
+ self.tabWidget.setTabShape(0)
150
171
  #QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('Cleanlooks'))
151
172
 
152
173
  def findBarShow(self):
@@ -154,3 +175,180 @@ class Ui_MainWindow(object):
154
175
  self.tab_8.show()
155
176
  else:
156
177
  self.tab_8.hide()
178
+
179
+ def initToolBar(self):
180
+ self.action_NewProject = QAction(os_icon('newprj_wiz'), 'Project', self)
181
+ self.action_NewProject.setShortcut('Ctrl+P')
182
+ self.action_NewProject.triggered.connect(self.newProject)
183
+ self.action_NewProject.setToolTip("Create a New Project")
184
+ self.action_NewProject.setStatusTip("Create a New Project")
185
+
186
+ self.action_Open = QAction(os_icon('__imp_obj'), 'Open', self)
187
+ self.action_Open.setShortcut('Ctrl+O')
188
+ self.action_Open.triggered.connect(self.fileOpen)
189
+ self.action_Open.setToolTip("Open File")
190
+ self.action_Open.setStatusTip("Open File")
191
+
192
+ self.action_Save = QAction(os_icon('save_edit'), 'Save', self)
193
+ self.action_Save.setShortcut('Ctrl+S')
194
+ self.action_Save.triggered.connect(self.fileSave)
195
+ self.action_Save.setToolTip("Save Current File")
196
+ self.action_Save.setStatusTip("Save Current File")
197
+
198
+ self.action_SaveAll = QAction(os_icon('saveall_edit'), 'SaveAll', self)
199
+ self.action_SaveAll.setShortcut('Ctrl+A')
200
+ self.action_SaveAll.triggered.connect(self.fileSaveAll)
201
+ self.action_SaveAll.setToolTip("Save All Files")
202
+ self.action_SaveAll.setStatusTip("Save All Files")
203
+ self.action_Help = QAction(os_icon('toc_open'), 'Help', self)
204
+ self.action_Help.triggered.connect(self.help)
205
+ self.action_About = QAction(os_icon('alert_obj'), 'About', self)
206
+ self.action_About.triggered.connect(self.about)
207
+ self.action_Run = QAction(os_icon('lrun_obj'), 'Run', self)
208
+ self.action_Run.setShortcut('Ctrl+R')
209
+ self.action_Run.triggered.connect(self.adb.run)
210
+ self.action_RunFile = QAction(os_icon('start_ccs_task'), 'File', self)
211
+ self.action_Stop = QAction(os_icon('term_sbook'), 'Stop', self)
212
+ self.action_Stop.setShortcut('Ctrl+Q')
213
+ self.action_Stop.triggered.connect(self.adb.stop)
214
+ self.action_Design = QAction(os_icon('task_set'), 'Design', self)
215
+ #self.action_Design.triggered.connect(self.stop)
216
+ self.action_Todo = QAction(os_icon('task_set'), 'Todo', self)
217
+ #self.action_Todo.triggered.connect(self.stop)
218
+ #Only variation CHeck Later
219
+ self.action_Options = QAction(QIcon(":/{0}.png".format("Icons"+ospathsep+'emblem-system')), 'Options', self)
220
+ self.action_Options.triggered.connect(self.options)
221
+ self.action_Full = QAction(os_icon('task_set'), 'Full', self)
222
+ self.action_Full.setShortcut('Shift+Enter')
223
+ self.action_Full.triggered.connect(self.full)
224
+
225
+ self.action_Syntax = QAction(os_icon('task_set'), 'Syntax', self)
226
+ men = QMenu()#public_co.gif
227
+ #chkBox =QCheckBox(men)
228
+ #chkBox.setText("MyCheckBox")
229
+ chkBoxAction=QWidgetAction(men)
230
+ #chkBoxAction.setDefaultWidget(QPixmap(":/Icons/public_co"))
231
+ men.addAction(chkBoxAction)
232
+
233
+ men.addAction(QAction("C",self))
234
+ men.addAction(QAction("C++",self))
235
+ men.addAction(QAction("Lua",self))
236
+ men.addAction(QAction("Squirrel",self))
237
+ self.action_Syntax.setMenu(men)
238
+
239
+
240
+
241
+ self.action_Style = QAction(os_icon('welcome16'), 'Style', self)
242
+ self.action_Style.triggered.connect(self.style)
243
+ men1 = QMenu()
244
+ men1.addAction(QAction("All Hallow's Eve",self))
245
+ men1.addAction(QAction("Amy",self))
246
+ men1.addAction(QAction("Aptana Studio",self))
247
+ men1.addAction(QAction("Bespin",self))
248
+ men1.addAction(QAction("Blackboard",self))
249
+ men1.addAction(QAction("Choco",self))
250
+ men1.addAction(QAction("Cobalt",self))
251
+ men1.addAction(QAction("Dawn",self))
252
+ men1.addAction(QAction("Eclipse",self))
253
+ men1.addAction(QAction("IDLE",self))
254
+ men1.addAction(QAction("Mac Classic",self))
255
+ men1.addAction(QAction("Monokai",self))
256
+ men1.addAction(QAction("Monokai Dark",self))
257
+ men1.addAction(QAction("Pastels on Dark",self))
258
+ men1.addAction(QAction("Sunburst",self))
259
+ men1.addAction(QAction("Twilight",self))
260
+ self.action_Style.setMenu(men1)
261
+
262
+
263
+
264
+ self.action_Stop.setDisabled(True)
265
+ self.toolbar = self.addToolBar('ToolBar')
266
+ self.toolbar.setIconSize(QSize(16,16))
267
+ self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
268
+ self.toolbar.setAllowedAreas(Qt.AllToolBarAreas)
269
+
270
+ self.toolbar.addAction(self.action_NewProject)
271
+ self.toolbar.addAction(self.action_Open)
272
+ self.toolbar.addAction(self.action_Save)
273
+ self.toolbar.addAction(self.action_SaveAll)
274
+ self.toolbar.addSeparator()
275
+ self.toolbar.addAction(self.action_Run)
276
+ self.toolbar.addAction(self.action_RunFile)
277
+ self.toolbar.addAction(self.action_Stop)
278
+ self.toolbar.addSeparator()
279
+ self.toolbar.addAction(self.action_Design)
280
+ self.toolbar.addAction(self.action_Todo)
281
+ self.toolbar.addAction(self.action_Options)
282
+ self.toolbar.addAction(self.action_Syntax)
283
+ self.toolbar.addAction(self.action_Style)
284
+ self.toolbar.addSeparator()
285
+ self.toolbar.addAction(self.action_Help)
286
+ self.toolbar.addAction(self.action_About)
287
+ self.toolbar.addAction(self.action_Full)
288
+
289
+ def about(self):
290
+ QMessageBox.about(self, "About Sabel IDE",
291
+ """
292
+ <b>Sabel</b> v%s
293
+ <p>
294
+ All rights reserved in accordance with
295
+ GPL v3 or later.
296
+ <p>This application can be used for Squirrel and EmoFramework Projects.
297
+ <p>Squirrel Shell (c) 2006-2011, Constantin Makshin
298
+ <p>Squirrel (c) Alberto Demichelis
299
+ <p>zlib (c) Jean-loup Gailly and Mark Adler
300
+ <p>Icons (c) Eclipse EPL
301
+ <p>Python %s - Qt %s - PyQt %s on %s
302
+ <p>Copyright (c) 2011 emo-framework project
303
+ <p>Created By: pyros2097
304
+ <p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
305
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING, BUT NOT
306
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
307
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
308
+ EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
309
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
310
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
311
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
312
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
313
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
314
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
315
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
316
+ POSSIBILITY OF SUCH DAMAGE.
317
+ """ % (
318
+ __version__,PY_VERSION,
319
+ QT_VERSION_STR, PYQT_VERSION_STR,OS_NAME))
320
+
321
+ def help(self):
322
+ QMessageBox.about(self, "About Simple Editor","This is The Help")
323
+
324
+ def full(self):
325
+ if not self.isFull:
326
+ self.setWindowState(Qt.WindowFullScreen)
327
+ self.isFull = True
328
+ else:
329
+ self.setWindowState(Qt.WindowMaximized)
330
+ self.isFull = False
331
+
332
+ def cmd(self):
333
+ if(self.tabWidget_3.isHidden()):
334
+ self.tabWidget_3.show()
335
+ else:
336
+ self.tabWidget_3.hide()
337
+
338
+ def findCurrentText(self):
339
+ edt = self.tabWidget.widget(self.tabWidget.currentIndex())
340
+ edt.findText(self.lineEdit.text(),self.regex.isChecked(),self.caseSensitive.isChecked(),self.wholeWord.isChecked(),self.backward.isChecked())
341
+
342
+ def replaceCurrentText(self):
343
+ edt = self.tabWidget.widget(self.tabWidget.currentIndex())
344
+ done = edt.findText(self.lineEdit.text(),self.regex.isChecked(),self.caseSensitive.isChecked(),self.wholeWord.isChecked(),self.backward.isChecked())
345
+ if(done):
346
+ edt.replaceText(self.lineEdit_2.text())
347
+ else:
348
+ QMessageBox.about(self, "About Sabel IDE","Could Not Find Text")
349
+ return done
350
+
351
+ def replaceAllText(self):
352
+ edt = self.tabWidget.widget(self.tabWidget.currentIndex())
353
+ while(edt.findText(self.lineEdit.text(),self.regex.isChecked(),self.caseSensitive.isChecked(),self.wholeWord.isChecked(),self.backward.isChecked())):
354
+ edt.replaceText(self.lineEdit_2.text())
ui_simple.pyc DELETED
Binary file