def on_pt(event):
if self.flagRB == 1:
dlg.view.AddTextCtrl(cont_sup, widget_name='pointi', initial='5500')
# self.qpStatLin = wx.StaticText(self.dlg, -1, "Q value for P-Wave:")
# self.qpChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys())
# self.qsStatLin = wx.StaticText(self.dlg, -1, "Q value for S-Wave:")
# self.qsChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys())
# self.qSizer = wx.FlexGridSizer(cols=2, hgap=3, vgap=3)
# self.qSizer.AddGrowableCol(1)
# self.qSizer.Add(self.qpStatLin, 0, wx.ALL, 5)
# self.qSizer.Add(self.qpChoiceBox, 0, wx.EXPAND|wx.ALL, 5)
# self.qSizer.Add(self.qsStatLin, 0, wx.ALL, 5)
# self.qSizer.Add(self.qsChoiceBox, 0, wx.EXPAND|wx.ALL, 5)
# self.mainSizer.Insert(8, self.qSizer, 0, wx.EXPAND|wx.ALL, 5)
# self.flagRB = 0
# self.dlg.SetSize((610, 860))
python类Choice()的实例源码
def _fill_list(self):
self.list.InsertColumn(0, 'Nome')
self.list.InsertColumn(1, 'Unidade')
self.list.InsertColumn(2, 'Tipo de curva')
self.list.InsertColumn(3, 'Tipo de dado')
self.curvetype_choices = []
self.datatype_choices = []
for i in range(self.nrows):
curvetype_choice = wx.Choice(self.list, -1, choices=['']+self.curvetypes)
datatype_choice = wx.Choice(self.list, -1, choices=['']+self.datatypes)
index = self.list.InsertStringItem(sys.maxint, self.names[i])
self.list.SetStringItem(index, 1, self.units[i])
self.list.SetStringItem(index, 2, ' ')
self.list.SetStringItem(index, 3, ' ')
self.list.SetItemWindow(index, 2, curvetype_choice, expand=True)
self.list.SetItemWindow(index, 3, datatype_choice, expand=True)
self.curvetype_choices.append(curvetype_choice)
self.datatype_choices.append(datatype_choice)
def CreateEditorCtrl(self, parent, rect, value):
OM = ObjectManager(self)
obj = self.model.ItemToObject(self.item)
self._options = OrderedDict()
#print 'ObjectNameRenderer:', obj.model.obj_tid
if obj.model.obj_tid in LogPlotController.get_acceptable_tids():
for om_obj in OM.list(obj.model.obj_tid):
#print ' Adding:', om_obj.uid, om_obj.name
self._options[om_obj.uid] = om_obj.name
_editor = wx.Choice(parent,
wx.ID_ANY,
rect.GetTopLeft(),
wx.Size(rect.GetWidth(), -1),
choices=self._options.values()
)
_editor.SetRect(rect)
return _editor
def on_yes_rb(self, event):
if self.flagRB == 1:
self.qpStatLin = wx.StaticText(self.dlg, -1, "Q value for P-Wave:")
self.qpChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys())
self.qsStatLin = wx.StaticText(self.dlg, -1, "Q value for S-Wave:")
self.qsChoiceBox = wx.Choice(self.dlg, -1, choices=self.logOptions.keys())
self.qSizer = wx.FlexGridSizer(cols=2, hgap=3, vgap=3)
self.qSizer.AddGrowableCol(1)
self.qSizer.Add(self.qpStatLin, 0, wx.ALL, 5)
self.qSizer.Add(self.qpChoiceBox, 0, wx.EXPAND|wx.ALL, 5)
self.qSizer.Add(self.qsStatLin, 0, wx.ALL, 5)
self.qSizer.Add(self.qsChoiceBox, 0, wx.EXPAND|wx.ALL, 5)
self.mainSizer.Insert(8, self.qSizer, 0, wx.EXPAND|wx.ALL, 5)
self.flagRB = 0
self.dlg.SetSize((610, 860))
def _create_well_choice(self):
self.index2uid = []
items = []
for well in self._OM.list('well'):
uid = well.uid
name = well.name
self.index2uid.append(uid)
items.append(name)
well_choice = wx.Choice(self)
well_choice.AppendItems(items)
well_choice.Bind(wx.EVT_CHOICE, self.on_well_choice)
return well_choice
def receive_messages(self, event):
while True:
result = self.client.receive()
if not result:
break
for name in result:
if not 'value' in result[name]:
print 'no value', result
raise 'no value'
value = round3(result[name]['value'])
strvalue = str(value)
if len(strvalue) > 50:
strvalue = strvalue[:47] + '...'
self.values[name].SetLabel(strvalue)
if name in self.controls:
try:
if str(type(self.controls[name])) == "<class 'wx._controls.Choice'>":
if not self.controls[name].SetStringSelection(value):
print 'warning, invalid choice value specified'
elif str(type(self.controls[name])) == "<class 'wx._controls.Slider'>":
r = self.sliderrange[name]
self.controls[name].SetValue(float(value - r[0])/(r[1]-r[0])*1000)
else:
self.controls[name].SetValue(value)
except:
self.controls[name].SetValue(str(value))
size = self.GetSize()
self.Fit()
self.SetSize(size)
def __init__(self, parent):
# Translators: The title of a dialog to configure advanced WinTenApps add-on options such as update checking.
super(WinTenAppsConfigDialog, self).__init__(parent, title=_("Windows 10 App Essentials settings"))
mainSizer = wx.BoxSizer(wx.VERTICAL)
w10Helper = gui.guiHelper.BoxSizerHelper(self, orientation=wx.VERTICAL)
# Translators: A checkbox to toggle automatic add-on updates.
self.autoUpdateCheckbox=w10Helper.addItem(wx.CheckBox(self,label=_("Automatically check for add-on &updates")))
self.autoUpdateCheckbox.SetValue(config.conf["wintenApps"]["autoUpdateCheck"])
# Translators: The label for a setting in WinTenApps add-on settings to select automatic update interval in days.
self.updateInterval=w10Helper.addLabeledControl(_("Update &interval in days"), gui.nvdaControls.SelectOnFocusSpinCtrl, min=0, max=30, initial=config.conf["wintenApps"]["updateCheckTimeInterval"])
# Translators: The label for a combo box to select update channel.
labelText = _("&Add-on update channel:")
self.channels=w10Helper.addLabeledControl(labelText, wx.Choice, choices=["development", "stable"])
self.updateChannels = ("dev", "stable")
self.channels.SetSelection(self.updateChannels.index(config.conf["wintenApps"]["updateChannel"]))
if canUpdate:
# Translators: The label of a button to check for add-on updates.
updateCheckButton = w10Helper.addItem(wx.Button(self, label=_("Check for add-on &update")))
updateCheckButton.Bind(wx.EVT_BUTTON, self.onUpdateCheck)
w10Helper.addDialogDismissButtons(self.CreateButtonSizer(wx.OK | wx.CANCEL))
self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
self.Bind(wx.EVT_BUTTON, self.onCancel, id=wx.ID_CANCEL)
mainSizer.Add(w10Helper.sizer, border=gui.guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL)
mainSizer.Fit(self)
self.Sizer = mainSizer
self.autoUpdateCheckbox.SetFocus()
self.Center(wx.BOTH | (wx.CENTER_ON_SCREEN if hasattr(wx, "CENTER_ON_SCREEN") else 2))
def add_choice(self, choices, tp, title, key, unit):
sizer = wx.BoxSizer( wx.HORIZONTAL )
lab_title = wx.StaticText( self, wx.ID_ANY, title,
wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
lab_title.Wrap( -1 )
sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
ctrl = wx.Choice( self, wx.ID_ANY,
wx.DefaultPosition, wx.DefaultSize,
[str(choice) for choice in choices], 0 )
ctrl.SetSelection(0)
ctrl.SetValue = lambda x:ctrl.SetSelection(choices.index(x))
ctrl.GetValue = lambda : tp(choices[ctrl.GetSelection()])
self.ctrl_dic[key] = ctrl
ctrl.Bind( wx.EVT_CHOICE, lambda x : self.para_changed(key))
sizer.Add( ctrl, 2, wx.ALL, 5 )
lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )
lab_unit.Wrap( -1 )
sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
self.tus.append((lab_title, lab_unit))
self.lst.Add( sizer, 0, wx.EXPAND, 5 )
def __init__(self, *args, **kwds):
# grab the serial keyword and remove it from the dict
self.serial = kwds['serial']
del kwds['serial']
self.show = SHOW_ALL
if 'show' in kwds:
self.show = kwds.pop('show')
# begin wxGlade: SerialConfigDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.label_2 = wx.StaticText(self, -1, "Port")
self.choice_port = wx.Choice(self, -1, choices=[])
self.label_1 = wx.StaticText(self, -1, "Baudrate")
self.combo_box_baudrate = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN)
self.sizer_1_staticbox = wx.StaticBox(self, -1, "Basics")
self.panel_format = wx.Panel(self, -1)
self.label_3 = wx.StaticText(self.panel_format, -1, "Data Bits")
self.choice_databits = wx.Choice(self.panel_format, -1, choices=["choice 1"])
self.label_4 = wx.StaticText(self.panel_format, -1, "Stop Bits")
self.choice_stopbits = wx.Choice(self.panel_format, -1, choices=["choice 1"])
self.label_5 = wx.StaticText(self.panel_format, -1, "Parity")
self.choice_parity = wx.Choice(self.panel_format, -1, choices=["choice 1"])
self.sizer_format_staticbox = wx.StaticBox(self.panel_format, -1, "Data Format")
self.panel_timeout = wx.Panel(self, -1)
self.checkbox_timeout = wx.CheckBox(self.panel_timeout, -1, "Use Timeout")
self.text_ctrl_timeout = wx.TextCtrl(self.panel_timeout, -1, "")
self.label_6 = wx.StaticText(self.panel_timeout, -1, "seconds")
self.sizer_timeout_staticbox = wx.StaticBox(self.panel_timeout, -1, "Timeout")
self.panel_flow = wx.Panel(self, -1)
self.checkbox_rtscts = wx.CheckBox(self.panel_flow, -1, "RTS/CTS")
self.checkbox_xonxoff = wx.CheckBox(self.panel_flow, -1, "Xon/Xoff")
self.sizer_flow_staticbox = wx.StaticBox(self.panel_flow, -1, "Flow Control")
self.button_ok = wx.Button(self, wx.ID_OK, "")
self.button_cancel = wx.Button(self, wx.ID_CANCEL, "")
self.__set_properties()
self.__do_layout()
# end wxGlade
# attach the event handlers
self.__attach_events()
def __init__(self, *args, **kwargs):
self.keys = kwargs.pop('keys', [])
wx.Choice.__init__(self, *args, **kwargs)
def create_postorder(self):
if len(self.zchildren)==0:
# non-container wx.Window's: TextCtrl, StaticText, Choice, ...
self.zchildren_sizer = None
else:
# Container: Frame, Dialog, Panel
c0 = self.zchildren[0]
if len(self.zchildren)==1 and isinstance(c0, Sizer) and c0.border==0 and c0.flag==wx.EXPAND and c0.proportion>0:
# Promote an explicitly created sizer, provided it doesn't have settings (such as border>0)
# which require a surrounding sizer to accomodate.
self.zchildren_sizer = self.zchildren[0].sized
else:
# Supply a sizer created from Frame/Dialog/Panel arguments.
self.zchildren_sizer = wx.BoxSizer(self.orient)
for c in self.zchildren:
_add_to_sizer(self.zchildren_sizer, c)
self.w.SetSizer(self.zchildren_sizer)
def create_wxwindow(self):
return self.initfn(wx.Choice)(self.parent, self.id, self.pos, self.size, self.choices, self.style, self.validator, self.name)
def __init__(self, welluid, *args, **kwargs):
super(Dialog, self).__init__(*args, **kwargs)
self.welluid = welluid
self.partitionuid = None
self._OM = ObjectManager(self)
self.partitionmap = [pttn.uid for pttn in self._OM.list('partition', self.welluid)]
partitionchoiceitems = [pttn.name for pttn in self._OM.list('partition', self.welluid)]
self.partmap = []
self.partitionchoice = wx.Choice(self)
self.partitionchoice.AppendItems(partitionchoiceitems)
self.partitionchoice.Bind(wx.EVT_CHOICE, self.on_partition_choice)
self.partslistbox = wx.CheckListBox(self)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
main_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.Add(self.partitionchoice, proportion=0, flag=wx.EXPAND)
main_sizer.Add(self.partslistbox, proportion=1, flag=wx.EXPAND)
main_sizer.AddSizer(button_sizer, proportion=0, flag=wx.ALIGN_RIGHT)
self.SetSizer(main_sizer)
if len(self.partitionmap) == 1:
self.set_partitionuid(self.partitionmap[0])
def __init__(self, *args, **kwargs):
if 'on_ok_callback' in kwargs:
self.on_ok_callback = kwargs.pop('on_ok_callback')
else:
self.on_ok_callback = None
if 'on_cancel_callback' in kwargs:
self.on_cancel_callback = kwargs.pop('on_cancel_callback')
else:
self.on_cancel_callback = None
super(Dialog, self).__init__(*args, **kwargs)
self._OM = ObjectManager(self)
self._OM.subscribe(self.on_wells_changed, 'add')
self._OM.subscribe(self.on_wells_changed, 'post_remove')
#self._OM.addcallback("add", self.on_wells_change)
#self._OM.addcallback("post-remove", self.on_wells_change)
self._mapui = []
self.choice = wx.Choice(self)
self.choice.Bind(wx.EVT_CHOICE, self.on_select)
self.ls_panel = Panel(self)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
self.Bind(wx.EVT_BUTTON, self.on_button)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(self.choice, flag=wx.ALIGN_CENTER)
vbox.Add(self.ls_panel, 1, wx.ALL | wx.EXPAND)
vbox.Add(button_sizer, flag=wx.ALIGN_RIGHT)
self.SetSizer(vbox)
self.SetSize((400, 600))
self.SetTitle(u"Seletor de Perfis para Plotagem")
self.on_wells_change(None)
def __init__(self, *args, **kwargs):
if 'on_ok_callback' in kwargs:
self.on_ok_callback = kwargs.pop('on_ok_callback')
else:
self.on_ok_callback = None
if 'on_cancel_callback' in kwargs:
self.on_cancel_callback = kwargs.pop('on_cancel_callback')
else:
self.on_cancel_callback = None
super(Dialog, self).__init__(*args, **kwargs)
self._OM = ObjectManager(self)
self._OM.subscribe(self.on_wells_changed, 'add')
self._OM.subscribe(self.on_wells_changed, 'post_remove')
#self._OM.addcallback('add_object', self.on_wells_changed)
#self._OM.addcallback('post_remove_object', self.on_wells_changed)
self.well_selector = wx.Choice(self)
self.well_selector.Bind(wx.EVT_CHOICE, self.on_well_select)
self.export_panel = Panel(self)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
self.Bind(wx.EVT_BUTTON, self.on_button)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(self.well_selector, proportion=0, flag=wx.ALIGN_CENTER)
vbox.Add(self.export_panel, proportion=1, flag=wx.ALL | wx.EXPAND)
vbox.Add(button_sizer, flag=wx.ALIGN_RIGHT)
self.SetSizer(vbox)
self.SetSize((400, 600))
self.SetTitle(u"Exportar:")
self.welluid = None
self.wellmap = []
self.iwellmap = {}
self.on_wells_changed(None)
def __init__(self, *args, **kwargs):
if 'on_ok_callback' in kwargs:
self.on_ok_callback = kwargs.pop('on_ok_callback')
else:
self.on_ok_callback = None
if 'on_cancel_callback' in kwargs:
self.on_cancel_callback = kwargs.pop('on_cancel_callback')
else:
self.on_cancel_callback = None
super(Dialog, self).__init__(*args, **kwargs)
self.wells = None
self.choice = wx.Choice(self)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
self.Bind(wx.EVT_BUTTON, self.on_button)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(self.choice, flag=wx.ALIGN_CENTER)
vbox.Add(button_sizer, flag=wx.ALIGN_RIGHT)
self.SetSizer(vbox)
self.SetSize((300, 200))
self.SetTitle(u"Seletcione o poço")
def __init__(self, *args, **kwargs):
super(Panel, self).__init__(*args, **kwargs)
self._OM = ObjectManager(self)
self.xselector = wx.Choice(self)
self.yselector = wx.Choice(self)
self.zselector = wx.Choice(self)
self.wselector = wx.Choice(self)
gridsizer = wx.FlexGridSizer(rows=4, cols=2, hgap=5, vgap=5)
gridsizer.Add(wx.StaticText(self, label="Eixo x: "), 0, wx.ALIGN_RIGHT)
gridsizer.Add(self.xselector, 1, wx.EXPAND)
gridsizer.Add(wx.StaticText(self, label="Eixo y: "), 0, wx.ALIGN_RIGHT)
gridsizer.Add(self.yselector, 1, wx.EXPAND)
gridsizer.Add(wx.StaticText(self, label="Barra de cor: "), 0, wx.ALIGN_RIGHT)
gridsizer.Add(self.zselector, 1, wx.EXPAND)
gridsizer.Add(wx.StaticText(self, label="Particionamento: "), 0, wx.ALIGN_RIGHT)
gridsizer.Add(self.wselector, 1, wx.EXPAND)
self.SetSizer(gridsizer)
self.xmap = []
self.ixmap = {}
self.ymap = []
self.iymap = {}
self.zmap = []
self.izmap = {}
self.wmap = []
self.iwmap = {}
self.welluid = None
def create_well_choice(self):
sb_well = wx.StaticBox(self, label=u"Poço:")
sbs_well = wx.StaticBoxSizer(sb_well, wx.VERTICAL)
self.well_choice = wx.Choice(self)
self.well_choice.Bind(wx.EVT_CHOICE, self.on_well_input)
sbs_well.Add(self.well_choice, proportion=1, flag=wx.EXPAND)
self.sizer.Add(sbs_well)
self.selected_well = None
def __init__(self, labels, *args, **kwargs):
super(LogInputPanel, self).__init__(*args, **kwargs)
fgs = wx.FlexGridSizer(len(labels), 2, 4, 4)
self.choices = []
for label in labels:
st = wx.StaticText(self, label=label + ": ")
choice = wx.Choice(self)
fgs.Add(st)
fgs.Add(choice)
self.choices.append(choice)
fgs.AddGrowableCol(1, 1)
self.SetSizer(fgs)
def __init__(self, labels, *args, **kwargs):
super(LogInputPanel, self).__init__(*args, **kwargs)
fgs = wx.FlexGridSizer(len(labels), 2, 4, 4)
self.choices = []
for label in labels:
st = wx.StaticText(self, label=label + ": ")
choice = wx.Choice(self)
fgs.Add(st)
fgs.Add(choice)
self.choices.append(choice)
fgs.AddGrowableCol(1, 1)
self.SetSizer(fgs)
def __init__(self, *args, **kwargs):
self._uiobj = wx.Choice(*args, **kwargs)
self._OM = ObjectManager(self)
self.tids = None
self.well_uid = None
self.index2uid = None
def __init__(self, parent, sms):
wxskinDialog.__init__(self, parent, -1, "SMS edit")
self.SetAutoLayout(False)
self.sms = sms
# Main window resizer object
sizer = wx.BoxSizer(wx.VERTICAL)
sizer = wx.FlexGridSizer(4,1)
self.smsLabel = wx.StaticText(self, -1, "Message Text (%d / 160)" % len(sms.message))
sizer.Add(self.smsLabel, 1, wx.ALIGN_CENTER | wx.ALL, 5)
smsTextId = wx.NewId()
self.smsText = wx.TextCtrl(self, smsTextId, sms.message, size=(300,100), style=wx.TE_MULTILINE | wx.TE_LINEWRAP, validator = pySIMvalidator(None, None, 160))
sizer.Add(self.smsText, 1, wx.ALIGN_CENTER | wx.ALL, 5)
hsizer = wx.FlexGridSizer(2,3)
label = wx.StaticText(self, -1, "Date: ")
hsizer.Add(label, 1, wx.ALL, 5)
label = wx.StaticText(self, -1, "From: ")
hsizer.Add(label, 1, wx.ALL, 5)
label = wx.StaticText(self, -1, "Status: ")
hsizer.Add(label, 1, wx.ALL, 5)
text = wx.TextCtrl(self, -1, self.sms.timestamp, style=wx.TE_READONLY)
hsizer.Add(text, 1, wx.ALL, 5)
self.numberCtrl = wx.TextCtrl(self, -1, self.sms.number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
hsizer.Add(self.numberCtrl, 1, wx.ALL, 5)
choiceList = ['Read', 'Unread', 'Deleted']
self.ch = wx.Choice(self, -1, (80, 50), choices = choiceList)
for i in range(len(choiceList)):
if sms.status == choiceList[i]:
self.ch.SetSelection(i)
break
hsizer.Add(self.ch, 1, wx.ALL, 5)
sizer.Add(hsizer, 1, wx.ALL, 5)
buttons = wx.BoxSizer(wx.HORIZONTAL)
buttons.Add(wx.Button(self, ID_BUTTON_OK, "Save"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
sizer.Add(buttons, 1, wx.ALIGN_CENTER | wx.ALL, 5)
wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
wx.EVT_TEXT(self.smsText, smsTextId, self.smsTextChange)
self.SetAutoLayout(1);
self.SetSizer(sizer)
sizer.Fit(self)
self.Layout()
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
# URL???
self.method_choice = wx.Choice(self, -1, size=(80, -1), choices=[u'GET', u'POST'])
self.method_choice.SetSelection(0)
self.url_text = wx.TextCtrl(self, -1)
url_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "URL"))
url_sizer.Add(self.method_choice, 0)
url_sizer.Add(self.url_text, 1, wx.EXPAND | wx.LEFT, 2)
# ??
self.post_params_text = wx.TextCtrl(self, -1, size=(-1, 150), style=wx.TE_MULTILINE | wx.HSCROLL)
post_params_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Post Params"), wx.VERTICAL)
post_params_sizer.Add(self.post_params_text, 1, wx.EXPAND | wx.TOP, 5)
# ???
self.headers_text = wx.TextCtrl(self, -1, size=(-1, 150), style=wx.TE_MULTILINE | wx.HSCROLL)
headers_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Headers"))
headers_sizer.Add(self.headers_text, 1, wx.EXPAND)
# ????
self.template_choice = wx.Choice(self, -1, size=(150, -1), choices=[])
template_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Template"))
template_sizer.Add(self.template_choice, 1, wx.EXPAND)
# ?????????
self.slice_text = wx.TextCtrl(self, -1)
slice_sizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, "Response slice startswith"))
slice_sizer.Add(self.slice_text, 1, wx.EXPAND)
# ??
self.transform_button = wx.Button(self, -1, u'Only Transform', size=(130, 30))
self.request_transform_button = wx.Button(self, -1, u'Request And Transform', size=(170, 30))
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
button_sizer.Add((0, 0), 1)
button_sizer.Add(self.transform_button, 0)
button_sizer.Add(self.request_transform_button, 0)
main_box = wx.BoxSizer(wx.VERTICAL)
main_box.Add(url_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
main_box.Add(post_params_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
main_box.Add(headers_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
main_box.Add(template_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
main_box.Add(slice_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
main_box.Add(button_sizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5)
self.SetSizer(main_box)
self.preload_templates()
self.Bind(wx.EVT_BUTTON, self.on_request_transform_button_click, self.request_transform_button)
self.Bind(wx.EVT_BUTTON, self.on_transform_button_click, self.transform_button)
def __init__(self, parent):
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"Selection Frame", pos=wx.DefaultPosition,
size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
self.model = WatchableDict()
self.model["selection"] = 1
self.model["list"] = [u"One", u"Two", u"Three"]
self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
sizer = wx.BoxSizer(wx.VERTICAL)
gb_sizer = wx.GridBagSizer(5, 5)
gb_sizer.SetFlexibleDirection(wx.BOTH)
gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
choices = []
self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
choices, 0)
gb_sizer.Add(self.combo_box, wx.GBPosition(0, 0), wx.GBSpan(1, 1), wx.EXPAND, 5)
pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list")
pywatch.wx.SelectionChanger(self.combo_box, self.model, "selection")
self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0)
self.choice.SetSelection(0)
gb_sizer.Add(self.choice, wx.GBPosition(1, 0), wx.GBSpan(1, 1), wx.EXPAND, 5)
pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list")
pywatch.wx.SelectionChanger(self.choice, self.model, "selection")
self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choices, 0)
gb_sizer.Add(self.list_box, wx.GBPosition(2, 0), wx.GBSpan(1, 1), wx.EXPAND, 5)
pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list")
pywatch.wx.SelectionChanger(self.list_box, self.model, "selection")
self.radio_box = wx.RadioBox(self, wx.ID_ANY, u"Radio Box", wx.DefaultPosition, wx.DefaultSize,
[u"One", u"Two", u"Three"], 1, wx.RA_SPECIFY_COLS)
self.radio_box.SetSelection(0)
gb_sizer.Add(self.radio_box, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 5)
pywatch.wx.SelectionChanger(self.radio_box, self.model, "selection")
gb_sizer.AddGrowableCol(0)
gb_sizer.AddGrowableRow(2)
sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5)
self.SetSizer(sizer)
self.Layout()
self.Centre(wx.BOTH)
def __init__(self, parent):
wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"List Frame", pos=wx.DefaultPosition,
size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
sizer = wx.BoxSizer(wx.VERTICAL)
gb_sizer = wx.GridBagSizer(5, 5)
gb_sizer.SetFlexibleDirection(wx.BOTH)
gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)
list_boxChoices = []
self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, list_boxChoices, 0)
gb_sizer.Add(self.list_box, wx.GBPosition(0, 0), wx.GBSpan(1, 2), wx.EXPAND, 0)
combo_boxChoices = []
self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
combo_boxChoices, 0)
gb_sizer.Add(self.combo_box, wx.GBPosition(1, 0), wx.GBSpan(1, 2), wx.EXPAND, 0)
choiceChoices = []
self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choiceChoices, 0)
self.choice.SetSelection(0)
gb_sizer.Add(self.choice, wx.GBPosition(2, 0), wx.GBSpan(1, 2), wx.EXPAND, 0)
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
wx.TE_PROCESS_ENTER)
gb_sizer.Add(self.text_ctrl, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 0)
self.button = wx.Button(self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0)
gb_sizer.Add(self.button, wx.GBPosition(3, 1), wx.GBSpan(1, 1), wx.ALL, 0)
gb_sizer.AddGrowableCol(0)
gb_sizer.AddGrowableRow(0)
sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5)
self.SetSizer(sizer)
self.Layout()
self.Centre(wx.BOTH)
# Connect Events
self.button.Bind(wx.EVT_BUTTON, self.on_add)
self.text_ctrl.Bind(wx.EVT_TEXT_ENTER, self.on_add)
self.model = WatchableDict()
self.model["list"] = []
self.model["text"] = ""
pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text")
pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list")
pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list")
pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list")
# Virtual event handlers, overide them in your derived class
def __init__(self, *args, **kwargs):
if 'on_ok_callback' in kwargs:
self.on_ok_callback = kwargs.pop('on_ok_callback')
else:
self.on_ok_callback = None
if 'on_cancel_callback' in kwargs:
self.on_cancel_callback = kwargs.pop('on_cancel_callback')
else:
self.on_cancel_callback = None
super(Dialog, self).__init__(*args, **kwargs)
self._OM = ObjectManager(self)
self._OM.subscribe(self.on_wells_changed, 'add')
self._OM.subscribe(self.on_wells_changed, 'post_remove')
#self._OM.addcallback("add", self.on_wells_changed)
#self._OM.addcallback("post-remove", self.on_wells_changed)
self.wellselector = wx.Choice(self)
self.wellselector.Bind(wx.EVT_CHOICE, self.on_well_select)
self.crossplotselector = Panel(self)
button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)
self.Bind(wx.EVT_BUTTON, self.on_button)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(self.wellselector, 0, wx.ALIGN_CENTER, 5)
vbox.Add(self.crossplotselector, 1, wx.ALL|wx.EXPAND, 5)
vbox.Add(button_sizer, 0, wx.ALIGN_RIGHT, 5)
self.SetSizer(vbox)
self.SetSize((400, 600))
self.Fit()
self.SetTitle(u"Crossplot")
self.welluid = None
self.wellmap = []
self.iwellmap = {}
self.on_wells_changed(None)
def __init__(self, *args, **kwargs):
if 'size' not in kwargs:
kwargs['size'] = (640, 480)
super(Dialog, self).__init__(*args, **kwargs)
self._OM = ObjectManager(self)
self.currentwellindex = 0
self.currentrocktableindex = 0
self.tables = []
self.rocktablemap = [rocktable.uid for rocktable in self._OM.list('rocktable')]
work_table = []
for rocktable in self._OM.list('rocktable'):
work_table.append(RockTable(rocktable.uid))
self.tables.append(work_table)
self.grid = wx.grid.Grid(self)
self.grid.SetDefaultColSize(100)
# else:
self.grid.SetTable(self.tables[self.currentwellindex][self.currentrocktableindex])
self.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.on_cell_dlclick)
self.grid.Bind(wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.on_label_dlclick)
toolbar_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.rocktable_choice = wx.Choice(self)
self.rocktable_choice.AppendItems([self._OM.get(rocktableuid).name for rocktableuid in self.rocktablemap])
self.rocktable_choice.SetSelection(self.currentrocktableindex)
self.rocktable_choice.Bind(wx.EVT_CHOICE, self.on_rocktable_choice)
add_rocktype_button = wx.Button(self, label='ADD ROCK TYPE')
add_rocktype_button.Bind(wx.EVT_BUTTON, self.on_add_rocktype)
remove_rocktype_button = wx.Button(self, label='REM ROCK TYPE')
remove_rocktype_button.Bind(wx.EVT_BUTTON, self.on_remove_rocktype)
toolbar_sizer.Add(self.rocktable_choice, 1, wx.ALIGN_LEFT)
toolbar_sizer.Add(add_rocktype_button, 0, wx.ALIGN_LEFT)
toolbar_sizer.Add(remove_rocktype_button, 0, wx.ALIGN_LEFT)
main_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.Add(toolbar_sizer, proportion=0, flag=wx.EXPAND)
main_sizer.Add(self.grid, proportion=1, flag=wx.EXPAND)
self.SetSizer(main_sizer)