bcmd 0.6.4__tar.gz → 0.6.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bcmd might be problematic. Click here for more details.

Files changed (35) hide show
  1. {bcmd-0.6.4 → bcmd-0.6.5}/PKG-INFO +1 -1
  2. {bcmd-0.6.4 → bcmd-0.6.5}/bcmd.egg-info/PKG-INFO +1 -1
  3. {bcmd-0.6.4 → bcmd-0.6.5}/bcmd.egg-info/SOURCES.txt +3 -1
  4. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/lib.py +44 -9
  5. bcmd-0.6.5/bcmdx/utils/__init__.py +0 -0
  6. bcmd-0.6.5/bcmdx/utils/tkUtil.py +130 -0
  7. {bcmd-0.6.4 → bcmd-0.6.5}/pyproject.toml +2 -3
  8. {bcmd-0.6.4 → bcmd-0.6.5}/MANIFEST.in +0 -0
  9. {bcmd-0.6.4 → bcmd-0.6.5}/README.md +0 -0
  10. {bcmd-0.6.4 → bcmd-0.6.5}/bcmd.egg-info/dependency_links.txt +0 -0
  11. {bcmd-0.6.4 → bcmd-0.6.5}/bcmd.egg-info/entry_points.txt +0 -0
  12. {bcmd-0.6.4 → bcmd-0.6.5}/bcmd.egg-info/requires.txt +0 -0
  13. {bcmd-0.6.4 → bcmd-0.6.5}/bcmd.egg-info/top_level.txt +0 -0
  14. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/__init__.py +0 -0
  15. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/common/__init__.py +0 -0
  16. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/common/func.py +0 -0
  17. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/common/password.py +0 -0
  18. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/main.py +0 -0
  19. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/resources/project/main.py +0 -0
  20. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/__init__.py +0 -0
  21. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/bin.py +0 -0
  22. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/code.py +0 -0
  23. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/crypto.py +0 -0
  24. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/debian.py +0 -0
  25. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/download.py +0 -0
  26. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/image.py +0 -0
  27. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/json.py +0 -0
  28. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/math.py +0 -0
  29. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/mirror.py +0 -0
  30. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/pdf.py +0 -0
  31. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/proxy.py +0 -0
  32. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/time.py +0 -0
  33. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/upgrade.py +0 -0
  34. {bcmd-0.6.4 → bcmd-0.6.5}/bcmdx/tasks/wasabi.py +0 -0
  35. {bcmd-0.6.4 → bcmd-0.6.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -28,4 +28,6 @@ bcmdx/tasks/pdf.py
28
28
  bcmdx/tasks/proxy.py
29
29
  bcmdx/tasks/time.py
30
30
  bcmdx/tasks/upgrade.py
31
- bcmdx/tasks/wasabi.py
31
+ bcmdx/tasks/wasabi.py
32
+ bcmdx/utils/__init__.py
33
+ bcmdx/utils/tkUtil.py
@@ -6,6 +6,8 @@ import typer
6
6
  from beni import bcolor, bfile, bpath, brun, btask
7
7
  from beni.bfunc import syncCall
8
8
 
9
+ from bcmdx.utils.tkUtil import TkForm
10
+
9
11
  from ..common import password
10
12
 
11
13
  app: Final = btask.newSubApp('lib 工具')
@@ -21,23 +23,55 @@ async def update_version(
21
23
  file = path / 'pyproject.toml'
22
24
  btask.assertTrue(file.is_file(), '文件不存在', file)
23
25
  data = await bfile.readToml(file)
24
- version = data['project']['version']
25
- versionList = [int(x) for x in version.split('.')]
26
- versionList[-1] += 1
27
- newVersion = '.'.join([str(x) for x in versionList])
26
+ latestVersion = data['project']['version']
27
+ vAry = [int(x) for x in latestVersion.split('.')]
28
+ versionList = [
29
+ f'{vAry[0] + 1}.0.0',
30
+ f'{vAry[0]}.{vAry[1] + 1}.0',
31
+ f'{vAry[0]}.{vAry[1]}.{vAry[2] + 1}',
32
+ ]
33
+
34
+ def showGui():
35
+ app = TkForm()
36
+ app.title('bcmd 版本更新')
37
+ app.addLabel('当前版本号', latestVersion)
38
+ version_var = app.addRadioBtn(
39
+ '请选择新版本',
40
+ versionList,
41
+ selectedIndex=-1,
42
+ )
43
+ result: str = ''
44
+
45
+ def onBtn():
46
+ nonlocal result
47
+ result = version_var.get()
48
+ app.destroy()
49
+
50
+ app.addBtn('确定', onBtn, focus=True)
51
+ app.run()
52
+ return result
53
+
54
+ newVersion = showGui()
55
+ if not newVersion:
56
+ btask.abort('用户取消操作')
28
57
  content = await bfile.readText(file)
29
- if f"version = '{version}'" in content:
30
- content = content.replace(f"version = '{version}'", f"version = '{newVersion}'")
31
- elif f'version = "{version}"' in content:
32
- content = content.replace(f'version = "{version}"', f'version = "{newVersion}"')
58
+ if f"version = '{latestVersion}'" in content:
59
+ content = content.replace(f"version = '{latestVersion}'", f"version = '{newVersion}'")
60
+ elif f'version = "{latestVersion}"' in content:
61
+ content = content.replace(f'version = "{latestVersion}"', f'version = "{newVersion}"')
33
62
  else:
34
63
  raise Exception('版本号修改失败,先检查文件中定义的版本号格式是否正常')
35
64
  await bfile.writeText(file, content)
65
+
66
+ # 执行一遍 uv.lock
67
+ with bpath.changePath(path):
68
+ await brun.run('uv lock')
69
+
36
70
  bcolor.printCyan(newVersion)
37
71
  if not isNotCommit:
38
72
  msg = f'更新版本号 {newVersion}'
39
73
  os.system(
40
- rf'TortoiseGitProc.exe /command:commit /path:{file} /logmsg:"{msg}"'
74
+ rf'TortoiseGitProc.exe /command:commit /path:{path} /logmsg:"{msg}"'
41
75
  )
42
76
  bcolor.printGreen('OK')
43
77
 
@@ -56,3 +90,4 @@ async def build(
56
90
  with bpath.changePath(path):
57
91
  await brun.run(f'uv build')
58
92
  await brun.run(f'uv publish -u {user} -p {pwd}')
93
+ bcolor.printGreen('OK')
File without changes
@@ -0,0 +1,130 @@
1
+ import tkinter as tk
2
+ from tkinter.scrolledtext import ScrolledText
3
+ from typing import Callable
4
+ from uuid import uuid4
5
+
6
+ # version 2026-0621
7
+
8
+
9
+ class TkForm(tk.Tk):
10
+
11
+ _row = -1
12
+ _initFocusItem: tk.Widget | None = None
13
+
14
+ RADIO_NOTHING = uuid4().hex
15
+
16
+ def __init__(self):
17
+ super().__init__()
18
+ self.resizable(False, False)
19
+ self.bind("<Map>", self._onMap)
20
+
21
+ def _onMap(self, event: tk.Event):
22
+ if self._initFocusItem:
23
+ self._initFocusItem.focus_set()
24
+ self._initFocusItem = None
25
+
26
+ def add(self, desc: str, widget: tk.Widget):
27
+ self._row += 1
28
+ tk.Label(text=desc).grid(row=self._row, column=0, padx=10, pady=5, sticky='n')
29
+ widget.grid(row=self._row, column=1, padx=10, pady=5, sticky='w')
30
+
31
+ def addFrame(self, frame: tk.Frame):
32
+ self._row += 1
33
+ frame.grid(row=self._row, column=0, columnspan=2, padx=10, pady=5)
34
+
35
+ def run(self):
36
+ self.center()
37
+ self.mainloop()
38
+
39
+ def center(self):
40
+ self.withdraw() # 先隐藏窗口,避免闪动
41
+ self.update_idletasks() # 确保获取正确的窗口尺寸
42
+ width = self.winfo_width() # 获取窗口宽度
43
+ height = self.winfo_height() # 获取窗口高度
44
+ screen_width = self.winfo_screenwidth() # 屏幕宽度
45
+ screen_height = self.winfo_screenheight() # 屏幕高度
46
+ x = (screen_width - width) // 2 # 水平居中
47
+ y = (screen_height - height) // 2 # 垂直居中
48
+ self.geometry(f"+{x}+{y}") # 设置窗口位置
49
+ self.deiconify() # 恢复显示窗口
50
+
51
+ def addLabel(self, desc: str, text: str):
52
+ self.add(desc, tk.Label(text=text))
53
+
54
+ def addBtn(self, label: str, command: Callable[..., None], *, width: int = 20, focus: bool = False):
55
+ frame = tk.Frame(self)
56
+ self.addFrame(frame)
57
+ btn = tk.Button(frame, text=label, width=width, command=command)
58
+ btn.pack(side="left", expand=True, padx=15)
59
+ if focus:
60
+ self._initFocusItem = btn
61
+
62
+ def addRadioBtn(self, desc: str, selectionList: list[str], *, selectedIndex: int | None = None, focusIndex: int | None = None):
63
+ frame = tk.Frame()
64
+ self.add(desc, frame)
65
+ var = tk.StringVar(value=selectionList[selectedIndex] if selectedIndex is not None else self.RADIO_NOTHING)
66
+ radioBtnList: list[tk.Radiobutton] = []
67
+ for version in selectionList:
68
+ radioBtn = tk.Radiobutton(frame, text=version, variable=var, value=version)
69
+ radioBtn.pack(side="left", padx=(0, 15))
70
+ radioBtnList.append(radioBtn)
71
+ if focusIndex is not None:
72
+ self._initFocusItem = radioBtnList[focusIndex]
73
+ return var
74
+
75
+ def addEntry(self, desc: str, text: str = '', *, width: int = 60, focus: bool = False):
76
+ entry = tk.Entry(self, width=30)
77
+ entry.insert(0, text)
78
+ self.add(desc, entry)
79
+ if focus:
80
+ self._initFocusItem = entry
81
+ return entry
82
+
83
+ def addScrolledText(self, desc: str, text: str = '', *, width: int = 60, height: int = 20, focus: bool = False):
84
+ scrolledText = ScrolledText(self, width=width, height=height)
85
+ scrolledText.insert("1.0", text)
86
+ self.add(desc, scrolledText)
87
+ if focus:
88
+ self._initFocusItem = scrolledText
89
+ return scrolledText
90
+
91
+ def addCheckBox(self, text: str, value: bool = False):
92
+ remember_var = tk.BooleanVar(value=value)
93
+ check_btn = tk.Checkbutton(text=text, variable=remember_var)
94
+ self.add("", check_btn)
95
+ return remember_var
96
+
97
+ def addPasswordInput(self, desc: str, *, width: int = 60, command: Callable[..., None] | None = None):
98
+ password_entry = tk.Entry(self, show="*", width=width) # 使用 show="*" 隐藏输入内容
99
+ if command:
100
+ password_entry.bind('<Return>', lambda event: command())
101
+ self.add(desc, password_entry)
102
+ return password_entry
103
+
104
+
105
+ ''' 例子
106
+ app = TkForm()
107
+ app.title('更新版本信息')
108
+ app.addLabel('当前版本号', '3.11.8')
109
+ app.addLabel('上次更新时间', '2025-06-16 16:00:00')
110
+ version_var = app.addRadioBtn(
111
+ '请选择新版本',
112
+ ['3.11.8', '3.11.9', '3.11.10'],
113
+ 2,
114
+ )
115
+ log_text = app.addScrolledText('更新日志', '123\n23454asd这个')
116
+ vara = app.addCheckBox('记住密码', False)
117
+ varb = app.addCheckBox('阿萨德法师大润发', True)
118
+ passwordInput = app.addPasswordInput('密码', command=lambda: onBtn())
119
+
120
+
121
+ def onBtn():
122
+ print(version_var.get())
123
+ print(log_text.get('1.0', "end-1c").split('\n'))
124
+ app.destroy()
125
+
126
+
127
+ app.addBtn('确定', onBtn)
128
+ app.bind("<Visibility>", lambda e: passwordInput.focus_set())
129
+ app.run()
130
+ '''
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = 'bcmd'
6
- version = '0.6.4'
6
+ version = '0.6.5'
7
7
  description = 'Commands for Beni'
8
8
  requires-python = '>=3.10'
9
9
  keywords = ['benimang', 'beni', 'bcmd']
@@ -41,5 +41,4 @@ package = true
41
41
  # 使用默认镜像地址
42
42
  [[tool.uv.index]]
43
43
  url = "https://mirrors.aliyun.com/pypi/simple"
44
- default = true
45
-
44
+ default = true
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes