保证能跑(
This commit is contained in:
parent
ada99b304e
commit
e7f0276748
@ -149,7 +149,7 @@ def _call_back(call_back: Callable) -> Callable:
|
||||
@functools.wraps(func)
|
||||
def warp(self: "ClientWindow", *args, **kwargs):
|
||||
result = func(self, *args, **kwargs)
|
||||
call_back(self)
|
||||
# call_back(self)
|
||||
return result
|
||||
return warp
|
||||
return wrapper
|
||||
|
@ -1338,7 +1338,7 @@ pub mod dr {
|
||||
/// 用于描述一个零件的属性
|
||||
pub struct DRPartType<T>
|
||||
where
|
||||
T: DRPartTypeAttrTrait,
|
||||
T: DRPartTypeAttrTrait + Clone,
|
||||
{
|
||||
/// 部件 ID
|
||||
pub id: String,
|
||||
@ -1381,4 +1381,25 @@ pub mod dr {
|
||||
// 附加属性
|
||||
pub attr: HashMap<String, T>,
|
||||
}
|
||||
|
||||
impl<T: DRPartTypeAttrTrait> DRPartType<T>
|
||||
where
|
||||
T: DRPartTypeAttrTrait + Clone,
|
||||
{
|
||||
#[inline]
|
||||
pub fn data_ref(&self, name: &str) -> Option<&T> {
|
||||
if let Some(data) = self.attr.get(name) {
|
||||
return Some(data);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn data(&self, name: &str) -> Option<T> {
|
||||
if let Some(data) = self.attr.get(name) {
|
||||
return Some(data.clone());
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user