示例#1
0
def pull_apk(_serial, package):
    """下载apk"""
    device_apk = pm_path(_serial, package)
    if not device_apk:
        utils.showinfo("找不到此应用")
        return ''

    apk_name = '{package}-{now}.apk'.format(package=package, now=__get_now())
    save_dir = setting_atool.output_dir + os.sep + "apk"
    utils.make_dir(save_dir)

    pc_apk = save_dir + os.sep + apk_name
    s = 'adb -s {serial} pull "{device_apk}" {pc_apk}'
    s = s.format(serial=_serial, device_apk=device_apk, pc_apk=pc_apk)
    print(s)
    # 'adb: error: remote object \'/data/app/com.bbk.personal-2/base.apk\' does not exist'
    result = execute(s)

    if result.count("error"):
        url = 'http://app.mi.com/details?id=com.estrongs.android.pop'
        utils.clipboard_set(url)
        utils.showinfo("可能权限不够,可使用 es文件浏览器 执行备份应用操作!\napk下载链接已拷贝到剪贴板\n" +
                       result)
        return ''

    return pc_apk
示例#2
0
    def am_list(serial, is_system=False):
        """获得应用列表"""

        if not is_system:
            _boo = False
            desc_type = "用户应用"
            desc = "获取 {0} 信息成功!\n已复制到剪贴板,请粘贴后使用"
            msg_desc = "正在获取用户安装的应用列表信息"
        else:
            _boo = True
            desc_type = "全部应用"
            desc = "获取 {0} 信息成功!\n已复制到剪贴板,请粘贴后使用"
            msg_desc = "正在获取全部的应用列表信息"
        util_atool.show_msg(msg_desc)

        # 执行命令行
        s = util_atool.pm_list_f(serial, _boo)
        # 复制到剪贴板
        desc_add = '以下是{desc}信息,如需 拷贝 apk 到本机可使用:\n\t{adb} -s {serial} pull "[/data/app/xx.apk]"\n\n'
        desc_add = desc_add.format(desc=desc_type,
                                   adb=util_atool.adb_path,
                                   serial=serial)
        s = desc_add + s
        utils.clipboard_set(s)

        # 提示
        desc = desc.format(desc_type)
        utils.showinfo(desc)
示例#3
0
 def send_input_clipper(serial, is_get=False):
     """发送文本"""
     if not is_get:
         s = utils.clipboard_get()
         if s:
             util_atool.send_input_clipper_set(serial, s)
             util_atool.show_msg('正发送文本 {0} 到 {1} 设备上'.format(s, serial))
         else:
             utils.showinfo("请先复制字符到剪贴板")
     else:
         s = util_atool.send_input_clipper_get(serial)
         utils.clipboard_set(s)
         util_atool.show_msg("安卓设备的剪贴板发现“{0}”\n已复制到本机的剪贴板".format(s))
示例#4
0
    def p_am_cur(self, is_right=False):
        self.msg("正在查询 前台运行...")
        s = util_atool.activity_current(self.serial, is_right)
        utils.clipboard_set(s)
        if is_right:
            if s and len(s.split(" ")) == 1:
                self.cbb_item.append(s)
                self.cbb_item.set(s)
                self.grid_cbb_package()
                self.msg("前台正在运行:{},已加入包名下拉框并复制到剪贴板中".format(s))
            else:
                self.msg("找不到 前台正在运行".format(s))

        else:
            self.msg("前台正在运行:{},已拷贝到剪贴板".format(s))
示例#5
0
    def btn_click(self, event):
        """点击按钮"""
        w = event.widget
        if utils.is_right_click(event.num):
            # 鼠标右键键
            if w == self.btn_refresh:
                self.show_devices_force()
            elif w == self.btn_apk:
                self.show_apk_info(utils.clipboard_get(), True)
            elif w == self.btn_wifi:
                win_wifi_connect.connect_one()

        else:
            # 鼠标左键
            if w == self.btn_refresh:
                self.show_devices()

            elif w == self.btn_apk:
                self.show_apk_info()

            elif w == self.btn_folder:
                f = setting_atool.last_screen_shot
                s = str(f)

                if os.path.exists(f):
                    utils.open_file(f, True)  # 如果有文件记录 则定位到文件
                else:
                    s = str(setting_atool.output_dir)
                    success = utils.open_dir(s)
                    if not success:
                        utils.showinfo("文件夹不存在,请查看设置")
                utils.clipboard_set(s)  # 将路径拷贝到剪贴板中

            # wifi链接
            elif w == self.btn_wifi:
                if not utils.lift_and_check(self.win_wifi):
                    self.win_wifi = win_wifi_connect.WifiConnect()
            # 遥控器
            elif w == self.btn_remote:
                util_atool.show_remote()
            # 设置
            elif w == self.btn_setting:
                if not utils.lift_and_check(self.win_pref):
                    self.win_pref = win_preferences.Main()
示例#6
0
 def op_copy_cmd(self):
     """拷贝命令行"""
     s = util_atool.get_cmd_with_serial(self.serial)
     utils.clipboard_set(s)
     desc = '命令行' if utils.is_windows else '终端'
     self.msg("已复制到剪贴板,请粘贴到{0}上使用\n{1}".format(desc, s))