def unicode2ChineseBtnClick(self): srcStr = unicode(self.srcStrEdit.toPlainText()) print _translateUtf8(srcStr) print _fromUtf8(srcStr) print srcStr.encode('utf-8') print _translate("", srcStr, None) self.destStrEdit.setText(_translateUtf8(srcStr))
def initUI(self): screen = QtGui.QDesktopWidget().screenGeometry() self.setGeometry(screen.width() / 20 * 16, screen.height() / 20 * 1, 280, 30) # we can resize the widget. https://blog.csdn.net/y673582465/article/details/73603265 sizeGrip = QtGui.QSizeGrip(self) self.setWindowTitle('AndroidTools') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.SubWindow) quitAction = QtGui.QAction(_fromUtf8("退出"), self) quitAction.connect(quitAction, QtCore.SIGNAL('triggered()'), QtGui.qApp.quit) self.popMenu = QtGui.QMenu() self.popMenu.addAction(quitAction) self.mainLayout = QtGui.QVBoxLayout() firstHBox = QtGui.QHBoxLayout() self.weatherlabel = QtGui.QLabel(_fromUtf8("天气")) self.tipsLabel = QtGui.QLabel(_fromUtf8("桌面提示")) self.moreBtn = QtGui.QPushButton() self.weatherlabel.setPalette(QtFontUtil().setFontColor2Palette(QtCore.Qt.black)) self.tipsLabel.setPalette(QtFontUtil().setFontColor2Palette(QtCore.Qt.red)) self.weatherlabel.connect(self.weatherlabel, QtCore.SIGNAL('weatherUpdateSignal(QString)'), self.showWeather) self.tipsLabel.connect(self.tipsLabel, QtCore.SIGNAL('tipsChangeSignal(QString)'), self.showTips) self.moreBtn.connect(self.moreBtn, QtCore.SIGNAL('clicked()'), self.clickMoreBtn) self.setMoreBtnIcon() firstHBox.addWidget(self.weatherlabel) firstHBox.addWidget(self.moreBtn) self.mainLayout.addLayout(firstHBox) self.mainLayout.addWidget(self.tipsLabel) self.mainLayout.addStretch(1) self.setLayout(self.mainLayout) tranColor = QtGui.QColor(0xDE, 0xDE, 0xDE) self.setTransparency(tranColor) self.queryTipsMethod()
def copyFileBtnClick(self): srcFilePath = unicode(self.srcFilePathEdit.text()) destFilePath = unicode(self.destFilePathEdit.text()) fileListEdit = str(self.fileListEdit.toPlainText()) if not fileListEdit: tips = unicode("请在文件集合框中输入拷贝文件路径") self.setTips(_fromUtf8(tips)) return srcFilePath = (srcFilePath if srcFilePath.strip() else str("Y:\\work_src\\gitlab\\I13\\HLOS")) destFilePath = (destFilePath if destFilePath.strip() else str("G:\\copyfile")) FileUtil.mkdirNotExist(destFilePath) # print fileListEdit # .* 匹配除换行符 \n 之外的任何字符 \S 匹配任何非空白字符, 此处用来匹配保存在string中的文件目录格式 reFileStr = r'(.*\S)' fileList = re.findall(reFileStr, fileListEdit) if not fileList: tips = unicode("没有在文件集合中找到文件路径") self.setTips(_fromUtf8(tips)) return for fileName in fileList: if not fileName: continue if fileName.startswith("/") or fileName.startswith("\\"): fileName = fileName[1:] fileName = fileName.replace("/", "\\") # srcFile = os.path.join(srcFilePath, fileName) # destFile = os.path.join(destFilePath, fileName) # print 'srcFilePath: ', srcFile # print 'destFile: ', destFile FileUtil.copyFile(srcFilePath, destFilePath,srcFilePath, fileName) tips = unicode("拷贝完成: ") + destFilePath self.setTips(_fromUtf8(tips)) self._runSysCmd.run(['explorer.exe', destFilePath])
def doScreenCap(self, deviceModel=None, callBack=None): screenPath = '/sdcard/screenshot_' if deviceModel: screenPath += deviceModel + "_" screenPath += str(DateUtil().getCurrentTimeStamp()) + ".png" destPath = "d:" + os.sep + "adbTools" + os.sep FileUtil.mkdirNotExist(destPath) cmd = str('%s -s %s shell /system/bin/screencap -p %s ' % (adbCmd, self.getCurrentSerialNo(), screenPath)) result = self._runSysCmd.run(cmd, should_process=False).stdout.read() if 'not found' in result: if callBack: callBack(_fromUtf8("未获取到设备, 请检查USB连接~")) return result cmd2 = str('%s -s %s pull %s %s' % (adbCmd, self.getCurrentSerialNo(), screenPath, destPath)) callBack(_fromUtf8("正在截屏操作, 请稍后..")) result = self._runSysCmd.run(cmd2, should_process=False).stdout.read() if "file pulled" in result: # os.startfile('d:\\adbTools') self._runSysCmd.run(['explorer.exe', destPath]) if callBack: strTmp = "已完成截屏, 保存地址为: %s" % (destPath + FileUtil.getFileName(screenPath)) callBack(_fromUtf8(strTmp)) return result
def doDeleteMethod(self): tipsDesc = str(self.tipsDescEdit.text()).decode('utf8') if not tipsDesc: self.setTips(_fromUtf8("提醒内容不能为空!")) return result = self.tipsDao.delete(tipsDesc) if result: self.setTips(_fromUtf8("提醒事项已删除")) self.hasOperTipsList(tipsDesc, TipsOperateWin.operateDelete) self.emitOperTips() else: self.setTips(_fromUtf8("提醒事项删除失败, 请检查!"))
def orderDeleteMethod(self): orderNum = str(self.orderNumEdit.text()).decode('utf8') if not orderNum: self.setTips(_fromUtf8("删除工单信息时,工单号必不可少!")) return orderBean = WorkOrderBean() orderBean.order_num = orderNum result = self.orderDao.delete(orderBean) if result: self.setTips(_fromUtf8("工单信息删除成功")) else: self.setTips(_fromUtf8("工单信息删除失败"))
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self) screen = QtGui.QDesktopWidget().screenGeometry() self.resize(screen.width() / 8 * 3, screen.height() / 6 * 3) # self.setFixedSize(screen.width() / 8 * 3, screen.height() / 6 * 3) self.setWindowTitle(AppConstants.ApplicationName) # 设置顶级窗口 # self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.setAcceptDrops(True) self.tray = TrayIcon(parent=self) self.tray.showMsg(msg=_fromUtf8("别人20, 你5..."), title=_fromUtf8("警告")) self.tray.connect(self.tray, QtCore.SIGNAL('showProgramSignal'), self.showProgram)
def doStartScreenRecord(self, deviceModel=None, callBack=None): recordPath = '/sdcard/demo_' if deviceModel: recordPath += deviceModel + "_" recordPath += str(DateUtil().getCurrentTimeStamp()) + ".mp4" self._lastScreenRecordPath = recordPath cmd = str('%s -s %s shell screenrecord %s' % (adbCmd, self.getCurrentSerialNo(), recordPath)) callBack(_fromUtf8("正在进行录屏, 如需暂停请点击'结束录屏'按钮..")) result = self._runSysCmd.run(cmd, should_process=False).stdout.read() if callBack and 'not found' in result: callBack(_fromUtf8("未获取到设备, 请检查USB连接~")) return result
def doDeleteAdbMethod(self): adbCmdName = str(self.adbCmdNameEdit.text()).decode('utf8') adbCmd = str(self.adbCmdEdit.text()).decode('utf8') adbCmdDesc = str(self.adbCmdDescEdit.text()).decode('utf8') # print 'adbCmdName:%s , adbCmd:%s , adbCmdDesc: %s ' % (adbCmdName, adbCmd, adbCmdDesc) if not adbCmd: self.setTips(_fromUtf8("adb命令不能为空!")) return result = self.adbDao.delete(adbCmd) if result: self.setTips(_fromUtf8("adb命令已删除")) self.emitOperateCmd(adbCmd, AdbOperateWin.operateDelete) else: self.setTips(_fromUtf8("adb命令删除失败, 请检查!"))
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setWindowTitle(u'桌面提醒信息') self.centralwidget = QWidget() self.setCentralWidget(self.centralwidget) self.resize(350, 100) self.tipsDao = TipsDao() self.tipsList = [] mainLayout = QtGui.QVBoxLayout() mainLayout.setAlignment(QtCore.Qt.AlignTop) mainLayout.setContentsMargins(5, 10, 5, 2) operHBox = QtGui.QHBoxLayout() tipsForm = QtGui.QFormLayout() self.tipsTypeComboBox = QtGui.QComboBox() self.tipsDescEdit = QtGui.QLineEdit() self.tipsListEdit = QtGui.QTextEdit() self.tipsDescEdit.setPlaceholderText(_fromUtf8("输入提醒事项")) # tipsLayout = QtGui.QHBoxLayout() # tipsLayout.addWidget(self.tipsTypeComboBox, QtCore.Qt.AlignVCenter) # tipsLayout.addWidget(self.tipsDescEdit) # tipsForm.addRow(tipsLayout) tipsForm.addRow(self.tipsTypeComboBox, self.tipsDescEdit) self.tipsTypeComboBox.setMinimumHeight(25) self.tipsDescEdit.setMinimumHeight(25) self.addBtn = QtGui.QPushButton(_fromUtf8("添加")) self.deleteBtn = QtGui.QPushButton(_fromUtf8("删除")) self.queryBtn = QtGui.QPushButton(_fromUtf8("查询")) self.addBtn.connect(self.addBtn, QtCore.SIGNAL('clicked()'), self.doAddMethod) self.deleteBtn.connect(self.deleteBtn, QtCore.SIGNAL('clicked()'), self.doDeleteMethod) self.queryBtn.connect(self.queryBtn, QtCore.SIGNAL('clicked()'), self.doQueryMethod) self.tipLabel = QtGui.QLabel() self.tipLabel.setFont(QtFontUtil().getFont('Monospace', 12)) self.tipLabel.setContentsMargins(5, 0, 5, 5) self.setTipsType() operHBox.addWidget(self.addBtn, 1) operHBox.addWidget(self.deleteBtn, 1) operHBox.addWidget(self.queryBtn, 1) mainLayout.addLayout(tipsForm) mainLayout.addWidget(self.tipsListEdit) mainLayout.addSpacing(5) mainLayout.addLayout(operHBox) mainLayout.addStretch(1) mainLayout.addWidget(self.tipLabel) self.centralwidget.setLayout(mainLayout)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self._runSysCmd = RunSysCommand() mainLayout = QtGui.QVBoxLayout() operBtnsLayout = QtGui.QHBoxLayout() filePathForm = QtGui.QFormLayout() srcFilePathLabel = QtGui.QLabel(_fromUtf8("源根目录:")) destFilePathLabel = QtGui.QLabel(_fromUtf8("目标目录:")) fileListLabel = QtGui.QLabel(_fromUtf8("文件集合:")) self.tipsLabel = QtGui.QLabel() self.srcFilePathEdit = QtGui.QLineEdit() self.destFilePathEdit = QtGui.QLineEdit() self.fileListEdit = QtGui.QTextEdit() srcFilePathLabel.setMinimumHeight(25) destFilePathLabel.setMinimumHeight(25) self.srcFilePathEdit.setMinimumHeight(25) self.destFilePathEdit.setMinimumHeight(25) self.srcFilePathEdit.setPlaceholderText(_fromUtf8("Y:\work_src\gitlab\I13\HLOS")) self.destFilePathEdit.setPlaceholderText(_fromUtf8("G:\copyfile")) self.copyFileBtn = QtGui.QPushButton(u'拷贝文件') self.deleteDirBtn = QtGui.QPushButton(u'删除目录') self.startFileBtn = QtGui.QPushButton(u'打开文件') self.copyFileBtn.setFixedSize(100, 30) self.deleteDirBtn.setFixedSize(100, 30) self.startFileBtn.setFixedSize(100, 30) self.copyFileBtn.connect(self.copyFileBtn, QtCore.SIGNAL('clicked()'), self.copyFileBtnClick) self.deleteDirBtn.connect(self.deleteDirBtn, QtCore.SIGNAL('clicked()'), self.deleteDirBtnClick) self.startFileBtn.connect(self.startFileBtn, QtCore.SIGNAL('clicked()'), self.startFileBtnClick) filePathForm.addRow(srcFilePathLabel, self.srcFilePathEdit) filePathForm.addRow(destFilePathLabel, self.destFilePathEdit) filePathForm.addRow(fileListLabel, self.fileListEdit) # 将表单最后一个文本框设置为可垂直拉伸 QtGui.QSizePolicy policy = self.fileListEdit.sizePolicy() policy.setVerticalStretch(1) self.fileListEdit.setSizePolicy(policy) operBtnsLayout.addWidget(self.tipsLabel) operBtnsLayout.addStretch(1) operBtnsLayout.addWidget(self.copyFileBtn) operBtnsLayout.addWidget(self.deleteDirBtn) operBtnsLayout.addWidget(self.startFileBtn) mainLayout.addLayout(filePathForm) mainLayout.addLayout(operBtnsLayout) self.setLayout(mainLayout)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) mainLayout = QtGui.QVBoxLayout() operBtnsLayout = QtGui.QHBoxLayout() filePathForm = QtGui.QFormLayout() srcFilePathLabel = QtGui.QLabel(_fromUtf8("文件目录:")) self.srcFilePathEdit = QtGui.QLineEdit() self.logEdit = QtGui.QTextEdit() srcFilePathLabel.setMinimumHeight(25) self.srcFilePathEdit.setMinimumHeight(25) self.unzipFileBtn = QtGui.QPushButton(u'解压文件') self.unzipFileBtn.setFixedSize(100, 30) self.unzipFileBtn.connect(self.unzipFileBtn, QtCore.SIGNAL('clicked()'), self.unzipFileBtnClick) self.logEdit.connect(self.logEdit, QtCore.SIGNAL('appendLogSignal(QString)'), self.appendLog) filePathForm.addRow(srcFilePathLabel, self.srcFilePathEdit) operBtnsLayout.addStretch(1) operBtnsLayout.addWidget(self.unzipFileBtn) mainLayout.addLayout(filePathForm) mainLayout.addWidget(self.logEdit) mainLayout.addLayout(operBtnsLayout) self.setLayout(mainLayout)
def doAddMethod(self): tipsType = self.tipsTypeComboBox.currentText() tipsDesc = str(self.tipsDescEdit.text()).decode('utf8') # print 'tipsType:%s , tipsDesc:%s ' % (tipsType, tipsDesc) if not tipsDesc: self.setTips(_fromUtf8("提醒内容不能为空!")) return tipBean = TipsBean() tipBean.tips_type = tipsType tipBean.tips_desc = tipsDesc result = self.tipsDao.save(tipBean) if result: self.setTips(_fromUtf8("提醒事项添加加成功~")) self.hasOperTipsList(tipBean.tips_desc, TipsOperateWin.operateAdd) self.emitOperTips() else: self.setTips(_fromUtf8("提醒事项添加失败, 请检查!"))
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setWindowTitle(u'adb指令') self.centralwidget = QWidget() self.setCentralWidget(self.centralwidget) self.resize(350, 200) self.adbDao = AdbDao() mainLayout = QtGui.QVBoxLayout() mainLayout.setAlignment(QtCore.Qt.AlignTop) mainLayout.setContentsMargins(5, 10, 5, 2) operHBox = QtGui.QHBoxLayout() adbCmdForm = QtGui.QFormLayout() adbCmdNameLabel = QtGui.QLabel(_fromUtf8("adb名称:")) adbCmdLabel = QtGui.QLabel(_fromUtf8("adb命令:")) adbCmdDescLabel = QtGui.QLabel(_fromUtf8("adb描述:")) self.adbCmdNameEdit = QtGui.QLineEdit() self.adbCmdEdit = QtGui.QLineEdit() self.adbCmdDescEdit = QtGui.QLineEdit() self.adbCmdNameEdit.setFixedHeight(25) self.adbCmdEdit.setFixedHeight(25) self.adbCmdDescEdit.setFixedHeight(25) adbCmdForm.addRow(adbCmdNameLabel, self.adbCmdNameEdit) adbCmdForm.addRow(adbCmdLabel, self.adbCmdEdit) adbCmdForm.addRow(adbCmdDescLabel, self.adbCmdDescEdit) self.addBtn = QtGui.QPushButton(_fromUtf8("添加")) self.addBtn.setMinimumWidth(150) self.addBtn.connect(self.addBtn, QtCore.SIGNAL('clicked()'), self.doAddAdbMethod) self.deleteBtn = QtGui.QPushButton(_fromUtf8("删除")) self.deleteBtn.setMinimumWidth(150) self.deleteBtn.connect(self.deleteBtn, QtCore.SIGNAL('clicked()'), self.doDeleteAdbMethod) self.tipLabel = QtGui.QLabel() self.tipLabel.setFont(QtFontUtil().getFont('Monospace', 12)) self.tipLabel.setContentsMargins(5, 0, 5, 5) operHBox.addStretch() operHBox.addWidget(self.addBtn) operHBox.addSpacing(20) operHBox.addWidget(self.deleteBtn) operHBox.addStretch() mainLayout.addLayout(adbCmdForm) mainLayout.addSpacing(30) mainLayout.addLayout(operHBox) mainLayout.addStretch(1) mainLayout.addWidget(self.tipLabel) self.centralwidget.setLayout(mainLayout)
def orderQueryAllMethod(self): orderBeanList = self.orderDao.queryAll() if not orderBeanList: self.emitTipsChange(_fromUtf8("还没有工单信息~")) return excelPath = "C:\\Users\\20251572\\Desktop\\all_" + str( DateUtil().getCurrentTimeStamp()) + ".xls" self.write2Excel(orderBeanList, excelPath) os.startfile(excelPath)
def doAddAdbMethod(self): adbCmdName = str(self.adbCmdNameEdit.text()).decode('utf8') adbCmd = str(self.adbCmdEdit.text()).decode('utf8') adbCmdDesc = str(self.adbCmdDescEdit.text()).decode('utf8') # print 'adbCmdName:%s , adbCmd:%s , adbCmdDesc: %s ' % (adbCmdName, adbCmd, adbCmdDesc) if not adbCmd: self.setTips(_fromUtf8("adb命令不能为空!")) return adbBean = AdbBean() adbBean.adb_cmd_name = adbCmdName adbBean.adb_cmd = adbCmd adbBean.adb_cmd_desc = adbCmdDesc result = self.adbDao.save(adbBean) if result: self.setTips(_fromUtf8("adb命令添加加成功~")) self.emitOperateCmd(adbBean.adb_cmd, AdbOperateWin.operateAdd) else: self.setTips(_fromUtf8("adb命令添加失败, 请检查!"))
def orderAddMethod(self): orderNum = str(self.orderNumEdit.text()).decode('utf8') orderTitle = str(self.orderTitleEdit.text()).decode('utf8') orderReason = str(self.orderReasonEdit.toPlainText()).decode('utf8') orderDealTime = DateUtil().getCurrentTime() if not orderNum: self.setTips(_fromUtf8("添加工单信息时,工单号必不可少!")) return orderBean = WorkOrderBean() orderBean.order_num = orderNum orderBean.order_title = orderTitle orderBean.order_reason = orderReason orderBean.deal_time = orderDealTime result = self.orderDao.save(orderBean) if result: self.setTips(_fromUtf8("工单信息添加成功")) else: self.setTips(_fromUtf8("工单信息添加失败"))
def getDeviceSucess(self, deviceList): if not deviceList: self.printLog(_fromUtf8("未获取到设备, 请检查USB连接~")) return self.deviceList = deviceList for deviceInfo in deviceList: # 解决QComboBox重复添加的问题 if self.devicesListComboBox.findText(deviceInfo.model) == -1: self.devicesListComboBox.addItem(deviceInfo.model) self.printLog(deviceInfo.serialNo)
def queryTipsFromDb(self): tipsDao = TipsDao() tipsBeanList = tipsDao.queryAll() if not tipsBeanList: return # 重新初始化 self.tipsList[:] = [] for tip in tipsBeanList: self.tipsList.append(tip.tips_desc) tips = choice(self.tipsList) self.emitTipsChangeShow(_fromUtf8(tips))
def queryAdbListBtnClick(self): adbDao = AdbDao() adbBeanList = adbDao.queryAll() if not adbBeanList: self.printLog(_fromUtf8("请先添加常用的ADB指令~")) return # 重新初始化 self.adbCmdList[:] = [] for adbBean in adbBeanList: self.adbCmdList.append(unicode(adbBean.adb_cmd)) self.adbListEdit.setText("\n".join(self.adbCmdList))
def doQueryMethod(self): tipDao = TipsDao() tipsBeanList = tipDao.queryAll() if not tipsBeanList: self.setTips(_fromUtf8("请先添加提醒事项~")) return # 重新初始化 self.tipsList[:] = [] for tip in tipsBeanList: self.tipsList.append(unicode(tip.tips_desc)) self.tipsListEdit.setText("\n".join(self.tipsList))
def unzipFileBtnClick(self): srcFilePath = str(self.srcFilePathEdit.text()) if not srcFilePath: tips = unicode("请输入解压目录") self.setTips(_fromUtf8(tips)) return # 解压文件 threadUtil = ThreadUtil(funcName=self.doUnzipFile, srcFilePath=srcFilePath, log_call_back=self.emitAppendLogSignal) threadUtil.setDaemon(True) threadUtil.start()
def updateAppInfo(self, appName, appIconPath, packageName, launcherActivity, versionCode, versionName, minSdkVersion, targetSdkVersion, permissionList): self.apkInfoAppName.setText(appName) iconPixmap = QtGui.QPixmap(appIconPath) self.apkInfoIcon.setPixmap(iconPixmap) self.apkInfoPackageName.setText(packageName) self.apkInfoLauncherActivity.setText(launcherActivity) self.apkInfoVersionCode.setText(versionCode) self.apkInfoVersionName.setText(versionName) self.apkInfoMinSdkVersion.setText(minSdkVersion) self.apkInfoTargetSdkVersion.setText(targetSdkVersion) self.apkInfoPermissionList.setText(permissionList.join("\n")) self.printLog(_fromUtf8("%sapk解析完成" % appName))
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.winBootUp = WinBootUp() mainLayout = QtGui.QVBoxLayout() commonGroupBox = QtGui.QGroupBox(_fromUtf8("&通用")) commonHBox = QtGui.QHBoxLayout() self.bootUpCB = QtGui.QCheckBox() bootUpLabel = QtGui.QLabel(_fromUtf8("开机启动")) self.bootUpCB.connect(self.bootUpCB, QtCore.SIGNAL('stateChanged(int)'), self.setBootUp) self.setBootUpBySetting() commonHBox.addWidget(self.bootUpCB) commonHBox.addWidget(bootUpLabel) commonHBox.addStretch(1) commonGroupBox.setLayout(commonHBox) mainLayout.addWidget(commonGroupBox) mainLayout.addStretch(1) self.setLayout(mainLayout)
def doStopScreenRecord(self, callBack=None): if not self._lastScreenRecordPath: if callBack: callBack(_fromUtf8("请先进行录屏操作~")) return None recordPath = self._lastScreenRecordPath destPath = "d:" + os.sep + "adbTools" + os.sep FileUtil.mkdirNotExist(destPath) recordPidCmd = str('%s -s %s shell ps | %s screenrecord' % (adbCmd, self.getCurrentSerialNo(), findCmd)) recordPidResult = self._runSysCmd.run( recordPidCmd, should_process=False).stdout.read() # print 'recordRe: ', recordPidResult if 'not found' in recordPidResult: if callBack: callBack(_fromUtf8("未获取到设备, 请检查USB连接~")) return recordPidResult reRecordPidStr = r'[0-9]+' recordPid = re.findall(reRecordPidStr, recordPidResult)[0] # print 'recordPid: ', recordPid killScreenRecordCmd = str( '%s -s %s shell kill -2 %s' % (adbCmd, self.getCurrentSerialNo(), recordPid)) self._runSysCmd.run(killScreenRecordCmd, should_process=False).stdout.read() cmd = str('%s -s %s pull %s %s' % (adbCmd, self.getCurrentSerialNo(), recordPath, destPath)) result = self._runSysCmd.run(cmd, should_process=False).stdout.read() if "file pulled" in result: # os.startfile('d:\\adbTools') self._runSysCmd.run(['explorer.exe', destPath]) if callBack: strTmp = "已完成录屏, 保存地址为: %s" % ( destPath + FileUtil.getFileName(self._lastScreenRecordPath)) callBack(_fromUtf8(strTmp)) return result
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) mainLayout = QtGui.QVBoxLayout() # show log self.logGroupBox = QtGui.QGroupBox(_fromUtf8("日志")) self.logHBox = QtGui.QHBoxLayout() self.logTextEdit = QtGui.QTextEdit() self.logTextEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.logTextEdit.setFont(QtFontUtil().getFont('Monospace', 12)) self.logHBox.addWidget(self.logTextEdit) self.logGroupBox.setLayout(self.logHBox) mainLayout.addWidget(self.logGroupBox) self.setLayout(mainLayout)
def analyApkInfoMethod(self, apkPath): self.printLog(_fromUtf8("正在解析apk...")) aaptUtil = AaptUtil() apkInfo = aaptUtil.getApkInfo(apkPath) packageName = aaptUtil.getApkPackageName(apkPath, apkInfo) appLabel = aaptUtil.getApkApplicationLabel(apkPath, apkInfo) iconPath = aaptUtil.getApkApplicationIconPath(apkPath, apkInfo) launcherActivity = aaptUtil.getApkLauncherActivity(apkPath, apkInfo) versionCode = aaptUtil.getApkVersionCode(apkPath, apkInfo) versionName = aaptUtil.getApkVersionName(apkPath, apkInfo) minSdkVersion = aaptUtil.getApkMinSdkVersion(apkPath, apkInfo) targetSdkVersion = aaptUtil.getApkTargetSdkVersion(apkPath, apkInfo) permissionList = aaptUtil.getApkPermissionList(apkPath, apkInfo) self.emitUpdateAppInfoSignal(appLabel, iconPath, packageName, launcherActivity, versionCode, versionName, minSdkVersion, targetSdkVersion, permissionList)
def showTipsOperateWin(self): self.tipsWin.setTips(_fromUtf8("添加删除时,需填写相关的提醒事项~")) # self.tipsWin.show() self.containerWidget.addWidget(self.tipsWin) self.containerWidget.setCurrentWidget(self.tipsWin)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.keepAlive = KeepWinAlive() self.tipsWin = TipsOperateWin() self.keepAlive.cancel_call_back = self.keepWinCancelCallBack self.desktopWidget = DesktopWidget() mainLayout = QtGui.QVBoxLayout() firstGroupBox = QtGui.QGroupBox(_fromUtf8("Windows")) firstHBox = QtGui.QHBoxLayout() secondGroupBox = QtGui.QGroupBox(_fromUtf8("Work")) secondHBox = QtGui.QHBoxLayout() # container Widget containerGroupBox = QtGui.QGroupBox(_fromUtf8("")) containerHBox = QtGui.QHBoxLayout() self.containerWidget = QtGui.QStackedWidget() lockScreenBtn = QtGui.QPushButton(_fromUtf8("电脑锁屏")) self.keepScreenOnBtn = QtGui.QPushButton(_fromUtf8("电脑常亮")) cancelScreeOnBtn = QtGui.QPushButton(_fromUtf8("取消常亮")) showDesktopWidgetBtn = QtGui.QPushButton(_fromUtf8("显示窗口小部件")) tipsOperateBtn = QtGui.QPushButton(_fromUtf8("提醒信息")) workOrderBtn = QtGui.QPushButton(_fromUtf8("工单处理")) translateBtn = QtGui.QPushButton(_fromUtf8("有道翻译")) copyFileBtn = QtGui.QPushButton(_fromUtf8("文件拷贝")) unzipFileBtn = QtGui.QPushButton(_fromUtf8("文件解压")) todoListBtn = QtGui.QPushButton(_fromUtf8("todoList")) lockScreenBtn.connect(lockScreenBtn, QtCore.SIGNAL('clicked()'), self.lockScreenBtnClick) self.keepScreenOnBtn.connect(self.keepScreenOnBtn, QtCore.SIGNAL('clicked()'), self.keepScreenOnBtnClick) cancelScreeOnBtn.connect(cancelScreeOnBtn, QtCore.SIGNAL('clicked()'), self.cancelScreenOnBtnClick) showDesktopWidgetBtn.connect(showDesktopWidgetBtn, QtCore.SIGNAL('clicked()'), self.showDesktopWidget) tipsOperateBtn.connect(tipsOperateBtn, QtCore.SIGNAL('clicked()'), self.showTipsOperateWin) self.tipsWin.connect(self.tipsWin, QtCore.SIGNAL('operTipsSignal'), self.changeTipsList) workOrderBtn.connect(workOrderBtn, QtCore.SIGNAL('clicked()'), self.showWorkOrderWidget) translateBtn.connect(translateBtn, QtCore.SIGNAL('clicked()'), self.showTranslateWidget) copyFileBtn.connect(copyFileBtn, QtCore.SIGNAL('clicked()'), self.showCopyFileWidget) unzipFileBtn.connect(unzipFileBtn, QtCore.SIGNAL('clicked()'), self.showUnzipFileWidget) todoListBtn.connect(todoListBtn, QtCore.SIGNAL('clicked()'), self.showTodoListWidget) firstHBox.addWidget(lockScreenBtn) firstHBox.addWidget(self.keepScreenOnBtn) firstHBox.addWidget(cancelScreeOnBtn) firstHBox.addWidget(showDesktopWidgetBtn) firstHBox.addWidget(tipsOperateBtn) firstHBox.addStretch(1) firstGroupBox.setLayout(firstHBox) secondHBox.addWidget(workOrderBtn) secondHBox.addWidget(translateBtn) secondHBox.addWidget(copyFileBtn) secondHBox.addWidget(unzipFileBtn) secondHBox.addWidget(todoListBtn) secondHBox.addStretch(1) secondGroupBox.setLayout(secondHBox) # self.containerWidget.addWidget(self.tipsWin) containerHBox.addWidget(self.containerWidget) containerGroupBox.setLayout(containerHBox) mainLayout.addWidget(firstGroupBox) mainLayout.addWidget(secondGroupBox) # mainLayout.addStretch(1) mainLayout.addWidget(containerGroupBox, 1) self.setLayout(mainLayout)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.orderDao = WorkOrderDao() mainLayout = QtGui.QVBoxLayout() workOrderForm = QtGui.QFormLayout() operateHBox = QtGui.QHBoxLayout() orderNumLabel = QtGui.QLabel(_fromUtf8("工单号:")) orderTitleLabel = QtGui.QLabel(_fromUtf8("工单标题:")) orderReasonLabel = QtGui.QLabel(_fromUtf8("问题回复:")) self.orderNumEdit = QtGui.QLineEdit() self.orderTitleEdit = QtGui.QLineEdit() self.orderReasonEdit = QtGui.QTextEdit() orderNumLabel.setMinimumHeight(25) orderTitleLabel.setMinimumHeight(25) orderReasonLabel.setMinimumHeight(25) self.orderNumEdit.setMinimumHeight(25) self.orderTitleEdit.setMinimumHeight(25) orderAddBtn = QtGui.QPushButton(_fromUtf8("增加")) orderDeleteBtn = QtGui.QPushButton(_fromUtf8("删除")) orderQueryWeekBtn = QtGui.QPushButton(_fromUtf8("导出本周")) orderQueryAllBtn = QtGui.QPushButton(_fromUtf8("导出所有")) orderAddBtn.setFixedSize(100, 30) orderDeleteBtn.setFixedSize(100, 30) orderQueryWeekBtn.setFixedSize(100, 30) orderQueryAllBtn.setFixedSize(100, 30) orderAddBtn.connect(orderAddBtn, QtCore.SIGNAL('clicked()'), self.orderAddMethod) orderDeleteBtn.connect(orderDeleteBtn, QtCore.SIGNAL('clicked()'), self.orderDeleteMethod) orderQueryWeekBtn.connect(orderQueryWeekBtn, QtCore.SIGNAL('clicked()'), self.exportWeekData) orderQueryAllBtn.connect(orderQueryAllBtn, QtCore.SIGNAL('clicked()'), self.exportAllData) self.orderNumEdit.connect(self.orderNumEdit, QtCore.SIGNAL('textChanged(QString)'), self.changeOrderNumInput) self.tipLabel = QtGui.QLabel() self.tipLabel.setFont(QtFontUtil().getFont('Monospace', 12)) self.tipLabel.setContentsMargins(5, 0, 5, 5) self.tipLabel.connect(self.tipLabel, QtCore.SIGNAL('tipsChangeSignal(QString)'), self.setTips) workOrderForm.addRow(orderNumLabel, self.orderNumEdit) workOrderForm.addRow(orderTitleLabel, self.orderTitleEdit) workOrderForm.addRow(orderReasonLabel, self.orderReasonEdit) # 将表单最后一个文本框设置为可垂直拉伸 QtGui.QSizePolicy policy = self.orderReasonEdit.sizePolicy() policy.setVerticalStretch(1) self.orderReasonEdit.setSizePolicy(policy) operateHBox.addWidget(self.tipLabel) operateHBox.addStretch(1) operateHBox.addWidget(orderAddBtn) operateHBox.addWidget(orderDeleteBtn) operateHBox.addWidget(orderQueryWeekBtn) operateHBox.addWidget(orderQueryAllBtn) mainLayout.addLayout(workOrderForm) mainLayout.addSpacing(5) mainLayout.addLayout(operateHBox) self.setLayout(mainLayout)