2019-06-06 11:52:23 -05:00
|
|
|
from __future__ import unicode_literals
|
2014-11-12 20:41:29 -06:00
|
|
|
import wx
|
|
|
|
|
|
|
|
class BaseWXDialog(wx.Dialog):
|
2021-06-16 16:18:41 -05:00
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(BaseWXDialog, self).__init__(*args, **kwargs)
|
2014-11-12 20:41:29 -06:00
|
|
|
|
2021-06-16 16:18:41 -05:00
|
|
|
def get_response(self):
|
|
|
|
return self.ShowModal()
|
2014-11-12 20:41:29 -06:00
|
|
|
|
2021-06-16 16:18:41 -05:00
|
|
|
def get(self, control):
|
|
|
|
if hasattr(self, control):
|
|
|
|
control = getattr(self, control)
|
|
|
|
if hasattr(control, "GetValue"): return getattr(control, "GetValue")()
|
|
|
|
elif hasattr(control, "GetLabel"): return getattr(control, "GetLabel")()
|
|
|
|
else: return -1
|
|
|
|
else: return 0
|
2015-02-26 10:09:13 -06:00
|
|
|
|
2021-06-16 16:18:41 -05:00
|
|
|
def set(self, control, text):
|
|
|
|
if hasattr(self, control):
|
|
|
|
control = getattr(self, control)
|
|
|
|
if hasattr(control, "SetValue"): return getattr(control, "SetValue")(text)
|
|
|
|
elif hasattr(control, "SetLabel"): return getattr(control, "SetLabel")(text)
|
|
|
|
elif hasattr(control, "ChangeValue"): return getattr(control, "ChangeValue")(text)
|
|
|
|
else: return -1
|
|
|
|
else: return 0
|
2015-03-08 14:18:29 -06:00
|
|
|
|
2021-06-16 16:18:41 -05:00
|
|
|
def set_title(self, title):
|
|
|
|
self.SetTitle(title)
|