mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-18 15:33:03 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8789ad743 | |||
| bf106ea234 | |||
| c67a7e3773 | |||
| bdc700d3da |
@@ -203,6 +203,7 @@ class AutoLib(MsgBase):
|
|||||||
f"用户配置文件路径: {self.__users_config_reader.configPath()}")
|
f"用户配置文件路径: {self.__users_config_reader.configPath()}")
|
||||||
|
|
||||||
for user in users:
|
for user in users:
|
||||||
|
user_counter["current"] += 1
|
||||||
self._showTrace(f"正在处理第 {user_counter["current"]}/{len(users)} 个用户: {user['username']}......")
|
self._showTrace(f"正在处理第 {user_counter["current"]}/{len(users)} 个用户: {user['username']}......")
|
||||||
if self.__run(
|
if self.__run(
|
||||||
username=user["username"],
|
username=user["username"],
|
||||||
|
|||||||
+2
-2
@@ -403,9 +403,9 @@ class LibReserve(LibOperator):
|
|||||||
if abs_diff < best_time_diff or (
|
if abs_diff < best_time_diff or (
|
||||||
abs_diff == best_time_diff and (
|
abs_diff == best_time_diff and (
|
||||||
# prefer earlier time
|
# prefer earlier time
|
||||||
(prefer_earlier and actual_diff < 0) or
|
(prefer_earlier and actual_diff <= 0) or
|
||||||
# prefer later time
|
# prefer later time
|
||||||
(not prefer_earlier and actual_diff > 0)
|
(not prefer_earlier and actual_diff >= 0)
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
best_time_diff = abs_diff
|
best_time_diff = abs_diff
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
self.DateEdit.setDate(QDate.currentDate())
|
self.DateEdit.setDate(QDate.currentDate())
|
||||||
self.DateEdit.setMinimumDate(QDate.currentDate())
|
self.DateEdit.setMinimumDate(QDate.currentDate())
|
||||||
self.DateEdit.setMaximumDate(QDate.currentDate())
|
self.DateEdit.setMaximumDate(QDate.currentDate())
|
||||||
if QTime.currentTime() > QTime(19, 0, 0) and QTime.currentTime() < QTime(23, 0, 0):
|
if QTime.currentTime() > QTime(18, 0, 0) and QTime.currentTime() < QTime(23, 0, 0):
|
||||||
self.DateEdit.setMaximumDate(QDate.currentDate().addDays(1))
|
self.DateEdit.setMaximumDate(QDate.currentDate().addDays(1))
|
||||||
self.BeginTimeEdit.setTime(QTime.currentTime())
|
self.BeginTimeEdit.setTime(QTime.currentTime())
|
||||||
self.PreferEarlyBeginTimeCheckBox.setChecked(False)
|
self.PreferEarlyBeginTimeCheckBox.setChecked(False)
|
||||||
@@ -479,7 +479,7 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
if not config_path:
|
if not config_path:
|
||||||
config_path = QFileDialog.getOpenFileName(
|
config_path = QFileDialog.getOpenFileName(
|
||||||
self,
|
self,
|
||||||
"选择配置文件 - AutoLibrary",
|
"从现有配置文件中加载 - AutoLibrary",
|
||||||
f"{QDir.toNativeSeparators(QDir.currentPath())}",
|
f"{QDir.toNativeSeparators(QDir.currentPath())}",
|
||||||
"JSON 文件 (*.json);;所有文件 (*)"
|
"JSON 文件 (*.json);;所有文件 (*)"
|
||||||
)[0]
|
)[0]
|
||||||
@@ -489,16 +489,12 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
system_config = self.loadSystemConfig(config_path)
|
system_config = self.loadSystemConfig(config_path)
|
||||||
users_config = self.loadUsersConfig(config_path)
|
users_config = self.loadUsersConfig(config_path)
|
||||||
if system_config is not None:
|
if system_config is not None:
|
||||||
self.__config_paths["system"] = config_path
|
|
||||||
self.__system_config_data.update(system_config)
|
self.__system_config_data.update(system_config)
|
||||||
self.setSystemConfigToWidget(self.__system_config_data)
|
self.setSystemConfigToWidget(self.__system_config_data)
|
||||||
self.CurrentSystemConfigEdit.setText(config_path)
|
|
||||||
return True
|
return True
|
||||||
if users_config is not None:
|
if users_config is not None:
|
||||||
self.__config_paths["users"] = config_path
|
|
||||||
self.__users_config_data.update(users_config)
|
self.__users_config_data.update(users_config)
|
||||||
self.fillUsersList(self.__users_config_data)
|
self.fillUsersList(self.__users_config_data)
|
||||||
self.CurrentUserConfigEdit.setText(config_path)
|
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
@@ -644,7 +640,9 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
)[0]
|
)[0]
|
||||||
if system_config_path:
|
if system_config_path:
|
||||||
system_config_path = QDir.toNativeSeparators(system_config_path)
|
system_config_path = QDir.toNativeSeparators(system_config_path)
|
||||||
self.loadConfig(system_config_path)
|
if self.loadConfig(system_config_path):
|
||||||
|
self.__config_paths["system"] = system_config_path
|
||||||
|
self.CurrentSystemConfigEdit.setText(system_config_path)
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def onBrowseCurrentUserConfigButtonClicked(
|
def onBrowseCurrentUserConfigButtonClicked(
|
||||||
@@ -659,7 +657,9 @@ class ALConfigWidget(QWidget, Ui_ALConfigWidget):
|
|||||||
)[0]
|
)[0]
|
||||||
if users_config_path:
|
if users_config_path:
|
||||||
users_config_path = QDir.toNativeSeparators(users_config_path)
|
users_config_path = QDir.toNativeSeparators(users_config_path)
|
||||||
self.loadConfig(users_config_path)
|
if self.loadConfig(users_config_path):
|
||||||
|
self.__config_paths["users"] = users_config_path
|
||||||
|
self.CurrentUserConfigEdit.setText(users_config_path)
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def onBrowseExportSystemConfigButtonClicked(
|
def onBrowseExportSystemConfigButtonClicked(
|
||||||
|
|||||||
+40
-1
@@ -560,6 +560,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>勾选此项,如果有多个与目标<span style=" font-weight:700; font-style:italic;">开始时间</span>相近的可选时间,选择时间最早项</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>优先选择最早</string>
|
<string>优先选择最早</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -601,6 +604,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>期望的<span style=" font-weight:700; font-style:italic;">结束时间</span>不可用时,按照该偏差范围寻找最近可选时间</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>120</number>
|
<number>120</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -691,6 +697,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>期望的<span style=" font-weight:700; font-style:italic;">开始时间</span>不可用时,按照该偏差范围寻找最近可选时间</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>120</number>
|
<number>120</number>
|
||||||
</property>
|
</property>
|
||||||
@@ -710,6 +719,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>勾选此项,如果有多个与目标<span style=" font-weight:700; font-style:italic;">结束时间</span>相近的可选时间,选择时间最晚项</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>优先选择最晚</string>
|
<string>优先选择最晚</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -789,6 +801,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>期望的预约时长,脚本会尽量满足</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>8.000000000000000</double>
|
<double>8.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
@@ -869,6 +884,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>勾选此项,会优先满足预约时长限制,当座位紧张时可能会导致<span style=" font-weight:700; font-style:italic;">预约失败</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>优先满足时长要求</string>
|
<string>优先满足时长要求</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -1046,6 +1064,12 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>脚本运行使用的浏览器类型</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string><html><head/><body><p><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="currentText">
|
<property name="currentText">
|
||||||
<string>edge</string>
|
<string>edge</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -1113,6 +1137,12 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>详情请参阅根目录中的 manual.html</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string><html><head/><body><p><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -1150,6 +1180,12 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>运行时不显示浏览器</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string><html><head/><body><p><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>无头模式</string>
|
<string>无头模式</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -1237,6 +1273,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string><html><head/><body><p>无需更改</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>主机URL:</string>
|
<string>主机URL:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -1758,7 +1797,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>载入配置</string>
|
<string>加载配置</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -127,6 +127,12 @@
|
|||||||
<height>30</height>
|
<height>30</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>开始运行自动脚本</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="whatsThis">
|
||||||
|
<string><html><head/><body><p><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: rgb(10, 170, 10);
|
<string notr="true">background-color: rgb(10, 170, 10);
|
||||||
font: 12pt "Microsoft YaHei UI";
|
font: 12pt "Microsoft YaHei UI";
|
||||||
|
|||||||
Reference in New Issue
Block a user