cede389e
—
pyros2097 13 years ago
another save
- Widget/adb.py +74 -23
- Widget/adb.pyc +0 -0
- Widget/dialogs.py +16 -1
- Widget/editor.py +3 -1
- Widget/editor.pyc +0 -0
- config.py +17 -7
- config.yaml +4 -4
- window.py +0 -4
Widget/adb.py
CHANGED
|
@@ -2,15 +2,17 @@ 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,QThread,QProcess,QString
|
|
5
|
+
from PyQt4.QtCore import pyqtSignal,SIGNAL,QThread,QProcess,QString,QTimer
|
|
6
6
|
|
|
7
7
|
class WorkThread(QThread):
|
|
8
8
|
def __init__(self):
|
|
9
9
|
QThread.__init__(self)
|
|
10
10
|
self.process = QProcess()
|
|
11
11
|
self.cmd = None
|
|
12
|
-
self.
|
|
12
|
+
self.process.readyReadStandardOutput.connect(self.readOutput)
|
|
13
|
-
self.
|
|
13
|
+
self.process.readyReadStandardError.connect(self.readErrors)
|
|
14
|
+
self.process.finished.connect(self.fini)
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
def setCmd(self,val):
|
|
16
18
|
self.cmd = val
|
|
@@ -21,14 +23,23 @@ class WorkThread(QThread):
|
|
|
21
23
|
def run(self):
|
|
22
24
|
#self.process_thread.run()
|
|
23
25
|
self.process.start(self.cmd)
|
|
24
|
-
|
|
26
|
+
self.exec_()
|
|
27
|
+
self.process.waitForFinished(-1)
|
|
28
|
+
self.process.kill()
|
|
29
|
+
#self.emit(SIGNAL("finished"))
|
|
30
|
+
#self.setCmd(adblist[1])
|
|
31
|
+
#self.process.kill()
|
|
32
|
+
#self.process.start(self.cmd)
|
|
25
|
-
self.process.waitForFinished()
|
|
33
|
+
#self.process.waitForFinished()
|
|
34
|
+
|
|
26
35
|
#self.emit(SIGNAL("fini"))
|
|
27
36
|
#self.process.finished.connect(self.fini)
|
|
28
37
|
#self.emit(SIGNAL("finished"),True)
|
|
38
|
+
#return
|
|
39
|
+
|
|
40
|
+
def fini(self,no):
|
|
41
|
+
self.emit(SIGNAL("fini"),no,self.cmd)
|
|
29
42
|
|
|
30
|
-
def fini(self):
|
|
31
|
-
self.emit(SIGNAL("fini"))
|
|
32
43
|
def readOutput(self):
|
|
33
44
|
self.emit(SIGNAL("update"),QString(self.process.readAllStandardOutput()))
|
|
34
45
|
|
|
@@ -36,8 +47,7 @@ class WorkThread(QThread):
|
|
|
36
47
|
self.emit(SIGNAL("update"),QString(self.process.readAllStandardError()))
|
|
37
48
|
|
|
38
49
|
def __del__(self):
|
|
39
|
-
pass
|
|
40
|
-
|
|
50
|
+
self.wait()
|
|
41
51
|
|
|
42
52
|
|
|
43
53
|
class AdbThread(threading.Thread,QWidget):
|
|
@@ -80,24 +90,67 @@ class Adb(QWidget):
|
|
|
80
90
|
self.adb_process = None
|
|
81
91
|
self.isRunning = False
|
|
82
92
|
self.adb_thread = WorkThread()
|
|
93
|
+
self.timer = QTimer()
|
|
83
94
|
#self.adb_thread = AdbThread()
|
|
84
95
|
self.connect(self.adb_thread, SIGNAL("update"),self.update)
|
|
85
96
|
#self.connect(self.adb_thread, SIGNAL("fini"),self.newstart)
|
|
86
|
-
self.connect(self.adb_thread, SIGNAL("
|
|
97
|
+
self.connect(self.adb_thread, SIGNAL("fini"),self.newstart)
|
|
98
|
+
#self.connect(self.timer , SIGNAL('timeout()') , self.onTimeout)
|
|
99
|
+
#self.connect(self.adb_thread , SIGNAL('started()') , self.onThreadStarted)
|
|
100
|
+
#self.connect(self.adb_thread , SIGNAL('finished()'), self.onThreadFinished)
|
|
101
|
+
|
|
102
|
+
def onTimeout(self):
|
|
103
|
+
print "timeout"
|
|
104
|
+
"""
|
|
105
|
+
# Update the progress bar
|
|
106
|
+
value = self.pbar.value()
|
|
107
|
+
# Going forward or backwards?
|
|
108
|
+
if self.pbar.invertedAppearance():
|
|
109
|
+
if value-2 < self.pbar.minimum():
|
|
110
|
+
self.pbar.setValue(self.pbar.minimum())
|
|
111
|
+
self.pbar.setInvertedAppearance(False)
|
|
112
|
+
else:
|
|
113
|
+
self.pbar.setValue(value-2)
|
|
114
|
+
else:
|
|
115
|
+
if value+2 > self.pbar.maximum():
|
|
116
|
+
self.pbar.setValue(self.pbar.maximum())
|
|
117
|
+
self.pbar.setInvertedAppearance(True)
|
|
118
|
+
else:
|
|
119
|
+
self.pbar.setValue(value+2)
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
def onThreadStarted(self):
|
|
123
|
+
print "Thread has been started"
|
|
124
|
+
self.timer.start(10)
|
|
125
|
+
#self.enableButtons(False)
|
|
126
|
+
|
|
127
|
+
def onThreadFinished(self):
|
|
128
|
+
print "Thread has finished"
|
|
129
|
+
self.timer.stop()
|
|
130
|
+
#self.enableButtons(True)
|
|
131
|
+
#self.pbar.setValue(0)
|
|
87
132
|
|
|
88
133
|
def update(self,line):
|
|
89
134
|
self.parent.textEdit.append(line)
|
|
90
135
|
|
|
91
|
-
def newstart(self):
|
|
136
|
+
def newstart(self,no,cmd):
|
|
137
|
+
if(cmd == "adb -d push "+adblist[0]):
|
|
138
|
+
self.parent.textEdit.append(str(no))
|
|
92
|
-
|
|
139
|
+
self.parent.textEdit.append(cmd)
|
|
93
|
-
|
|
140
|
+
self.parent.textEdit.append("Finshed")
|
|
141
|
+
self.adb_thread.setCmd("adb -d shell am start -a android.intent.action.MAIN -n "+adblist[1])
|
|
142
|
+
self.adb_thread.run()
|
|
143
|
+
elif(cmd == "adb -d push "+adblist[0]):
|
|
144
|
+
self.parent.textEdit.append(str(no))
|
|
145
|
+
self.parent.textEdit.append(cmd)
|
|
146
|
+
self.parent.textEdit.append("Finshed")
|
|
147
|
+
self.adb_thread.setCmd("adb -d logcat -s "+adblist[2])
|
|
148
|
+
self.adb_thread.run()
|
|
94
149
|
#self.adb_thread.kill_process()
|
|
95
150
|
#self.parent.textEdit.append("Starting Activity...\n")
|
|
96
151
|
#self.adb_thread.setCmd(adblist[1])
|
|
97
152
|
#self.adb_thread.run()
|
|
98
|
-
#print "finished"
|
|
99
153
|
|
|
100
|
-
|
|
101
154
|
def run(self):
|
|
102
155
|
if self.isRunning == False:
|
|
103
156
|
#if self.adb_process != None and self.adb_process.poll() == None:
|
|
@@ -110,9 +163,9 @@ class Adb(QWidget):
|
|
|
110
163
|
self.parent.tabWidget_3.setCurrentIndex(1)
|
|
111
164
|
self.parent.textEdit.clear()
|
|
112
165
|
self.parent.textEdit.append("Pushing main.nut...\n")
|
|
113
|
-
self.adb_thread.setCmd(adblist[0])
|
|
166
|
+
self.adb_thread.setCmd("adb -d push "+adblist[0])
|
|
114
167
|
self.adb_thread.run()
|
|
115
|
-
|
|
168
|
+
|
|
116
169
|
"""
|
|
117
170
|
self.adb_thread.setCmd(adblist[0])
|
|
118
171
|
self.adb_thread.run()
|
|
@@ -136,16 +189,14 @@ class Adb(QWidget):
|
|
|
136
189
|
self.isRunning = False
|
|
137
190
|
self.adb_thread.setCmd(adblist[3])
|
|
138
191
|
self.adb_thread.run()
|
|
139
|
-
self.adb_thread.join()
|
|
140
|
-
self.adb_thread.
|
|
192
|
+
self.adb_thread.kill_process()
|
|
141
|
-
#if self.adb_process != None and self.adb_process.poll() == None:
|
|
142
|
-
# self.adb_process.kill()
|
|
143
193
|
self.parent.action_Stop.setDisabled(True)
|
|
144
|
-
self.parent.textEdit.append("Stopped")
|
|
194
|
+
self.parent.textEdit.append("Stopped.")
|
|
145
195
|
if not(self.parent.tabWidget_3.isHidden()):
|
|
146
196
|
self.parent.tabWidget_3.hide()
|
|
147
197
|
self.parent.action_Run.setEnabled(True)
|
|
148
198
|
|
|
149
199
|
def close(self):
|
|
150
200
|
if self.adb_process != None and self.adb_process.poll() == None:
|
|
201
|
+
#self.adb_thread.kill_process()
|
|
151
|
-
self.
|
|
202
|
+
self.adb_thread.quit()
|
Widget/adb.pyc
CHANGED
|
Binary file
|
Widget/dialogs.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from PyQt4 import QtGui
|
|
2
|
-
from PyQt4 import QtCore
|
|
2
|
+
from PyQt4 import QtCore
|
|
3
|
+
from globals import adblist,config
|
|
3
4
|
"""
|
|
4
5
|
class UIProject(QDialog):
|
|
5
6
|
def __init__(self, parentWindow):
|
|
@@ -80,7 +81,21 @@ class DialogAndroid(QtGui.QDialog):
|
|
|
80
81
|
self.label_4.setText("Logcat:")
|
|
81
82
|
self.label_5.setText("Exit Activity:")
|
|
82
83
|
self.tabWidget.setTabText(0,"Android")
|
|
84
|
+
self.buttonBox.clicked.connect(self.ok)
|
|
85
|
+
self.lineEdit_2.setText(adblist[0])
|
|
86
|
+
self.lineEdit_3.setText(adblist[1])
|
|
87
|
+
self.lineEdit_4.setText(adblist[2])
|
|
88
|
+
self.lineEdit_5.setText(adblist[3])
|
|
83
89
|
|
|
90
|
+
def ok(self,btn):
|
|
91
|
+
val = []
|
|
92
|
+
if(btn.text() == "OK"):
|
|
93
|
+
val.append(str(self.lineEdit_2.text()))
|
|
94
|
+
val.append(str(self.lineEdit_3.text()))
|
|
95
|
+
val.append(str(self.lineEdit_4.text()))
|
|
96
|
+
val.append(str(self.lineEdit_5.text()))
|
|
97
|
+
config.setAdb(val)
|
|
98
|
+
self.close()
|
|
84
99
|
class DialogAnt(QtGui.QDialog):
|
|
85
100
|
def __init__(self, parent=None):
|
|
86
101
|
QtGui.QDialog.__init__(self, parent)
|
Widget/editor.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from globals import fontSize,fontName,ospathjoin,os_pixmap,apiDir,thresHold
|
|
1
|
+
from globals import fontSize,fontName,ospathjoin,os_pixmap,apiDir,thresHold,config
|
|
2
2
|
from PyQt4.QtCore import SIGNAL,QString
|
|
3
3
|
from PyQt4.QtGui import QFontMetrics, QFont, QPixmap, QColor ,QPalette
|
|
4
4
|
from PyQt4.Qsci import QsciScintilla, QsciLexerPython ,QsciAPIs ,QsciLexerCPP
|
|
@@ -80,6 +80,7 @@ class Editor(QsciScintilla):
|
|
|
80
80
|
|
|
81
81
|
def zoomin(self):
|
|
82
82
|
self.fontSize += 1
|
|
83
|
+
config.setFontSize(self.fontSize)
|
|
83
84
|
self.font.setPointSize(self.fontSize)
|
|
84
85
|
#self.setFont(self.font)
|
|
85
86
|
self.lexer.setFont(self.font)
|
|
@@ -87,6 +88,7 @@ class Editor(QsciScintilla):
|
|
|
87
88
|
|
|
88
89
|
def zoomout(self):
|
|
89
90
|
self.fontSize -= 1
|
|
91
|
+
config.setFontSize(self.fontSize)
|
|
90
92
|
self.font.setPointSize(self.fontSize)
|
|
91
93
|
#self.setFont(self.font)
|
|
92
94
|
self.lexer.setFont(self.font)
|
Widget/editor.pyc
CHANGED
|
Binary file
|
config.py
CHANGED
|
@@ -14,17 +14,23 @@ class Config:
|
|
|
14
14
|
|
|
15
15
|
def writeSetting(self,section,value):
|
|
16
16
|
self.data["Setting"][section] = value
|
|
17
|
+
self.write()
|
|
17
18
|
|
|
18
19
|
def workSpace(self):
|
|
19
20
|
return self.readSetting("workspace")
|
|
21
|
+
|
|
20
22
|
def fontSize(self):
|
|
21
23
|
return int(self.readSetting('fontsize'))
|
|
24
|
+
def setFontSize(self,val):
|
|
25
|
+
self.writeSetting('fontsize',val)
|
|
26
|
+
|
|
22
27
|
def fontName(self):
|
|
23
28
|
return self.readSetting('fontname')
|
|
29
|
+
def setFontName(self,val):
|
|
30
|
+
self.writeSetting('fontname',val)
|
|
31
|
+
|
|
24
32
|
def iconSize(self):
|
|
25
33
|
return int(self.readSetting('iconsize'))
|
|
26
|
-
def colorStyle(self):
|
|
27
|
-
return int(self.readSetting('colorstyle'))
|
|
28
34
|
|
|
29
35
|
def projects(self):
|
|
30
36
|
return self.read('Project')
|
|
@@ -43,20 +49,24 @@ class Config:
|
|
|
43
49
|
|
|
44
50
|
def adb(self):
|
|
45
51
|
return self.read('ADB')
|
|
52
|
+
def setAdb(self,val):
|
|
53
|
+
self.data['ADB'][0] = val[0]
|
|
54
|
+
self.data['ADB'][1] = val[1]
|
|
55
|
+
self.data['ADB'][2] = val[2]
|
|
56
|
+
self.data['ADB'][3] = val[3]
|
|
57
|
+
self.write()
|
|
46
58
|
|
|
47
59
|
def thresh(self):
|
|
48
60
|
return self.readSetting('thresh')
|
|
49
|
-
|
|
50
61
|
def setThresh(self,val):
|
|
51
62
|
self.writeSetting('thresh',val)
|
|
63
|
+
|
|
52
|
-
|
|
64
|
+
def colorStyle(self):
|
|
53
|
-
|
|
65
|
+
return int(self.readSetting('colorstyle'))
|
|
54
66
|
def styleIndex(self):
|
|
55
67
|
return self.readSetting('styleindex')
|
|
56
|
-
|
|
57
68
|
def setstyleIndex(self,value):
|
|
58
69
|
self.writeSetting("styleindex",value)
|
|
59
|
-
self.write()
|
|
60
70
|
|
|
61
71
|
def write(self):
|
|
62
72
|
try:
|
config.yaml
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
ADB:
|
|
2
|
-
-
|
|
2
|
+
- C:/CODE/main.nut /sdcard/
|
|
3
|
-
-
|
|
3
|
+
- com.emo_framework.examples/com.emo_framework.EmoActivity
|
|
4
|
-
-
|
|
4
|
+
- EmoFramework
|
|
5
5
|
- adb -d shell ps | grep com.emo_framework.examples | awk '{print $2}' | xargs adb
|
|
6
6
|
shell kill
|
|
7
7
|
ANT:
|
|
8
8
|
- android update project --target 5 --path .
|
|
9
9
|
- ant debug install
|
|
10
10
|
File:
|
|
11
|
-
- C:/CODE/assets/
|
|
11
|
+
- C:/CODE/assets/creditscene.nut
|
|
12
12
|
- C:/CODE/assets/main.nut
|
|
13
13
|
Project:
|
|
14
14
|
- C:/CODE/data/
|
window.py
CHANGED
|
@@ -393,10 +393,6 @@ class Window(QMainWindow):
|
|
|
393
393
|
|
|
394
394
|
def android(self):
|
|
395
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
396
|
#form.exec_()
|
|
401
397
|
form.show()
|
|
402
398
|
|