def createWidgets(self):
# Main window resizer object
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(topPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
sizer.Add(bottomPanel(self, self.SIM), 1, wx.ALL|wx.EXPAND, 5)
#buttons = wx.BoxSizer(wx.HORIZONTAL)
#buttons.Add(wx.Button(self, ID_BUTTON_CHANGE_PIN, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
#buttons.Add(wx.Button(self, wxID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
#sizer.Add(buttons, 1, wx.ALL)
self.SetSizer(sizer)
self.SetAutoLayout(1)
sizer.Fit(self)
self.Layout()
wx.EVT_CLOSE(self, self.closeWindow)
python类ALIGN_RIGHT的实例源码
def __do_layout(self):
# begin wxGlade: Dialog_snapshot.__do_layout
sizer_2 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_2 = wx.FlexGridSizer(4, 2, 10, 10)
grid_sizer_2.Add(self.label_1, 0, 0, 0)
grid_sizer_2.Add(self.nombre_snap, 0, 0, 0)
grid_sizer_2.Add(self.label_2, 0, 0, 0)
grid_sizer_2.Add(self.descripcion_snap, 0, 0, 0)
grid_sizer_2.Add(self.checkbox_memory, 0, 0, 0)
grid_sizer_2.Add(self.checkbox_quiesce, 0, 0, 0)
grid_sizer_2.Add(self.snap_ok, 0, wx.ALIGN_RIGHT | wx.RIGHT, 0)
grid_sizer_2.Add(self.snap_cancel, 0, 0, 0)
grid_sizer_2.AddGrowableCol(1)
sizer_2.Add(grid_sizer_2, 1, wx.ALL | wx.EXPAND, 10)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
self.Layout()
# end wxGlade
# end of class Dialog_snapshot
def __do_layout(self):
# begin wxGlade: Dialogo_user_pass.__do_layout
sizer_3 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_4 = wx.FlexGridSizer(1, 2, 0, 0)
grid_sizer_1 = wx.FlexGridSizer(2, 2, 5, 5)
grid_sizer_1.Add(self.label_3, 0, 0, 0)
grid_sizer_1.Add(self.usuario, 0, 0, 0)
grid_sizer_1.Add(self.label_4, 0, 0, 0)
grid_sizer_1.Add(self.password, 0, 0, 0)
grid_sizer_1.AddGrowableCol(0)
sizer_3.Add(grid_sizer_1, 1, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, 10)
grid_sizer_4.Add(self.button_OK, 0, 0, 0)
grid_sizer_4.Add(self.button_cancel, 0, wx.ALIGN_RIGHT, 0)
sizer_3.Add(grid_sizer_4, 1, wx.ALIGN_RIGHT | wx.ALL, 4)
self.SetSizer(sizer_3)
sizer_3.Fit(self)
self.Layout()
# end wxGlade
# end of class Dialogo_user_pass
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_4 = wx.BoxSizer(wx.VERTICAL)
sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
sizer_5.Add(self.label_5, 0, wx.ALIGN_CENTER_VERTICAL, 0)
sizer_5.Add(self.text_ctrl_bucar, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 7)
sizer_5.Add(self.button_buscar, 0, wx.ALIGN_CENTER_VERTICAL, 0)
sizer_5.Add(self.label_6, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
sizer_5.Add(self.bitmap_button_1, 0, wx.ALIGN_CENTER_VERTICAL, 0)
sizer_4.Add(sizer_5, 1, wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT | wx.ALL, 6)
sizer_4.Add(self.list_ctrl_1, 1, 0, 0)
self.SetSizer(sizer_4)
sizer_4.Fit(self)
self.Layout()
# end wxGlade
# end of class MyFrame
def __init__(self, parent, info):
wx.Dialog.__init__(self, parent, title=_("License"), size=(500, 400),
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
if parent and parent.GetIcon():
self.SetIcon(parent.GetIcon())
self.SetMinSize((400, 300))
close = wx.Button(self, id=wx.ID_CLOSE, label=_("&Close"))
ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)
ctrl.SetValue(info.License)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.Add(close)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(ctrl, 1, wx.EXPAND | wx.ALL, 10)
sizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=10)
self.SetSizer(sizer)
self.Layout()
self.Show()
self.SetEscapeId(close.GetId())
close.Bind(wx.EVT_BUTTON, lambda evt: self.Destroy())
def __init__(self, parent, enable_required=True):
wx.Dialog.__init__(self, parent, title=_('Project properties'),
style=wx.DEFAULT_DIALOG_STYLE)
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
main_sizer.AddGrowableCol(0)
main_sizer.AddGrowableRow(0)
self.ProjectProperties = ProjectPropertiesPanel(
self,
enable_required=enable_required)
main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW)
self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK,
self.ButtonSizer.GetAffirmativeButton())
main_sizer.AddSizer(self.ButtonSizer, border=20,
flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
self.ProjectProperties.Fit()
self.Fit()
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.GridSizer(5, 2, 0, 0)
grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20)
grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20)
grid_sizer_1.Add(self.label_3, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_3, 0, wx.RIGHT|wx.TOP, 20)
grid_sizer_1.Add(self.label_4, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20)
grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20)
grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0)
grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30)
sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
self.Centre()
# end wxGlade
def __do_layout(self):
# begin wxGlade: CE_TE.__do_layout
sizer_5 = wx.BoxSizer(wx.VERTICAL)
sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
sizer_6.Add(self.label_1, 0, wx.LEFT, 0)
sizer_6.Add(self.text_ctrl_1, 0, wx.LEFT|wx.ALIGN_RIGHT, 35)
sizer_5.Add(sizer_6, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 30)
sizer_7.Add(self.label_2, 0, wx.LEFT, 0)
sizer_7.Add(self.text_ctrl_2, 0, wx.LEFT, 35)
sizer_5.Add(sizer_7, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 30)
sizer_8.Add(self.button_2, 0, 0, 0)
sizer_8.Add(self.button_1, 0, wx.LEFT, 35)
sizer_5.Add(sizer_8, 1, wx.LEFT|wx.RIGHT|wx.TOP|wx.EXPAND, 20)
self.SetSizer(sizer_5)
self.text_ctrl_1.SetFocus()
self.Layout()
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.GridSizer(5, 2, 0, 0)
grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20)
grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20)
#grid_sizer_1.Add(self.button_3, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20)
#grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20)
grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0)
grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30)
sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
self.Centre()
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.GridSizer(5, 2, 0, 0)
grid_sizer_1.Add(self.label_1, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_1, 0, wx.TOP, 20)
grid_sizer_1.Add(self.label_2, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_2, 0, wx.TOP, 20)
grid_sizer_1.Add(self.label_3, 0, wx.LEFT|wx.TOP, 20)
grid_sizer_1.Add(self.combo_box_3, 0, wx.RIGHT|wx.TOP, 20)
#grid_sizer_1.Add(self.button_3, 0, wx.LEFT|wx.TOP|wx.BOTTOM|wx.EXPAND, 20)
#grid_sizer_1.Add(self.combo_box_4, 0, wx.RIGHT|wx.TOP|wx.BOTTOM, 20)
grid_sizer_1.Add(self.button_1, 0, wx.TOP|wx.ALIGN_RIGHT, 0)
grid_sizer_1.Add(self.button_2, 0, wx.LEFT, 30)
sizer_1.Add(grid_sizer_1, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
self.Layout()
self.Centre()
def __do_layout(self):
# begin wxGlade: TerminalSettingsDialog.__do_layout
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
self.sizer_4_staticbox.Lower()
sizer_4 = wx.StaticBoxSizer(self.sizer_4_staticbox, wx.VERTICAL)
sizer_4.Add(self.checkbox_echo, 0, wx.ALL, 4)
sizer_4.Add(self.checkbox_unprintable, 0, wx.ALL, 4)
sizer_4.Add(self.radio_box_newline, 0, 0, 0)
sizer_2.Add(sizer_4, 0, wx.EXPAND, 0)
sizer_3.Add(self.button_ok, 0, 0, 0)
sizer_3.Add(self.button_cancel, 0, 0, 0)
sizer_2.Add(sizer_3, 0, wx.ALL | wx.ALIGN_RIGHT, 4)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
self.Layout()
# end wxGlade
def create_page_buttons(self, sizer, panel):
button_sizer = wx.BoxSizer(wx.HORIZONTAL)
button_sizer.Add(
self.create_button(
panel=panel, key=['settings', 'ok_button'],
bind=self.button_clicked, multiple=True)['item'],
0, wx.ALIGN_RIGHT)
button_sizer.Add(
self.create_button(
panel=panel, key=['settings', 'apply_button'],
bind=self.button_clicked, enabled=False, multiple=True)['item'],
0, wx.ALIGN_RIGHT)
button_sizer.Add(
self.create_button(
panel=panel, key=['settings', 'cancel_button'],
bind=self.button_clicked, multiple=True)['item'],
0, wx.ALIGN_RIGHT)
sizer.Add(button_sizer, 0, wx.ALIGN_RIGHT | wx.ALL, 4)
def GetAttr(self, row, col, kind):
#if _iswxphoenix:
attr = wx.grid.GridCellAttr().Clone()
#else:
# attr = wx.grid.GridCellAttr()
if col >= self.N_COLS:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
elif col == 0:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
elif col == 1:
part = self._OM.get(self.partmap[row])
attr.SetBackgroundColour(part.color)
attr.SetReadOnly(True)
elif col == 2:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
elif col == 3:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
return attr
def getPanelBottomButtons(self):
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.HORIZONTAL)
b1 = wx.Button(panel, -1, "OK")
sizer.Add(b1, 0, wx.ALIGN_RIGHT, border=5)
b2 = wx.Button(panel, -1, "Apply")
sizer.Add(b2, 0, wx.ALIGN_RIGHT, border=5)
b3 = wx.Button(panel, -1, "Cancel")
sizer.Add(b3, 0, wx.LEFT|wx.RIGHT, border=5)
b1.Bind(wx.EVT_BUTTON, self._OnButtonOK)
b2.Bind(wx.EVT_BUTTON, self._OnButtonApply)
b3.Bind(wx.EVT_BUTTON, self._OnButtonCancel)
panel.SetSizer(sizer)
return panel
def GetAttr(self, row, col, kind):
#if _iswxphoenix:
attr = wx.grid.GridCellAttr().Clone()
if col >= self.N_COLS:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
elif col == 0:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
elif col == 1:
rocktype = self._OM.get(self.rocktypemap[row])
attr.SetBackgroundColour(rocktype.color)
attr.SetReadOnly(True)
elif col == 2:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
elif col == 3:
attr.SetAlignment(wx.ALIGN_RIGHT, wx.ALIGN_CENTER)
return attr
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.header_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.header_panel, proportion=1, flag=wx.ALL | wx.EXPAND)
vbox.Add(button_sizer, flag=wx.ALIGN_RIGHT)
self.SetSizer(vbox)
self.SetSize((800, 600))
self.SetTitle(u"Editor de Cabeçalho ODT")
def __init__(self, parent, columns, df_list_ctrl, change_callback):
wx.Panel.__init__(self, parent)
columns_with_neutral_selection = [''] + list(columns)
self.columns = columns
self.df_list_ctrl = df_list_ctrl
self.change_callback = change_callback
self.num_filters = 10
self.main_sizer = wx.BoxSizer(wx.VERTICAL)
self.combo_boxes = []
self.text_controls = []
for i in range(self.num_filters):
combo_box = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY)
text_ctrl = wx.TextCtrl(self, wx.ID_ANY, '')
self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select)
self.Bind(wx.EVT_TEXT, self.on_text_change)
row_sizer = wx.BoxSizer(wx.HORIZONTAL)
row_sizer.Add(combo_box, 0, wx.ALL, 5)
row_sizer.Add(text_ctrl, 1, wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, 5)
self.combo_boxes.append(combo_box)
self.text_controls.append(text_ctrl)
self.main_sizer.Add(row_sizer, 0, wx.EXPAND)
self.SetSizer(self.main_sizer)
def InitLayout(self):
"""Lay out controls and add buttons."""
sizer = wx.BoxSizer(wx.HORIZONTAL)
txtSizer = wx.BoxSizer(wx.VERTICAL)
btnSizer = wx.BoxSizer(wx.VERTICAL)
replaceSizer = wx.BoxSizer(wx.HORIZONTAL)
txtSizer.Add(wx.StaticText(self, -1, "Unrecognised Word:"), 0, wx.LEFT|wx.TOP, 5)
txtSizer.Add(self.error_text, 1, wx.ALL|wx.EXPAND, 5)
replaceSizer.Add(wx.StaticText(self, -1, "Replace with:"), 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
replaceSizer.Add(self.replace_text, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
txtSizer.Add(replaceSizer, 0, wx.EXPAND, 0)
txtSizer.Add(self.replace_list, 2, wx.ALL|wx.EXPAND, 5)
sizer.Add(txtSizer, 1, wx.EXPAND, 0)
self.buttons = []
for label, action, tip in (\
("Ignore", self.OnIgnore, "Ignore this word and continue"),
("Ignore All", self.OnIgnoreAll, "Ignore all instances of this word and continue"),
("Replace", self.OnReplace, "Replace this word"),
("Replace All", self.OnReplaceAll, "Replace all instances of this word"),
("Add", self.OnAdd, "Add this word to the dictionary"),
("Done", self.OnDone, "Finish spell-checking and accept changes"),
):
btn = wx.Button(self, -1, label)
btn.SetToolTip(wx.ToolTip(tip))
btnSizer.Add(btn, 0, wx.ALIGN_RIGHT|wx.ALL, 4)
btn.Bind(wx.EVT_BUTTON, action)
self.buttons.append(btn)
sizer.Add(btnSizer, 0, wx.ALL|wx.EXPAND, 5)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
def __init__(self, parent, name, number, minnamelen, maxnamelen):
wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry")
self.SetAutoLayout(True)
self.name = None
self.number = None
nameTextId = wx.NewId()
# Main window resizer object
border = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.")
border.Add(label, 1, wx.ALL, 10)
#fgs = wx.FlexGridSizer(2,3,5,20)
fgs = wx.BoxSizer(wx.HORIZONTAL)
label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen)
fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen))
fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
border.Add(fgs, 1, wx.ALL)
fgs = wx.BoxSizer(wx.HORIZONTAL)
label = wx.StaticText(self, -1, "Number (max 20): ")
fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
border.Add(fgs, 1, wx.ALL)
buttons = wx.BoxSizer(wx.HORIZONTAL)
buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
border.Add(buttons, 1, wx.ALL)
wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK)
self.SetAutoLayout(1);
self.SetSizer(border)
border.Fit(self)
self.Layout()
def __init__(self, parent, name):
wxskinDialog.__init__(self, parent, -1, "Phonebook import")
self.SetAutoLayout(True)
self.function = 0
# Main window resizer object
border = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(self, -1, "Name '%s' already exists in SIM phonebook.\n\nDo you want to overwrite exisiting, duplicate or skip!?" % (name))
border.Add(label, 1, wx.ALL, 10)
buttons = wx.BoxSizer(wx.HORIZONTAL)
buttons.Add(wx.Button(self, ID_BUTTON_OVERWRITE, "Overwrite"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
buttons.Add(wx.Button(self, ID_BUTTON_COPY, "Duplicate"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
buttons.Add(wx.Button(self, ID_BUTTON_SKIP, "Skip"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
border.Add(buttons, 1, wx.ALL)
self.applyAll = wx.CheckBox(self, ID_CHECKBOX_APPLY_ALL, " Apply to all", wx.Point(65, 40), wx.Size(150, 20), wx.NO_BORDER)
border.Add(self.applyAll, 1, wx.ALIGN_CENTER | wx.ALL)
wx.EVT_BUTTON(self, ID_BUTTON_OVERWRITE, self.onOverwrite)
wx.EVT_BUTTON(self, ID_BUTTON_COPY, self.onDuplicate)
wx.EVT_BUTTON(self, ID_BUTTON_SKIP, self.onSkip)
self.SetAutoLayout(1);
self.SetSizer(border)
border.Fit(self)
self.Layout()
def __init__(self, parent, name, number, minnamelen, maxnamelen):
wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry")
self.SetAutoLayout(True)
self.name = None
self.number = None
nameTextId = wx.NewId()
# Main window resizer object
border = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.")
border.Add(label, 1, wx.ALL, 10)
#fgs = wx.FlexGridSizer(2,3,5,20)
fgs = wx.BoxSizer(wx.HORIZONTAL)
label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen)
fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen))
fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
border.Add(fgs, 1, wx.ALL)
fgs = wx.BoxSizer(wx.HORIZONTAL)
label = wx.StaticText(self, -1, "Number (max 20): ")
fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
border.Add(fgs, 1, wx.ALL)
buttons = wx.BoxSizer(wx.HORIZONTAL)
buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
border.Add(buttons, 1, wx.ALL)
wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK)
self.SetAutoLayout(1);
self.SetSizer(border)
border.Fit(self)
self.Layout()
def __init__(self, parent, name):
wxskinDialog.__init__(self, parent, -1, "Phonebook import")
self.SetAutoLayout(True)
self.function = 0
# Main window resizer object
border = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(self, -1, "Name '%s' already exists in SIM phonebook.\n\nDo you want to overwrite exisiting, duplicate or skip!?" % (name))
border.Add(label, 1, wx.ALL, 10)
buttons = wx.BoxSizer(wx.HORIZONTAL)
buttons.Add(wx.Button(self, ID_BUTTON_OVERWRITE, "Overwrite"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
buttons.Add(wx.Button(self, ID_BUTTON_COPY, "Duplicate"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
buttons.Add(wx.Button(self, ID_BUTTON_SKIP, "Skip"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
border.Add(buttons, 1, wx.ALL)
self.applyAll = wx.CheckBox(self, ID_CHECKBOX_APPLY_ALL, " Apply to all", wx.Point(65, 40), wx.Size(150, 20), wx.NO_BORDER)
border.Add(self.applyAll, 1, wx.ALIGN_CENTER | wx.ALL)
wx.EVT_BUTTON(self, ID_BUTTON_OVERWRITE, self.onOverwrite)
wx.EVT_BUTTON(self, ID_BUTTON_COPY, self.onDuplicate)
wx.EVT_BUTTON(self, ID_BUTTON_SKIP, self.onSkip)
self.SetAutoLayout(1);
self.SetSizer(border)
border.Fit(self)
self.Layout()
def __init__(self, parent, date, number):
wxskinDialog.__init__(self, parent, -1, "SMS import")
self.SetAutoLayout(False)
self.function = 0
# Main window resizer object
border = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(self, -1, "SMS from '%s' on '%s' already exists in SMS folder.\n\nDo you want to overwrite exisiting, duplicate or skip!?" % (number, date))
border.Add(label, 1, wx.ALL, 10)
buttons = wx.BoxSizer(wx.HORIZONTAL)
buttons.Add(wx.Button(self, ID_BUTTON_OVERWRITE, "Overwrite"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
buttons.Add(wx.Button(self, ID_BUTTON_COPY, "Duplicate"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
buttons.Add(wx.Button(self, ID_BUTTON_SKIP, "Skip"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
border.Add(buttons, 1, wx.ALL)
self.applyAll = wx.CheckBox(self, ID_CHECKBOX_APPLY_ALL, " Apply to all", wx.Point(65, 40), wx.Size(150, 20), wx.NO_BORDER)
border.Add(self.applyAll, 1, wx.ALIGN_CENTER | wx.ALL)
wx.EVT_BUTTON(self, ID_BUTTON_OVERWRITE, self.onOverwrite)
wx.EVT_BUTTON(self, ID_BUTTON_COPY, self.onDuplicate)
wx.EVT_BUTTON(self, ID_BUTTON_SKIP, self.onSkip)
#EVT_CHECKBOX(self, ID_CHECKBOX_APPLY_ALL, self.EvtCheckBox)
self.SetAutoLayout(1);
self.SetSizer(border)
border.Fit(self)
self.Layout()
def __do_layout(self):
# begin wxGlade: Dialogo_texto.__do_layout
self.sizer_1_staticbox.Lower()
sizer_1 = wx.StaticBoxSizer(self.sizer_1_staticbox, wx.VERTICAL)
sizer_1.Add(self.salida_texto, 0, wx.ALL | wx.EXPAND, 4)
sizer_1.Add(self.bnt_salida_ok, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.SHAPED, 5)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
# end of class Dialogo_texto
def __init__(self, parent):
wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
self.panelphase = self.GetParent().GetParent().GetParent()
self.font = self.GetParent().font
self.file = None
vbox = wx.BoxSizer(wx.VERTICAL)
title = wx.StaticText(self, label="Convert HDF5 to Numpy array.")
vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.input_filename = TextPanelObject(self, "Input HDF5 File: ", "",150,"HDF files (*.hdf)|*.hdf|HDF5 files (*.h5)|*.h5|All files (*.*)|*.*")
vbox.Add(self.input_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
hbox = wx.BoxSizer(wx.HORIZONTAL)
label = wx.StaticText(self, -1,"HDF Key Path:" , style =wx.ALIGN_RIGHT, size=(150,-1) )
label.SetFont(self.font)
hbox.Add( label, 0, wx.CENTER )
def OnEdit(event):
self.objectpath.ChangeValue(event.GetString())
self.objectpath = TextCtrlNew(self, -1)
self.objectpath.SetFont(self.font)
self.objectpath.SetValue("")
self.objectpath.SetToolTipNew("Comma separated key names.")
self.objectpath.Bind(wx.EVT_TEXT_ENTER, OnEdit)
hbox.Add( self.objectpath, 1, wx.CENTER |wx.EXPAND )
self.button = ButtonNew(self, -1, "Browse")
self.button.SetFont(self.font)
self.button.SetToolTipNew("Browse for HDF5 key path.")
self.button.Bind(wx.EVT_BUTTON, self.OnBrowse)
hbox.Add( self.button, 0, wx.LEFT|wx.CENTER)
vbox.Add(hbox, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,'*.npy')
vbox.Add(self.output_filename, 0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
self.SetAutoLayout(True)
self.SetSizer( vbox )
def __init__(self, parent, name, objectpath, textwidth, file_extension):
def assign(input):
self.objectpath.ChangeValue(input)
def OnBrowse(self):
if IsNotWX4():
dlg = wx.FileDialog(parent, 'Choose a file', os.getcwd(), '', file_extension, wx.OPEN)
else:
dlg = wx.FileDialog(parent, 'Choose a file', os.getcwd(), '', file_extension, wx.FD_OPEN)
if dlg.ShowModal() == wx.ID_OK:
assign(dlg.GetPath())
dlg.Destroy()
def OnEdit(event):
self.objectpath.ChangeValue(event.GetString())
fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()
self.font = wx.Font(fontpointsize, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
dc = wx.ScreenDC()
dc.SetFont(self.font)
textw,texth = dc.GetTextExtent(name)
if textw > textwidth:
labelw = textw
else:
labelw = textwidth
wx.BoxSizer.__init__(self, wx.HORIZONTAL)
self.label = StaticTextNew(parent, -1, name, style =wx.ALIGN_RIGHT, size=(labelw,-1) )
self.label.SetFont(self.font)
self.Add( self.label, 0, wx.CENTER )
self.objectpath = TextCtrlNew(parent, -1)
self.objectpath.SetFont(self.font)
self.objectpath.SetValue(objectpath)
self.objectpath.SetToolTipNew("Browse for file or type "+os.linesep+"path and name")
self.objectpath.Bind(wx.EVT_TEXT_ENTER, OnEdit)
self.Add( self.objectpath, 1, wx.CENTER |wx.EXPAND )
self.button = ButtonNew(parent, -1, "Browse")
self.button.SetFont(self.font)
self.button.SetToolTipNew("Browse for file or type "+os.linesep+"path and name")
self.button.Bind(wx.EVT_BUTTON, OnBrowse)
self.Add( self.button, 0, wx.LEFT|wx.CENTER)
def __init__(self, parent, name, init, stextwidth):
def OnEdit(event):
text = event.GetString()
point = self.value.GetInsertionPoint()
if (IsNumber(self.value.GetValue()) == False):
self.value.SetBackgroundColour( "Pink" )
self.value.SetForegroundColour( "Black" )
else:
self.value.SetBackgroundColour(wx.NullColour)
self.value.SetForegroundColour(wx.NullColour)
self.value.ChangeValue(text)
self.value.SetInsertionPoint(point)
fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()
self.font = wx.Font(fontpointsize, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
wx.BoxSizer.__init__(self, wx.HORIZONTAL)
dc = wx.ScreenDC()
dc.SetFont(self.font)
textw,texth = dc.GetTextExtent(name)
if textw > stextwidth:
labelw = textw
else:
labelw = stextwidth
self.label = StaticTextNew(parent, -1, name, style =wx.ALIGN_RIGHT, size=(labelw,-1) )
self.label.SetFont(self.font)
self.Add( self.label, 0, wx.CENTER )
self.value = TextCtrlNew(parent, value=str(init), style=wx.TE_PROCESS_ENTER)
self.value.SetWindowStyle(wx.TE_RIGHT)
self.value.SetFont(self.font)
self.value.Bind(wx.EVT_TEXT, OnEdit)
self.Add( self.value, 1, wx.CENTER|wx.EXPAND )
def update_current_search_tab(self):
sizer = self.current_sizer
sizer.Clear(True)
sizer.RemoveGrowableRow(0)
sizer.RemoveGrowableRow(1)
sizer.RemoveGrowableCol(0)
sizer.RemoveGrowableCol(2)
if( len(self.current_search) == 0 ):
sizer.AddGrowableRow(0)
sizer.AddGrowableCol(0)
sizer.Add(wx.StaticText(parent=self.current_tab,label="There are no search items."),flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL,pos=(0,0))
else:
sizer.AddGrowableCol(2)
for i in range(len(self.current_search)):
if i%2 == 0:
not_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i][0],choices=['','not'],style=wx.CB_READONLY,size=(60,-1),id=i/2)
not_box.Bind(wx.EVT_COMBOBOX,self.not_search_item)
sizer.Add(not_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)
key = self.current_search[i][1]
value = self.current_search[i][2]
sizer.Add(wx.StaticText(parent=self.current_tab,label=key+" = '"+value+"'"),pos=(i,1),flag=wx.TOP|wx.LEFT|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,border=5)
removeButton = wx.Button(self.current_tab,label='Remove',id=i/2)
removeButton.Bind(wx.EVT_BUTTON,self.remove_search_item)
sizer.Add(removeButton,pos=(i,2),flag=wx.ALIGN_RIGHT|wx.TOP,border=5)
else:
and_or_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i],choices=['and','or'],style=wx.CB_READONLY,size=(60,-1),id=(i-1)/2)
and_or_box.Bind(wx.EVT_COMBOBOX,self.and_or_search_item)
sizer.Add(and_or_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)
self.current_tab.EnableScrolling(x_scrolling=True,y_scrolling=True)
self.current_tab.SetScrollbars(20,20,10,10)
self.current_tab.Fit()
def update_current_search_tab(self):
sizer = self.current_sizer
sizer.Clear(True)
sizer.RemoveGrowableRow(0)
sizer.RemoveGrowableRow(1)
sizer.RemoveGrowableCol(0)
sizer.RemoveGrowableCol(2)
if( len(self.current_search) == 0 ):
sizer.AddGrowableRow(0)
sizer.AddGrowableCol(0)
sizer.Add(wx.StaticText(parent=self.current_tab,label="There are no search items."),flag=wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL,pos=(0,0))
else:
sizer.AddGrowableCol(2)
for i in range(len(self.current_search)):
if i%2 == 0:
not_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i][0],choices=['','not'],style=wx.CB_READONLY,size=(60,-1),id=i/2)
not_box.Bind(wx.EVT_COMBOBOX,self.not_search_item)
sizer.Add(not_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)
key = self.current_search[i][1]
value = self.current_search[i][2]
sizer.Add(wx.StaticText(parent=self.current_tab,label=key+" = '"+value+"'"),pos=(i,1),flag=wx.TOP|wx.LEFT|wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL,border=5)
removeButton = wx.Button(self.current_tab,label='Remove',id=i/2)
removeButton.Bind(wx.EVT_BUTTON,self.remove_search_item)
sizer.Add(removeButton,pos=(i,2),flag=wx.ALIGN_RIGHT|wx.TOP,border=5)
else:
and_or_box = wx.ComboBox(parent=self.current_tab,value=self.current_search[i],choices=['and','or'],style=wx.CB_READONLY,size=(60,-1),id=(i-1)/2)
and_or_box.Bind(wx.EVT_COMBOBOX,self.and_or_search_item)
sizer.Add(and_or_box,pos=(i,0),flag=wx.ALIGN_LEFT|wx.TOP,border=5)
self.current_tab.EnableScrolling(x_scrolling=True,y_scrolling=True)
self.current_tab.SetScrollbars(20,20,10,10)
self.current_tab.Fit()
def __init__(self, parent, name, library, default=None):
wx.Dialog.__init__(self,
name='BrowseValueDialog', parent=parent,
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
title=_('Browse %s values library') % name)
self.staticText1 = wx.StaticText(
label=_('Choose a value for %s:') % name, name='staticText1', parent=self,
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.ValuesLibrary = wx.TreeCtrl(
name='ValuesLibrary', parent=self, pos=wx.Point(0, 0),
size=wx.Size(400, 200), style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)
self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
self.flexGridSizer1.AddWindow(self.staticText1, 0, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
self.flexGridSizer1.AddWindow(self.ValuesLibrary, 0, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT)
self.flexGridSizer1.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.flexGridSizer1.AddGrowableCol(0)
self.flexGridSizer1.AddGrowableRow(1)
self.SetSizer(self.flexGridSizer1)
self.Fit()
root = self.ValuesLibrary.AddRoot("")
self.GenerateValuesLibraryBranch(root, library, default)