4f1792cd pyros2097

13 years ago
saving
Dialog/__init__.py DELETED
@@ -1 +0,0 @@
1
- from dialogs import UIAbout,UIProject,UIRename,UIOptions
Dialog/__init__.pyc DELETED
Binary file
Dialog/dialogs.py DELETED
@@ -1,47 +0,0 @@
1
- from PyQt4.QtGui import *
2
- from globals import ospathdirname,ospathjoin
3
-
4
- class UIProject(QDialog):
5
- """Project dialogue
6
- """
7
- def __init__(self, parentWindow):
8
- QDialog.__init__(self, parentWindow)
9
- from PyQt4 import uic # lazy import for better startup performance
10
- uic.loadUi(ospathjoin(ospathdirname(__file__), 'Project.ui'), self)
11
-
12
-
13
- class UIOptions(QDialog):
14
- """Project dialogue
15
- """
16
- def __init__(self, parentWindow):
17
- QDialog.__init__(self, parentWindow)
18
- from PyQt4 import uic # lazy import for better startup performance
19
- uic.loadUi(ospathjoin(ospathdirname(__file__), 'Options.ui'), self)
20
- #self.tabWidget.
21
- #fname = unicode(QFileDialog.getExistingDirectory(self,
22
- # "Open File", '.', "Files (*.*)"))
23
-
24
-
25
-
26
-
27
-
28
- class MainForm(QMainWindow):
29
- def __init__(self, parent=None):
30
- super(MainForm, self).__init__(parent)
31
- qtt = QTextEdit(self)
32
- self.setCentralWidget(qtt)
33
- qtt.textChanged.connect(self.dd)
34
-
35
- def dd(self):
36
- main = UIOptions(self)
37
- main.show()
38
-
39
- def main():
40
- app = QApplication([])
41
- form = MainForm()
42
- form.show()
43
- app.exec_()
44
-
45
- if __name__ == '__main__':
46
- main()
47
-
Dialog/dialogs.pyc DELETED
Binary file
{Dialog → Widget}/Options.ui RENAMED
File without changes
{Dialog → Widget}/Project.ui RENAMED
File without changes
Widget/__init__.py CHANGED
@@ -4,4 +4,5 @@ from tree import Tree
4
4
  from adb import Adb
5
5
  from parser import Parser
6
6
  from ipython import PyInterp
7
- from style import *
7
+ from style import *
8
+ from dialogs import *
Widget/__init__.pyc CHANGED
Binary file
Widget/adb.py CHANGED
@@ -2,22 +2,56 @@ from globals import adblist
2
2
  from PyQt4.QtGui import QWidget
3
3
  import threading
4
4
  from subprocess import PIPE,Popen,STDOUT
5
- from PyQt4.QtCore import pyqtSignal,SIGNAL
5
+ from PyQt4.QtCore import pyqtSignal,SIGNAL,QThread,QProcess,QString
6
6
 
7
+ class WorkThread(QThread):
8
+ def __init__(self):
9
+ QThread.__init__(self)
10
+ self.process = QProcess()
11
+ self.cmd = None
12
+ self.connect(self.process, SIGNAL("readyReadStandardOutput()"), self.readOutput)
13
+ self.connect(self.process, SIGNAL("readyReadStandardError()"), self.readErrors)
14
+
15
+ def setCmd(self,val):
16
+ self.cmd = val
17
+
18
+ def kill_process(self):
19
+ self.process.kill()
20
+
21
+ def run(self):
22
+ #self.process_thread.run()
23
+ self.process.start(self.cmd)
24
+ #self.exec_()
25
+ self.process.waitForFinished()
26
+ #self.emit(SIGNAL("fini"))
27
+ #self.process.finished.connect(self.fini)
28
+ #self.emit(SIGNAL("finished"),True)
29
+
30
+ def fini(self):
31
+ self.emit(SIGNAL("fini"))
32
+ def readOutput(self):
33
+ self.emit(SIGNAL("update"),QString(self.process.readAllStandardOutput()))
34
+
35
+ def readErrors(self):
36
+ self.emit(SIGNAL("update"),QString(self.process.readAllStandardError()))
37
+
38
+ def __del__(self):
39
+ pass
40
+ #self.wait()
7
41
 
42
+
8
- class Adb(QWidget):
43
+ class AdbThread(threading.Thread,QWidget):
9
- def __init__(self,parent):
44
+ def __init__(self):
10
- QWidget.__init__(self,parent)
45
+ QWidget.__init__(self)
46
+ threading.Thread.__init__(self)
11
- self.parent = parent
47
+ self.stdout = None
48
+ self.stderr = None
49
+ self.cmd = None
12
50
  self.adb_process = None
13
- self.isRunning = False
14
- self.connect(self, SIGNAL("didSomething"),self.update)
15
51
 
16
- def update(self,line):
52
+
17
- self.parent.textEdit.append(line)
18
-
19
- def setCommand(self,comlist):
53
+ def setCmd(self,val):
20
- pass
54
+ self.cmd = val
21
55
 
22
56
  def output(self,pipe):
23
57
  while True:
@@ -25,18 +59,49 @@ class Adb(QWidget):
25
59
  if self.adb_process.poll() != None:
26
60
  break
27
61
  line = pipe.readline().strip()
28
-
29
- if len(line) > 0:
62
+ if len(line) > 0:
63
+ #print line
30
64
  self.emit(SIGNAL("didSomething"),line)
31
65
  except:
32
66
  print "except"
33
67
  #traceback.print_exc()
68
+
69
+ def run(self):
70
+ if(self.cmd != ""):
71
+ self.adb_process = Popen(self.cmd, creationflags=0x08000000,shell=False,stdout=PIPE,stderr=PIPE)
72
+ t = threading.Thread(target=self.output, args=(self.adb_process.stdout,))
73
+ t.start()
74
+ #t.join()
34
75
 
76
+ class Adb(QWidget):
77
+ def __init__(self,parent):
78
+ QWidget.__init__(self,parent)
79
+ self.parent = parent
80
+ self.adb_process = None
81
+ self.isRunning = False
82
+ self.adb_thread = WorkThread()
83
+ #self.adb_thread = AdbThread()
84
+ self.connect(self.adb_thread, SIGNAL("update"),self.update)
85
+ #self.connect(self.adb_thread, SIGNAL("fini"),self.newstart)
86
+ self.connect(self.adb_thread, SIGNAL("finished"),self.newstart)
87
+
88
+ def update(self,line):
89
+ self.parent.textEdit.append(line)
90
+
91
+ def newstart(self):
92
+ print "finished"
93
+ self.parent.textEdit.append("Finshed")
94
+ #self.adb_thread.kill_process()
95
+ #self.parent.textEdit.append("Starting Activity...\n")
96
+ #self.adb_thread.setCmd(adblist[1])
97
+ #self.adb_thread.run()
98
+ #print "finished"
99
+
35
100
 
36
101
  def run(self):
37
102
  if self.isRunning == False:
38
- if self.adb_process != None and self.adb_process.poll() == None:
103
+ #if self.adb_process != None and self.adb_process.poll() == None:
39
- self.adb_process.kill()
104
+ # self.adb_process.kill()
40
105
  self.isRunning = True
41
106
  self.parent.action_Run.setDisabled(True)
42
107
  self.parent.action_Stop.setEnabled(True)
@@ -44,23 +109,37 @@ class Adb(QWidget):
44
109
  self.parent.tabWidget_3.show()
45
110
  self.parent.tabWidget_3.setCurrentIndex(1)
46
111
  self.parent.textEdit.clear()
47
- self.parent.textEdit.append("Pushing main.nut\n")
112
+ self.parent.textEdit.append("Pushing main.nut...\n")
48
- self.adb_process = Popen(adblist[0], creationflags=0x08000000, shell=False, stdout=PIPE,stderr=STDOUT)
113
+ self.adb_thread.setCmd(adblist[0])
114
+ self.adb_thread.run()
49
- t = threading.Thread(target=self.output, args=(self.adb_process.stdout,))
115
+ #self.adb_thread.finished(self.newstart)
116
+ """
117
+ self.adb_thread.setCmd(adblist[0])
50
- t.start()
118
+ self.adb_thread.run()
51
- t.join()
52
- #adb_process.wait()
119
+ self.adb_thread.join()
120
+ self.adb_thread.adb_process.kill()
53
- #self.parent.textEdit.append("Starting Activity\n")
121
+ self.parent.textEdit.append("Starting Activity\n")
122
+ self.adb_thread.setCmd(adblist[1])
123
+ self.adb_thread.run()
124
+ self.adb_thread.join()
54
- #adb_process = subprocess.Popen(adb[1], shell=False, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
125
+ self.adb_thread.adb_process.kill()
55
- #self.parent.textEdit.append("Logging")
126
+ self.parent.textEdit.append("Logging")
127
+ self.adb_thread.setCmd(adblist[2])
128
+ self.adb_thread.run()
56
- #adb_process.wait()
129
+ self.adb_thread.join()
57
- #adb_process = subprocess.Popen(adb[2], shell=False, stdout=subprocess.PIPE,stderr=subprocess.PIPE)
130
+ #self.adb_thread.adb_process.kill()
131
+ """
132
+
58
133
 
59
134
  def stop(self):
60
135
  if self.isRunning == True:
61
136
  self.isRunning = False
137
+ self.adb_thread.setCmd(adblist[3])
138
+ self.adb_thread.run()
139
+ self.adb_thread.join()
140
+ self.adb_thread.adb_process.kill()
62
- if self.adb_process != None and self.adb_process.poll() == None:
141
+ #if self.adb_process != None and self.adb_process.poll() == None:
63
- self.adb_process.kill()
142
+ # self.adb_process.kill()
64
143
  self.parent.action_Stop.setDisabled(True)
65
144
  self.parent.textEdit.append("Stopped")
66
145
  if not(self.parent.tabWidget_3.isHidden()):
@@ -69,4 +148,4 @@ class Adb(QWidget):
69
148
 
70
149
  def close(self):
71
150
  if self.adb_process != None and self.adb_process.poll() == None:
72
- self.adb_process.kill()
151
+ self.adb_process.kill()
Widget/adb.pyc CHANGED
Binary file
Widget/dialogs.py ADDED
@@ -0,0 +1,92 @@
1
+ from PyQt4 import QtGui
2
+ from PyQt4 import QtCore
3
+ """
4
+ class UIProject(QDialog):
5
+ def __init__(self, parentWindow):
6
+ QDialog.__init__(self, parentWindow)
7
+ from PyQt4 import uic # lazy import for better startup performance
8
+ uic.loadUi(ospathjoin(ospathdirname(__file__), 'Project.ui'), self)
9
+
10
+
11
+ class UIOptions(QDialog):
12
+ def __init__(self, parentWindow):
13
+ QDialog.__init__(self, parentWindow)
14
+ from PyQt4 import uic # lazy import for better startup performance
15
+ uic.loadUi(ospathjoin(ospathdirname(__file__), 'Options.ui'), self)
16
+ #self.tabWidget.
17
+ #fname = unicode(QFileDialog.getExistingDirectory(self,
18
+ # "Open File", '.', "Files (*.*)"))
19
+
20
+ """
21
+ class DialogAndroid(QtGui.QDialog):
22
+ def __init__(self, parent=None):
23
+ QtGui.QDialog.__init__(self, parent)
24
+ self.resize(400, 420)
25
+ self.horizontalLayoutWidget = QtGui.QWidget(self)
26
+ self.horizontalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 401, 361))
27
+ self.horizontalLayoutWidget.setObjectName(("horizontalLayoutWidget"))
28
+ self.horizontalLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget)
29
+ self.horizontalLayout.setMargin(0)
30
+ self.horizontalLayout.setObjectName(("horizontalLayout"))
31
+ self.tabWidget = QtGui.QTabWidget(self.horizontalLayoutWidget)
32
+ self.tabWidget.setObjectName(("tabWidget"))
33
+ self.tab_4 = QtGui.QWidget()
34
+ self.tab_4.setObjectName(("tab_4"))
35
+ self.formLayoutWidget = QtGui.QWidget(self.tab_4)
36
+ self.formLayoutWidget.setGeometry(QtCore.QRect(10, 10, 361, 311))
37
+ self.formLayoutWidget.setObjectName(("formLayoutWidget"))
38
+ self.formLayout = QtGui.QFormLayout(self.formLayoutWidget)
39
+ self.formLayout.setMargin(0)
40
+ self.formLayout.setObjectName(("formLayout"))
41
+ self.label_2 = QtGui.QLabel(self.formLayoutWidget)
42
+ self.label_2.setObjectName(("label_2"))
43
+ self.formLayout.setWidget(0, QtGui.QFormLayout.SpanningRole, self.label_2)
44
+ self.lineEdit_2 = QtGui.QLineEdit(self.formLayoutWidget)
45
+ self.lineEdit_2.setText((""))
46
+ self.lineEdit_2.setObjectName(("lineEdit_2"))
47
+ self.formLayout.setWidget(1, QtGui.QFormLayout.SpanningRole, self.lineEdit_2)
48
+ self.lineEdit_3 = QtGui.QLineEdit(self.formLayoutWidget)
49
+ self.lineEdit_3.setText((""))
50
+ self.lineEdit_3.setObjectName(("lineEdit_3"))
51
+ self.formLayout.setWidget(3, QtGui.QFormLayout.SpanningRole, self.lineEdit_3)
52
+ self.label_3 = QtGui.QLabel(self.formLayoutWidget)
53
+ self.label_3.setObjectName(("label_3"))
54
+ self.formLayout.setWidget(2, QtGui.QFormLayout.SpanningRole, self.label_3)
55
+ self.label_4 = QtGui.QLabel(self.formLayoutWidget)
56
+ self.label_4.setObjectName(("label_4"))
57
+ self.formLayout.setWidget(5, QtGui.QFormLayout.SpanningRole, self.label_4)
58
+ self.lineEdit_4 = QtGui.QLineEdit(self.formLayoutWidget)
59
+ self.lineEdit_4.setText((""))
60
+ self.lineEdit_4.setObjectName(("lineEdit_4"))
61
+ self.formLayout.setWidget(6, QtGui.QFormLayout.SpanningRole, self.lineEdit_4)
62
+ self.label_5 = QtGui.QLabel(self.formLayoutWidget)
63
+ self.label_5.setObjectName(("label_5"))
64
+ self.formLayout.setWidget(7, QtGui.QFormLayout.SpanningRole, self.label_5)
65
+ self.lineEdit_5 = QtGui.QLineEdit(self.formLayoutWidget)
66
+ self.lineEdit_5.setText((""))
67
+ self.lineEdit_5.setObjectName(("lineEdit_5"))
68
+ self.formLayout.setWidget(8, QtGui.QFormLayout.SpanningRole, self.lineEdit_5)
69
+ self.tabWidget.addTab(self.tab_4, (""))
70
+ self.horizontalLayout.addWidget(self.tabWidget)
71
+ self.buttonBox = QtGui.QDialogButtonBox(self)
72
+ self.buttonBox.setGeometry(QtCore.QRect(40, 370, 341, 32))
73
+ self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
74
+ self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
75
+ self.buttonBox.setObjectName(("buttonBox"))
76
+ self.tabWidget.setCurrentIndex(1)
77
+ self.setWindowTitle("Tools")
78
+ self.label_2.setText("Push Main File:")
79
+ self.label_3.setText("Start Activity:")
80
+ self.label_4.setText("Logcat:")
81
+ self.label_5.setText("Exit Activity:")
82
+ self.tabWidget.setTabText(0,"Android")
83
+
84
+ class DialogAnt(QtGui.QDialog):
85
+ def __init__(self, parent=None):
86
+ QtGui.QDialog.__init__(self, parent)
87
+ self.resize(400, 420)
88
+
89
+ class DialogSquirrel(QtGui.QDialog):
90
+ def __init__(self, parent=None):
91
+ QtGui.QDialog.__init__(self, parent)
92
+ self.resize(400, 420)
{Dialog → Widget}/ui_Options.py RENAMED
File without changes
{Dialog → Widget}/ui_Project.py RENAMED
File without changes
build/exe.win32-2.7/Sabel.exe CHANGED
Binary file
build/exe.win32-2.7/Sabel.zip CHANGED
Binary file
build/exe.win32-2.7/config.yaml CHANGED
@@ -9,6 +9,7 @@ File:
9
9
  - C:/CODE/assets/common.nut
10
10
  - C:/CODE/assets/logoscene.nut
11
11
  - C:/CODE/assets/main.nut
12
+ - C:/CODE/assets/runtime.nut
12
13
  Project:
13
14
  - C:/CODE/data/
14
15
  - C:/CODE/assets/
build/exe.win32-2.7/library.zip CHANGED
Binary file
window.py CHANGED
@@ -3,12 +3,12 @@ from PyQt4.QtGui import (QAction,QIcon,QMessageBox,QWidgetAction,QMenu,QWidget,
3
3
  QLineEdit,QPushButton,QToolButton,QSplitter,QStatusBar,
4
4
  QMainWindow,QPalette,QColor)
5
5
  from PyQt4.QtCore import QSize,Qt, QT_VERSION_STR,PYQT_VERSION_STR,QStringList
6
- from Widget import Tab,Tree
6
+ from Widget import Tab,Tree,DialogAndroid
7
7
  from Widget.style import Styles
8
8
 
9
9
  from globals import (ospathsep,ospathjoin,ospathbasename,workDir,
10
10
  OS_NAME,PY_VERSION,__version__,os_icon,os_icon_png,config,workSpace,
11
- iconSize,iconDir,styleIndex)
11
+ iconSize,iconDir,styleIndex,adblist)
12
12
 
13
13
 
14
14
 
@@ -56,9 +56,15 @@ class Window(QMainWindow):
56
56
  self.treeWidget.setObjectName("treeWidget")
57
57
  self.treebar = QToolBar()
58
58
  action_Folder = QAction(os_icon('newfolder_wiz'),'New Folder', self)
59
+ action_Folder.triggered.connect(self.about)
60
+ action_Android = QAction(os_icon_png('android1'),'Android', self)
61
+ action_Android.triggered.connect(self.android)
62
+ action_Ant = QAction(os_icon('ant_view'),'Ant', self)
63
+ action_Ant.triggered.connect(self.ant)
59
64
  self.treebar.addAction(action_Folder)
65
+ self.treebar.addAction(action_Android)
66
+ self.treebar.addAction(action_Ant)
60
67
  self.treebar.setIconSize(QSize(16,16))
61
- self.treebar.setMaximumHeight(23)
62
68
  self.VerticalLayout_2.addWidget(self.treebar)
63
69
  self.VerticalLayout_2.addWidget(self.treeWidget)
64
70
 
@@ -201,7 +207,7 @@ class Window(QMainWindow):
201
207
  self.statusbar.addWidget(self.aboutButton)
202
208
  self.statusbar.addWidget(self.zoominButton)
203
209
  self.statusbar.addWidget(self.zoomoutButton)
204
- self.statusbar.setFixedHeight(18)
210
+ #self.statusbar.setFixedHeight(18)
205
211
 
206
212
  #Init colorstyling
207
213
  self.colorStyle = None
@@ -385,6 +391,18 @@ class Window(QMainWindow):
385
391
  self.setWindowState(Qt.WindowMaximized)
386
392
  self.isFull = False
387
393
 
394
+ def android(self):
395
+ form = DialogAndroid(self)
396
+ form.lineEdit_2.setText(adblist[0])
397
+ form.lineEdit_3.setText(adblist[1])
398
+ form.lineEdit_4.setText(adblist[2])
399
+ form.lineEdit_5.setText(adblist[3])
400
+ #form.exec_()
401
+ form.show()
402
+
403
+ def ant(self):
404
+ pass
405
+
388
406
  def cmd(self):
389
407
  if(self.tabWidget_3.isHidden()):
390
408
  self.tabWidget_3.show()