def __init__(self, parent=None, default_client_id="", default_client_secret=""):
wx.Panel.__init__(self, parent)
border = wx.StaticBox(self, label="Client authorization")
sizer = wx.StaticBoxSizer(border, wx.VERTICAL)
self._client_id_status_label = ProcessingPlaceholderText(self)
self._client_secret_status_label = ProcessingPlaceholderText(self)
client_id_sizer = wx.BoxSizer(wx.VERTICAL)
client_id_label = wx.StaticText(self, label="Client ID")
client_id_label.SetToolTipString("Your IRIDA client ID")
client_id_sizer.Add(client_id_label, flag=wx.EXPAND | wx.BOTTOM, border=2)
client_id_input_sizer = wx.BoxSizer(wx.HORIZONTAL)
self._client_id = wx.TextCtrl(self)
self._client_id.Bind(wx.EVT_KILL_FOCUS, self._client_id_changed)
self._client_id.SetValue(default_client_id)
client_id_input_sizer.Add(self._client_id, flag=wx.EXPAND, proportion=1)
client_id_input_sizer.Add(self._client_id_status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0)
client_id_sizer.Add(client_id_input_sizer, flag=wx.EXPAND)
sizer.Add(client_id_sizer, flag=wx.EXPAND | wx.ALL, border=5)
client_secret_sizer = wx.BoxSizer(wx.VERTICAL)
client_secret_label = wx.StaticText(self, label="Client Secret")
client_secret_label.SetToolTipString("Your IRIDA client secret")
client_secret_sizer.Add(client_secret_label, flag=wx.EXPAND | wx.BOTTOM, border=2)
client_secret_input_sizer = wx.BoxSizer(wx.HORIZONTAL)
self._client_secret = wx.TextCtrl(self)
self._client_secret.Bind(wx.EVT_KILL_FOCUS, self._client_secret_changed)
self._client_secret.SetValue(default_client_secret)
client_secret_input_sizer.Add(self._client_secret, flag=wx.EXPAND, proportion=1)
client_secret_input_sizer.Add(self._client_secret_status_label, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5, proportion=0)
client_secret_sizer.Add(client_secret_input_sizer, flag=wx.EXPAND)
sizer.Add(client_secret_sizer, flag=wx.EXPAND | wx.ALL, border=5)
self.SetSizerAndFit(sizer)
self.Layout()
pub.subscribe(self._client_id_status_label.SetError, APIConnectorTopics.connection_error_client_id_topic)
pub.subscribe(self._client_secret_status_label.SetError, APIConnectorTopics.connection_error_client_secret_topic)
pub.subscribe(self._client_id_status_label.SetSuccess, APIConnectorTopics.connection_success_topic)
pub.subscribe(self._client_secret_status_label.SetSuccess, APIConnectorTopics.connection_success_topic)
pub.subscribe(self._client_id_status_label.SetSuccess, APIConnectorTopics.connection_success_valid_client_id)
pub.subscribe(self._client_secret_status_label.SetSuccess, APIConnectorTopics.connection_success_valid_client_secret)
self.Bind(wx.EVT_CLOSE, self._on_close)
评论列表
文章目录