提交 032a6afc 编写于 作者: H horsesword

文件重命名默认不再修改扩展名,避免重命名导致的其他问题。圣诞快乐!

上级 2f3d8230
...@@ -57,6 +57,12 @@ Tagdox / 标签文库,是用于对文档进行「标签化管理」的免费 ...@@ -57,6 +57,12 @@ Tagdox / 标签文库,是用于对文档进行「标签化管理」的免费
## 近期更新 ## 近期更新
#### v0.22.0.2 2021年12月25日
文件重命名默认不再修改扩展名,避免重命名导致的其他问题。
圣诞快乐!
#### v0.22.0.1 2021年12月21日 #### v0.22.0.1 2021年12月21日
优化文件夹排序,实现英文首字母混排,且忽略标签分隔符。 优化文件夹排序,实现英文首字母混排,且忽略标签分隔符。
精简部分菜单项。 精简部分菜单项。
......
_img
\ No newline at end of file
.md
\ No newline at end of file
def get_split_path(full_path) -> list: def get_split_path(full_path) -> list:
''' """
通用函数: 通用函数:
将完整路径按照斜杠拆分,得到每个文件夹到文件名的列表。 将完整路径按照斜杠拆分,得到每个文件夹到文件名的列表。
''' """
test_str = full_path.replace('\\', '/', -1) test_str = full_path.replace('\\', '/', -1)
test_str_res = test_str.split('/') test_str_res = test_str.split('/')
return (test_str_res) return test_str_res
...@@ -131,6 +131,7 @@ class tdInputWindow: ...@@ -131,6 +131,7 @@ class tdInputWindow:
# #
# 窗口设置 # 窗口设置
# self.input_window.overrideredirect(True) # 这句话可以去掉标题栏,同时也会没有阴影 # self.input_window.overrideredirect(True) # 这句话可以去掉标题栏,同时也会没有阴影
# 上面功能启用之后,好像快捷键会出现问题。
self.w_width = 800 self.w_width = 800
self.w_height = 160 self.w_height = 160
# #
...@@ -258,7 +259,7 @@ class tdSpaceWindow: ...@@ -258,7 +259,7 @@ class tdSpaceWindow:
self.sub_window = tk.Toplevel(self.form0) self.sub_window = tk.Toplevel(self.form0)
# #
self.sub_window.transient(self.form0) # 避免在任务栏出现第二个窗口,而且可以实现置顶 self.sub_window.transient(self.form0) # 避免在任务栏出现第二个窗口,而且可以实现置顶
self.sub_window.grab_set() # 模态 # self.sub_window.grab_set() # 模态,此功能生效后,窗口外不可以点击。注释掉就可以操作了。
# #
# 窗口设置 # 窗口设置
...@@ -308,7 +309,7 @@ class tdSpaceWindow: ...@@ -308,7 +309,7 @@ class tdSpaceWindow:
""" """
# print(event.widget) # print(event.widget)
if event.widget == self.sub_window: if event.widget == self.sub_window:
print("输入框失去焦点") print("失去焦点")
self.sub_exit(self) self.sub_exit(self)
def sub_exit(self, event=None): def sub_exit(self, event=None):
......
...@@ -49,10 +49,13 @@ URL_HELP = 'https://gitee.com/horse_sword/my-local-library' # 帮助的超链 ...@@ -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_ADV = 'https://gitee.com/horse_sword/my-local-library/issues' # 提建议的位置
URL_CHK_UPDATE = 'https://gitee.com/horse_sword/my-local-library/releases' # 检查更新的位置 URL_CHK_UPDATE = 'https://gitee.com/horse_sword/my-local-library/releases' # 检查更新的位置
TAR = 'Tagdox / 标签文库' # 程序名称 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日 #### 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 ...@@ -1389,15 +1392,15 @@ def show_window_input(title_value, body_value='', init_value='', is_file_name=Tr
# 特殊处理 # 特殊处理
if is_file_name: 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 return res
pass pass
...@@ -1425,9 +1428,12 @@ def update_folder_list(event=None, need_select=True): ...@@ -1425,9 +1428,12 @@ def update_folder_list(event=None, need_select=True):
lst_root_text = get_folder_group_list() lst_root_text = get_folder_group_list()
lst_my_path_short = exec_list_sort(lst_my_path_short) 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 find_succ = 0
pos = 0 pos = 0
...@@ -1436,7 +1442,7 @@ def update_folder_list(event=None, need_select=True): ...@@ -1436,7 +1442,7 @@ def update_folder_list(event=None, need_select=True):
else: else:
items = tree_lst_folder.get_children(node) items = tree_lst_folder.get_children(node)
for i in items: 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 find_succ = 1
break break
pos += 1 pos += 1
...@@ -2403,20 +2409,21 @@ def exec_tree_file_rename(tar=None): # 对文件重命名 ...@@ -2403,20 +2409,21 @@ def exec_tree_file_rename(tar=None): # 对文件重命名
# 获得目标文件 # 获得目标文件
item_text = tree.item(item, "values") item_text = tree.item(item, "values")
tmp_full_path = item_text[-1] 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('正在重命名:')
print(tmp_full_path) print('路径:', tmp_full_path)
print(tmp_file_name) print('文件名:', tmp_file_name)
# res = simpledialog.askstring('文件重命名',prompt='请输入新的文件名',initialvalue =tmp_file_name) # 有bug,不能输入#号 # 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: if res is not None:
try: try:
tmp_new_name = '/'.join(get_split_path(tmp_full_path)[0:-1] + [res]) tmp_new_name = '/'.join(get_split_path(tmp_full_path)[0:-1] + [res + fename])
print('tmp_new_name=') print('tmp_new_name=', tmp_new_name)
print(tmp_new_name)
# os.rename(tmp_full_path,tmp_new_name) # os.rename(tmp_full_path,tmp_new_name)
final_name = exec_safe_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) update_main_window(0, fast_mode=True)
......
...@@ -8,9 +8,18 @@ ...@@ -8,9 +8,18 @@
## 更新记录 # 更新记录
## 2021年12月
#### v0.22.0.2 2021年12月25日
文件重命名默认不再修改扩展名,避免重命名导致的其他问题。
圣诞快乐!
#### v0.22.0.1 2021年12月21日 #### v0.22.0.1 2021年12月21日
优化文件夹排序,实现英文首字母混排,且忽略标签分隔符。 优化文件夹排序,实现英文首字母混排,且忽略标签分隔符。
精简部分菜单项。 精简部分菜单项。
...@@ -30,6 +39,12 @@ ...@@ -30,6 +39,12 @@
#### v0.21.4.3 2021年12月2日 #### v0.21.4.3 2021年12月2日
隐藏了标签下拉框。 隐藏了标签下拉框。
## 2021年11月
##
#### v0.21.4.2 2021年11月28日 #### v0.21.4.2 2021年11月28日
尝试修复Typora以覆盖方式更新md文件导致丢失标签的bug。 尝试修复Typora以覆盖方式更新md文件导致丢失标签的bug。
...@@ -42,6 +57,12 @@ ...@@ -42,6 +57,12 @@
#### v0.21.3.1 2021年11月17日 #### v0.21.3.1 2021年11月17日
优化体验,当左键单击列表空白的时候,会自动取消选中。 优化体验,当左键单击列表空白的时候,会自动取消选中。
## 2021年10月
#### v0.21.3.0 2021年10月30日 #### v0.21.3.0 2021年10月30日
增加对markdown移动的优化,相对路径附件可以在移动的时候自动复制了, 增加对markdown移动的优化,相对路径附件可以在移动的时候自动复制了,
这样移动后的md文件仍然可以正常访问图片等附件。 这样移动后的md文件仍然可以正常访问图片等附件。
...@@ -68,6 +89,11 @@ ...@@ -68,6 +89,11 @@
#### v0.21.0.0 2021年10月3日 #### v0.21.0.0 2021年10月3日
优化标签逻辑,采用NTFS流模式,不再影响文件名(测试版)。 优化标签逻辑,采用NTFS流模式,不再影响文件名(测试版)。
优化右键响应,现在可以正确在被点击的项目处出现右键菜单了。 优化右键响应,现在可以正确在被点击的项目处出现右键菜单了。
## 2021年9月
#### v0.20.3.7 2021年9月18日 #### v0.20.3.7 2021年9月18日
优化了分组的颜色,调整为浅蓝色;调整菜单按钮颜色为浅蓝色。 优化了分组的颜色,调整为浅蓝色;调整菜单按钮颜色为浅蓝色。
#### v0.20.3.6 2021年9月15日 #### v0.20.3.6 2021年9月15日
...@@ -137,7 +163,7 @@ ...@@ -137,7 +163,7 @@
### 2021年8月 ## 2021年8月
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册