import
sys
import
os
from PyQt4
import
QtGui
from PyQt4
import
QtCore
apk_path=os.getcwd()+
"\\aa.apk"
class MyWindow(QtGui.QWidget):
''
'自定义窗口类'
''
def __init__(self,parent=None):
''
'构造函数'
''
super(MyWindow,self).__init__(parent)
self.setFixedSize(QtCore.QSize(800,600))
bodyWidget = QtGui.QWidget(self)
mainLayout = QtGui.QVBoxLayout(bodyWidget)
button = MyButton(self)
button.setText(
"Apk_Decode"
)
mainLayout.addWidget(button)
button.clicked.connect(self.OnClick)
def OnClick(self):
''
'响应点击'
''
QtGui.QMessageBox.about(self,
"apk_d"
,
"apk is decoding"
)
def apk_decode(self,path):
print(path)
apkToD=
'java -jar apktool.jar d '
+path
print(apkToD)
os.system(apkToD)
def mousePressEvent(self,event):
''
'鼠标按下事件'
''
if
event.button() == QtCore.Qt.LeftButton:
self.setStyleSheet(
''
''
''
)
self.apk_decode(apk_path)
class MyButton(QtGui.QToolButton):
''
'自定义按钮类'
''
def __init__(self,parent=None):
''
'构造函数'
''
super(MyButton,self).__init__(parent)
self.setFixedSize(QtCore.QSize(800,120))
self.setStyleSheet(
''
'background-color:red;'
''
)
def mousePressEvent(self,event):
''
'鼠标按下事件'
''
if
event.button() == QtCore.Qt.LeftButton:
self.clicked.emit(True)
self.parent().mousePressEvent(event)
if
__name__ ==
"__main__"
:
''
'主函数'
''
app = QtGui.QApplication(sys.argv)
window = MyWindow()
window.show()
sys.
exit
(app.exec_())