def __init__(self, _parent): IPanel.__init__(self, _parent) frame = self.frame canvas = tk.Canvas(frame, width=self.icon_size, height=self.icon_size) # bg=util_theme.COLOR_GRAP2, # frame.create_rectangle(0, 0, 72, 72, fill=util_theme.COLOR_GRAP2) # image = self.canvas.create_image(50, 50, anchor=tk.N + tk.E, image=filename) # only gif # , outline = util_theme.COLOR_GRAY # canvas.create_rectangle(2, 2, 96, 96) canvas.grid(columns=1, row=1) color = util_theme.COLOR_BLACK color2 = util_theme.COLOR_GRAY btn_save = tk.Button(frame, text='保存', width=8, fg=color) btn_save.bind("<Button-1>", self.btn_click) txt = tk.Label(frame, fg=color2, font=util_theme.get_small_format()) utils.set_groove((btn_save, )) self.canvas = canvas self.pre_img = None self.btn_save = btn_save self.icon_path = "" self.icon_save_path = "" self.txt = txt
def __init__(self, _parent, **kw): IPanel.__init__(self, _parent) # **kw key = 'name' txt_name = kw[key] if key in kw else "" key = 'name_width' name_width = kw[key] if key in kw else 10 key = 'value_width' value_width = kw[key] if key in kw else 100 frame = self.frame tf = util_theme.get_small_format() txt_name = tk.Label(frame, text=txt_name + ":", width=name_width, fg=util_theme.COLOR_BLACK, font=tf, anchor=tk.N + tk.E) txt_value = tk.Text(frame, height=1, width=value_width, fg=util_theme.COLOR_BLACK, bd=0, wrap=tk.WORD, highlightthickness=1, highlightcolor=util_theme.COLOR_GRAY, font=tf) txt_name.grid(column=1, row=1, sticky=tk.NW) txt_value.grid(column=3, row=1, sticky=tk.N + tk.S + tk.W) utils.set_groove((txt_value, )) self.txt_name = txt_name self.txt_value = txt_value
def __init__(self, _parent): frame = tk.Frame(_parent, padx=2, pady=1) btn = tk.Button(frame, text='', width=40, command=self.btn_call) btn_close = tk.Button(frame, text='移除', fg=theme.COLOR_GRAY, width=4, command=self.close_call) btn.grid(column=1, row=1, sticky=tk.W) btn_close.grid(column=2, row=1) utils.set_groove((btn, btn_close)) self.frame = frame self.btn = btn self.btn_close = btn_close
def __init__(self, _parent, **kw): IPanel.__init__(self, _parent) frame = self.frame if 'text' in kw: btn_text = kw['text'] else: btn_text = "开始" btn_call = kw['command'] if 'command' in kw else '' # frame = tk.Frame(_parent, bd=1, padx=0, pady=2) # frame.grid(column=1, row=1, sticky=tk.W) # 颜色 c_black = util_theme.COLOR_BLACK c_list_bg = util_theme.COLOR_LIST_BG txt_width = 80 + 6 # 开始转码 按钮 btn = tk.Button(frame, text=btn_text, command=btn_call) btn.config(height=5, width=12) # listbox 和 scrollBar self.v2 = tk.StringVar() w = kw['width'] if 'width' in kw else txt_width list_box = tk.Listbox(frame, selectmode=tk.EXTENDED, listvariable=self.v2, width=w, height=5, fg=c_black, bd=0, background=c_list_bg, setgrid=1, activestyle='none') scroll_bar = tk.Scrollbar(frame, orient=tk.VERTICAL) # self.scrollBar.set(0.5,1) list_box.config(yscrollcommand=scroll_bar.set) scroll_bar.config(command=list_box.yview) btn.grid(column=1, row=1, sticky=tk.N + tk.W) list_box.grid(column=2, row=1, sticky=tk.W) scroll_bar.grid(column=3, row=1, sticky=tk.N + tk.S) utils.set_groove((btn, )) self.frame = frame self.start_btn = btn self.list_box = list_box
def __init__(self, _parent, **kw): IPanel.__init__(self, _parent) frame = self.frame label_text = kw['label_text'] if 'label_text' in kw else '' cb_text = kw['cb_text'] if 'cb_text' in kw else '' cb_call = kw['cb_call'] if 'cb_call' in kw else None btn_text = kw['btn_text'] if 'btn_text' in kw else '' btn_call = kw['connect_call'] if 'connect_call' in kw else None action_btn_text = kw[ 'action_btn_text'] if 'action_btn_text' in kw else '...' action_btn_call = kw[ 'action_btn_call'] if 'action_btn_call' in kw else None file_types = kw['filetypes'] if 'filetypes' in kw else [] is_folder = kw['isFolder'] if 'isFolder' in kw else False text_width = kw['text_width'] if 'text_width' in kw else 80 # 颜色 color = util_theme.COLOR_BLACK wrap_length = 780 font_name = '微软雅黑' if utils.is_windows else '' font_size = 7 if utils.is_windows else 12 self.cb_call = cb_call has_check = False if label_text: self.label_txt = tk.Label(frame, text=label_text, fg=color) self.label_txt.grid(column=1, row=1, sticky=tk.W) # 勾选框 形式 elif cb_text: self.var_cb = tk.IntVar() cb = tk.Checkbutton(frame, text=cb_text, variable=self.var_cb, fg=color, command=self.checkbox_call) cb.grid(column=1, row=1, sticky=tk.W) self.cb = cb has_check = True # 按钮 形式 elif btn_text: btn = tk.Button(frame, text=btn_text, fg=color) if btn_call: btn.config(command=btn_call) utils.tooltip(btn, "点击打开目录", 100, 2000) btn.grid(column=1, row=1, sticky=tk.W) self.btn = btn utils.set_groove((btn, )) # 文件路径 txt = tk.Label(frame, text='') txt.config(width=text_width, height=1, bd=1, padx=3, fg=color, wraplength=wrap_length, justify='left', anchor='w') txt.grid(column=2, row=1) # 选择文件按钮 action_btn = tk.Button(frame, text=action_btn_text, fg=color, font=(font_name, font_size), state=tk.DISABLED) if len(file_types): action_btn.config(command=self.open_file_call) utils.bind(action_btn, self.right_click_call, True) self.filetypes = file_types self.action_btn_call = action_btn_call if is_folder: action_btn.config(command=self.open_folder_call, state=tk.NORMAL) utils.bind(action_btn, self.right_click_call, True) utils.tooltip(action_btn, "左键点击 选择文件/目录\n右键点击 前往对应文件/目录", 100, 2000) action_btn.grid(column=3, row=1) tup = (frame, action_btn) utils.set_groove(tup) self.txt = txt self.action_btn = action_btn self.hasCheck = has_check self.is_folder = is_folder
def __init__(self, parent, **kw): frame = parent color_black = util_theme.COLOR_BLACK # **kw key = 'file_types' self.file_types = kw[key] if key in kw else [ ("文件", "*.*"), ] key = 'tree_num' tree_num = kw[key] if key in kw else 20 key = 'paste_notice' self.smart_notice = kw[key] if key in kw else ' ;-) 右键点我 粘贴文件' key = 'tree_widths' tree_widths = kw[key] if key in kw else [] key = 'has_list_btn' has_list_btn = kw[key] if key in kw else False # 补齐格式 arr = [] for t in self.file_types: if len(t) >= 2: arr.append(t[1].replace("*", "")) self.file_types_tup = tuple(arr) # 补齐宽度 if utils.is_mac: w_arr = [50, 100, 220, 420, 70] else: w_arr = [30, 70, 192, 370, 70] for i in range(len(w_arr)): if len(tree_widths) - 1 < i: tree_widths.append(w_arr[i]) frame_top = tk.Frame(frame) frame_center = tk.Frame(frame) # 导入文件 / ↑ / ↓ / - /+ import_btn = tk.Button(frame_top, text='导入文件', width=14) import_dir_btn = tk.Button(frame_top, text='导入目录', width=8) import_list_btn = tk.Button(frame_top, text='↺', width=2) import_btn.bind("<Button-1>", self.import_call) import_dir_btn.bind("<Button-1>", self.import_call) import_list_btn.bind("<Button-1>", self.import_call) w = 101 - 12 - 10 if utils.is_mac else 62 tf = setting_fftool.font_default smart_paste = tk.Label(frame_top, padx=8, bd=0, height=1, width=w, fg=color_black, font=tf) smart_paste['text'] = self.smart_notice utils.bind(smart_paste, self.paste_right_click, True) tips = "右键单击此处可以粘贴哦!" utils.tooltip(smart_paste, tips, 100, 6000) up = tk.Button(frame_top, text='↑', width=2, command=self.up_call) down = tk.Button(frame_top, text='↓', width=2, command=self.down_call) remove_btn = tk.Button(frame_top, text='-', width=2, command=self.remove_call) add_btn = tk.Button(frame_top, text='+', width=2, command=self.add_call) import_btn.grid(column=1, row=0) import_dir_btn.grid(column=2, row=0) if has_list_btn: import_list_btn.grid(column=3, row=0) smart_paste.grid(column=4, row=0) up.grid(column=11, row=0) down.grid(column=12, row=0) remove_btn.grid(column=13, row=0) add_btn.grid(column=14, row=0) # 设置tooltip utils.tooltip(import_list_btn, "恢复上次的文件列表", 300, 3000) # treeview self.tree = TreeView(frame_center, tree_num=tree_num, tree_widths=tree_widths) w = (frame_top, frame_center, import_btn, import_list_btn, import_dir_btn, up, down, remove_btn, add_btn) utils.set_groove(w) frame_top.grid(column=1, row=1, sticky=tk.NW) frame_center.grid(column=1, row=2, sticky=tk.NW) self.paste = smart_paste self.import_btn = import_btn self.import_list_btn = import_list_btn self.import_dir_btn = import_dir_btn self.up = up self.down = down self.remove_btn = remove_btn self.add_btn = add_btn
def __init__(self): top_win = tk.Toplevel(utils.win) # '180x200+1920+1080' top_win.geometry(_win_pos) top_win.title('TV遥控器') frame_btn = tk.Frame(top_win) frame_txt = tk.Frame(top_win) # 配置 并创建按钮 config = ([self.btn_up, '▲', 2, 1, "btn_up", "快捷键:↑"], [self.btn_down, '▼', 2, 3, "btn_down", "快捷键:↓"], [self.btn_left, '◀', 1, 2, "btn_left", "快捷键:←"], [self.btn_right, '▶', 3, 2, "btn_right", "快捷键:→"], [self.btn_enter, '●', 2, 2, "btn_enter", "快捷键:回车键" ], [self.btn_menu, '☰', 1, 4, "btn_menu", "可尝试 菜单键 或 右徽标键"], [self.btn_home, 'home', 2, 4, "btn_home", ""], [ self.btn_back, '⇦', 3, 4, "btn_back", "可尝试 esc键 或 backspace键" ], [self.btn_vol_down, '音量-', 1, 6, "btn_vol_down", ""], [self.btn_vol_mute, '静音', 2, 6, "btn_vol_mute", ""], [self.btn_vol_up, '音量+', 3, 6, "btn_vol_up", ""], [self.btn_power, '电源', 1, 7, "btn_power", "功能:电源键"], [self.btn_screen, '✄', 2, 7, "btn_screen", ""], [self.btn_switch, '切换', 3, 7, "btn_switch", "功能:切换应用"]) arr = [] for c in config: text = c[1] column = c[2] row = c[3] name = c[4] tips = c[5] c[0] = tk.Button(frame_btn, text=text, width=4) btn = c[0] setattr(btn, "name", name) btn.bind("<Button-1>", self.btn_call) if tips: utils.tooltip(btn, tips) btn.grid(column=column, row=row) arr.append(btn) # 分割线 tk.Label(frame_btn).grid(column=1, row=5, sticky=tk.W) t = tuple(arr) utils.set_groove(t) # 文本框 txt = tk.Label(frame_txt, fg=util_theme.COLOR_GRAY, width=18) txt.grid(column=1, row=1) frame_btn.grid(column=1, row=1) frame_txt.grid(column=1, row=2) # frame_btn.focus() # frame_btn.bind("<Button-1>", self.refocus) top_win.bind('<Key>', self.btn_call) top_win.protocol("WM_DELETE_WINDOW", self.on_closing) self.txt = txt self.serial = 'emulator-5554' self.data = None self.frame_btn = frame_btn self.top_win = top_win self.auto_select()
def manual_int(self): if self.is_manual_int: return self.is_manual_int = True win = self.win # 颜色 GRAP = "#515556" LIST_BG = "#EFEFEF" LIST_WIDTH = 91 + 10 frameImport = tk.Frame(win, padx=8, pady=8) frame_file = tk.Frame(win, padx=8) frameList = tk.Frame(win, padx=8) frameOutDir = tk.Frame(win, padx=8) frameStart = tk.Frame(win, padx=8) frameCB = tk.Frame(win, padx=8) frameImport.grid(column=1, row=1, sticky=tk.N + tk.S + tk.W) frame_file.grid(column=1, row=2, sticky=tk.N + tk.S + tk.W) frameList.grid(column=1, row=3, sticky=tk.N + tk.S + tk.W) frameOutDir.grid(column=1, row=4, sticky=tk.N + tk.S + tk.W) frameCB.grid(column=1, row=5, sticky=tk.N + tk.S + tk.W) frameStart.grid(column=1, row=6, sticky=tk.N + tk.S + tk.W) self.importBtn = tk.Button(frameImport, text='导入文件', width=14) self.importBtn.bind("<Button-1>", self.importCall) self.importBtn.grid(column=1, row=0) self.smartNotice = " ;-) 点我 粘贴视频文件" self.smartPaste = tk.Text(frameImport, height=1, width=LIST_WIDTH - 22, fg=GRAP, wrap=tk.WORD, font=setting_fftool.font_default) self.smartPaste.grid(column=2, row=0) self.smartPaste.bind("<Leave>", self.smartPasteLeave) self.smartPaste.bind("<Button-1>", self.smartPasteClick) self.smartPaste.insert(tk.INSERT, self.smartNotice) # tk.Label(frameImport, height=1, width=LIST_WIDTH-22).grid(column=2, row=0) # 右边距 self.randomBtn = tk.Button(frameImport, text='⇌随机', width=9) self.randomBtn.bind("<Button-1>", self.randomCall) self.randomBtn.grid(column=6, row=0) self.varL = tk.StringVar() self.varC = tk.StringVar() self.varR = tk.StringVar() self.listL = tk.Listbox( frameList, selectmode=tk.EXTENDED, fg=GRAP, background=LIST_BG, height=20, setgrid=1, activestyle='none') self.listC = utils.clone(self.listL) self.listR = utils.clone(self.listL) self.listL.config(yscrollcommand=self.yscrollL, listvariable=self.varL, bd=1, justify=tk.LEFT, width=48 - 2) self.listC.config(yscrollcommand=self.yscrollC, listvariable=self.varC, bd=0, justify=tk.CENTER, width=7) self.listR.config(yscrollcommand=self.yscrollR, listvariable=self.varR, bd=1, justify=tk.LEFT, width=48 - 2) self.listL.grid(column=1, row=10, sticky=tk.E) self.listC.grid(column=2, row=10, sticky=tk.W) self.listR.grid(column=3, row=10, sticky=tk.W) self.scrollbar = tk.Scrollbar(frameList, orient='vertical', command=self.yview) self.scrollbar.grid(column=4, row=10, sticky=tk.N + tk.S + tk.W) self.fc_out = FileChooser(frameOutDir, btn_text=" 输出目录 ", action_btn_text='选择目录', btn_call=self.gotoOutDir, isFolder=True, hasGROOVE=True, text_width=84) frame_out = self.fc_out.get_frame() frame_out.grid(column=1, row=21, sticky=tk.NW) self.CheckVar1 = tk.IntVar() self.cb1 = tk.Checkbutton(frameCB, text="极速模式", variable=self.CheckVar1) self.cb1.grid(column=1, row=1, sticky=tk.W) # 开始转码 按钮 self.start_btn = Start(frameStart, text='开始\n合并', command=self.startCheck) self.start_btn.grid(column=1, row=1, sticky=tk.W) self.start_btn.set_state(False) tup = (self.importBtn, self.randomBtn, self.listL, self.listR) utils.set_groove(tup) self.autoSelect()
def __init__(self): top_win = tk.Toplevel(utils.win) top_win.title('wifi连接') top_win.geometry(_win_pos) frame_top = tk.Frame(top_win) frame_top2 = tk.Frame(top_win) frame_list = tk.Frame(top_win) # 顶部输入框 var_entry = tk.StringVar() var_entry2 = tk.StringVar() # 模拟器端口 port = "7555" if utils.is_windows else "5555" serial1 = "127.0.0.1:{0}".format(port) serial2 = "127.0.0.1:{0}".format("62001") desc1 = "mumu模拟器" txt1 = tk.Label(frame_top, text='请输入设备的 IP 地址:') txt2 = tk.Label(frame_top, text='最近连接:', fg=theme.COLOR_GRAY) entry = tk.Entry(frame_top, textvariable=var_entry, width=28) entry.select_adjust(15) entry.focus() btn_connect = tk.Button(frame_top, text='连接', width=8) btn_serial1 = tk.Button(frame_top, text=desc1, width=40) btn_scan = tk.Button(frame_top, text='网络发现', width=8) entry.bind('<Return>', self.entry_call) btn_connect.bind('<Button-1>', self.connect_call) utils.bind(btn_serial1, self.emulator_call, False) utils.bind(btn_serial1, self.emulator_call, True) utils.tooltip(btn_serial1, "左键 mumu模拟器 {0}\n右键 夜神模拟器 {1}".format(serial1, serial2)) utils.bind(btn_scan, self.scan_call, False) utils.bind(btn_scan, self.scan_call, True) utils.tooltip(btn_scan, "左键扫描 开放5555端口的ip\n" "右键扫描 开放7555端口的ip") # tree 配置 # 列号,宽度,对齐,列名称 config = [ ["1", 140, "center", "名称"], ["2", 120, "nw", "IP"], ["3", 80, "center", "端口号"] ] names = [] for c in config: names.append(c[0]) tree = ttk.Treeview(frame_list, show="headings", selectmode=tk.EXTENDED, columns=names) tree.config(height=10) for c in config: tree.column(c[0], width=c[1], anchor=c[2]) tree.heading(c[0], text=c[3]) tree.tag_configure(self.ODD, background='#f5f5f5') tree.bind('<Button-1>', self.tree_call) tree.bind('<Double-1>', self.tree_double_call) y_scrollbar = ttk.Scrollbar(frame_list, orient=tk.VERTICAL, command=tree.yview) tree.config(yscrollcommand=y_scrollbar.set) self.i_name = 0 self.i_ip = 1 self.i_port = 2 entry2 = tk.Entry(frame_top2, textvariable=var_entry2, width=28) rename = tk.Button(frame_top2, text='✏', width=2, command=self.rename_call) up = tk.Button(frame_top2, text='↑', width=2, command=self.up_call) down = tk.Button(frame_top2, text='↓', width=2, command=self.down_call) remove_btn = tk.Button(frame_top2, text='-', width=2, command=self.remove_call) entry2.bind('<Return>', self.entry2_call) utils.tooltip(rename, "更改设备名称\n支持输入框按enter键") txt1.grid(column=1, row=1, sticky=tk.NW) entry.grid(column=1, row=2, sticky=tk.E + tk.W) btn_serial1.grid(column=1, row=3, sticky=tk.NW) txt2.grid(column=1, row=4, sticky=tk.NW) btn_connect.grid(column=2, row=2) btn_scan.grid(column=2, row=3) tree.grid(column=1, row=2) y_scrollbar.grid(column=2, row=2, sticky=tk.N + tk.S) entry2.grid(column=2, row=3) rename.grid(column=3, row=3) up.grid(column=4, row=3) down.grid(column=5, row=3) remove_btn.grid(column=6, row=3) frame_top.grid(column=1, row=1) frame_list.grid(column=1, row=2, sticky=tk.NW) frame_top2.grid(column=1, row=3, sticky=tk.EW) utils.set_groove((btn_connect, btn_serial1, btn_scan, up, down, remove_btn)) # utils.win.call('focus', '-force', entry) top_win.protocol("WM_DELETE_WINDOW", self.on_closing) self.top_win = top_win self.frame_top = frame_top self.entry = entry self.var_entry = var_entry self.var_entry2 = var_entry2 self.btn_connect = btn_connect self.btn_emulator1 = btn_serial1 self.widget_arr = [] self.serial1 = serial1 self.serial2 = serial2 self.tree = tree self.auto_select()
def __init__(self, apk): top_win = tk.Toplevel(utils.win) top_win.title('apk信息查看器') # top_win.geometry('200x200') # top_win.bind("<Destroy>", self.destroyed) color = util_theme.COLOR_BLACK frame_top = tk.Frame(top_win, padx=2, pady=2) frame_content = tk.Frame(top_win, padx=2, pady=2) bind = utils.bind btn_browse = tk.Button(frame_top, text='选择apk', fg=color, width=10) bind(btn_browse, self.btn_call) bind(btn_browse, self.btn_call, True) utils.tooltip(btn_browse, "左键点击 选择一个apk文件\n右键点击 读取剪贴板中的文件") frame_rename = tk.Frame(frame_top) btn_rename1 = tk.Button(frame_rename, text='应用名', width=6, fg=color) btn_rename2 = tk.Button(frame_rename, text='包名', width=6, fg=color) btn_rename3 = tk.Button(frame_rename, text='渠道名', width=6, fg=color) bind(btn_rename1, self.rename_call) bind(btn_rename2, self.rename_call) bind(btn_rename3, self.rename_call) bind(btn_rename1, self.rename_right_call, True) bind(btn_rename2, self.rename_right_call, True) bind(btn_rename3, self.rename_right_call, True) # labelframe label_frame_base = tk.LabelFrame(frame_content, text=' 基本 ', borderwidth=1) label_frame_sign = tk.LabelFrame(frame_content, text=' 签名、文件 ', borderwidth=1) label_frame_per = tk.LabelFrame(frame_content, text=' 权限 ', borderwidth=1) icon_frame = tk.Frame(label_frame_base, padx=0, pady=0) icon_left = tk.Frame(icon_frame, padx=0, pady=0) icon_right = tk.Frame(icon_frame, padx=0, pady=0) # label item config = [ [icon_left, "名称", 0, 30, 1, 1], [icon_left, "包名", 0, 30, 1, 2], [icon_left, "版本号", 0, 30, 1, 3], [icon_left, "内部版本号", 0, 30, 1, 4], [icon_left, "友盟渠道", 0, 30, 1, 5], [icon_left, "友盟appkey", 0, 30, 1, 6], [label_frame_base, "min_sdk", 0, 55, 1, 2], [label_frame_base, "target_sdk", 0, 55, 1, 3], [label_frame_sign, "签名MD5", 0, 55, 1, 1], [label_frame_sign, "签名SHA1", 0, 55, 1, 2], [label_frame_sign, "签名SHA256", 0, 55, 1, 3], [label_frame_sign, "文件地址", 0, 55, 1, 4], [label_frame_sign, "文件大小", 0, 55, 1, 5], [label_frame_sign, "文件MD5", 0, 55, 1, 6], ] obj_arr = [] for arr in config: col = arr[4] row = arr[5] obj = LabelItem(arr[0], name=arr[1], value_width=arr[3]) obj.grid(column=col, row=row, sticky=tk.NW) obj_arr.append(obj) # icon m_icon = IconItem(icon_right) # 权限文本框 m_entry = tk.Text(label_frame_per, height=9, width=65, fg=color, bd=1, wrap=tk.WORD, highlightthickness=1, highlightcolor=util_theme.COLOR_GRAY, font=util_theme.get_small_format()) btn_browse.grid(column=1, row=1) tk.Label(frame_top, width=19).grid(column=2, row=1) frame_rename.grid(column=3, row=1) btn_rename1.grid(column=2, row=1) btn_rename2.grid(column=3, row=1) btn_rename3.grid(column=4, row=1) label_frame_base.grid(column=1, row=1, sticky=tk.N + tk.S + tk.W) label_frame_sign.grid(column=1, row=2, sticky=tk.N + tk.S + tk.W) label_frame_per.grid(column=1, row=4, sticky=tk.N + tk.S + tk.W) m_icon.grid(column=1, row=1) m_entry.grid(column=1, row=1, sticky=tk.N + tk.S + tk.W) icon_left.grid(column=1, row=1, sticky=tk.N + tk.S + tk.W) icon_right.grid(column=2, row=1, sticky=tk.N + tk.S + tk.W) icon_frame.grid(column=1, row=1, sticky=tk.N + tk.S + tk.W) frame_top.grid(column=1, row=1, sticky=tk.W) frame_content.grid(column=1, row=2) self.m_name = obj_arr[0] self.m_package = obj_arr[1] self.m_ver = obj_arr[2] self.m_ver_inner = obj_arr[3] self.m_um_channel = obj_arr[4] self.m_um_key = obj_arr[5] self.m_min_sdk = obj_arr[6] self.m_target_sdk = obj_arr[7] self.m_sign_md5 = obj_arr[8] self.m_sign_sha1 = obj_arr[9] self.m_sign_sha256 = obj_arr[10] self.m_apk_path = obj_arr[11] self.m_apk_size = obj_arr[12] self.m_apk_md5 = obj_arr[13] self.m_entry = m_entry utils.set_groove((btn_browse, btn_rename1, btn_rename2, btn_rename3)) self.m_icon = m_icon self.top_win = top_win self.btn_browse = btn_browse self.btn_rename1 = btn_rename1 self.btn_rename2 = btn_rename2 self.btn_rename3 = btn_rename3 self.destroy_arr = [frame_top, frame_content, btn_browse] self.__update_tips() # 如果定义了 apk 地址 if os.path.exists(apk): self.__show_info(apk)
def __init__(self, _parent): IPanel.__init__(self, _parent) frame = self.frame self.th = utils.thread_func self.msg = util_atool.show_msg # frame = tk.LabelFrame(_parent, text=' 指令列表 ', fg=util_theme.COLOR_GRAP2, borderwidth=1, padx=4, pady=4) # 包名下拉框 btn_frame = tk.Frame(frame) cbb_item = PackageCombobox(frame) cbb = ttk.Combobox(btn_frame, width=18, state='readonly', height=20, justify='center') cbb.bind("<<ComboboxSelected>>", self.cbb_call) # utils.tooltip(cbb, '选择下拉项即执行操作') utils.tooltip(cbb, '选择下拉项改变按钮功能') btn = tk.Button(btn_frame, text="Go", width=12, fg=util_theme.COLOR_BLACK) utils.bind(btn, self.btn_call) utils.bind(btn, self.btn_call, True) frame_btn_group = tk.Frame(btn_frame) # btn_am = tk.Button(frame_btn_group, text="应用管理", width=6) btn_screen = tk.Button(frame_btn_group, text="截屏", width=6) btn_install = tk.Button(frame_btn_group, text="安装", width=6) btn_log = tk.Button(frame_btn_group, text="日志", width=6) # utils.bind(btn_am, self.btn_group_call) # utils.bind(btn_am, self.btn_group_call, True) utils.bind(btn_screen, self.btn_group_call) utils.bind(btn_screen, self.btn_group_call, True) utils.bind(btn_install, self.btn_group_call) utils.bind(btn_install, self.btn_group_call, True) utils.bind(btn_log, self.btn_group_call) utils.bind(btn_log, self.btn_group_call, True) utils.tooltip(btn_screen, "左键截屏并自动打开图片\n右键截屏不自动打开图片", 800) utils.tooltip(btn_install, "左键点击 安装\n右键点击 安装剪贴板里的apk", 800) utils.tooltip(btn_log, "左键获取日志\n右键清除日志", 800) utils.set_groove((btn, btn_screen, btn_install, btn_log)) # btn_am.grid(column=1, row=1, sticky=tk.NW) btn_screen.grid(column=2, row=1, sticky=tk.NW) btn_install.grid(column=3, row=1, sticky=tk.NW) btn_log.grid(column=4, row=1, sticky=tk.NW) cbb.grid(column=1, row=1, sticky=tk.NW) btn.grid(column=2, row=1, sticky=tk.NW) tk.Label(btn_frame, width='4').grid(column=3, row=1, sticky=tk.NW) frame_btn_group.grid(column=4, row=1) # cbb_item.grid(1, 2, tk.NW) btn_frame.grid(column=1, row=1, sticky=tk.NW) self.btn = btn self.cbb_item = cbb_item self.cbb = cbb self.cbb_ops = None # self.btn_am = btn_am self.btn_screen = btn_screen self.btn_install = btn_install self.btn_log = btn_log
def manual_int(self): if self.is_manual_int: return self.is_manual_int = True win = self.win self.hasQuery = False self.LeftIsReverse = False self.RightIsReverse = False self.sortDesc = ('排序↕', "升序a-z", '降序z-a') """组装 ui """ # 颜色 GRAP = "#515556" # GRAP2 = "#B9BFC1" # TXT_BG = "#ECECEC" LIST_BG = "#EFEFEF" LIST_WIDTH = 91 + 10 # TXT_WIDTH = 80+7 # FILE_GAP = 65+10 # WRAP_LENGTH = 780 frame = tk.Frame(win, padx=8, pady=2) frame.grid(column=1, row=0, sticky=tk.N + tk.S + tk.W) self.svL = StringVar() self.svC = StringVar() self.svR = StringVar() varL = self.svL.get_object() varC = self.svC.get_object() varR = self.svR.get_object() self.list_l = tk.Listbox(frame, selectmode=tk.EXTENDED, fg=GRAP, background=LIST_BG, height=20, setgrid=1, activestyle='none') self.list_c = utils.clone(self.list_l) self.list_r = utils.clone(self.list_l) self.list_l.config(yscrollcommand=self.yscroll1, listvariable=varL) self.list_c.config(yscrollcommand=self.yscroll2, listvariable=varC) self.list_r.config(yscrollcommand=self.yscroll3, listvariable=varR) self.list_l.config(bd=1, justify=tk.RIGHT, width=LIST_WIDTH - 35) self.list_c.config(bd=0, justify=tk.CENTER, width=7) self.list_r.config(bd=1, justify=tk.LEFT, width=25) self.list_l.grid(column=1, row=10, sticky=tk.E) self.list_c.grid(column=2, row=10, sticky=tk.W) self.list_r.grid(column=3, row=10, sticky=tk.W) self.scrollbar = tk.Scrollbar(frame, orient='vertical', command=self.yview) self.scrollbar.grid(column=4, row=10, sticky=tk.N + tk.S + tk.W) # test # for x in range(30): # self.list_l.insert('end', x) # self.list_r.insert('end', x) self.msgLeft = " ;-) 点我 粘贴 需命名的文件" self.paste_l = tk.Text(frame, height=1, width=LIST_WIDTH - 30, fg=GRAP, wrap=tk.WORD, font=setting_fftool.font_default) self.paste_l.bind("<Leave>", self.paste_leave_left) self.paste_l.bind("<Button-1>", self.pasteClick) self.paste_l.tag_config("right", justify=tk.RIGHT) self.paste_l.insert(tk.INSERT, self.msgLeft, "right") self.msg_right = " ;-) 粘贴 文件名 或 文件" self.paste_r = tk.Text(frame, height=1, width=25, fg=GRAP, wrap=tk.WORD, font=setting_fftool.font_default) self.paste_r.bind("<Leave>", self.leave_right) self.paste_r.bind("<Button-1>", self.pasteClick) self.paste_r.insert(tk.INSERT, self.msg_right) self.paste_l.grid(column=1, row=0, sticky=tk.NE) self.paste_r.grid(column=3, row=0, sticky=tk.NW) # 左右排序按钮 fleft = tk.Frame(frame, padx=8, pady=2) fRight = tk.Frame(frame, padx=8, pady=2) desc = self.sortDesc self.sortLS = tk.Button(fleft, text=desc[0], width=7) self.sortLU = tk.Button(fleft, text='↑', width=2) self.sortLD = tk.Button(fleft, text='↓', width=2) self.sortRS = tk.Button(fRight, text=desc[0], width=7) self.sortRU = tk.Button(fRight, text='↑', width=2) self.sortRD = tk.Button(fRight, text='↓', width=2) widgets = (self.sortLS, self.sortLU, self.sortLD, self.sortRS, self.sortRU, self.sortRD) for w in widgets: utils.bind(w, self.sortCall) fleft.grid(column=1, row=5, sticky=tk.NE) self.sortLS.grid(column=4, row=1) self.sortLU.grid(column=2, row=1) self.sortLD.grid(column=3, row=1) fRight.grid(column=3, row=5, sticky=tk.NE) self.sortRS.grid(column=1, row=1) self.sortRU.grid(column=2, row=1) self.sortRD.grid(column=3, row=1) start_btn = tk.Button(frame, text='开始\n命名', width=6, height=3, command=self.start_check, relief=tk.GROOVE) undo_btn = tk.Button(frame, text='↺撤销', width=6, height=1, command=self.start_check, relief=tk.GROOVE) start_btn.grid(column=2, row=20) undo_btn.grid(column=2, row=21) utils.set_state(start_btn, False) utils.set_state(undo_btn, False) # 统一设置样式 tub1 = (self.list_l, self.list_r, start_btn, undo_btn) tub = widgets + tub1 utils.set_groove(tub) self.undo_btn = undo_btn self.start_btn = start_btn
def init_btn(text, width=8): btn = tk.Button(frame_btn, text=text, width=width, fg=color) btn.bind("<Button-1>", self.btn_click) utils.set_groove((btn, )) return btn