|
|
@ -11,7 +11,7 @@ import abc |
|
|
|
import wx |
|
|
|
import wx.grid |
|
|
|
|
|
|
|
from frontend.components_lib.constant import ButtonClass, FontSize |
|
|
|
from frontend.components_lib.constant import ButtonClass, FontSize, LayoutParams |
|
|
|
|
|
|
|
|
|
|
|
class ComponentWith3Cols: |
|
|
@ -288,3 +288,56 @@ class GridTable(wx.grid.Grid): |
|
|
|
# 设置表格最小大小 |
|
|
|
self.SetMinSize(wx.Size(*size)) |
|
|
|
self.SetMaxSize(wx.Size(*size)) |
|
|
|
|
|
|
|
|
|
|
|
class PhoneVerifyCodeComponent: |
|
|
|
def __init__(self, parent, text, spacer, sizer, code_comp, font): |
|
|
|
self._parent = parent |
|
|
|
self._text = wx.StaticText(parent, **text) |
|
|
|
# 自动换行截断 |
|
|
|
self._text.Wrap(-1) |
|
|
|
# 设置字体 |
|
|
|
self._text.SetFont(wx.Font(**font)) |
|
|
|
# 设置空格占位栏 |
|
|
|
self._spacer = spacer |
|
|
|
self._code_sizer = sizer |
|
|
|
# 设定输入控件栏 |
|
|
|
self._code, self._get_code_btn = self.code_and_btn(**code_comp) |
|
|
|
# 设置输入控件栏的字体 |
|
|
|
self._code.SetFont(wx.Font(**font)) |
|
|
|
self._get_code_btn.SetFont(wx.Font(**font)) |
|
|
|
|
|
|
|
def code_and_btn(self, label_size, btn_name): |
|
|
|
_code = wx.TextCtrl( |
|
|
|
self._parent, |
|
|
|
**{ |
|
|
|
"id": wx.ID_ANY, |
|
|
|
"value": wx.EmptyString, |
|
|
|
"pos": wx.DefaultPosition, |
|
|
|
"size": wx.Size(*label_size), |
|
|
|
"style": 0 |
|
|
|
} |
|
|
|
) |
|
|
|
_btn_param = ButtonClass.PRIMEARY_BUTTON.copy() |
|
|
|
_btn_param["label"] = btn_name |
|
|
|
_get_code_btn = wx.Button(self._parent, **_btn_param) |
|
|
|
_get_code_btn.SetMinSize(wx.Size(170, -1)) |
|
|
|
|
|
|
|
self._code_sizer.AddMany( |
|
|
|
( |
|
|
|
(_code, *LayoutParams.VER_LAYOUT), |
|
|
|
(_get_code_btn, *LayoutParams.VER_LAYOUT) |
|
|
|
) |
|
|
|
) |
|
|
|
self._code_sizer.SetMinSize(280, -1) |
|
|
|
return _code, _get_code_btn |
|
|
|
|
|
|
|
@property |
|
|
|
def get_item(self): |
|
|
|
item = ( |
|
|
|
(self._text, *LayoutParams.VER_LAYOUT), |
|
|
|
(self._spacer, *LayoutParams.VER_LAYOUT), |
|
|
|
(self._code_sizer, 0, wx.ALIGN_CENTER_HORIZONTAL, 5), |
|
|
|
self._code, self._get_code_btn |
|
|
|
) |
|
|
|
return item |
|
|
|