|
|
@ -180,7 +180,6 @@ class ButtonGropu: |
|
|
|
exit_btn_name, |
|
|
|
submit_btn_name, |
|
|
|
spacer, |
|
|
|
bottom_spacer, |
|
|
|
layout, |
|
|
|
font=FontSize.BUTTON_SIZE |
|
|
|
): |
|
|
@ -190,7 +189,6 @@ class ButtonGropu: |
|
|
|
:param exit_btn_name: 取消按钮的名称 |
|
|
|
:param submit_btn_name: 提交按钮的名称 |
|
|
|
:param spacer: 按钮间的空白占位 |
|
|
|
:param bottom_spacer: 按钮距页面底部边框的空白占位 |
|
|
|
:param layout: 用于排版的参数 |
|
|
|
:param font: |
|
|
|
""" |
|
|
@ -205,7 +203,6 @@ class ButtonGropu: |
|
|
|
self.__exit_btn = wx.Button(parent, **__exit) |
|
|
|
self.__spacer = spacer |
|
|
|
self.__submit_btn = wx.Button(parent, **__submit) |
|
|
|
self.__bottom_spacer = bottom_spacer |
|
|
|
|
|
|
|
# 设定按钮字体 |
|
|
|
self.__exit_btn.SetFont(wx.Font(**font)) |
|
|
@ -216,8 +213,7 @@ class ButtonGropu: |
|
|
|
item = ( |
|
|
|
(self.__exit_btn, *self.__layout), |
|
|
|
(self.__spacer, *self.__layout), |
|
|
|
(self.__submit_btn, *self.__layout), |
|
|
|
(self.__bottom_spacer, *self.__layout) |
|
|
|
(self.__submit_btn, *self.__layout) |
|
|
|
) |
|
|
|
return item |
|
|
|
|
|
|
@ -341,3 +337,44 @@ class PhoneVerifyCodeComponent: |
|
|
|
self._code, self._get_code_btn |
|
|
|
) |
|
|
|
return item |
|
|
|
|
|
|
|
|
|
|
|
class SearchComboBox(wx.ComboBox): |
|
|
|
def __init__(self, parent, choices): |
|
|
|
wx.ComboBox.__init__(self, parent, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, choices, 0) |
|
|
|
self.choices = choices |
|
|
|
self.ignoreEvtText = False |
|
|
|
self.initUI() |
|
|
|
|
|
|
|
def initUI(self): |
|
|
|
self.Bind(wx.EVT_TEXT, self.textChange) |
|
|
|
|
|
|
|
def get_choices(self, args): |
|
|
|
return |
|
|
|
|
|
|
|
def textChange(self, event): |
|
|
|
current_text = event.GetString() |
|
|
|
if self.ignoreEvtText: |
|
|
|
return |
|
|
|
# 这里先判断内容是否为空,如果为空的话,需要让下拉菜单隐藏起来 |
|
|
|
if current_text == '': |
|
|
|
self.ignoreEvtText = True |
|
|
|
self.SetItems(self.choices) |
|
|
|
self.Dismiss() |
|
|
|
self.ignoreEvtText = False |
|
|
|
return |
|
|
|
|
|
|
|
choice_temp = self.get_choices(current_text) |
|
|
|
|
|
|
|
if choice_temp: |
|
|
|
if len(choice_temp) == 1 and choice_temp[0] == current_text: |
|
|
|
return |
|
|
|
self.ignoreEvtText = True |
|
|
|
self.SetItems(choice_temp) |
|
|
|
self.Popup() |
|
|
|
self.SetValue(current_text) |
|
|
|
self.SetInsertionPoint(len(current_text)) |
|
|
|
self.ignoreEvtText = False |
|
|
|
return |
|
|
|
self.Dismiss() |
|
|
|
self.SetInsertionPoint(len(current_text)) |
|
|
|