Skip to content

Commit

Permalink
rename .set_HighLevel to set_high_level, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodenoughPhysicsLab committed Nov 16, 2024
1 parent d338b33 commit 6625873
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 49 deletions.
10 changes: 5 additions & 5 deletions docs/elements.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
### 逻辑电路

逻辑电路元件都有的`method`:
* set_HighLevelValue # 设置高电平的值
* get_HighLevelValue # 获取高电平的值
* set_LowLevelValue # 设置低电平的值
* get_LowLevelValue # 获取高电平的值
* set_high_level_value # 设置高电平的值
* get_high_level_value # 获取高电平的值
* set_low_level_value # 设置低电平的值
* get_low_level_value # 获取高电平的值

<table border="1">
<thead>
Expand All @@ -43,7 +43,7 @@
<td>Logic_Input</td>
<td>Logic Input</td>
<td>o</td>
<td>set_highLevel # 将逻辑输入的状态设置为1</td>
<td>set_high_level # 将逻辑输入的状态设置为1</td>
</tr>
<tr>
<td>逻辑输出</td>
Expand Down
8 changes: 1 addition & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,4 @@

## 其他
### 关闭打印的颜色
因为`windows`的颜色打印很容易出问题,因此提供了关闭颜色打印的函数:`close_color_print()`

# 物实程序化3
我也曾试过xuzhengx的物实程序化3,发现爆了文件错误
与原作者(xuzhengx)沟通之后了解到:xuzhengx直接把冰如冷的教程拿来索引元件
这是个大坑,对感兴趣的同学应该有帮助
[点击查看物实程序化3](https://gitee.com/script2000/temp/blob/master/other%20physicsLab/%E7%89%A9%E5%AE%9E%E7%A8%8B%E5%BA%8F%E5%8C%963.py)
如果颜色打印出现了问题,可以使用`close_color_print()`来关闭颜色打印
1 change: 1 addition & 0 deletions docs/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@
6. 新增`Experiment.get_element`, `Experiment.crt_element`, `Experiment.del_element`, `Experiment.count_element`, `Experiment.clear_element`
7. 删除`music.Player`,其功能完全由`music.Piece.release`代替
8. 重命名`*_Wire``*_wire`, `*_Wires``*_wires`
9. 重命名`set_HighLevelValue``set_high_level_value`, `set_HighLevel``set_high_level`,对lowLevel也同理
30 changes: 0 additions & 30 deletions docs/structure.md

This file was deleted.

14 changes: 7 additions & 7 deletions physicsLab/circuit/elements/logicCircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@
from physicsLab.typehint import Optional, numType, CircuitElementData, Self, Generate

class _logicBase(CircuitBase):
def set_HighLevelValue(self, num: numType) -> Self:
def set_high_level_value(self, num: numType) -> Self:
''' 设置高电平的值 '''
if not isinstance(num, (int, float)) or num < self.get_LowLevelValue():
if not isinstance(num, (int, float)) or num < self.get_low_level_value():
raise TypeError

self.data["Properties"]["高电平"] = num

return self

def get_HighLevelValue(self) -> numType:
def get_high_level_value(self) -> numType:
''' 获取高电平的值 '''
return self.data["Properties"]["高电平"]

def set_LowLevelValue(self, num: numType) -> Self:
def set_low_level_value(self, num: numType) -> Self:
''' 设置低电平的值 '''
if not isinstance(num, (int, float)) or num < self.get_LowLevelValue():
if not isinstance(num, (int, float)) or num < self.get_low_level_value():
raise TypeError

self.data["Properties"]["低电平"] = num

return self

def get_LowLevelValue(self):
def get_low_level_value(self):
''' 获取低电平的值 '''
return self.data["Properties"]["低电平"]

Expand All @@ -53,7 +53,7 @@ def __repr__(self) -> str:
res += ".set_highLevel()"
return res

def set_highLevel(self) -> "Logic_Input":
def set_high_level(self) -> "Logic_Input":
''' 将逻辑输入的状态设置为1 '''
self.data["Properties"]["开关"] = 1.0
return self
Expand Down

0 comments on commit 6625873

Please sign in to comment.