From 032a6afc90e06e2d5081f0265489dcb7edca5c72 Mon Sep 17 00:00:00 2001 From: horsesword Date: Sat, 25 Dec 2021 18:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=86=8D=E4=BF=AE=E6=94=B9=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E5=90=8D=EF=BC=8C=E9=81=BF=E5=85=8D=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E5=AF=BC=E8=87=B4=E7=9A=84=E5=85=B6=E4=BB=96=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82=E5=9C=A3=E8=AF=9E=E5=BF=AB=E4=B9=90=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++ config/ex_folders.txt | 1 + config/sep_exts.txt | 1 + libs/common_funcs.py | 8 ++-- libs/widgets/my_tk_widgets.py | 5 ++- tagdox.py | 45 +++++++++++-------- ...64\346\226\260\350\256\260\345\275\225.md" | 30 ++++++++++++- 7 files changed, 69 insertions(+), 27 deletions(-) create mode 100644 config/ex_folders.txt create mode 100644 config/sep_exts.txt diff --git a/README.md b/README.md index 23d355a..af352c0 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,12 @@ Tagdox / 标签文库,是用于对文档进行「标签化管理」的免费 ## 近期更新 +#### v0.22.0.2 2021年12月25日 +文件重命名默认不再修改扩展名,避免重命名导致的其他问题。 +圣诞快乐! + + + #### v0.22.0.1 2021年12月21日 优化文件夹排序,实现英文首字母混排,且忽略标签分隔符。 精简部分菜单项。 diff --git a/config/ex_folders.txt b/config/ex_folders.txt new file mode 100644 index 0000000..8b12a06 --- /dev/null +++ b/config/ex_folders.txt @@ -0,0 +1 @@ +_img \ No newline at end of file diff --git a/config/sep_exts.txt b/config/sep_exts.txt new file mode 100644 index 0000000..109599f --- /dev/null +++ b/config/sep_exts.txt @@ -0,0 +1 @@ +.md \ No newline at end of file diff --git a/libs/common_funcs.py b/libs/common_funcs.py index cd2ba94..cbce27f 100644 --- a/libs/common_funcs.py +++ b/libs/common_funcs.py @@ -1,9 +1,9 @@ def get_split_path(full_path) -> list: - ''' - 通用函数: + """ + 通用函数: 将完整路径按照斜杠拆分,得到每个文件夹到文件名的列表。 - ''' + """ test_str = full_path.replace('\\', '/', -1) test_str_res = test_str.split('/') - return (test_str_res) + return test_str_res diff --git a/libs/widgets/my_tk_widgets.py b/libs/widgets/my_tk_widgets.py index f05341f..f991c64 100644 --- a/libs/widgets/my_tk_widgets.py +++ b/libs/widgets/my_tk_widgets.py @@ -131,6 +131,7 @@ class tdInputWindow: # # 窗口设置 # self.input_window.overrideredirect(True) # 这句话可以去掉标题栏,同时也会没有阴影 + # 上面功能启用之后,好像快捷键会出现问题。 self.w_width = 800 self.w_height = 160 # @@ -258,7 +259,7 @@ class tdSpaceWindow: self.sub_window = tk.Toplevel(self.form0) # self.sub_window.transient(self.form0) # 避免在任务栏出现第二个窗口,而且可以实现置顶 - self.sub_window.grab_set() # 模态 + # self.sub_window.grab_set() # 模态,此功能生效后,窗口外不可以点击。注释掉就可以操作了。 # # 窗口设置 @@ -308,7 +309,7 @@ class tdSpaceWindow: """ # print(event.widget) if event.widget == self.sub_window: - print("输入框失去焦点") + print("失去焦点") self.sub_exit(self) def sub_exit(self, event=None): diff --git a/tagdox.py b/tagdox.py index 13defba..9840cd9 100644 --- a/tagdox.py +++ b/tagdox.py @@ -49,10 +49,13 @@ URL_HELP = 'https://gitee.com/horse_sword/my-local-library' # 帮助的超链 URL_ADV = 'https://gitee.com/horse_sword/my-local-library/issues' # 提建议的位置 URL_CHK_UPDATE = 'https://gitee.com/horse_sword/my-local-library/releases' # 检查更新的位置 TAR = 'Tagdox / 标签文库' # 程序名称 -VER = 'v0.22.0.1' # 版本号 +VER = 'v0.22.0.2' # 版本号 """ ## 近期更新说明 +#### v0.22.0.2 2021年12月25日 +文件重命名默认不再修改扩展名,避免重命名导致的其他问题。 +圣诞快乐! #### v0.22.0.1 2021年12月21日 优化文件夹排序,实现英文首字母混排,且忽略标签分隔符。 @@ -1389,15 +1392,15 @@ def show_window_input(title_value, body_value='', init_value='', is_file_name=Tr # 特殊处理 if is_file_name: - res = res.replace('\\', '') - res = res.replace('/', '') - res = res.replace('?', '') - res = res.replace('|', '') - res = res.replace('*', '') - res = res.replace('"', '') - res = res.replace('<', '') - res = res.replace('>', '') - res = res.replace(':', '') + res = res.replace('\\', '_') + res = res.replace('/', '_') + res = res.replace('?', '_') + res = res.replace('|', '_') + res = res.replace('*', '_') + res = res.replace('"', '_') + res = res.replace('<', '_') + res = res.replace('>', '_') + res = res.replace(':', '_') return res pass @@ -1425,9 +1428,12 @@ def update_folder_list(event=None, need_select=True): lst_root_text = get_folder_group_list() lst_my_path_short = exec_list_sort(lst_my_path_short) - def find_node_pos_by_text(node, text): + def find_node_pos_by_text(node, text, pos_min=0): """ 返回对应的位置编号 + node + text + pos_min 是最小的位置,默认为0. 只会返回不小于这个值的查询位置。 """ find_succ = 0 pos = 0 @@ -1436,7 +1442,7 @@ def update_folder_list(event=None, need_select=True): else: items = tree_lst_folder.get_children(node) for i in items: - if tree_lst_folder.item(i, 'text') == text: + if tree_lst_folder.item(i, 'text') == text and pos >= pos_min: find_succ = 1 break pos += 1 @@ -2403,20 +2409,21 @@ def exec_tree_file_rename(tar=None): # 对文件重命名 # 获得目标文件 item_text = tree.item(item, "values") tmp_full_path = item_text[-1] - tmp_file_name = get_split_path(tmp_full_path)[-1] + tmp_file_name = get_split_path(tmp_full_path)[-1] # 文件名 # # print('正在重命名:') - print(tmp_full_path) - print(tmp_file_name) + print('路径:', tmp_full_path) + print('文件名:', tmp_file_name) # res = simpledialog.askstring('文件重命名',prompt='请输入新的文件名',initialvalue =tmp_file_name) # 有bug,不能输入#号 - res = show_window_input('文件重命名', body_value='请输入新的文件名', init_value=tmp_file_name) # 有bug,不能输入#号 + [fname, fename] = os.path.splitext(tmp_file_name) # 文件名,扩展名,其中扩展名包括点号。 + print(fname,' ',fename) + res = show_window_input('文件重命名', body_value='请输入新的文件名', init_value=fname) # 有bug,不能输入#号 # if res is not None: try: - tmp_new_name = '/'.join(get_split_path(tmp_full_path)[0:-1] + [res]) - print('tmp_new_name=') - print(tmp_new_name) + tmp_new_name = '/'.join(get_split_path(tmp_full_path)[0:-1] + [res + fename]) + print('tmp_new_name=', tmp_new_name) # os.rename(tmp_full_path,tmp_new_name) final_name = exec_safe_rename(tmp_full_path, tmp_new_name) update_main_window(0, fast_mode=True) diff --git "a/\346\233\264\346\226\260\350\256\260\345\275\225.md" "b/\346\233\264\346\226\260\350\256\260\345\275\225.md" index 4eadb54..07e6569 100644 --- "a/\346\233\264\346\226\260\350\256\260\345\275\225.md" +++ "b/\346\233\264\346\226\260\350\256\260\345\275\225.md" @@ -8,9 +8,18 @@ -## 更新记录 +# 更新记录 + + + +## 2021年12月 + +#### v0.22.0.2 2021年12月25日 +文件重命名默认不再修改扩展名,避免重命名导致的其他问题。 +圣诞快乐! #### v0.22.0.1 2021年12月21日 + 优化文件夹排序,实现英文首字母混排,且忽略标签分隔符。 精简部分菜单项。 @@ -30,6 +39,12 @@ #### v0.21.4.3 2021年12月2日 隐藏了标签下拉框。 + + +## 2021年11月 + +## + #### v0.21.4.2 2021年11月28日 尝试修复Typora以覆盖方式更新md文件导致丢失标签的bug。 @@ -42,6 +57,12 @@ #### v0.21.3.1 2021年11月17日 优化体验,当左键单击列表空白的时候,会自动取消选中。 + + +## 2021年10月 + + + #### v0.21.3.0 2021年10月30日 增加对markdown移动的优化,相对路径附件可以在移动的时候自动复制了, 这样移动后的md文件仍然可以正常访问图片等附件。 @@ -68,6 +89,11 @@ #### v0.21.0.0 2021年10月3日 优化标签逻辑,采用NTFS流模式,不再影响文件名(测试版)。 优化右键响应,现在可以正确在被点击的项目处出现右键菜单了。 + + + +## 2021年9月 + #### v0.20.3.7 2021年9月18日 优化了分组的颜色,调整为浅蓝色;调整菜单按钮颜色为浅蓝色。 #### v0.20.3.6 2021年9月15日 @@ -137,7 +163,7 @@ -### 2021年8月 +## 2021年8月 -- GitLab