3d6c2c7e pyros2097

13 years ago
0.31
Files changed (10) hide show
  1. .pydevproject +1 -1
  2. Config.pyc +0 -0
  3. README.md +6 -1
  4. Widget/tree.py +1 -0
  5. Widget/tree.pyc +0 -0
  6. config.py +13 -12
  7. config.yaml +3 -5
  8. main.py +76 -62
  9. styles.py +6 -6
  10. styles.pyc +0 -0
.pydevproject CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  <pydev_project>
5
5
  <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
6
- <path>/IDE</path>
6
+ <path>/Sabel</path>
7
7
  </pydev_pathproperty>
8
8
  <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
9
9
  <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
Config.pyc CHANGED
Binary file
README.md CHANGED
@@ -1,4 +1,9 @@
1
1
  Sabel
2
2
  =====
3
3
 
4
+ Sabel is an IDE for programming squirrel and EmoFramework.
5
+ Can be used to Create games for android and ios.
6
+
7
+ Check out Sabel at http://code.google.com/p/sabel-ide/
4
- A Squirrel and EmoFrameWork IDE written in PyQt4
8
+ Check out Squirrel at http://www.squirrel-lang.org
9
+ Check out Emo at http://www.emo-framework.com
Widget/tree.py CHANGED
@@ -24,6 +24,7 @@ class Tree(QTreeWidget):
24
24
  self.setAcceptDrops(True)
25
25
  self.setColumnCount(1)
26
26
  self.projects = 0
27
+ self.header().close()
27
28
  self.setContextMenuPolicy(Qt.CustomContextMenu)
28
29
  self.connect(self,SIGNAL("customContextMenuRequested(const QPoint &)"), self.doMenu)
29
30
  self.connect(self, SIGNAL("dropped"), self.addItem)
Widget/tree.pyc CHANGED
Binary file
config.py CHANGED
@@ -37,17 +37,22 @@ class Config:
37
37
  for i in data:
38
38
  if(i == nfile):
39
39
  return False
40
- return True
40
+ return True
41
41
 
42
-
42
+
43
43
  def addFile(self,nfile):
44
44
  files = self.files()
45
45
  if(self.check(files,nfile)):
46
+ if(os.path.exists(nfile)):
46
- files.append(nfile)
47
+ files.append(nfile)
47
- try:
48
+ try:
48
- yaml.dump(self.data,open(self.configfile,'w'),default_flow_style=False)
49
+ yaml.dump(self.data,open(self.configfile,'w'),default_flow_style=False)
49
- except:
50
+ except:
50
- print "cannot open config file"
51
+ print "cannot open config file"
52
+ else:
53
+ print "File Does not Exist"
54
+ else:
55
+ print "File is Already Saved"
51
56
 
52
57
  def removeFile(self,nfile):
53
58
  files = self.files()
@@ -74,8 +79,4 @@ class Config:
74
79
  try:
75
80
  yaml.dump(self.data,open(self.configfile,'w'),default_flow_style=False)
76
81
  except:
77
- print "cannot open config file"
82
+ print "cannot open config file"
78
-
79
- if __name__ == '__main__':
80
- config = Config()
81
- config.addFile("C:/CO")
config.yaml CHANGED
@@ -1,10 +1,8 @@
1
1
  File:
2
- - C:\CODE\IDE\main.nut
3
- - C:\CODE\assets\main.nut
2
+ - C:/CODE/assets/main.nut
3
+ - C:/CODE/assets/commo.nut
4
4
  Project:
5
- - C:\CODE\assets\
5
+ - C:/CODE/assets/
6
- - C:\CODE\IDE\
7
- - !!python/unicode 'C:/CODE/Icons'
8
6
  Recent:
9
7
  - C:\CODE\IDE\main.nut
10
8
  Setting:
main.py CHANGED
@@ -1,18 +1,20 @@
1
1
  #!/usr/bin/env python
2
2
  __author__ = "pyros2097"
3
3
  __license__ = "GPLv3"
4
- __version__ = "0.3"
4
+ __version__ = "0.31"
5
5
  __copyright__ = 'Copyright 2012, pyros2097'
6
6
  __credits__ = ['pyros2097', 'eclipse']
7
7
  __email__ = 'pyros2097@gmail.com'
8
8
 
9
- import sys
9
+ #TODO:
10
+ #Need to add options for all GUI
11
+
10
12
  import os
11
13
  import platform
12
14
 
13
-
15
+ from PyQt4.QtGui import (QMainWindow,QApplication,QPixmap,QSplashScreen,
14
- from PyQt4.QtGui import *
16
+ QIcon,QAction,QMenu,QMessageBox)
15
- from PyQt4.QtCore import SIGNAL,Qt,QProcess,QThread,QString,QT_VERSION_STR,PYQT_VERSION_STR
17
+ from PyQt4.QtCore import SIGNAL,Qt,QProcess,QString,QT_VERSION_STR,PYQT_VERSION_STR
16
18
 
17
19
  from ui_simple import Ui_MainWindow
18
20
  import icons_rc
@@ -22,7 +24,8 @@ from Dialog import *
22
24
  from config import Config
23
25
  from styles import *
24
26
  import threading
27
+
25
- import platform
28
+ from ipython import PyInterp
26
29
 
27
30
 
28
31
  config = Config()
@@ -33,57 +36,55 @@ iconSize = config.iconSize()
33
36
  workDir = os.getcwd()
34
37
  iconDir = os.path.join(workDir,"Icons")
35
38
 
36
-
37
- #TODO:
39
+
38
- #Need to add options for all GUI
39
- #Need to check filename != none in createTab
40
40
  class myThread (threading.Thread):
41
- def __init__(self, proc, name = None, counter = None):
41
+ def __init__(self, proc):
42
- self.proc = proc
43
- self.name = name
44
- self.counter = counter
45
42
  threading.Thread.__init__(self)
43
+ self.proc = proc
44
+
46
45
  def run(self):
47
46
  self.proc()
48
- print "Starting " + self.name
47
+ print "Starting "
49
- print "Exiting " + self.name
48
+ print "Exiting "
50
49
 
51
50
  class MainWindow(QMainWindow, Ui_MainWindow):
52
51
  def __init__(self, parent=None):
53
52
  super(MainWindow, self).__init__(parent)
54
- self.setupUi(self)
53
+ self.setupUi(self)
55
- # self.resize(800, 600)
56
- #self.setWindowFlags(Qt.FramelessWindowHint)
57
54
  self.isRunning = False
58
55
  self.isFull = False
59
56
  self.isCmd = False
57
+ self.CmdThread = None
60
58
  self.process = QProcess(self)
61
- #self.CmdThread = myThread(self.run())
62
59
  self.cmdText = ""
63
- self.connect(self, SIGNAL('triggered()'), self.closeEvent)
64
-
65
60
  self.setWindowTitle("Sabel")
66
61
  self.setWindowIcon(self.os_icon("eclipse"))
67
-
62
+ self.init()
63
+
64
+ def init(self):
65
+ #self.initOS()
68
66
  self.initConfig()
69
67
  self.initToolBar()
70
68
  self.initCommand()
71
- for i in self.projects:
72
- self.createProjects(i)
73
69
  self.initTree()
70
+ self.initProjects()
71
+ self.initStyles()
72
+ self.connect(self, SIGNAL('triggered()'), self.closeEvent)
74
73
  self.connect(self.tabWidget,SIGNAL("dropped"), self.createTab)
75
- #self.ipy = PyInterp(self)
74
+
76
- #self.ipy.initInterpreter(locals())
75
+ #self.initInterpreter()
77
- #self.tabWidget_2.addTab(self.ipy, "Python")
78
- #self.initSytles()
79
76
  #print self.files.pop()
80
- print platform.system()
81
- print os.name
82
- print os.path.join("C:",os.sep,"Code")
83
77
 
78
+
79
+ def initOS(self):
80
+ print platform.system()
81
+ #print os.name
82
+ #print os.path.join("C:",os.sep,"Code")
83
+
84
84
  def initConfig(self):
85
85
  self.tabWidget.setTabsClosable(True)
86
+ #Important must be empty
86
- self.files = [""]
87
+ self.files = []
87
88
  self.projects = config.projects()
88
89
  self.recent = config.recent()
89
90
  self.dirty = []
@@ -91,11 +92,38 @@ class MainWindow(QMainWindow, Ui_MainWindow):
91
92
  self.tabWidget.setCurrentIndex(len(self.files)-1)
92
93
  self.tabWidget.tabCloseRequested.connect(self.closeTab)
93
94
  self.tabWidget.setTabShape(1)
95
+
96
+ def initTree(self):
97
+ self.treeWidget.itemDoubleClicked.connect(self.ss)
98
+
99
+ def initProjects(self):
100
+ if self.projects != None:
101
+ for i in self.projects:
102
+ self.createProjects(i)
103
+
104
+
105
+ def createProjects(self,startDir):
106
+ self.treeWidget.addProject(startDir)
107
+
108
+ def ss(self,item):
109
+ self.createTab(item.getPath())
110
+
111
+ def initStyles(self):
112
+ self.tabWidget.setStyleSheet(stl)
113
+ #self.statusBar().setStyleSheet(statl)
114
+ #self.textEdit.setStyleSheet(scl)
115
+ #self.toolbar.setStyleSheet(ttl)
94
116
 
95
117
  def initCommand(self):
96
118
  self.connect(self.process, SIGNAL("readyReadStandardOutput()"), self.readOutput)
97
119
  self.connect(self.process, SIGNAL("readyReadStandardError()"), self.readErrors)
98
120
 
121
+ def initInterpreter(self):
122
+ self.ipy = PyInterp(self)
123
+ self.ipy.initInterpreter(locals())
124
+ self.tabWidget_2.addTab(self.ipy, "Python")
125
+
126
+
99
127
  def initToolBar(self):
100
128
  self.action_NewProject = QAction(self.os_icon('newprj_wiz'), 'Project', self)
101
129
  self.action_NewProject.setShortcut('Ctrl+P')
@@ -182,29 +210,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
182
210
  self.toolbar.addAction(self.action_About)
183
211
  self.toolbar.addAction(self.action_Full)
184
212
 
185
- def createProjects(self,startDir):
186
- self.treeWidget.addProject(startDir)
187
-
188
- def initTree(self):
189
- self.treeWidget.itemDoubleClicked.connect(self.ss)
190
-
191
- def ss(self,item):
192
- self.createTab(item.getPath())
193
- #print item.getPath()
194
-
195
- def initStyles(self):
196
- self.tabWidget.setStyleSheet(stl)
197
- #self.dockWidget.setStyleSheet(dtl)
198
- self.statusBar().setStyleSheet(statl)
199
- self.textEdit.setStyleSheet(scl)
200
- self.toolbar.setStyleSheet(ttl)
201
213
 
202
214
  def createTab(self,nfile):
215
+ if(nfile != None):
216
+ if len(self.files) != 0:
203
- for i in self.files:
217
+ for i in self.files:
204
- if(i == nfile):
218
+ if(i == nfile):
205
- QMessageBox.about(self,"Can't Open","File Already Open")
219
+ QMessageBox.about(self,"Can't Open","File Already Open")
206
- return
220
+ return
207
- if type(nfile) == str:
221
+ if type(nfile) == str:
208
222
  config.addFile(nfile)
209
223
  self.files.append(nfile)
210
224
  self.dirty.append(False)
@@ -217,9 +231,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
217
231
  tab.textChanged.connect(lambda:self.setDirty(nfile))
218
232
  except:
219
233
  QMessageBox.about(self,"Can't Open","File Does Not Exist")
220
- else:
234
+ else:
221
- for i in nfile:
235
+ for i in nfile:
222
- self.createTab(i)
236
+ self.createTab(i)
223
237
 
224
238
 
225
239
 
@@ -261,7 +275,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
261
275
  def about(self):
262
276
  QMessageBox.about(self, "About IDE",
263
277
  """
264
- <b>IDE</b> v%s
278
+ <b>Sabel</b> v%s
265
279
  <p>
266
280
  All rights reserved in accordance with
267
281
  GPL v3 or later.
@@ -317,7 +331,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
317
331
 
318
332
  def fileOpen(self):
319
333
  '''Open file'''
320
- fname = unicode(QFileDialog.getOpenFileName(self,
334
+ fname = str(QFileDialog.getOpenFileName(self,
321
335
  "Open File", '.', "Files (*.*)"))
322
336
  if not (fname == ""):
323
337
  for file in self.files:
@@ -329,7 +343,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
329
343
  QMessageBox.about(self, "Already Open","File Already Open")
330
344
  return
331
345
  else:
332
- QMessageBox.about(self, "No File","No File Selected")
333
346
  return
334
347
 
335
348
  def fileSave(self):
@@ -391,7 +404,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
391
404
 
392
405
 
393
406
  def runn(self):
407
+ self.CmdThread = myThread(self.run())
394
- self.CmdThread.start()
408
+ #self.CmdThread.start()
395
409
 
396
410
  def run(self):
397
411
  if self.isRunning == False:
@@ -404,7 +418,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
404
418
  self.textEdit.clear()
405
419
  self.tabWidget_2.setCurrentIndex(1)
406
420
  self.textEdit.append("Pushing main.nut\n")
407
- self.process.start("adb -d push C:\\CODE\\main.nut /sdcard/")
421
+ self.process.start("adb -d push C:/CODE/main.nut /sdcard/")
408
422
  self.process.waitForFinished()
409
423
  self.process.kill()
410
424
  self.textEdit.append("Starting Activity\n")
styles.py CHANGED
@@ -8,20 +8,20 @@ QTabWidget::tab-bar {
8
8
  */
9
9
  QTabBar::tab {
10
10
  min-width: 15px;
11
- max-width: 240px;
11
+ max-width: 800px;
12
- padding: 4px 16px;
12
+ padding: 2px 12px;
13
- font-size: .85em;
13
+ font-size: .75em;
14
14
  }
15
15
 
16
16
  QTabBar::tab:!selected {
17
- margin-top: 3px; /* make non-selected tabs look smaller */
17
+ margin-top: 1px; /* make non-selected tabs look smaller */
18
18
  }
19
19
 
20
20
  /* make use of negative margins for overlapping tabs */
21
21
  QTabBar::tab:selected {
22
22
  /* expand/overlap to the left and right by 4px */
23
- margin-left: -2px;
23
+ /* margin-left: -1px; */
24
- margin-right: -2px;
24
+ /* margin-right: -1px;*/
25
25
  }
26
26
 
27
27
  QTabBar::tab:first:selected {
styles.pyc CHANGED
Binary file