Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions Gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ def get_windows_version():
return 10
else:
return major_version



def filter_hotkey(text:str):
return text.split('(')[0]

Expand Down Expand Up @@ -535,16 +534,16 @@ def check_default_var(value):

class UMainWindow(QMainWindow):
'''自定义窗口基类'''
def __init__(self, parent=None):
def __init__(self):
logger.debug('Initializing window.')
super().__init__()

super().__init__(parent=parent)
self.setWindowIcon(icon)
new_color_bar(self)

def showEvent(self, event):
'''窗口显示事件'''
new_color_bar(self)
QTimer.singleShot(setting_value.soft_delay, lambda: new_color_bar(self))
return super().showEvent(event)

class UDialog(QDialog):
Expand All @@ -558,7 +557,7 @@ def __init__(self, parent=None):

def showEvent(self, event):
'''窗口显示事件'''
new_color_bar(self)
QTimer.singleShot(setting_value.soft_delay, lambda:new_color_bar(self))
return super().showEvent(event)

class StartManager(QObject):
Expand Down Expand Up @@ -2308,7 +2307,7 @@ def update_attr(self):
value = get_unit_value(main_window.total_run_time)
self.total_run_time.setText(f'{get_lang('2c')}: {value[0]:.2f}{value[1]}')

class SettingWindow(SelectUI):
class SettingWindow(SelectUI, UMainWindow):
click_setting_changed = Signal()
window_restarted = Signal()

Expand All @@ -2320,7 +2319,6 @@ def __init__(self, values:dict | None = None):
self.setFixedSize(self.width(), self.height())
self.setWindowTitle(filter_hotkey(get_lang('04')))
self.setParent(main_window)
self.setWindowIcon(QIcon(get_resource_path('icons', 'extensions', f'cms{'pre' if is_pre else ''}.ico')))
self.setWindowFlags(
Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint
) # 设置窗口属性
Expand Down Expand Up @@ -2453,7 +2451,7 @@ def parse_hotkey(input: UHotkeyLineEdit):
soft_delay_setting = setting_value.soft_delay

soft_delay = QSlider(Qt.Horizontal)
soft_delay.setMinimum(0)
soft_delay.setMinimum(5)
soft_delay.setMaximum(100)
soft_delay.setValue(soft_delay_setting // 10)
soft_delay.setTickPosition(QSlider.TicksBelow)
Expand Down Expand Up @@ -2673,8 +2671,8 @@ def parse_hotkey(input: UHotkeyLineEdit):
style_use_windows_layout.addStretch(1)

theme_layout = QHBoxLayout() # 主题布局
theme_tip_window = QLabel(get_lang('4b'))
set_style(theme_tip_window, StyleClass.d_11)
theme_tip_label = QLabel(get_lang('4b'))
set_style(theme_tip_label, StyleClass.d_11)
theme_combo = QComboBox()
theme_combo.addItems(QStyleFactory.keys())
theme_combo.setCurrentText(setting_value.theme)
Expand All @@ -2691,13 +2689,14 @@ def parse_hotkey(input: UHotkeyLineEdit):
layout.addWidget(tip_label)
layout.addWidget(create_horizontal_line())
layout.addLayout(theme_layout)
layout.addWidget(theme_tip_window)
layout.addWidget(theme_tip_label)
layout.addWidget(create_horizontal_line())

# 连接信号
self.style_choice.currentIndexChanged.connect(lambda: self.on_setting_changed(self.style_choice.currentIndex, SettingText.select_style))
style_choice_use_windows.checkStateChanged.connect(lambda: self.on_setting_changed(style_choice_use_windows.isChecked, SettingText.use_windows_color))
theme_combo.currentIndexChanged.connect(lambda: self.on_setting_changed(theme_combo.currentText, SettingText.theme))
theme_combo.currentIndexChanged.connect(lambda: refresh.run())
theme_combo.currentIndexChanged.connect(lambda: self.app.setStyle(theme_combo.currentText()))
case self.page_hotkey:
set_content_label(get_lang('21'))
Expand Down Expand Up @@ -3033,11 +3032,6 @@ def repair_auto_start(self):
os.remove(Path(os.environ['APPDATA'], 'Microsoft', 'Windows', 'Start Menu', 'Programs', 'Startup', 'Clickmouse.lnk'))
auto_start_manager.create_reg()
MessageBox.information(self, get_lang('16'), get_lang('d2'))

def showEvent(self, event):
'''窗口显示事件'''
new_color_bar(self)
return super().showEvent(event)

def repair_settings(self, key: str):
'''还原默认设置'''
Expand Down Expand Up @@ -3543,7 +3537,7 @@ def on_start(self):
for k in dev_flags.keys():
if k not in [i['key'] for i in dev_settings]:
del dev_back[k]
logger.warning(f'测试版配置ID{k}不存在,自动清除')
logger.warning(f'Beta feature ID:{k} is deprecated. Auto delete.')
dev_flags = dev_back.copy()
with open(data_path / 'dev_flags.json', 'w', encoding='utf-8') as f:
json.dump(dev_flags, f)
Expand Down Expand Up @@ -3582,6 +3576,7 @@ def on_start(self):

# 加载窗口
logger.info('Loading ui')

main_window = MainWindow()
on_input_change(type=InputChange.main_window) # 更新时间估计状态

Expand Down
2 changes: 1 addition & 1 deletion Gui/res/dev_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"name": "More settings",
"key": "new_settings",
"desc": "Can add more settings include:\nToast settings\nEnable hotkey checkbox\nFeedback settings and more..."
"desc": "To add more settings include:\nToast settings\nEnable hotkey checkbox\nFeedback settings and more..."
}
]
Binary file removed Gui/res/icons/extensions/cmspre.ico
Binary file not shown.
17 changes: 6 additions & 11 deletions Gui/res/styles/dark.qss
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ QDialog {
background-color: #202020;
}

QMenu {
background-color: #202020;
border-radius: 5px;
}

QMenu:selected {
background-color: #353535;
border-radius: 5px;
}

QComboBox {
background-color: #353535;
}
Expand Down Expand Up @@ -67,19 +57,24 @@ QPushButton:pressed {
QMenu {
background-color: #202020;
color: white;
border-radius: 10px;
border-radius: 5px;
border: 1px solid #303030;
}

QMenu:disabled {
background-color: #252525;
color: #505050;
border-radius: 5px;
}

QMenu:selected {
background-color: #353535;
}

QMenuBar {
background-color: #202020;
}

QMenuBar::item:selected {
background-color: #353535;
}
Expand Down
4 changes: 4 additions & 0 deletions Gui/res/styles/light.qss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ QMenu:selected {
background-color: #e0e0e0;
}

QMenuBar {
background-color: #f3f3f3;
}

QMenuBar::item:selected {
background-color: #e0e0e0;
}
Expand Down
2 changes: 1 addition & 1 deletion Gui/res/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"package_format_version": "1.2.0", "clickmouse":"3.2.1.20"}
{"package_format_version": "1.2.0", "clickmouse":"3.3.0.22alpha4"}
24 changes: 24 additions & 0 deletions Gui/tests/test_super.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class B:
def __init__(self, b_arg):
print("B init")
self.b_value = b_arg

class C:
def __init__(self, c_arg):
print("C init")
self.c_value = c_arg

class A(B, C):
def __init__(self, b_arg, c_arg, a_arg):
# 显式调用 B 和 C 的初始化
B.__init__(self, b_arg)
C.__init__(self, c_arg)
print("A init")
self.a_value = a_arg

def test_super():
# 测试
a = A("B data", "C data", "A data")
print(a.b_value) # B data
print(a.c_value) # C data
print(a.a_value) # A data
2 changes: 1 addition & 1 deletion Gui/uiStyles/uiTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
__all__ = ['SelectUI', 'PagesUI']

class SelectUI(QMainWindow):
def __init__(self, parent=None):
def __init__(self):
super().__init__()

self.page_choice_buttons = [] # 用于存储页面选择按钮文字
Expand Down
3 changes: 1 addition & 2 deletions guiclean/clickclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ def init_ui(self):
ok_button.clicked.connect(self.close)
logger.debug('Initializing about window')

class SettingWindow(SelectUI):
class SettingWindow(SelectUI, UMainWindow):
click_setting_changed = Signal()
window_restarted = Signal()

Expand All @@ -1121,7 +1121,6 @@ def __init__(self, values:dict | None = None):
self.setFixedSize(self.width(), self.height())
self.setWindowTitle(filter_hotkey(get_lang('04')))
self.setParent(main_window)
self.setWindowIcon(QIcon(get_resource_path('icons', 'clickmouse', f'cms.ico')))
self.setWindowFlags(
Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint
) # 设置窗口属性
Expand Down
21 changes: 0 additions & 21 deletions guiclean/res/LICENSE.txt

This file was deleted.

Binary file removed guiclean/res/icons/clickmouse/cms.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion guiclean/sharelibs.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def run_software(code_path, exe_path, args=None):
args = [] if args is None else args
subprocess.Popen(f'python {code_path} {' '.join(args)}' if in_dev else f'{exe_path} {" ".join(args)}')

__version__ = '3.2.1.20'
__version__ = '3.2.2.21'

with open(get_resource_path('langs', 'units.json'), 'r', encoding='utf-8') as f:
unit_lang = json.load(f)
Expand Down
6 changes: 3 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
command = python -m nuitka --msvc=latest --remove-output --company-name="xystudio" --copyright="Copyright 2026 xystudio" --trademarks="xystudio" --product-version="3.2.1" --standalone
command = python -m nuitka --msvc=latest --remove-output --company-name="xystudio" --copyright="Copyright 2026 xystudio" --trademarks="xystudio" --product-version="3.3.0" --standalone

main:
echo Please run a build command, such as "make clickmouse".

clickmouse: gui/main.py
$(command) --file-description="Clickmouse" --product-name="ClickMouse" --windows-icon-from-ico=gui/res/icons/clickmouse/icon.ico --include-data-dir=gui/res/=res/ --include-data-file=gui/key=key gui/main.py --file-version="3.2.1.20" --enable-plugin=pyside6 --windows-console-mode="disable" --include-data-file=gui/7z.exe=7z.exe --include-data-file=gui/7z.dll=7z.dll --output-dir=dist/clickmouse/
$(command) --file-description="Clickmouse" --product-name="ClickMouse" --windows-icon-from-ico=gui/res/icons/clickmouse/icon.ico --include-data-dir=gui/res/=res/ --include-data-file=gui/key=key gui/main.py --file-version="3.3.0.22" --enable-plugin=pyside6 --windows-console-mode="disable" --include-data-file=gui/7z.exe=7z.exe --include-data-file=gui/7z.dll=7z.dll --output-dir=dist/clickmouse/
$(command) --file-description="Clickmouse uninstall" --product-name="uninstall" --windows-icon-from-ico=gui/res/icons/clickmouse/uninstall.ico --file-version="2.1.4.8" gui/uninstall.py --enable-plugin=pyside6 --windows-console-mode="disable" --windows-uac-admin --output-dir=dist/clickmouse/
$(command) --file-description="Clickmouse IPK" --product-name="CmIPK" --windows-icon-from-ico=gui/res/icons/clickmouse/init.ico --file-version="2.0.6.11" gui/install_pack.py --enable-plugin=pyside6 --windows-console-mode="disable" --output-dir=dist/clickmouse/
$(command) --file-description="Clickmouse repair" --product-name="CmRepair" --windows-icon-from-ico=gui/res/icons/clickmouse/repair.ico --file-version="2.2.3.7" gui/repair.py --enable-plugin=pyside6 --windows-console-mode="disable" --windows-uac-admin --output-dir=dist/clickmouse/
Expand All @@ -13,7 +13,7 @@ clickmouse: gui/main.py
powershell -ExecutionPolicy Bypass -Command "./merge-distFolders.ps1 -SourcePath ./dist/clickmouse/"

clickclean: guiclean/clickclean.py
$(command) --file-version="1.0.0.0" guiclean/clickclean.py --windows-console-mode="disable" --product-name="ClickClean" --windows-icon-from-ico=guiclean/res/icons/clickmouse/icon.ico --file-description="ClickClean" --enable-plugin=pyside6 --include-data-dir=guiclean/res/=res/ --output-dir=dist/
$(command) --file-version="3.2.2.21" guiclean/clickclean.py --windows-console-mode="disable" --product-name="ClickClean" --windows-icon-from-ico=guiclean/res/icons/clickmouse/icon.ico --file-description="ClickClean" --enable-plugin=pyside6 --include-data-dir=guiclean/res/=res/ --output-dir=dist/

clickmouse_lib: setup.py
python setup.py bdist_wheel
Expand Down
Loading