1017c01a pyros2097

13 years ago
v0.62 Update Enabled.. added updater improved the UI a bit
.settings/org.eclipse.core.resources.prefs CHANGED
@@ -1,3 +1,4 @@
1
1
  eclipse.preferences.version=1
2
2
  encoding//Widget/audio.py=utf-8
3
+ encoding//Widget/popup.py=utf-8
3
4
  encoding/runtests.py=utf-8
README.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Sabel v0.57
1
+ ## Sabel v0.60
2
2
 
3
3
  Sabel is an IDE for programming squirrel and EmoFramework.
4
4
  Can be used to Create games for android and ios.
@@ -12,7 +12,7 @@ WORKS only on Device for Now.Will add emulator support in next version.
12
12
  * Code completion.
13
13
  * Instant Launch of your main.nut to SDcard in Android.
14
14
  * Android Debug logcat is directly displayed in console.
15
- * Python Interactive Interpreter.
15
+ * Build Options
16
16
 
17
17
  Check out [Sabel](http://code.google.com/p/sabel-ide/)
18
18
  Check out [Squirrel](http://www.squirrel-lang.org)
@@ -20,13 +20,8 @@ Check out [Emo](http://www.emo-framework.com)
20
20
 
21
21
  ## TODO:
22
22
  - Fix Closed Projects Bug
23
- - Add Build Options
24
23
  - Add OS support
25
24
  - Add Style Options
26
25
  - Add iOS support
27
26
  - Make Mac Build
28
- - Add Lua and Neko Lexers
29
- - Dude Thats it for now
30
- - Squirrel Parser
27
+ - Squirrel Parser
31
- - Lua Parser
32
- - Neko Parser
Widget/__init__.py CHANGED
@@ -2,12 +2,8 @@ from editor import Editor
2
2
  from tab import *
3
3
  from tree import *
4
4
  from tool import Tool
5
- from adb import Adb
6
- from ant import Ant
7
- from parser import Parser
8
- from command import Command
9
- from ipython import PyInterp
10
5
  from style import *
11
6
  from dialogs import *
12
7
  from audio import Audio
13
- from image import Image
8
+ from image import Image
9
+ from popup import Popup
Widget/__init__.pyc CHANGED
Binary file
Widget/dialogs.py CHANGED
@@ -258,19 +258,6 @@ class DialogAbout(QtGui.QMessageBox):
258
258
  <p>Emo-Framework Copyright (c) 2011 Kota Iguchi
259
259
  <p>Python %s - Qt %s - PyQt %s on %s
260
260
  <p>Created By: pyros2097
261
- <p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
262
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING, BUT NOT
263
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
264
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
265
- EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
266
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
267
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
268
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
269
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
270
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
271
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
272
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
273
- POSSIBILITY OF SUCH DAMAGE.
274
261
  """ % (__version__,PY_VERSION,QtCore.QT_VERSION_STR, QtCore.PYQT_VERSION_STR,OS_NAME)
275
262
  self.about(self,"About",text)
276
263
 
Widget/editor.py CHANGED
@@ -1,5 +1,5 @@
1
1
  from globals import (fontSize,ospathjoin,os_pixmap,apiDir,config
2
- ,Auto,eol)
2
+ ,Auto,eol, Encoding)
3
3
  from PyQt4.QtCore import SIGNAL,QString,QEvent
4
4
  from PyQt4.QtGui import QFontMetrics, QFont, QPixmap, QColor, QPalette,QWidget
5
5
  from PyQt4.Qsci import QsciScintilla, QsciLexerPython ,QsciAPIs ,QsciLexerCPP
@@ -7,7 +7,6 @@ from lexersquirrel import LexerSquirrel
7
7
 
8
8
  class Editor(QsciScintilla):
9
9
  ARROW_MARKER_NUM = 8
10
- #fontSize = fontSize
11
10
  def __init__(self,parent,text,lang,colorStyle):
12
11
  QsciScintilla.__init__(self,parent)
13
12
  self.parent = parent
@@ -15,8 +14,11 @@ class Editor(QsciScintilla):
15
14
  self.fontSize = fontSize
16
15
  self.colorStyle = colorStyle
17
16
  self.errorLines = []
18
- self.setUtf8(True)
19
17
  self.setText(text)
18
+ #if(config.encoding() == Encoding.ASCII):
19
+ # self.setUtf8(False)
20
+ #else:
21
+ self.setUtf8(True)
20
22
  if(eol == 0):
21
23
  self.setEolMode(self.EolWindows)
22
24
  elif(eol == 1):
Widget/editor.pyc CHANGED
Binary file
Widget/popup.py ADDED
@@ -0,0 +1,72 @@
1
+ from PyQt4.QtCore import *
2
+ from PyQt4.QtGui import *
3
+
4
+ class Popup(QWidget):
5
+ def __init__(self, parent):
6
+ QWidget.__init__(self, parent)
7
+ self.parent = parent
8
+ self.setWindowFlags(Qt.Tool| Qt.X11BypassWindowManagerHint | Qt.FramelessWindowHint)
9
+ #self.setFrameStyle(QFrame.Box| QFrame.Plain)
10
+ r = QApplication.desktop().geometry()
11
+ self.setGeometry(QRect(r.right() - 290,r.bottom() - 230,300,50))
12
+ self.setAttribute(Qt.WA_TranslucentBackground, True)
13
+ self.anim = QPropertyAnimation(self, "geometry")
14
+ self.anim.setDuration(300)
15
+
16
+ ''' X ,Y position of Widget
17
+ W ,H of the widget '''
18
+ self.anim.setStartValue(QRect(r.right() - 290,r.bottom() - 230,300,50))
19
+ self.anim.setEndValue(QRect(r.right() - 290,r.bottom() - 200,300,150))
20
+ #,
21
+ self.anim.setEasingCurve(QEasingCurve.InOutQuad)
22
+
23
+ #self.layoutWidget = QWidget()
24
+ #self.layoutWidget.setGeometry(QRect(r.right() - 290,r.bottom() - 200,300,150))
25
+ self.vb = QVBoxLayout()
26
+ self.vb.setMargin(8)
27
+ self.vb.setSpacing(0)
28
+
29
+ self.label = QLabel()
30
+ self.label.setAlignment(Qt.AlignLeft)
31
+ #self.label.setGeometry(QRect(r.right() - 290,r.bottom() - 200,100,100))
32
+ #self.label.setGeometry(0, 0, 300,150)
33
+ self.label.setTextInteractionFlags(Qt.LinksAccessibleByMouse)
34
+ self.label.setOpenExternalLinks(True)
35
+ self.btn = QPushButton()
36
+ self.btn.setText("Start")
37
+ self.btn.clicked.connect(self.start)
38
+ self.vb.addWidget(self.label)
39
+ #self.vb.addWidget(self.layoutWidget)
40
+ self.vb.addWidget(self.btn)
41
+ self.setLayout(self.vb)
42
+
43
+ def start(self):
44
+ self.emit(SIGNAL("download"))
45
+ self.hide()
46
+
47
+ def hideBtn(self):
48
+ self.btn.hide()
49
+ def showBtn(self):
50
+ if(self.btn.isHidden()):
51
+ self.btn.show()
52
+
53
+ def showPopup(self):
54
+ self.anim.start()
55
+ self.show()
56
+
57
+ def setInfo(self, info):
58
+ text = "<b><u>Update</u></b>: "+"v"
59
+ #print text
60
+ for i in info:
61
+ text = text + str(i) + "<br>"
62
+ text = text + "<br><b>Check Out</b>: <br><a href='http://code.google.com/p/sabel-ide/'>Sabel</a>" + "<br>"
63
+ self.label.setText(text)
64
+
65
+ def mousePressEvent(self, e):
66
+ geom = self.geometry()
67
+ pos = e.pos()
68
+ pos = self.mapToParent(pos)
69
+ #print pos
70
+ if(geom.contains(pos)):
71
+ self.hide()
72
+ self.emit(SIGNAL("cancel"))
Widget/tab.py CHANGED
@@ -7,43 +7,31 @@ from PyQt4.QtCore import SIGNAL, Qt, QPoint, QMimeData, QByteArray
7
7
  from globals import ossep,ospathbasename,Icons
8
8
 
9
9
  class MyTabBar(QTabBar):
10
- """Tabs base class with drag and drop support"""
10
+ """ Tabs base class with enter, leave, drag, and drop support """
11
11
  def __init__(self,parent):
12
12
  QTabBar.__init__(self,parent)
13
13
  self.setAcceptDrops(True)
14
+ self.setMouseTracking(True)
14
15
  #self.setTabButton(QTabBar.ButtonPosition)
15
16
  #self.setShape(QTabBar.RoundedSouth)
16
17
 
18
+ def mouseMoveEvent(self, event):
19
+ if(self.tabAt(event.pos()) != -1):
20
+ print self.tabAt(event.pos())
21
+
17
- def dragEnterEvent(self, event):
22
+ def enterEvent(self,event):
18
- if event.mimeData().hasUrls:
23
+ print("Enter")
19
- event.accept()
24
+ #self.setStyleSheet("background-color:#45b545;")
20
- else:
21
- event.ignore()
22
25
 
23
- def dragMoveEvent(self, event):
26
+ def leaveEvent(self,event):
24
- if event.mimeData().hasUrls:
25
- event.setDropAction(Qt.CopyAction)
26
- event.accept()
27
- else:
28
- event.ignore()
29
-
30
- def dropEvent(self, event):
31
- if event.mimeData().hasUrls:
32
- event.setDropAction(Qt.CopyAction)
33
- event.accept()
34
- links = []
35
- for url in event.mimeData().urls():
36
- links.append(str(url.toLocalFile()))
37
- self.emit(SIGNAL("dropped"), links)
27
+ #self.setStyleSheet("background-color:yellow;")
38
- else:
39
- event.ignore()
28
+ print("Leave")
40
29
 
41
30
  class EditorTab(QTabWidget):
42
31
  def __init__(self,parent):
43
32
  QTabWidget.__init__(self,parent)
44
33
  self.setTabBar(MyTabBar(self))
45
34
  self.setAcceptDrops(True)
46
- self.connect(self.tabBar(), SIGNAL("dropped"), self.addItem)
47
35
 
48
36
  def dragEnterEvent(self, event):
49
37
  if event.mimeData().hasUrls:
@@ -67,45 +55,14 @@ class EditorTab(QTabWidget):
67
55
  links.append(str(url.toLocalFile()))
68
56
  self.emit(SIGNAL("dropped"), links)
69
57
  else:
70
- event.ignore()
58
+ event.ignore()
71
-
72
- def addItem(self,l):
73
- self.emit(SIGNAL("dropped"),l)
74
59
 
75
60
  class TreeTab(QTabWidget):
76
61
  def __init__(self,parent):
77
62
  QTabWidget.__init__(self,parent)
78
63
  self.setTabBar(MyTabBar(self))
79
- self.setAcceptDrops(True)
80
- self.connect(self.tabBar(), SIGNAL("dropped"), self.addItem)
81
-
82
- def dragEnterEvent(self, event):
83
- if event.mimeData().hasUrls:
84
- event.accept()
85
- else:
86
- event.ignore()
87
-
88
- def dragMoveEvent(self, event):
89
- if event.mimeData().hasUrls:
90
- event.setDropAction(Qt.CopyAction)
91
- event.accept()
92
- else:
93
- event.ignore()
94
-
95
- def dropEvent(self, event):
96
- if event.mimeData().hasUrls:
97
- event.setDropAction(Qt.CopyAction)
98
- event.accept()
99
- links = []
100
- for url in event.mimeData().urls():
101
- links.append(str(url.toLocalFile()))
102
- self.emit(SIGNAL("dropped"), links)
103
- else:
104
- event.ignore()
105
-
106
- def addItem(self,l):
107
- self.emit(SIGNAL("dropped"),l)
108
64
 
109
65
  class OutputTab(QTabWidget):
110
66
  def __init__(self,parent):
111
- QTabWidget.__init__(self,parent)
67
+ QTabWidget.__init__(self,parent)
68
+ self.setTabBar(MyTabBar(self))
Widget/tab.pyc CHANGED
Binary file
Widget/tool.py CHANGED
@@ -1,7 +1,7 @@
1
- from PyQt4.QtGui import (QToolBar, QMenu, QAction, QSlider, QWidgetAction,
1
+ from PyQt4.QtGui import (QToolBar, QMenu, QAction, QActionGroup ,QSlider, QWidgetAction,
2
- QFont, QFontComboBox, QComboBox)
2
+ QFont, QFontComboBox, QComboBox, QLabel)
3
3
  from PyQt4.QtCore import SIGNAL, Qt, QSize
4
- from globals import config, Icons
4
+ from globals import config, Icons, Encoding
5
5
 
6
6
  class Tool(QToolBar):
7
7
  def __init__(self,parent):
@@ -38,7 +38,7 @@ class Tool(QToolBar):
38
38
  self.action_Run.setShortcut('Ctrl+R')
39
39
  self.action_Run.triggered.connect(self.parent.adb.run)
40
40
  self.action_RunFile = QAction(Icons.go, 'Cmd', self)
41
- self.action_RunFile.triggered.connect(self.parent.command.setCmd)
41
+ self.action_RunFile.triggered.connect(self.parent.openCommand)
42
42
  self.parent.runButton.clicked.connect(self.parent.command.setCmdLine)
43
43
  self.action_Stop = QAction(Icons.stop, 'Stop', self)
44
44
  self.action_Stop.setShortcut('Ctrl+Q')
@@ -113,6 +113,10 @@ class Tool(QToolBar):
113
113
  action_designer.triggered.connect(self.parent.design)
114
114
  action_Indentation = QAction("Indentation Guides",self)
115
115
  action_Indentation.triggered.connect(self.parent.setIndent)
116
+ action_WhiteSpace = QAction("Show WhiteSpace",self)
117
+ action_WhiteSpace.triggered.connect(self.parent.setWhiteSpace)
118
+ action_EndLine = QAction("Show End of Lines",self)
119
+ action_EndLine.triggered.connect(self.parent.setEndLine)
116
120
  action_Margin = QAction("Line Numbers",self)
117
121
  action_Margin.triggered.connect(self.parent.setMargin)
118
122
  action_ToolLabel = QAction("Tool Labels",self)
@@ -124,21 +128,49 @@ class Tool(QToolBar):
124
128
  action_Squirrel = QAction(Icons.nut,'Squirrel', self)
125
129
  action_Squirrel.triggered.connect(self.parent.squirrel)
126
130
  action_Ios1 = QAction(Icons.ios,'iOS', self)
131
+ action_Update = QAction("Update",self)
132
+ action_Update.triggered.connect(self.parent.update)
133
+
134
+
135
+ '''Encoding'''
136
+ encodingGroup = QActionGroup(self)
137
+ encodingGroup.setExclusive(True)
138
+ action_Ascii = QAction("Ascii",encodingGroup)
139
+ action_Ascii.setCheckable(True)
140
+ action_Unicode = QAction("Unicode",encodingGroup)
141
+ action_Unicode.setCheckable(True)
142
+ encodingGroup.addAction(action_Ascii)
143
+ encodingGroup.addAction(action_Unicode)
144
+ encodingGroup.selected.connect(self.parent.setEncoding)
145
+ if(config.encoding() == Encoding.ASCII):
146
+ action_Ascii.setChecked(True)
147
+ else:
148
+ action_Unicode.setChecked(True)
127
149
  men.addAction(action_Android)
128
150
  men.addAction(action_Ant)
129
151
  men.addAction(action_Squirrel)
130
152
  men.addAction(action_Ios1)
153
+ men.addAction(action_Update)
131
154
  men.addSeparator()
132
155
  men.addAction(action_explorer)
133
156
  men.addAction(action_console)
134
157
  men.addAction(action_designer)
135
158
  men.addAction(action_Indentation)
159
+ men.addAction(action_WhiteSpace)
160
+ men.addAction(action_EndLine)
136
161
  men.addAction(action_Margin)
137
162
  men.addAction(action_ToolLabel)
138
163
  men.addSeparator()
139
- men.addAction(QAction("Font",self))
164
+ men.addActions(encodingGroup.actions())
165
+ men.addSeparator()
166
+ head_font = QLabel("Font---------------------")
167
+ fnt = head_font.font()
168
+ fnt.setBold(True)
169
+ head_font.setFont(fnt)
170
+ head_fontWidgetAction = QWidgetAction(men)
171
+ head_fontWidgetAction.setDefaultWidget(head_font)
172
+ men.addAction(head_fontWidgetAction)
140
173
  men.addAction(self.fontComboMenu)
141
- men.addAction(QAction("Font Size",self))
142
174
  men.addAction(self.fontSizeComboMenu)
143
175
  men.addSeparator()
144
176
  men.addAction(QAction("TabWidth",self))
@@ -157,17 +189,21 @@ class Tool(QToolBar):
157
189
  self.action_Full.setShortcut('Shift+Enter')
158
190
  self.action_Full.triggered.connect(self.parent.full)
159
191
 
192
+ self.modeGroup = QActionGroup(self)
193
+ self.modeGroup.setExclusive(True)
194
+ self.modeGroup.selected.connect(self.parent.setMode)
160
- self.action_Squirrel = QAction(Icons.nut, 'Squ', self)
195
+ self.action_Squirrel = QAction(Icons.nut, 'Squ', self.modeGroup)
161
196
  self.action_Squirrel.setCheckable(True)
162
- self.action_Squirrel.triggered.connect(self.parent.sq)
163
- self.action_Emo = QAction(Icons.emo, 'Emo', self)
197
+ self.action_Emo = QAction(Icons.emo, 'Emo', self.modeGroup)
164
198
  self.action_Emo.setCheckable(True)
165
- self.action_And = QAction(Icons.android, 'Android', self)
199
+ self.action_And = QAction(Icons.android, 'Android', self.modeGroup)
166
200
  self.action_And.setCheckable(True)
167
- self.action_Emo.triggered.connect(self.parent.emo)
168
- self.action_Ios = QAction(Icons.ios, 'ios', self)
201
+ self.action_Ios = QAction(Icons.ios, 'ios', self.modeGroup)
169
202
  self.action_Ios.setCheckable(True)
203
+ self.modeGroup.addAction(self.action_Squirrel)
204
+ self.modeGroup.addAction(self.action_Emo)
205
+ self.modeGroup.addAction(self.action_And)
170
- self.action_Ios.triggered.connect(self.parent.ios)
206
+ self.modeGroup.addAction(self.action_Ios)
171
207
 
172
208
 
173
209
  self.action_Style = QAction(Icons.style, 'Style', self)
@@ -213,9 +249,7 @@ class Tool(QToolBar):
213
249
  self.action_Style.setMenu(men1)
214
250
  self.styleslist[self.parent.styleIndex].setChecked(True)
215
251
 
216
-
217
252
  self.action_Stop.setDisabled(True)
218
-
219
253
  self.setToolLabel()
220
254
  self.setAllowedAreas(Qt.AllToolBarAreas)
221
255
  #self.setFixedHeight(40)
@@ -242,14 +276,15 @@ class Tool(QToolBar):
242
276
  self.addAction(self.action_Help)
243
277
  self.addAction(self.action_Full)
244
278
  self.addSeparator()
245
- self.addAction(self.action_Squirrel)
246
- self.addAction(self.action_Emo)
279
+ self.addActions(self.modeGroup.actions())
247
- self.addAction(self.action_And)
248
- self.addAction(self.action_Ios)
249
280
  if(config.mode() == 0):
250
281
  self.action_Squirrel.setChecked(True)
251
- else:
282
+ elif(config.mode() == 1):
252
283
  self.action_Emo.setChecked(True)
284
+ elif(config.mode() == 2):
285
+ self.action_And.setChecked(True)
286
+ elif(config.mode() == 3):
287
+ self.action_Ios.setChecked(True)
253
288
 
254
289
  def setIcon(self,val):
255
290
  config.setIconSize(val)
Widget/tree.py CHANGED
@@ -1,16 +1,18 @@
1
1
  from PyQt4.QtGui import (QTreeWidgetItem,QTreeWidget,QMessageBox,
2
2
  QIcon,QDrag,QMenu,QAction,QInputDialog,QCursor,QToolBar,
3
- QHeaderView,QFileDialog)
3
+ QHeaderView,QFileDialog, QKeySequence, QShortcut)
4
4
  from PyQt4.QtCore import QPoint ,SIGNAL, Qt, QMimeData, QUrl, QPoint, QByteArray, QDataStream, QIODevice
5
5
  from globals import (oslistdir,ospathisdir,ospathsep,ospathjoin,ospathexists,
6
6
  ospathbasename,os_icon,osremove,osrename,ospathdirname,
7
7
  recycle,ospathnormpath,oswalk,Icons,config)
8
+ import shutil
8
9
 
9
10
 
10
11
  class Dir(QTreeWidgetItem):
11
12
  def __init__(self,parent,name,path):
12
13
  QTreeWidgetItem.__init__(self,parent)
13
14
  self.path = ospathjoin(path,name)
15
+ self.name = name
14
16
  self.setText (0, name)
15
17
  self.setIcon(0,Icons.foldej)
16
18
 
@@ -22,12 +24,21 @@ class Dir(QTreeWidgetItem):
22
24
  return True
23
25
  def isFile(self):
24
26
  return False
27
+ def exists(self):
28
+ return ospathexists(self.path)
29
+ def hasItem(self,child):
30
+ #print self.indexOfChild(child)
31
+ if(self.indexOfChild(child) > -1):
32
+ return True
33
+ else:
34
+ return False
25
35
 
26
36
  class File(QTreeWidgetItem):
27
37
  ext = [".txt",".nut",".py",".cpp",".c",".h"]
28
38
  def __init__(self,parent,name,path):
29
39
  QTreeWidgetItem.__init__(self,parent)
30
40
  self.path = ospathjoin(path,name)
41
+ self.name = name
31
42
  self.setText (0, name)
32
43
  self.doc = False
33
44
  self.pic = False
@@ -70,6 +81,8 @@ class File(QTreeWidgetItem):
70
81
  return self.pic
71
82
  def isAudio(self):
72
83
  return self.audio
84
+ def exists(self):
85
+ return ospathexists(self.path)
73
86
 
74
87
  class Project(QTreeWidgetItem):
75
88
  Count = -1
@@ -98,10 +111,13 @@ class Project(QTreeWidgetItem):
98
111
  return False
99
112
  def isClosed(self):
100
113
  return self.closed
114
+ def exists(self):
115
+ return ospathexists(self.path)
101
116
 
102
117
  class ProjectTree(QTreeWidget):
103
118
  def __init__(self,parent = None):
104
119
  QTreeWidget.__init__(self,parent)
120
+ self.setSelectionMode(self.ExtendedSelection)
105
121
  self.setDragEnabled(True)
106
122
  self.setAcceptDrops(True)
107
123
  self.setColumnCount(1)
@@ -111,6 +127,7 @@ class ProjectTree(QTreeWidget):
111
127
  self.connect(self, SIGNAL("dropped"), self.addItem)
112
128
  self.projects = []
113
129
  self.projectItems = []
130
+ self.clipboard = []
114
131
  self.closed = config.closedProjects()
115
132
  if(self.closed == None):
116
133
  self.closed = []
@@ -141,6 +158,37 @@ class ProjectTree(QTreeWidget):
141
158
  drag.setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2))
142
159
  drag.setMimeData(mimeData)
143
160
  dropAction = drag.start(Qt.CopyAction)
161
+
162
+ def addItem(self,links):
163
+ print links
164
+
165
+ def dragMoveEvent(self, event):
166
+ if event.mimeData().hasUrls():
167
+ event.setDropAction(Qt.CopyAction)
168
+ event.accept()
169
+ else:
170
+ event.ignore()
171
+
172
+ def dragEnterEvent(self, event):
173
+ if event.mimeData().hasUrls:
174
+ event.accept()
175
+ else:
176
+ event.ignore()
177
+
178
+ def dropEvent(self, event):
179
+ if event.mimeData().hasUrls:
180
+ event.acceptProposedAction()
181
+ event.setDropAction(Qt.CopyAction)
182
+ event.accept()
183
+ links = []
184
+ for url in event.mimeData().urls():
185
+ links.append(str(url.toLocalFile()))
186
+ #item = File(self)
187
+ #item.setText(0, ospathbasename(str(url.toLocalFile())))
188
+ #self.addTopLevelItem(item)
189
+ self.emit(SIGNAL("dropped"), links)
190
+ else:
191
+ event.ignore()
144
192
 
145
193
  '''
146
194
  def startDrag(self, dropAction):
@@ -278,46 +326,6 @@ class ProjectTree(QTreeWidget):
278
326
  current_item = self.currentItem().parent()
279
327
  #print current_item.getPath()
280
328
  return current_item
281
-
282
- def addItem(self,links):
283
- print links
284
-
285
- def startDrag(self, dropAction):
286
- # create mime data object
287
- mime = QMimeData()
288
- mime.setData('text/xml', '???')
289
- # start drag
290
- drag = QDrag(self)
291
- drag.setMimeData(mime)
292
- drag.start(Qt.CopyAction | Qt.CopyAction)
293
-
294
- def dragMoveEvent(self, event):
295
- if event.mimeData().hasUrls():
296
- event.setDropAction(Qt.CopyAction)
297
- event.accept()
298
- else:
299
- event.ignore()
300
-
301
- def dragEnterEvent(self, event):
302
- if event.mimeData().hasUrls:
303
- event.accept()
304
- else:
305
- event.ignore()
306
-
307
- def dropEvent(self, event):
308
- if event.mimeData().hasUrls:
309
- event.acceptProposedAction()
310
- event.setDropAction(Qt.CopyAction)
311
- event.accept()
312
- links = []
313
- for url in event.mimeData().urls():
314
- links.append(str(url.toLocalFile()))
315
- #item = File(self)
316
- #item.setText(0, ospathbasename(str(url.toLocalFile())))
317
- #self.addTopLevelItem(item)
318
- self.emit(SIGNAL("dropped"), links)
319
- else:
320
- event.ignore()
321
329
 
322
330
  def doMenu(self, pos):
323
331
  index = self.indexAt(pos)
@@ -342,14 +350,13 @@ class ProjectTree(QTreeWidget):
342
350
  action_RunFile.triggered.connect(lambda:self.runFile(item))
343
351
  action_SendFile = QAction(Icons.file_obj,'Send to SDcard', self)
344
352
  action_SendFile.triggered.connect(lambda:self.sendFile(item))
345
- action_CopyFile = QAction(Icons.file_obj,'Copy', self)
346
- action_CopyFile.triggered.connect(lambda:self.copyFile(item))
347
- action_CopyDir = QAction(Icons.file_obj,'Copy', self)
353
+ action_Copy = QAction(Icons.file_obj,'Copy', self)
348
- action_CopyDir.triggered.connect(lambda:self.copyDir(item))
354
+ action_Copy.triggered.connect(lambda:self.copy(item))
349
- action_PasteFile = QAction(Icons.paste_edit,'Paste', self)
350
- action_PasteFile.triggered.connect(lambda:self.pasteFile(item))
351
- action_PasteDir = QAction(Icons.paste_edit,'Paste', self)
355
+ action_Paste = QAction(Icons.paste_edit,'Paste', self)
352
- action_PasteDir.triggered.connect(lambda:self.pasteDir(item))
356
+ action_Paste.triggered.connect(lambda:self.paste(item))
357
+ if(self.clipboard == []):
358
+ action_Paste.setEnabled(False)
359
+
353
360
  action_RefreshProject = QAction(Icons.refresh_tab,'Refresh', self)
354
361
  action_RefreshProject.triggered.connect(lambda:self.refreshProject(item))
355
362
  action_RemoveProject = QAction('Remove', self)
@@ -401,8 +408,8 @@ class ProjectTree(QTreeWidget):
401
408
  menu.addAction(action_Folder)
402
409
  menu.addAction(action_File)
403
410
  menu.addSeparator()
404
- menu.addAction(action_CopyDir)
411
+ #menu.addAction(action_Copy)
405
- menu.addAction(action_PasteDir)
412
+ menu.addAction(action_Paste)
406
413
  menu.addAction(action_RenameDir)
407
414
  menu.addAction(action_DeleteDir)
408
415
  else:
@@ -414,8 +421,9 @@ class ProjectTree(QTreeWidget):
414
421
  menu.addSeparator()
415
422
  menu.addAction(action_SendFile)
416
423
  menu.addSeparator()
417
- menu.addAction(action_CopyFile)
424
+ menu.addAction(action_Copy)
425
+
418
- menu.addAction(action_PasteFile)
426
+ menu.addAction(action_Paste)
419
427
  menu.addAction(action_RenameFile)
420
428
  menu.addAction(action_DeleteFile)
421
429
 
@@ -455,6 +463,7 @@ class ProjectTree(QTreeWidget):
455
463
  #osmkdir(fname+'/'+text,0755)
456
464
  except:
457
465
  QMessageBox.about(self,"Error","Could Not Create The File")
466
+
458
467
  def newFile(self,item):
459
468
  itempath = item.getPath()
460
469
  text,ok = QInputDialog.getText(self,"QInputDialog::getText()","Name:")
@@ -475,20 +484,52 @@ class ProjectTree(QTreeWidget):
475
484
  pass
476
485
 
477
486
  def sendFile(self,item):
478
- #Biachself.parent()
487
+ self.emit(SIGNAL("sendFileClicked"),item)
479
- pass
480
488
 
481
- def copyFile(self,item):
482
- pass
483
-
484
- def copyDir(self,item):
489
+ def copy(self,clickeditem = None):
490
+ items = self.selectedItems()
485
- pass
491
+ self.clipboard = []
492
+ if(items != None):
493
+ for item in items:
494
+ #print item.getPath()
495
+ self.clipboard.append(item)
486
496
 
487
- def pasteFile(self,item):
488
- pass
489
497
 
498
+ '''must test this'''
490
- def pasteDir(self,item):
499
+ def paste(self,item):
500
+ '''First check if item is file then get its parent
501
+ otherwise check if item is Dir'''
502
+ if(item.isFile()):
503
+ p = item.parent()
491
- pass
504
+ else:
505
+ p = item
506
+ if(self.clipboard != []):
507
+ for items in self.clipboard:
508
+ if(items.isFile()):
509
+ itemspath = items.getPath()
510
+ '''Check if we are pasting files that alreadt exists using ospathjoin'''
511
+ if not(ospathexists(ospathjoin(p.getPath(),items.name))):
512
+ try:
513
+ shutil.copyfile(itemspath,ospathjoin(p.getPath(),items.name))
514
+ newItem = File(p,items.name,ospathdirname(itemspath))
515
+ except:
516
+ QMessageBox.about(self,"Error","File Cannot be Pasted"+ospathjoin(p.getPath(),items.name))
517
+ else:
518
+ QMessageBox.about(self,"Error","File already Exists "+ospathjoin(p.getPath(),items.name))
519
+ return
520
+ elif(items.isDir()):
521
+ itemspath = items.getPath()
522
+ '''Check if we are pasting files that alreadt exists using ospathjoin'''
523
+ if not(ospathexists(ospathjoin(p.getPath(),items.name))):
524
+ try:
525
+ shutil.copyfile(itemspath,ospathjoin(p.getPath(),items.name))
526
+ newItem = File(p,items.name,ospathdirname(itemspath))
527
+ except:
528
+ QMessageBox.about(self,"Error","File Cannot be Pasted"+ospathjoin(p.getPath(),items.name))
529
+ else:
530
+ QMessageBox.about(self,"Error","File already Exists "+ospathjoin(p.getPath(),items.name))
531
+ return
532
+
492
533
 
493
534
  '''Signals are emitted because doesnt have access to Parent'''
494
535
  def create(self,item):
@@ -541,7 +582,7 @@ class ProjectTree(QTreeWidget):
541
582
  p = item.parent()
542
583
  p.removeChild(item)
543
584
  f = File(p,ospathbasename(newname),ospathdirname(newname))
544
- p.addChild(f)
585
+ #p.addChild(f)
545
586
  except:
546
587
  QMessageBox.about(self,"Error","Could Not Rename The File")
547
588
 
Widget/tree.pyc CHANGED
Binary file
build.py ADDED
@@ -0,0 +1,11 @@
1
+ from subprocess import Popen, PIPE
2
+
3
+ proc = Popen(['python', 'cx.py', 'build'],stdout=PIPE)
4
+
5
+ while True:
6
+ line = proc.stdout.readline()
7
+ if line != '':
8
+ print line.rstrip()
9
+ else:
10
+ break
11
+ print "FINISHED"
build/exe.win32-2.7/Sabel.exe CHANGED
Binary file
build/exe.win32-2.7/Sabel.zip DELETED
Binary file
build/exe.win32-2.7/config.yml CHANGED
@@ -18,43 +18,35 @@ CMD:
18
18
  - SQ
19
19
  - JAVA
20
20
  - GCC
21
- - NODE
22
- - NPM
23
- - NODEMON
24
21
  ClosedProject:
25
22
  - 0
26
23
  - 0
27
24
  - 0
28
25
  - 0
29
26
  File:
30
- - C:/CODE/assets/creditscene.nut
31
- - C:/CODE/assets/cll.nut
32
- - C:/mysite/new/views/index.jade
33
- - C:/mysite/new/app.js
34
- - C:/mysite/new/routes/index.js
35
27
  - C:/CODE/assets/common.nut
28
+ - C:/CODE/assets/howtoscene.nut
29
+ - C:/CODE/assets/logoscene.nut
36
- - C:/chaiscript-5/CMakeLists.txt
30
+ - C:/CODE/assets/creditscene.nut
37
- - C:/sdk/samples/concurrent/source/main.cpp
38
31
  PARAM:
39
- - ' C:/CODE/assets/cll.nut'
32
+ - Dude C:/CODE/assets/creditscene.nut C:/CODE/assets/physics.nut
40
- - ' '
41
- - C:/mysite/new/app.js 3000
42
33
  Project:
43
34
  - C:/CODE/assets/
44
- - C:/port/
45
- - C:/Android-Template/
46
35
  Recent: []
47
36
  Setting:
48
37
  device: 1
38
+ encoding: 1
49
39
  fontname: Courier New
50
- fontsize: 9
40
+ fontsize: 10
51
41
  iconsize: 16
52
42
  indent: 0
53
- margin: 1
43
+ margin: 0
54
44
  mode: 0
55
45
  styleindex: 8
56
46
  tabwidth: 2
57
47
  thresh: 1
48
+ toollabel: 0
49
+ whitespace: 0
58
50
  workspace: C:/CODE/
59
51
  Style: 0
60
52
  TODO:
@@ -64,7 +56,4 @@ TODO:
64
56
  - Add Style Options
65
57
  - Add iOS support
66
58
  - Make Mac Build
67
- - Dude Thats it for now
68
- - Squirrel Parser
69
- - Neko Parser
70
- - Desginer
59
+ - Dude
build/exe.win32-2.7/library.zip CHANGED
Binary file
build/exe.win32-2.7/license.txt DELETED
@@ -1,19 +0,0 @@
1
- Copyright (c) 2012 Peter John (pyros2097@gmail.com)
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
config.py CHANGED
@@ -19,6 +19,13 @@ class Config:
19
19
  def workSpace(self):
20
20
  return self.readSetting("workspace")
21
21
 
22
+ def encoding(self):
23
+ return int(self.readSetting("encoding"))
24
+ def setAscii(self):
25
+ self.writeSetting('encoding',0)
26
+ def setUnicode(self):
27
+ self.writeSetting('encoding',1)
28
+
22
29
  def fontSize(self):
23
30
  return int(self.readSetting('fontsize'))
24
31
  def setFontSize(self,val):
@@ -53,6 +60,11 @@ class Config:
53
60
  return int(self.readSetting('indent'))
54
61
  def setIndent(self,value):
55
62
  self.writeSetting("indent",value)
63
+
64
+ def whiteSpace(self):
65
+ return int(self.readSetting('whitespace'))
66
+ def setWhiteSpace(self,value):
67
+ self.writeSetting("whitespace",value)
56
68
 
57
69
  '''0 is emulator 1 is device'''
58
70
  def device(self):
config.yml CHANGED
@@ -24,23 +24,19 @@ ClosedProject:
24
24
  - 0
25
25
  - 0
26
26
  File:
27
+ - C:/CODE/assets/common.nut
27
28
  - C:/CODE/assets/howtoscene.nut
29
+ - C:/CODE/assets/logoscene.nut
28
30
  - C:/CODE/assets/creditscene.nut
29
- - C:/CODE/assets/main.nut
30
31
  PARAM:
31
32
  - Dude C:/CODE/assets/creditscene.nut C:/CODE/assets/physics.nut
32
33
  Project:
33
34
  - C:/CODE/assets/
34
- - C:/port/
35
- - C:/Android-Template/
36
35
  Recent: []
37
36
  Setting:
38
37
  device: 1
39
- fontname: !!python/object/apply:sip._unpickle_type
40
- - PyQt4.QtCore
41
- - QString
38
+ encoding: 1
42
- - !!python/tuple
43
- - !!python/unicode 'Courier New'
39
+ fontname: Courier New
44
40
  fontsize: 10
45
41
  iconsize: 16
46
42
  indent: 0
@@ -50,6 +46,7 @@ Setting:
50
46
  tabwidth: 2
51
47
  thresh: 1
52
48
  toollabel: 0
49
+ whitespace: 0
53
50
  workspace: C:/CODE/
54
51
  Style: 0
55
52
  TODO:
@@ -59,9 +56,4 @@ TODO:
59
56
  - Add Style Options
60
57
  - Add iOS support
61
58
  - Make Mac Build
62
- - Dude Thats it for now
63
- - Squirrel Parser
64
- - Neko Parser
65
- - Desginer
59
+ - Dude
66
- - Level EDitor
67
- - Fix copy paste explorer options
core/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ from adb import Adb
2
+ from ant import Ant
3
+ from parser import Parser
4
+ from command import Command
5
+ from ipython import PyInterp
6
+ from update import *
{Widget → core}/adb.py RENAMED
@@ -50,25 +50,25 @@ class Adb(QWidget):
50
50
  def newstart(self,no,cmd):
51
51
  self.checkFinished(no, cmd)
52
52
  self.parent.progressStart()
53
- if(cmd == self.cmd1):
53
+ if(cmd == self.cmd1):
54
- self.adb_thread.setCmd(self.cmd2)
54
+ self.adb_thread.setCmd(self.cmd2) #start
55
55
  self.adb_thread.run()
56
- elif(cmd == self.cmd2):
56
+ elif(cmd == self.cmd2):
57
- self.adb_thread.setCmd(self.cmd3)
57
+ self.adb_thread.setCmd(self.cmd3) #log
58
58
  self.parent.progressStop()
59
59
  self.adb_thread.run2()
60
- elif(cmd == self.cmd3):
60
+ elif(cmd == self.cmd3):
61
- self.adb_thread.setCmd(self.cmd4)
61
+ self.adb_thread.setCmd(self.cmd4) #enable app
62
62
  self.adb_thread.run()
63
- elif(cmd == self.cmd4):
63
+ elif(cmd == self.cmd4):
64
- self.adb_thread.setCmd(self.cmd5)
64
+ self.adb_thread.setCmd(self.cmd5) #disable app
65
65
  self.adb_thread.run()
66
- elif(cmd == self.cmd5):
66
+ elif(cmd == self.cmd5):
67
67
  if not(self.parent.outputTabWidget.isHidden()):
68
68
  self.parent.outputTabWidget.hide()
69
69
  self.parent.toolBar.action_Run.setEnabled(True)
70
- self.parent.progressStop()
71
70
  self.parent.statusWriting()
71
+ #self.stop()
72
72
 
73
73
  def run(self):
74
74
  if self.isRunning == False:
@@ -77,11 +77,11 @@ class Adb(QWidget):
77
77
  self.parent.toolBar.action_Stop.setEnabled(True)
78
78
  self.parent.popOutput()
79
79
  self.parent.textEdit.clear()
80
- self.parent.textEdit.append("Pushing main.nut...\n")
80
+ self.parent.textEdit.append("Pushing main.nut...\n")
81
- self.adb_thread.setCmd(self.cmd1)
81
+ self.adb_thread.setCmd(self.cmd1)
82
- self.parent.statusRunning()
82
+ self.parent.statusRunning()
83
- self.parent.progressStart()
83
+ self.parent.progressStart()
84
- self.adb_thread.run()
84
+ self.adb_thread.run()
85
85
 
86
86
  def stop(self):
87
87
  if self.isRunning == True:
{Widget → core}/ant.py RENAMED
File without changes
{Widget → core}/ipython.py RENAMED
File without changes
{Widget → core}/parser.py RENAMED
File without changes
core/update.py ADDED
@@ -0,0 +1,229 @@
1
+ import urllib2
2
+ from PyQt4.QtGui import QLabel, QMessageBox, QWidget, QDialog, QProgressBar, QPushButton, QVBoxLayout, QHBoxLayout
3
+ from PyQt4.QtCore import SIGNAL, QThread, QString, QTimer
4
+ from globals import Icons, __version__, osrename, ospathdirname ,ospathjoin, ospathexists, recycle
5
+ from subprocess import Popen, STARTUPINFO, SW_HIDE
6
+
7
+ """
8
+ We Can update the software by following these steps:
9
+ 1.Check if net connecetion is there
10
+ 2.Download the update.txt text which contains any version changes
11
+ 3.If a new version is there it will ask to download and then starts downloading
12
+ library.zip as library.zip_2097 after it completes it renames this file
13
+ 4.If no version changes is there then it will just show no updates
14
+ 5.If download is incomplete or terminated nothing happens since original file is intact
15
+ """
16
+ class Updater(QWidget):
17
+ def __init__(self,parent):
18
+ QWidget.__init__(self,parent)
19
+ self.parent = parent
20
+ self.downThread = DownThread()
21
+ self.prog = ProgressDialog(self)
22
+ self.firstStartUp = 0
23
+ self.connect(self.downThread, SIGNAL("net"),self.net)
24
+ self.connect(self.downThread, SIGNAL("timed"),self.timed)
25
+ self.connect(self.downThread, SIGNAL("cant"),self.cant)
26
+ self.connect(self.downThread, SIGNAL("stop"),self.stop)
27
+ self.connect(self.downThread, SIGNAL("progress"),self.show_prog)
28
+ self.connect(self.downThread, SIGNAL("status"),self.status)
29
+ self.connect(self.downThread, SIGNAL("text"),self.showPop)
30
+ self.connect(self.downThread, SIGNAL("updated"),self.updated)
31
+ self.connect(self.prog, SIGNAL("forceStop"),self.forceStop)
32
+ self.connect(self.parent.popWidget,SIGNAL("download"),self.OK)
33
+ self.connect(self.parent.popWidget,SIGNAL("cancel"),self.NotOK)
34
+
35
+ def updated(self):
36
+ done = False
37
+ self.prog.accept()
38
+ info = STARTUPINFO()
39
+ info.dwFlags |= SW_HIDE
40
+ reply = QMessageBox.question(self,
41
+ "Sabel IDE",
42
+ "You have to restart for changes to take place.\nRestart Now?",
43
+ QMessageBox.Yes|QMessageBox.No)
44
+ if reply == QMessageBox.No:
45
+ done = False
46
+ elif reply == QMessageBox.Yes:
47
+ done = True
48
+ self.parent.fileSaveAll()
49
+ if(done):
50
+ proc = Popen("Sabel.exe",startupinfo = info)
51
+ self.parent.kill()
52
+
53
+
54
+ def start(self):
55
+ print "starting updater"
56
+ self.downThread.setOK(0) #everytime we check for update the while should wait otherwise thread exits default
57
+ self.downThread.start()
58
+
59
+ def OK(self):
60
+ self.downThread.setOK(1)
61
+
62
+ def NotOK(self):
63
+ self.downThread.setOK(2)
64
+
65
+ def showPop(self,text):
66
+ if(text == []):
67
+ self.retry()
68
+ return
69
+ if(text[0] != __version__):
70
+ self.parent.popWidget.setInfo(text)
71
+ self.parent.popWidget.showPopup()
72
+ self.parent.popWidget.showBtn()
73
+ else:
74
+ ''' This is to trigger checking on startup if no update dont show
75
+ otherwise can be nagging on every startup '''
76
+ if(self.firstStartUp != 0):
77
+ self.parent.popWidget.setInfo([__version__,"<br> Currently No Update "])
78
+ self.parent.popWidget.hideBtn()
79
+ self.parent.popWidget.showPopup()
80
+ else:
81
+ self.firstStartUp = 1
82
+ self.NotOK() #thread should exit if no update is present
83
+
84
+
85
+ def retry(self):
86
+ QMessageBox.about(self,"Error",'Cant Read repository Retry')
87
+ def net(self):
88
+ QMessageBox.about(self,"Error",'Net Connection Not Found')
89
+ def timed(self):
90
+ QMessageBox.about(self,"Error",'Connection Timed Out')
91
+ def cant(self):
92
+ QMessageBox.about(self,"Error",'File Cant be downloaded')
93
+ def stop(self):
94
+ QMessageBox.about(self,"Error",'Stopped / Net Connection Lost')
95
+
96
+ def show_prog(self):
97
+ self.prog.exec_()
98
+
99
+ def status(self,val):
100
+ self.prog.setValue(int(val))
101
+
102
+ def forceStop(self):
103
+ print "Thread ForceStopping"
104
+ self.prog.accept()
105
+ self.downThread.forceStop()
106
+
107
+ class ProgressDialog(QDialog):
108
+ def __init__(self, parent):
109
+ QDialog.__init__(self, parent)
110
+ self.resize(300, 75)
111
+ self.setWindowTitle("Updating")
112
+ self.vw = QWidget(self)
113
+ self.vl = QVBoxLayout(self.vw)
114
+ self.vl.setMargin(10)
115
+ self.label = QLabel(self.vw)
116
+ self.label.setText("<b>Downloading:</b> library.zip")
117
+ self.vl.addWidget(self.label)
118
+ self.horizontalLayoutWidget = QWidget()
119
+ self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget)
120
+ self.horizontalLayout.setMargin(0)
121
+ self.progressbar = QProgressBar(self.horizontalLayoutWidget)
122
+ self.progressbar.setFixedWidth(260)
123
+ self.progressbar.setMinimum(0)
124
+ self.progressbar.setMaximum(100)
125
+ self.stopButton = QPushButton(self.horizontalLayoutWidget)
126
+ self.stopButton.setFlat(True)
127
+ self.stopButton.setIcon(Icons.stop)
128
+ self.stopButton.setFixedSize(16,16)
129
+ self.horizontalLayout.addWidget(self.progressbar)
130
+ self.horizontalLayout.addWidget(self.stopButton)
131
+ self.vl.addWidget(self.horizontalLayoutWidget)
132
+ self.stopButton.clicked.connect(self.forceStop)
133
+
134
+ def setValue(self,val):
135
+ self.progressbar.setValue(val)
136
+ def forceStop(self):
137
+ self.emit(SIGNAL("forceStop"))
138
+
139
+ class DownThread(QThread):
140
+ def __init__(self):
141
+ QThread.__init__(self)
142
+ self.ok = 0
143
+ self.running = True
144
+
145
+ def start(self):
146
+ QThread.start(self)
147
+ self.running = True
148
+
149
+ def forceStop(self):
150
+ self.running = False
151
+
152
+ def setOK(self, val):
153
+ self.ok = val
154
+
155
+ def run(self):
156
+ print "Checking Net"
157
+ if(self.internet_on()):
158
+ print "Checking version"
159
+ text = self.check()
160
+ self.emit(SIGNAL("text"),text)
161
+ while self.ok == 0:
162
+ pass
163
+ if(self.ok ==1):
164
+ print "Thread Downloading"
165
+ self.download() #pushbutton accepted
166
+ else:
167
+ self.forceStop() #canceled
168
+ print "Thread Exiting"
169
+ #self.exec_()
170
+
171
+ def internet_on(self):
172
+ try:
173
+ response = urllib2.urlopen('http://74.125.113.99', timeout=2)
174
+ return True
175
+ except urllib2.URLError as err:
176
+ self.emit(SIGNAL("net"))
177
+ except:
178
+ self.emit(SIGNAL("timed"))
179
+ return False
180
+
181
+ def check(self):
182
+ url = 'https://raw.github.com/Pyros2097/Sabel/master/update.txt'
183
+ try:
184
+ u = urllib2.urlopen(url)
185
+ lines = u.read()
186
+ lines = lines.splitlines()
187
+ #print lines
188
+ return lines
189
+ except:
190
+ return []
191
+
192
+ ''' maybe be put this into an entire while self.running loop to allow updates after forceStop'''
193
+ def download(self):
194
+ self.emit(SIGNAL("progress"))
195
+ url = 'https://raw.github.com/Pyros2097/Sabel/master/build/exe.win32-2.7/library.zip'
196
+ file_name = url.split('/')[-1]
197
+ try:
198
+ u = urllib2.urlopen(url)
199
+ f = open(file_name+"_2097", 'wb')
200
+ meta = u.info()
201
+ file_size = int(meta.getheaders('Content-Length')[0])
202
+ #print 'Downloading: %s Bytes: %s' % (file_name, file_size)
203
+ file_size_dl = 0
204
+ block_sz = 8192
205
+ while self.running:
206
+ buffer = u.read(block_sz)
207
+ if not buffer:
208
+ break
209
+ file_size_dl += len(buffer)
210
+ f.write(buffer)
211
+ status = file_size_dl * 100.0 / file_size
212
+ self.emit(SIGNAL("status"),status)
213
+ ''' The file library.zip is never used the library
214
+ is once loaded into the vm so no need to delete it '''
215
+ f.close()
216
+ if(self.running): #to prevent it from executing this code if terminated
217
+ if(ospathexists(file_name)):
218
+ recycle(file_name) # deletes library.zip
219
+ osrename(file_name+"_2097",ospathjoin(ospathdirname(file_name+"_2097"),"library.zip"))
220
+ self.emit(SIGNAL("updated"))
221
+
222
+ except urllib2.URLError as err:
223
+ self.emit(SIGNAL("cant"))
224
+ except:
225
+ self.emit(SIGNAL("stop"))
226
+ self.quit()
227
+
228
+ def __del__(self):
229
+ self.wait()
{Widget → core}/workthread.py RENAMED
@@ -8,7 +8,9 @@ class WorkThread(QThread):
8
8
  self.process.readyReadStandardOutput.connect(self.readOutput)
9
9
  self.process.readyReadStandardError.connect(self.readErrors)
10
10
  self.process.finished.connect(self.fini)
11
+
12
+ def fini(self,no):
11
- #self.procDone = QtCore.pyqtSignal(bool)
13
+ self.emit(SIGNAL("fini"),no,self.cmd)
12
14
 
13
15
  def setCmd(self,val):
14
16
  self.cmd = val
@@ -45,9 +47,6 @@ class WorkThread(QThread):
45
47
  self.exec_()
46
48
  #self.process.kill()
47
49
 
48
- def fini(self,no):
49
- self.emit(SIGNAL("fini"),no,self.cmd)
50
-
51
50
  def readOutput(self):
52
51
  self.emit(SIGNAL("update"),str(self.process.readAllStandardOutput()))
53
52
 
cx.py CHANGED
@@ -1,5 +1,6 @@
1
1
  from cx_Freeze import setup, Executable
2
- #excludes = ['curses', 'email', 'tcl','tk','Tkinter','Tkconstants','pywin.debugger']
2
+ excludes = ['curses', 'email', 'tcl','tk','Tkinter','Tkconstants','pywin.debugger']
3
+ includes = ["urllib2"]
3
4
  """
4
5
  excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
5
6
  'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
@@ -12,16 +13,23 @@ exe = Executable(
12
13
  base="Win32GUI",
13
14
  targetName = "Sabel.exe",
14
15
  initScript = None,
15
- compress = True,
16
+ compress = False,
16
17
  copyDependentFiles = True,
17
- appendScriptToExe = False,
18
+ appendScriptToExe = True,
18
19
  appendScriptToLibrary = False,
19
20
  icon = "C:\CODE\Sabel\Icons\sabel.ico"
20
21
  )
21
22
 
22
23
  setup(
23
24
  name = "Sabel",
24
- version ="0.60",
25
+ version ="0.00",
25
26
  description = "Sabel IDE",
27
+ options = {"build_exe": {"includes": includes,
28
+ "excludes": excludes,
29
+ #"packages": packages
30
+ #"path": path
31
+ }
32
+ },
33
+
26
34
  executables = [exe]
27
35
  )
error/__init__.py ADDED
File without changes
Error.py → error/type.py RENAMED
@@ -1,4 +1,4 @@
1
- class Errors:
1
+ class ErrorType:
2
2
  open = "Already Open"
3
3
  locked = "Locked"
4
4
  Exist = "Does not Exist"
globals.py CHANGED
@@ -1,10 +1,17 @@
1
+ #!/usr/bin/env python
2
+ __author__ = "pyros2097"
3
+ __license__ = "GPLv3"
4
+ __copyright__ = 'Copyright (c) 2013, pyros2097'
5
+ __credits__ = ['pyros2097', 'eclipse']
6
+ __email__ = 'pyros2097@gmail.com'
7
+ __version__ = "0.62"
8
+
1
9
  import os
2
10
  from platform import system,python_version
3
11
  from PyQt4.QtGui import QIcon,QPixmap,QApplication,QSplashScreen
4
12
  from send2trash import send2trash
5
13
  from config import Config
6
14
 
7
- __version__ = "0.60"
8
15
  #Python accesses local variables much more efficiently than global variables.
9
16
  oslistdir = os.listdir
10
17
  ospathisdir = os.path.isdir
@@ -49,6 +56,10 @@ def os_icon(name):
49
56
  def os_pixmap(name):
50
57
  return QPixmap(":/{0}.png".format(ospathjoin(iconDir,name)))
51
58
 
59
+ class Encoding:
60
+ ASCII = 0
61
+ UNICODE = 1
62
+
52
63
  class Icons:
53
64
  add = os_icon('auto_add')
54
65
  alert_obj = os_icon('alert_obj')
license.txt CHANGED
@@ -3,8 +3,7 @@ Copyright (c) 2012 Peter John (pyros2097@gmail.com)
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
5
5
  in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6
+ to use, copy, modify, merge, publish, distribute, sublicense and to permit persons to whom the Software is
7
- copies of the Software, and to permit persons to whom the Software is
8
7
  furnished to do so, subject to the following conditions:
9
8
 
10
9
  The above copyright notice and this permission notice shall be included in all
main.py CHANGED
@@ -1,13 +1,22 @@
1
1
  #!/usr/bin/env python
2
2
  __author__ = "pyros2097"
3
3
  __license__ = "GPLv3"
4
- __copyright__ = 'Copyright (c) 2012, pyros2097'
4
+ __copyright__ = 'Copyright (c) 2013, pyros2097'
5
5
  __credits__ = ['pyros2097', 'eclipse']
6
6
  __email__ = 'pyros2097@gmail.com'
7
- __version__ = "0.60"
7
+ """
8
- #TODO:
8
+ WARNING!!WARNING!!
9
- #Must learn to destroy editor completely because memory keeps increasing
9
+ Must not modify the main.py script which is embedded into the exe file
10
+ This is to ensure that updating the software will always work.
11
+ Built on :
12
+ python 2.7.3
13
+ qt 4.8.2
14
+ pyqt 4.9.4
15
+ cxFreeze 4.3
16
+ py2app 0.6.4
17
+ sip
18
+ qscintilla
10
- #when close tab occurs
19
+ """
11
20
 
12
21
  from PyQt4.QtGui import QApplication,QSplashScreen
13
22
  from PyQt4.QtCore import Qt
@@ -42,4 +51,5 @@ def main():
42
51
  app.exec_()
43
52
 
44
53
  if __name__ == "__main__":
45
- main()
54
+ main()
55
+
mainwindow.py CHANGED
@@ -2,9 +2,11 @@ from PyQt4.QtGui import (QApplication,QPixmap,QSplashScreen,QMessageBox,
2
2
  QIcon,QAction,QCheckBox,QFileDialog)
3
3
  from PyQt4.QtCore import SIGNAL,Qt,QStringList,QString
4
4
  from window import Window
5
+ from Widget import Editor,Audio,Image,Tool
5
- from Widget import Editor,PyInterp,Adb,Ant,Parser,Command,Audio,Image,Tool
6
+ from core import PyInterp,Adb,Ant,Parser,Command,update
6
7
  from globals import (ospathsep,ospathjoin,ospathbasename,workDir,config,workSpace,
7
- iconSize,iconDir,ospathexists,os_icon)
8
+ iconSize,iconDir,ospathexists,os_icon, __version__)
9
+ from globals import Encoding
8
10
  import sys
9
11
 
10
12
  class MainWindow(Window):
@@ -19,7 +21,12 @@ class MainWindow(Window):
19
21
  self.parser = Parser(self)
20
22
  self.command = Command(self)
21
23
  self.ant = Ant(self)
22
-
24
+ self.updater = update.Updater(self)
25
+ self.update()
26
+
27
+ def update(self):
28
+ self.updater.start()
29
+
23
30
  def init(self):
24
31
  self.toolBar = Tool(self)
25
32
  self.addToolBar(self.toolBar)
@@ -30,6 +37,7 @@ class MainWindow(Window):
30
37
  self.tabWidget.tabCloseRequested.connect(self.closeTab)
31
38
  self.treeWidget.itemDoubleClicked.connect(self.treeItemClicked)
32
39
  self.connect(self.treeWidget,SIGNAL("openFileClicked"),self.treeItemClicked)
40
+ self.connect(self.treeWidget,SIGNAL("sendFileClicked"),self.sendFile)
33
41
  self.connect(self.treeWidget,SIGNAL("create"), lambda x:self.ant.create(x))
34
42
  self.connect(self.treeWidget,SIGNAL("build"), lambda x:self.ant.build(x))
35
43
  self.connect(self.treeWidget,SIGNAL("buildRun"), lambda x:self.ant.buildRun(x))
@@ -53,6 +61,12 @@ class MainWindow(Window):
53
61
  self.openImage(item.getPath())
54
62
  elif(item.isAudio()):
55
63
  self.openAudio(item.getPath())
64
+
65
+ def sendFile(self,item):
66
+ if(item.isFile()):
67
+ self.command.setCmdText("adb push "+item.getPath()+" /sdcard/")
68
+
69
+
56
70
 
57
71
  def initInterpreter(self):
58
72
  self.ipy = PyInterp(self)
@@ -89,7 +103,10 @@ class MainWindow(Window):
89
103
  try:
90
104
  infile = open(nfile, 'r')
91
105
  tt = infile.read()
106
+ if(config.encoding() == Encoding.UNICODE):
92
- text = unicode(tt,"utf-8")#must add utf-8 for it to work
107
+ text = unicode(tt,"utf-8")#must add utf-8 for it to work
108
+ else:
109
+ text = str(tt)
93
110
 
94
111
  #infile.close()
95
112
  self.files.append(nfile)
@@ -202,13 +219,15 @@ class MainWindow(Window):
202
219
  fl = open(fname, 'w')
203
220
  self.statusSaving()
204
221
  self.progressStart()
222
+ if(config.encoding() == Encoding.UNICODE):
205
- tempText = unicode(self.tabWidget.widget(index).text())
223
+ tempText = unicode(self.tabWidget.widget(index).text())
206
- if tempText:
207
224
  fl.write(tempText.encode("utf-8"))
208
225
  fl.close()
209
- self.clearDirty(index)
210
226
  else:
211
- QMessageBox.about(self, "Can't Save","Failed to save ...")
227
+ tempText = str(self.tabWidget.widget(index).text())
228
+ fl.write(tempText)
229
+ fl.close()
230
+ self.clearDirty(index)
212
231
  except:
213
232
  QMessageBox.about(self, "Can't Save","File is Locked")
214
233
  self.statusWriting()
@@ -225,13 +244,15 @@ class MainWindow(Window):
225
244
  fl = open(fname, 'w')
226
245
  self.statusSaving()
227
246
  self.progressStart()
247
+ if(config.encoding() == Encoding.UNICODE):
228
- tempText = unicode(self.tabWidget.widget(index).text())
248
+ tempText = unicode(self.tabWidget.widget(index).text())
229
- if tempText:
230
249
  fl.write(tempText.encode("utf-8"))
231
250
  fl.close()
232
- self.clearDirty(index)
233
251
  else:
234
- QMessageBox.about(self, "Can't Save","Failed to save ...")
252
+ tempText = str(self.tabWidget.widget(index).text())
253
+ fl.write(tempText)
254
+ fl.close()
255
+ self.clearDirty(index)
235
256
  self.statusWriting()
236
257
  self.progressStop()
237
258
  except:
@@ -243,7 +264,6 @@ class MainWindow(Window):
243
264
 
244
265
 
245
266
  def closeEvent(self, event):
246
- #check this adb.exe process is always on
247
267
  self.adb.close()
248
268
  self.parser.close()
249
269
  self.command.close()
@@ -254,11 +274,11 @@ class MainWindow(Window):
254
274
  notSaved = True
255
275
  if notSaved:
256
276
  reply = QMessageBox.question(self,
257
- "Sabel - Unsaved Changes",
277
+ "Sabel - Unsaved Changes",
258
- "Save unsaved changes?",
278
+ "Save unsaved changes?",
259
- QMessageBox.Yes|QMessageBox.No|QMessageBox.Cancel)
279
+ QMessageBox.Yes|QMessageBox.No|QMessageBox.Cancel)
260
280
  if reply == QMessageBox.Cancel:
261
- pass
281
+ return
262
282
  elif reply == QMessageBox.Yes:
263
283
  self.fileSaveAll()
264
284
  sys.exit()
runtests.py CHANGED
@@ -7,4 +7,8 @@ def main(func):
7
7
  raise Exception, "Error: ", e
8
8
 
9
9
  if __name__ == "__main__":
10
+ #import uncompyle2
11
+ #import sys
12
+ #file = open("C:/gg.txt")
13
+ #uncompyle2.uncompyle_file("C:/update.pyc",sys.stdout)#,file)
10
14
  main("")
stylesheet.py CHANGED
@@ -1,3 +1,40 @@
1
+ popbg = """
2
+ QWidget {
3
+ background: QLinearGradient(x1: 1, y1: 0, x2: 0, y2: 1, stop: 0.4 #eef, stop: 0.9 #ccf);
4
+ border: 1px solid gray;
5
+ border-radius: 40px;
6
+ }
7
+ QLabel{
8
+ /*background: qlineargradient(x1: 0, y1: 1, x2: 0.08, y2: 0.05,stop: 0.2 #e8f2fe, stop: 0.9 #d8f2dd);*/
9
+ border: 1px solid gray;
10
+ font-size: 12px;
11
+ padding-left: 15px;
12
+ padding-top: 5px;
13
+ border-radius: 30px;
14
+ }
15
+ QLineEdit {
16
+ padding: 1px;
17
+ border-style: solid;
18
+ border: 2px solid gray;
19
+ border-radius: 8px;
20
+ }
21
+ QPushButton {
22
+ color: white;
23
+ background-color: QLinearGradient( x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #88d, stop: 0.1 #99e, stop: 0.49 #77c, stop: 0.5 #66b, stop: 1 #77c);
24
+ border-width: 1px;
25
+ border-color: #339;
26
+ border-style: solid;
27
+ border-radius: 7;
28
+ padding: 3px;
29
+ font-size: 10px;
30
+ padding-left: 5px;
31
+ padding-right: 5px;
32
+ min-width: 50px;
33
+ max-width: 50px;
34
+ min-height: 13px;
35
+ max-height: 13px;
36
+ }
37
+ """
1
38
  stletabb = """
2
39
  /* Style the tab using the tab sub-control. Note that
3
40
  it reads QTabBar _not_ QTabWidget */
@@ -6,7 +43,8 @@ stletabb = """
6
43
  stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
7
44
  stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);*/
8
45
  border: 1px solid #C2C7CB;
46
+ border-top-color: #e8f2fe;
9
- border-bottom-color: #C2C7CB; /* same as the pane color */
47
+ border-bottom-color: #e8f2fe; /* same as the pane color */
10
48
  border-top-left-radius: 1px;
11
49
  border-top-right-radius: 1px;
12
50
  min-width: 10ex;
@@ -20,8 +58,16 @@ stletabb = """
20
58
  }
21
59
 
22
60
  QTabBar::tab:selected {
61
+ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
62
+ stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
63
+ stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
64
+ /* border-color: #9B9B9B; */
65
+ border: 0px solid #C2C7CB;
23
- border-color: #9B9B9B;
66
+ border-bottom-color: #C2C7CB;
67
+ border-top-left-radius: 1px;
24
- border-bottom-color: #C2C7CB; /* same as pane color */
68
+ border-top-right-radius: 1px;
69
+ margin-left: 1px;
70
+ margin-right: 1px;
25
71
  }
26
72
 
27
73
  QTabBar::tab:!selected {
@@ -29,13 +75,6 @@ stletabb = """
29
75
  margin-left: 0px;
30
76
  margin-right: 0px;
31
77
  }
32
-
33
- /* make use of negative margins for overlapping tabs */
34
- QTabBar::tab:selected {
35
- /* expand/overlap to the left and right by 4px */
36
- margin-left: 0px;
37
- margin-right: 0px;
38
- }
39
78
 
40
79
  QTabBar::close-button {
41
80
  /*image: url(:/Icons/x.png) 5;*/
@@ -43,6 +82,10 @@ stletabb = """
43
82
  QTabBar::close-button:hover {
44
83
  /*image: url(:/Icons/x.png);*/
45
84
  }
85
+ QTabBar:hover
86
+ {
87
+ /*background-color: rgb(175,175,175);*/
88
+ }
46
89
 
47
90
  """
48
91
 
@@ -66,7 +109,5 @@ QMainWindow::separator {
66
109
  height: 10px; /* when horizontal */
67
110
  }
68
111
 
69
- QMainWindow::separator:hover {
112
+ QMainWindow::separator:hov
70
- background: red;
71
- }
72
- """
113
+ """
window.py CHANGED
@@ -10,6 +10,7 @@ from PyQt4.QtCore import QSize,Qt,QStringList,SIGNAL,SLOT,QString
10
10
 
11
11
  from Widget import EditorTab, TreeTab, OutputTab
12
12
  from Widget import ProjectTree, ErrorTree, OutlineTree
13
+ from Widget import Popup
13
14
 
14
15
  from Widget import DialogAndroid,DialogAbout,DialogAnt,DialogSquirrel,DialogTodo,DialogBrowse
15
16
 
@@ -18,7 +19,6 @@ from design import Screen
18
19
 
19
20
 
20
21
  from Widget.style import Styles
21
- from stylesheet import *
22
22
 
23
23
  from globals import (ospathsep,ospathjoin,ospathbasename,workDir,config,workSpace,
24
24
  iconSize,iconDir,Icons)
@@ -26,7 +26,6 @@ from globals import (ospathsep,ospathjoin,ospathbasename,workDir,config,workSpac
26
26
  class Window(QMainWindow):
27
27
  def __init__(self,parent = None):
28
28
  QMainWindow.__init__(self,parent)
29
- self.setStyleSheet(mainstyl)
30
29
  self.resize(1024,768)
31
30
  self.setWindowTitle("Sabel")
32
31
  self.setWindowIcon(Icons.sabel)
@@ -36,7 +35,6 @@ class Window(QMainWindow):
36
35
  self.styleIndex = config.styleIndex()
37
36
  self.cmdList = config.cmds()
38
37
  self.paramList = config.params()
39
- self.mode = config.mode()
40
38
 
41
39
  '''A.Editor TabWidget'''
42
40
  '''This parent is for findbar and vertical layout'''
@@ -47,10 +45,24 @@ class Window(QMainWindow):
47
45
  self.editorLayout.setMargin(0)
48
46
  self.editorLayout.addWidget(self.tabWidget)
49
47
 
48
+ "0.Style Layout"
49
+
50
+ "0.Style Layout"
51
+ self.styleLayoutWidget = QFrame()
52
+ self.styleLayoutWidget.setFrameShape(QFrame.StyledPanel)
53
+ self.styleLayout = QHBoxLayout(self.styleLayoutWidget)
54
+ self.styleTest = QPushButton(self.styleLayoutWidget)
55
+ self.styleTest.setText("Change Styles")
56
+ self.styleTest.clicked.connect(self.changeStyleSheet)
57
+ self.popWidget = Popup(self.styleLayoutWidget)
58
+ self.styleLayout.addWidget(self.styleTest)
59
+ self.styleLayout.addWidget(self.popWidget)
60
+ self.styleLayout.setMargin(0)
61
+ self.editorLayout.addWidget(self.styleLayoutWidget)
62
+ self.styleLayoutWidget.hide()
63
+
50
64
  "1.Find Layout"
51
65
  self.findLayoutWidget = QFrame()
52
- #self.findLayoutWidget.setLineWidth(2)
53
- #self.findLayoutWidget.setStyleSheet("margin-top:1px;margin-bottom:1px;")
54
66
  self.findLayoutWidget.setFrameShape(QFrame.StyledPanel)
55
67
  self.findLayout = QHBoxLayout(self.findLayoutWidget)
56
68
  self.lineEdit = QLineEdit(self.findLayoutWidget)
@@ -146,7 +158,6 @@ class Window(QMainWindow):
146
158
  '''E.Output TabWidget'''
147
159
  self.outputTabWidget = OutputTab(self)
148
160
  self.outputTabWidget.setMaximumHeight(200)#260
149
- self.tabWidget.tabBar().setStyleSheet(stletabb)
150
161
  self.tabWidget.currentChanged.connect(self.fileChanged)
151
162
  self.explorerTabWidget.currentChanged.connect(self.closeExplorer)
152
163
  self.outputTabWidget.currentChanged.connect(self.closeConsole)
@@ -327,7 +338,32 @@ class Window(QMainWindow):
327
338
  self.setCentralWidget(self.centralwidget)
328
339
  self.setStatusBar(self.statusbar)
329
340
  self.textEdit.setReadOnly(True)
341
+ self.initStyleSheet()
330
342
 
343
+ def initStyleSheet(self):
344
+ import stylesheet
345
+ self.setStyleSheet(stylesheet.mainstyl)
346
+ self.tabWidget.tabBar().setStyleSheet(stylesheet.stletabb)
347
+ self.popWidget.setStyleSheet(stylesheet.popbg)
348
+ self.popWidget.hide()
349
+
350
+
351
+ #self.findLayoutWidget.setLineWidth(2)
352
+ #self.findLayoutWidget.setStyleSheet("margin-top:1px;margin-bottom:1px;")
353
+
354
+ ''' This is only for testing dont know if it works for builds '''
355
+ def changeStyleSheet(self):
356
+ ''' Dynamically load the changed stylesheet.py and load the modules and change
357
+ the style at runtime saves countless deploys '''
358
+ import imp
359
+ foo = imp.load_source('stletabb', workDir+"/stylesheet.py")
360
+ #print foo.stletabb
361
+ #self.setStyleSheet(stylesheet.mainstyl)
362
+ self.tabWidget.tabBar().setStyleSheet(foo.stletabb)
363
+ self.popWidget.setStyleSheet(foo.popbg)
364
+ if(self.popWidget.isHidden()):
365
+ self.popWidget.showPopup()
366
+
331
367
  def build_project(self):
332
368
  #current_file = self.files[self.tabWidget.currentIndex()]
333
369
  prj = self.treeWidget.getProject()
@@ -344,38 +380,38 @@ class Window(QMainWindow):
344
380
  self.ant.kill()
345
381
  self.progressStop()
346
382
 
383
+ def kill(self):
384
+ self.deleteLater()
385
+
347
386
  #-----------------------------------------------------------------------------------#
348
387
  # Menu Actions Functions #
349
388
  #-----------------------------------------------------------------------------------#
350
389
  def run(self):
351
- if(self.mode == 0):
390
+ if(config.mode() == 0):
352
391
  self.sq.run()
353
- elif(self.mode == 1):
392
+ elif(config.mode() == 1):
354
393
  self.adb.run()
355
- elif(self.mode == 2):
394
+ elif(config.mode() == 2):
356
395
  self.ios.run()
357
- elif(self.mode == 3):
396
+ elif(config.mode() == 3):
358
397
  self.c.run()
359
- elif(self.mode == 4):
360
- self.cpp.run()
361
398
 
362
- def emo(self):
399
+ def setMode(self, action):
400
+ if(action.text() == "Squ"):
363
- if(self.mode == 0):
401
+ config.setMode(0)
402
+ elif(action.text() == "Emo"):
364
- self.mode = 1
403
+ config.setMode(1)
404
+ elif(action.text() == "Android"):
405
+ config.setMode(2)
365
- self.toolBar.action_Squirrel.setChecked(False)
406
+ elif(action.text() == "ios"):
366
- else:
367
- self.toolBar.action_Squirrel.setChecked(True)
407
+ config.setMode(3)
368
408
 
369
- def ios(self):
409
+ def openCommand(self):
370
- print "ios"
410
+ text, ok = QInputDialog.getText(self, 'Run Command', 'Command:')
371
-
372
-
373
- def sq(self):
411
+ cmd = str(text)
412
+ if ok and cmd != "":
413
+ import subprocess
374
- if(self.mode == 1):
414
+ subprocess.Popen(cmd)
375
- self.mode = 0
376
- self.toolBar.action_Emo.setChecked(False)
377
- else:
378
- self.toolBar.action_Emo.setChecked(True)
379
415
 
380
416
  def about(self):
381
417
  form = DialogAbout(self)
@@ -585,7 +621,7 @@ class Window(QMainWindow):
585
621
  # self.tabWidget.widget(i).zoomout()
586
622
 
587
623
  def setFont(self,font):
588
- config.setFontName(font.family())
624
+ config.setFontName(str(font.family()))
589
625
  for i in range(len(self.files)):
590
626
  self.tabWidget.widget(i).setNewFont(font)
591
627
 
@@ -613,6 +649,7 @@ class Window(QMainWindow):
613
649
  for i in range(len(self.files)):
614
650
  self.tabWidget.widget(i).setMargin(0)
615
651
 
652
+ ''' Toggle '''
616
653
  def setIndent(self):
617
654
  indent = config.indent()
618
655
  if(indent == 0):
@@ -623,7 +660,33 @@ class Window(QMainWindow):
623
660
  config.setIndent(0)
624
661
  for i in range(len(self.files)):
625
662
  self.tabWidget.widget(i).setIndent(0)
626
-
663
+ ''' Toggle '''
664
+ def setWhiteSpace(self):
665
+ white = config.whiteSpace()
666
+ if(white == 0):
667
+ config.setWhiteSpace(1)
668
+ for i in range(len(self.files)):
669
+ self.tabWidget.widget(i).setWhitespaceVisibility(True)
670
+ else:
671
+ config.setWhiteSpace(0)
672
+ for i in range(len(self.files)):
673
+ self.tabWidget.widget(i).setWhitespaceVisibility(False)
674
+
675
+ ''' Toggle '''
676
+ def setEndLine(self):
677
+ for i in range(len(self.files)):
678
+ edt = self.tabWidget.widget(i)
679
+ edt.setEolVisibility(not edt.eolVisibility())
680
+
681
+ def setEncoding(self, action):
682
+ if(action.text() == "Ascii"):
683
+ config.setAscii()
684
+ for i in range(len(self.files)):
685
+ self.tabWidget.widget(i).setUtf8(False)
686
+ elif(action.text() == "Unicode"):
687
+ config.setUnicode()
688
+ for i in range(len(self.files)):
689
+ self.tabWidget.widget(i).setUtf8(True)
627
690
 
628
691
  def setThreshold(self,val):
629
692
  config.setThresh(val)