我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wx.ALIGN_CENTER。
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) box = wx.BoxSizer(wx.VERTICAL) box.Add((20, 30)) keys = buttonDefs.keys() for k in keys: text = buttonDefs[k][1] btn = wx.Button(self, k, text) box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 15) self.Bind(wx.EVT_BUTTON, self.OnButton, btn) # put a GLCanvas on the wx.Panel c = CubeCanvas(self) c.SetMinSize((200, 200)) box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15) c = ConeCanvas(self) c.SetMinSize((200, 200)) box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15) self.SetAutoLayout(True) self.SetSizer(box)
def __init__(self, parent, id, title, message, download_url, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog'): wx.Dialog.__init__(self, parent, id, title, pos, size, style, name) label = wx.StaticText(self, label=message) button = wx.Button(self, id=wx.ID_OK, label="Close") button.SetDefault() line = wx.StaticLine(self, wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL) download_ctrl = hl.HyperLinkCtrl(self, wx.ID_ANY, download_url, URL=download_url) sizer = wx.BoxSizer(wx.VERTICAL) button_sizer = wx.StdDialogButtonSizer() button_sizer.AddButton(button) button_sizer.Realize() sizer.Add(label, 0, wx.ALIGN_CENTER|wx.ALL, 5) sizer.Add(download_ctrl, 0, wx.ALL, 10) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(button_sizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self)
def initOptions(self): optionsSizer = wx.BoxSizer(wx.HORIZONTAL) kernTypeControlBox = widgets.ControlBox(self, label='Kernel Type', orient=wx.HORIZONTAL) self.kernTypeComboBox = wx.ComboBox(self, choices=self.flt.kernMap.keys(), value=self.flt.kernType, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setKernType, self.kernTypeComboBox) kernTypeControlBox.Add(self.kernTypeComboBox, proportion=1, flag=wx.ALL, border=8) optionsSizer.Add(kernTypeControlBox, proportion=1, flag=wx.ALL | wx.ALIGN_CENTER, border=8) widthControlBox = widgets.ControlBox(self, label='Width', orient=wx.HORIZONTAL) self.widthSpinCtrl = wx.SpinCtrl(self, value=str(self.flt.width), min=2, max=100) self.Bind(wx.EVT_SPINCTRL, self.setWidth, self.widthSpinCtrl) widthControlBox.Add(self.widthSpinCtrl, proportion=1, flag=wx.ALL, border=8) optionsSizer.Add(widthControlBox, proportion=0, flag=wx.TOP | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=8) self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
def initOptions(self): optionsSizer = wx.BoxSizer(wx.HORIZONTAL) self.filtTypeComboBox = wx.ComboBox(self, choices=self.flt.filtMap.keys(), value=self.flt.filtType, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setFiltType, self.filtTypeComboBox) optionsSizer.Add(self.filtTypeComboBox, proportion=1, flag=wx.LEFT | wx.TOP | wx.RIGHT | wx.ALIGN_CENTER, border=20) self.zeroPhaseCheckBox = wx.CheckBox(self, label='Zero Phase') self.zeroPhaseCheckBox.SetValue(self.flt.zeroPhase) self.Bind(wx.EVT_CHECKBOX, self.setZeroPhase, self.zeroPhaseCheckBox) optionsSizer.Add(self.zeroPhaseCheckBox, proportion=1, flag=wx.LEFT | wx.TOP | wx.ALIGN_CENTER, border=20) self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
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: Dialogo_acceso_vcenter.__do_layout sizer_6 = wx.BoxSizer(wx.VERTICAL) grid_sizer_6 = wx.FlexGridSizer(1, 2, 0, 0) grid_sizer_5 = wx.FlexGridSizer(4, 2, 5, 5) grid_sizer_5.Add(self.label_7, 0, 0, 0) grid_sizer_5.Add(self.nombre_vcenter, 0, 0, 0) grid_sizer_5.Add(self.label_9, 0, 0, 0) grid_sizer_5.Add(self.login_vcenter, 0, 0, 0) grid_sizer_5.Add(self.label_10, 0, 0, 0) grid_sizer_5.Add(self.passwor_vcenter, 0, 0, 0) grid_sizer_5.Add(self.label_8, 0, 0, 0) grid_sizer_5.Add(self.puert_vcenter, 0, 0, 0) sizer_6.Add(grid_sizer_5, 1, wx.ALIGN_CENTER | wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, 10) grid_sizer_6.Add(self.button_Exit, 0, wx.RIGHT, 3) grid_sizer_6.Add(self.button_Connect, 0, 0, 0) sizer_6.Add(grid_sizer_6, 1, wx.ALIGN_RIGHT | wx.ALL, 4) self.SetSizer(sizer_6) self.Layout() # end wxGlade # end of class Dialogo_acceso_vcenter
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) from wx.lib.floatcanvas.ScreenShot import getScreenShotBitmap note1 = wx.StaticText(self, -1, errorText) note2 = wx.StaticText(self, -1, "This is what the FloatCanvas can look like:") S = wx.BoxSizer(wx.VERTICAL) S.Add((10, 10), 1) S.Add(note1, 0, wx.ALIGN_CENTER) S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 4) S.Add(wx.StaticBitmap(self,-1,getScreenShotBitmap()),0,wx.ALIGN_CENTER) S.Add((10, 10), 1) self.SetSizer(S) self.Layout()
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) note1 = wx.StaticText(self, -1, "The FloatCanvas Demo needs") note2 = wx.StaticText(self, -1, "a separate frame") b = wx.Button(self, -1, "Open Demo Frame Now") b.Bind(wx.EVT_BUTTON, self.OnButton) S = wx.BoxSizer(wx.VERTICAL) S.Add((10, 10), 1) S.Add(note1, 0, wx.ALIGN_CENTER) S.Add(note2, 0, wx.ALIGN_CENTER | wx.BOTTOM, 5) S.Add(b, 0, wx.ALIGN_CENTER | wx.ALL, 5) S.Add((10, 10), 1) self.SetSizer(S) self.Layout()
def add_num(self, rang, accu, 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 = NumCtrl(self, rang, accu) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_KEY_UP, 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 add_color(self, 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 = ColorCtrl(self) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_KEY_UP, 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 add_slide(self, rang, 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 ) iswin = platform.system() == 'Windows' lab = wx.SL_VALUE_LABEL if iswin else wx.SL_LABELS ctrl = wx.Slider( self, wx.ID_ANY, 50, rang[0], rang[1], wx.DefaultPosition, wx.Size( -1,-1 ), wx.SL_HORIZONTAL|lab ) self.ctrl_dic[key] = ctrl ctrl.Bind(wx.EVT_SCROLL, 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 add_txt(self, 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.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) self.ctrl_dic[key] = ctrl ctrl.Bind( wx.EVT_KEY_UP, 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, parent, id, title): wx.Dialog.__init__(self, parent, id, title) self.selection_idx = None self.selection_text = None vbox = wx.BoxSizer(wx.VERTICAL) stline = wx.StaticText( self, 11, 'Duplicate Component values found!' '\n\nPlease select which format to follow:') vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP) self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE) vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND) self.SetSizer(vbox) self.comp_list.Bind(wx.EVT_LISTBOX_DCLICK, self.on_selection, id=wx.ID_ANY)
def create_spin(**kwargs): panel = kwargs.get('panel') value = kwargs.get('value') key = kwargs.get('key') bind = kwargs.get('bind') gui = kwargs.get('gui') item_sizer = wx.BoxSizer(wx.HORIZONTAL) item_name = MODULE_KEY.join(key) style = wx.ALIGN_LEFT item_box = wx.SpinCtrl(panel, id=id_renew(item_name, update=True), min=gui['min'], max=gui['max'], initial=int(value), style=style) item_text = wx.StaticText(panel, label=translate_key(item_name)) item_box.Bind(wx.EVT_SPINCTRL, bind) item_box.Bind(wx.EVT_TEXT, bind) item_sizer.Add(item_text, 0, wx.ALIGN_CENTER) item_sizer.Add(item_box) return {'item': item_sizer, 'text_size': item_text.GetSize()[0], 'text_ctrl': item_text}
def create_colour_picker(**kwargs): panel = kwargs.get('panel') value = kwargs.get('value') key = kwargs.get('key') bind = kwargs.get('bind') item_sizer = wx.BoxSizer(wx.HORIZONTAL) item_name = MODULE_KEY.join(key) colour_picker = CustomColourPickerCtrl() item_box = colour_picker.create(panel, value=value, event=bind, key=key) item_text = wx.StaticText(panel, label=translate_key(item_name)) item_sizer.Add(item_text, 0, wx.ALIGN_CENTER) item_sizer.Add(item_box, 1, wx.EXPAND) return {'item': item_sizer, 'text_size': item_text.GetSize()[0], 'text_ctrl': item_text}
def create_dropdown(**kwargs): panel = kwargs.get('panel') value = kwargs.get('value') key = kwargs.get('key') bind = kwargs.get('bind') gui = kwargs.get('gui') item_sizer = wx.BoxSizer(wx.HORIZONTAL) choices = gui.get('choices', []) item_name = MODULE_KEY.join(key) item_text = wx.StaticText(panel, label=translate_key(item_name)) item_box = KeyChoice(panel, id=id_renew(item_name, update=True), keys=choices, choices=choices) item_box.Bind(wx.EVT_CHOICE, bind) item_box.SetSelection(choices.index(value)) item_sizer.Add(item_text, 0, wx.ALIGN_CENTER) item_sizer.Add(item_box) return {'item': item_sizer, 'text_size': item_text.GetSize()[0], 'text_ctrl': item_text}
def __init__(self, parent): super(MyTitle, self).__init__(parent) self.SetBackgroundColour('#00b294') self.SetMinSize((-1, 80)) sizer = wx.BoxSizer() sizer.AddStretchSpacer() family = wx.FONTFAMILY_DEFAULT style = wx.FONTSTYLE_NORMAL weight = wx.FONTWEIGHT_NORMAL font = wx.Font(20, family, style, weight) self.text = wx.StaticText(self, label=TITLE, style=wx.ALIGN_CENTER) self.text.SetFont(font) sizer.Add(self.text, flag=wx.ALIGN_CENTER_VERTICAL) sizer.AddStretchSpacer() self.SetSizer(sizer)
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 create_data_view_ctrl(self): dvc = dv.DataViewCtrl(self.splitter, style=dv.DV_ROW_LINES| dv.DV_VERT_RULES|dv.DV_MULTIPLE ) UIM = UIManager() controller = UIM.get(self._controller_uid) model = controller._get_real_model() # Track dv_col = dvc.AppendTextColumn("Track", 0, width=85) dv_col.SetMinWidth(55) # Object Type dvcr_object_tid = ObjectTidRenderer() dv_col = dv.DataViewColumn("Object Type", dvcr_object_tid, 1, width=85) dv_col.SetMinWidth(85) dvc.AppendColumn(dv_col) # Object Name dvcr_curve_name = ObjectNameRenderer(model) dv_col = dv.DataViewColumn("Object Name", dvcr_curve_name, 2, width=130) dv_col.SetMinWidth(85) dvc.AppendColumn(dv_col) # Adjusting for idx, dv_col in enumerate(dvc.Columns): dv_col.Renderer.Alignment = wx.ALIGN_CENTER dv_col.SetAlignment(wx.ALIGN_CENTER) return dvc
def __init__(self, controller_uid): TopLevel.__init__(self, controller_uid) UIM = UIManager() controller = UIM.get(self._controller_uid) wx.Dialog.__init__(self, None, wx.ID_ANY, controller.model.title, pos=controller.model.pos, size=controller.model.size, style=controller.model.style ) self._objects = {} if controller.model.icon: self.icon = wx.Icon(controller.model.icon, wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) if controller.model.maximized: self.Maximize() self.Bind(wx.EVT_MAXIMIZE, self.on_maximize) self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_MOVE, self.on_move) dialog_box = wx.BoxSizer(wx.VERTICAL) self.SetSizer(dialog_box) self.mainpanel = self.AddCreateContainer('BoxSizer', self, proportion=1, flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.EXPAND, border=10 ) button_sizer = self.CreateButtonSizer(controller.model.flags) dialog_box.Add(button_sizer, flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=10) dialog_box.Layout()
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, parent, columns, df_list_ctrl): wx.Panel.__init__(self, parent) columns_with_neutral_selection = [''] + list(columns) self.columns = columns self.df_list_ctrl = df_list_ctrl self.figure = Figure(facecolor="white", figsize=(1, 1)) self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvas(self, -1, self.figure) chart_toolbar = NavigationToolbar2Wx(self.canvas) self.combo_box1 = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select) row_sizer = wx.BoxSizer(wx.HORIZONTAL) row_sizer.Add(self.combo_box1, 0, wx.ALL | wx.ALIGN_CENTER, 5) row_sizer.Add(chart_toolbar, 0, wx.ALL, 5) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, flag=wx.EXPAND, border=5) sizer.Add(row_sizer) self.SetSizer(sizer)
def __init__(self, parent, columns, df_list_ctrl): wx.Panel.__init__(self, parent) columns_with_neutral_selection = [''] + list(columns) self.columns = columns self.df_list_ctrl = df_list_ctrl self.figure = Figure(facecolor="white", figsize=(1, 1)) self.axes = self.figure.add_subplot(111) self.canvas = FigureCanvas(self, -1, self.figure) chart_toolbar = NavigationToolbar2Wx(self.canvas) self.combo_box1 = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY) self.combo_box2 = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY) self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select) row_sizer = wx.BoxSizer(wx.HORIZONTAL) row_sizer.Add(self.combo_box1, 0, wx.ALL | wx.ALIGN_CENTER, 5) row_sizer.Add(self.combo_box2, 0, wx.ALL | wx.ALIGN_CENTER, 5) row_sizer.Add(chart_toolbar, 0, wx.ALL, 5) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, flag=wx.EXPAND, border=5) sizer.Add(row_sizer) self.SetSizer(sizer)
def __init__(self): frame = wx.Frame.__init__(self, None, -1, u"????", pos=(200, 300), size=(300, 150), style=wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN) self.panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) self.labelResult = wx.StaticText( self.panel, -1, u"????/??????", size=(300, 150),style=wx.ALIGN_CENTER) sizer.Add(self.labelResult, wx.EXPAND) self.panel.SetSizer(sizer) self.labelResult.SetDropTarget(OnDropFile(self.labelResult))
def InitUI(self): sb = wx.StaticText(self, label='Stop! Open or Create new project first!') ic = wx.ArtProvider.GetBitmap( wx.ART_TIP, size=(48,48) ) icn= wx.StaticBitmap(self,-1,ic,name='Stop') lbl_mt = wx.StaticText(self, label="") vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) vbox.Add(lbl_mt,flag=wx.CENTER, border=2) vbox.Add(sb,flag=wx.CENTER, border=2) vbox.Add(icn,flag=wx.CENTER, border=0) hbox2 = wx.BoxSizer(wx.HORIZONTAL) OButton = wx.Button(self, label='Open') NButton = wx.Button(self, label='New') hbox2.Add(OButton, flag=wx.CENTER, border=2) hbox2.Add(NButton, flag=wx.LEFT, border=5) vbox.Add(hbox2,flag=wx.ALIGN_CENTER|wx.TOP|wx.BOTTOM, border=2) OButton.Bind(wx.EVT_BUTTON,self.OpenBtn) NButton.Bind(wx.EVT_BUTTON,self.NewBtn) self.Show() self.SetFocus() self.SetWindowStyle( wx.STAY_ON_TOP )
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 _prepare_for_automatic_upload(self): """Clear out anything else that happens to be on the panel before Starting an automatic upload.""" self.Freeze() self._sizer.Clear(deleteWindows=True) self._discovered_runs = [] self._run_sizer = wx.BoxSizer(wx.VERTICAL) self._upload_sizer = wx.BoxSizer(wx.HORIZONTAL) self._sizer.Add(self._run_sizer, proportion=1, flag=wx.EXPAND) self._sizer.Add(self._upload_sizer, proportion=0, flag=wx.ALIGN_CENTER) self.Layout() self.Thaw()
def _settings_changed(self, api=None): """Reset the main display and attempt to connect to the server whenever the connection settings may have changed. Args: api: A placeholder for a complete api that's passed when the event is fired. """ # before doing anything, clear all of the children from the sizer and # also delete any windows attached (Buttons and stuff extend from Window!) self._sizer.Clear(deleteWindows=True) # and clear out the list of discovered runs that we might be uploading to the server. self._discovered_runs = [] # initialize the invalid sheets panel so that it can listen for events # before directory scanning starts, but hide it until we actually get # an error raised by the validation part. self._invalid_sheets_panel = InvalidSampleSheetsPanel(self, self._get_default_directory()) self._invalid_sheets_panel.Hide() should_monitor_directory = read_config_option("monitor_default_dir", expected_type=bool, default_value=False) if should_monitor_directory: automatic_upload_status_sizer = wx.BoxSizer(wx.HORIZONTAL) auto_upload_enabled_text = wx.StaticText(self, label=u"? Automatic upload enabled.") auto_upload_enabled_text.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.BOLD)) auto_upload_enabled_text.SetForegroundColour(wx.Colour(51, 102, 255)) auto_upload_enabled_text.SetToolTipString("Monitoring {} for CompletedJobInfo.xml".format(self._get_default_directory())) self._sizer.Add(auto_upload_enabled_text, flag=wx.ALIGN_CENTER | wx.ALL, border=5) logging.info("Going to monitor default directory [{}] for new runs.".format(self._get_default_directory())) # topics to handle when monitoring a directory for automatic upload pub.subscribe(self._prepare_for_automatic_upload, DirectoryMonitorTopics.new_run_observed) pub.subscribe(self._start_upload, DirectoryMonitorTopics.finished_discovering_run) threading.Thread(target=monitor_directory, kwargs={"directory": self._get_default_directory()}).start() # run connecting in a different thread so we don't freeze up the GUI threading.Thread(target=self._connect_to_irida).start()
def _scan_directories(self): """Begin scanning directories for the default directory.""" logging.info("Starting to scan [{}] for sequencing runs.".format(self._get_default_directory())) self.Freeze() self._run_sizer = wx.BoxSizer(wx.VERTICAL) self._upload_sizer = wx.BoxSizer(wx.HORIZONTAL) self._sizer.Add(self._run_sizer, proportion=1, flag=wx.EXPAND) self._sizer.Add(self._upload_sizer, proportion=0, flag=wx.ALIGN_CENTER) self.Layout() self.Thaw() threading.Thread(target=find_runs_in_directory, kwargs={"directory": self._get_default_directory()}).start()
def _handle_connection_error(self, error_message=None): """Handle connection errors that might be thrown when initially connecting to IRIDA. Args: error_message: A more detailed error message than "Can't connect" """ logging.error("Handling connection error.") self.Freeze() connection_error_sizer = wx.BoxSizer(wx.HORIZONTAL) connection_error_header = wx.StaticText(self, label=u"? Uh-oh. I couldn't to connect to IRIDA.") connection_error_header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) connection_error_header.SetForegroundColour(wx.Colour(255, 0, 0)) connection_error_header.Wrap(350) connection_error_sizer.Add(connection_error_header, flag=wx.LEFT | wx.RIGHT, border=5) self._sizer.Add(connection_error_sizer, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) if error_message: self._sizer.Add(wx.StaticText(self, label=wordwrap(error_message, 350, wx.ClientDC(self))), flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) open_settings_button = wx.Button(self, label="Open Settings") self.Bind(wx.EVT_BUTTON, self._parent._open_settings, id=open_settings_button.GetId()) self._sizer.Add(open_settings_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self.Layout() self.Thaw() pub.unsubscribe(self._handle_connection_error, APIConnectorTopics.connection_error_topic)
def _upload_failed(self, exception=None): """The upload failed, add a button to restart the upload. Args: exception: the error that caused the upload. """ logging.info("Adding try again button on upload failure.") self.Freeze() try_again = wx.Button(self, label="Try again") self._upload_sizer.Add(try_again, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self.Bind(wx.EVT_BUTTON, self._retry_upload, id=try_again.GetId()) self.Layout() self.Thaw()
def __init__(self, parent, sheets_directory): """Initalize InvalidSampleSheetsPanel. Args: parent: the owning Window sheets_directory: the parent directory for searching sample sheets. This argument is used in the error message that's displayed to the user to tell them where to look to fix any issues. """ wx.Panel.__init__(self, parent) self._sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self._sizer) header = wx.StaticText(self, label=u"? Looks like some sample sheets are not valid.") header.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) header.SetForegroundColour(wx.Colour(255, 0, 0)) header.Wrap(350) self._sizer.Add(header,flag=wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER, border=5) self._sizer.Add(wx.StaticText(self, label=wordwrap(( "I found the following sample sheets in {}, but I couldn't understand " "their contents. Check these sample sheets in an editor outside " "of the uploader, then click the 'Scan Again' button below.").format(sheets_directory), 350, wx.ClientDC(self))), flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) self._errors_tree = wx.TreeCtrl(self, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_LINES_AT_ROOT | wx.TR_HIDE_ROOT) self._errors_tree_root = self._errors_tree.AddRoot("") self._sizer.Add(self._errors_tree, flag=wx.EXPAND, proportion=1) scan_again_button = wx.Button(self, label="Scan Again") self.Bind(wx.EVT_BUTTON, lambda evt: send_message(SettingsDialog.settings_closed_topic), id=scan_again_button.GetId()) self._sizer.Add(scan_again_button, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=5) pub.subscribe(self._sample_sheet_error, DirectoryScannerTopics.garbled_sample_sheet) pub.subscribe(self._sample_sheet_error, DirectoryScannerTopics.missing_files)
def initOptions(self): optionsSizer = wx.BoxSizer(wx.HORIZONTAL) self.filtTypeComboBox = wx.ComboBox(self, choices=self.flt.filtMap.keys(), value=self.flt.filtType, style=wx.CB_DROPDOWN) self.Bind(wx.EVT_COMBOBOX, self.setFiltType, self.filtTypeComboBox) optionsSizer.Add(self.filtTypeComboBox, proportion=1, flag=wx.LEFT | wx.TOP | wx.RIGHT | wx.ALIGN_CENTER, border=20) self.sizer.Add(optionsSizer, proportion=0)#, flag=wx.EXPAND)
def __init__(self, *args, **kwds): # begin wxGlade: Dialogo_ejecutando.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.titulo = wx.StaticText(self, wx.ID_ANY, "Accediendo al sistema: ", style=wx.ALIGN_CENTER) self.elementos = wx.StaticText(self, wx.ID_ANY, "000000", style=wx.ALIGN_CENTER) self.__set_properties() self.__do_layout() # end wxGlade
def __do_layout(self): # begin wxGlade: Dialogo_ejecutando.__do_layout grid_sizer_3 = wx.FlexGridSizer(1, 2, 0, 0) grid_sizer_3.Add(self.titulo, 0, wx.ALIGN_CENTER | wx.ALL, 4) grid_sizer_3.Add(self.elementos, 0, wx.ALIGN_CENTER | wx.ALL, 4) self.SetSizer(grid_sizer_3) grid_sizer_3.Fit(self) self.Layout() # end wxGlade # end of class Dialogo_ejecutando
def __do_layout(self): # begin wxGlade: ExtractionDialog.__do_layout sizer_15 = wx.BoxSizer(wx.HORIZONTAL) sizer_16 = wx.BoxSizer(wx.VERTICAL) sizer_19 = wx.BoxSizer(wx.HORIZONTAL) sizer_20 = wx.BoxSizer(wx.HORIZONTAL) sizer_17 = wx.BoxSizer(wx.HORIZONTAL) sizer_18 = wx.BoxSizer(wx.HORIZONTAL) sizer_21 = wx.BoxSizer(wx.HORIZONTAL) sizer_16.Add(self.panel_21, 1, 0, 0) sizer_21.Add(self.panel_22, 0, wx.EXPAND, 0) sizer_21.Add(self.label_2, 0, wx.ALIGN_CENTER, 0) sizer_21.Add(self.panel_23, 0, wx.EXPAND, 0) sizer_21.Add(self.text_ctrl_outpath, 1, wx.EXPAND, 0) sizer_21.Add(self.panel_24, 0, wx.EXPAND, 0) sizer_21.Add(self.button_browse_path, 0, wx.EXPAND, 0) sizer_21.Add(self.panel_25, 0, wx.EXPAND, 0) sizer_16.Add(sizer_21, 1, wx.EXPAND, 0) sizer_16.Add(self.panel_10, 0, wx.EXPAND, 0) sizer_18.Add(self.panel_13, 0, wx.EXPAND, 0) sizer_18.Add(self.radio_box_selection, 1, wx.EXPAND, 0) sizer_18.Add(self.panel_14, 0, wx.EXPAND, 0) sizer_17.Add(sizer_18, 1, wx.EXPAND, 0) sizer_16.Add(sizer_17, 1, wx.EXPAND, 0) sizer_16.Add(self.panel_18, 0, wx.EXPAND, 0) sizer_20.Add(self.panel_19, 0, wx.EXPAND, 0) sizer_20.Add(self.checklistbox_options, 1, wx.EXPAND, 0) sizer_20.Add(self.panel_20, 0, wx.EXPAND, 0) sizer_16.Add(sizer_20, 1, 0, 0) sizer_16.Add(self.panel_12, 0, wx.EXPAND, 0) sizer_19.Add(self.panel_15, 1, wx.EXPAND, 0) sizer_19.Add(self.button_extract, 0, 0, 0) sizer_19.Add(self.panel_16, 0, wx.EXPAND, 0) sizer_19.Add(self.button_cancel, 0, 0, 0) sizer_19.Add(self.panel_17, 0, wx.EXPAND, 0) sizer_16.Add(sizer_19, 0, wx.EXPAND, 0) sizer_16.Add(self.panel_11, 0, wx.EXPAND, 0) sizer_15.Add(sizer_16, 1, 0, 0) self.SetSizer(sizer_15) self.Layout() # end wxGlade
def __init__(self, message, title): wx.Dialog.__init__(self, None, -1, title,size=(300, 120)) self.CenterOnScreen(wx.BOTH) text = wx.StaticText(self, -1, message) ok = wx.Button(self, wx.ID_OK, "???????????????") ok.SetDefault() vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(text, 1, wx.ALIGN_CENTER|wx.TOP, 10) vbox.Add(ok, 1, wx.ALIGN_CENTER|wx.BOTTOM, 10) self.SetSizer(vbox)
def GenerateMethodButtonSizer(self): normal_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"]) mouseover_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"], underline=True) msizer = wx.BoxSizer(wx.HORIZONTAL) for confnode_method in self.Controler.ConfNodeMethods: if "method" in confnode_method and confnode_method.get("shown", True): button = GenBitmapTextButton(self.Editor, bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")), label=confnode_method["name"], style=wx.NO_BORDER) button.SetFont(normal_bt_font) button.SetToolTipString(confnode_method["tooltip"]) if confnode_method.get("push", False): button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True)) else: button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button) # a fancy underline on mouseover def setFontStyle(b, s): def fn(event): b.SetFont(s) b.Refresh() event.Skip() return fn button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font)) button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font)) # hack to force size to mini if not confnode_method.get("enabled", True): button.Disable() msizer.AddWindow(button, flag=wx.ALIGN_CENTER) return msizer
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, parent): wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'Plugin List', pos = wx.DefaultPosition, size = wx.Size( 412,500 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL ) logopath = os.path.join(root_dir, 'data/logo.ico') self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) ) self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO)) self.SetSizeHints( wx.DefaultSize, wx.DefaultSize ) bSizer1 = wx.BoxSizer( wx.VERTICAL ) bSizer2 = wx.BoxSizer( wx.HORIZONTAL ) self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, "Search:", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1.Wrap( -1 ) bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER|wx.ALL, 5 ) self.txt_search = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) bSizer2.Add( self.txt_search, 1, wx.ALL, 5 ) bSizer1.Add( bSizer2, 0, wx.EXPAND, 5 ) self.lst_plgs = VirtualListCtrl( self, ['Name', 'Shotcut']) self.lst_plgs.SetColumnWidth(0,200) self.lst_plgs.SetColumnWidth(1,200) bSizer1.Add( self.lst_plgs, 1, wx.ALL|wx.EXPAND, 5 ) self.SetSizer( bSizer1 ) self.Layout() self.Centre( wx.BOTH ) # Connect Events self.txt_search.Bind( wx.EVT_TEXT, self.on_search ) self.lst_plgs.Bind(wx.EVT_LIST_KEY_DOWN, self.on_run) self.load() self.Bind(wx.EVT_CLOSE, self.on_close)
def __init__(self, parent, title, label): wx.Dialog.__init__(self, parent, 20, title, wx.DefaultPosition, wx.Size(300, 140)) vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) buttonbox = wx.BoxSizer(wx.HORIZONTAL) fgs = wx.FlexGridSizer(3, 2, 9, 5) self.title_tc1 = wx.StaticText(self, label=label) self.tc1 = wx.TextCtrl(self, size=(150, 25)) self.max = IntCtrl( self, size=(150, 25) ) self.max.Enable( True ) self.max.Hide() fgs.AddMany([(self.title_tc1), (self.tc1, 1, wx.EXPAND)]) fgs.AddMany([(self.title_tc1), (self.max, 1, wx.EXPAND)]) fgs.AddGrowableRow(2, 1) fgs.AddGrowableCol(1, 1) hbox.Add(fgs, flag=wx.ALL | wx.EXPAND, border=15) self.b_ok = wx.Button(self, label='Ok', id=OK_DIALOG) self.b_cancel = wx.Button(self, label='Cancel', id=CANCEL_DIALOG) buttonbox.Add(self.b_ok, 1, border=15) buttonbox.Add(self.b_cancel, 1, border=15) vbox.Add(hbox, flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND) vbox.Add(buttonbox, flag=wx.ALIGN_CENTER) self.SetSizer(vbox)
def __init__(self, parent, id, title): wx.Dialog.__init__(self, parent, id, title) self.selection_idx = None self.selection_text = None vbox = wx.BoxSizer(wx.VERTICAL) stline = wx.StaticText(self, 11, 'Please select from the following components') vbox.Add(stline, 0, wx.ALIGN_CENTER|wx.TOP) self.comp_list = wx.ListBox(self, 331, style=wx.LB_SINGLE) vbox.Add(self.comp_list, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND) self.SetSizer(vbox) self.comp_list.Bind(wx.EVT_LISTBOX, self.on_selection, id=wx.ID_ANY)
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=(0, 0), size=(480, 320)) self.bitmap_1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap("./gui/products.png", wx.BITMAP_TYPE_ANY), pos=(0, 0)) products = get_products() buttonids = [] i = 0 for product in products: if product.isshown: #480x320 self.but = wx.Button(self, id=wx.ID_ANY, label=product.name + u"\n" + u"%0.2f" % product.price, pos=((i%4)*120, int(i/4)*120), size=(120, 120)) self.but.SetBackgroundColour((255-((i+int(i/4))*20 % 40), (160+((i+int(i/4))*50 % 100)), 0)) #self.but.SetForegroundColour("#006699") self.but.SetFont(wx.Font(23, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) self.but.Bind(wx.EVT_LEFT_DOWN, parent.onProduct, id=self.but.Id) i += 1 if not settings.onlyOneDrink: self.b_less = wx.Button(self, id = wx.ID_ANY, label=u"-", pos=(0,250), size=(120, 70)) self.b_less.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) self.b_less.Bind(wx.EVT_LEFT_DOWN, self.onLess, id=self.b_less.Id) self.l_amount = wx.StaticText(self, wx.ID_ANY, "%2d" % 0, pos=(137, 245), style=wx.ALIGN_CENTER) self.l_amount.SetFont(wx.Font(50, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Sans")) self.b_more = wx.Button(self, id = wx.ID_ANY, label=u"+", pos=(240,250), size=(120, 70)) self.b_more.SetFont(wx.Font(60, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) self.b_more.Bind(wx.EVT_LEFT_DOWN, self.onMore, id=self.b_more.Id) self.b_exit = wx.Button(self, id = wx.ID_ANY, label=u"x", pos=(360,250), size=(120, 70)) self.b_exit.SetFont(wx.Font(30, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans")) self.b_exit.Bind(wx.EVT_LEFT_DOWN, parent.onExit, id=self.b_exit.Id) if i <= 4: self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=(20,170), style=wx.ALIGN_CENTER) else: self.l_user = wx.StaticText(self, wx.ID_ANY, "todo", pos=((i%4)*120+20,170), style=wx.ALIGN_CENTER) self.l_user.SetFont(wx.Font(25, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Humor Sans"))
def __init__(self, parent): wx.Panel.__init__(self, parent = parent) file_drop_target = FileDropTarget(self) lbl = wx.StaticText(self, label="Drag Transactions File here:") self.fileTextCtrl = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.VSCROLL|wx.TE_READONLY) self.fileTextCtrl.SetDropTarget(file_drop_target) button = wx.Button(self, label = "Process File") button.Bind(wx.EVT_LEFT_DOWN, self.process_file) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(lbl, 1, wx.ALL, 5) sizer.Add(self.fileTextCtrl, 10, wx.EXPAND|wx.ALL, 10) sizer.Add(button, 1, wx.ALIGN_CENTER, 5) self.SetSizer(sizer) self.text = ""
def create(self, panel, value="#FFFFFF", orientation=wx.HORIZONTAL, event=None, key=None, *args, **kwargs): item_sizer = wx.BoxSizer(orientation) self.event = event self.key = key label_panel = wx.Panel(panel, style=wx.BORDER_SIMPLE) label_sizer = wx.BoxSizer(wx.HORIZONTAL) label_sizer2 = wx.BoxSizer(wx.VERTICAL) label_text = wx.StaticText(label_panel, label=unicode(value), style=wx.ALIGN_CENTER) self.text = label_text label_sizer.Add(label_text, 1, wx.ALIGN_CENTER) label_sizer2.Add(label_sizer, 1, wx.ALIGN_CENTER) label_panel.SetSizer(label_sizer2) label_panel.SetBackgroundColour(value) self.panel = label_panel button = wx.Button(panel, label=translate_key(MODULE_KEY.join(key + ['button']))) button.Bind(wx.EVT_BUTTON, self.on_button_press) border_size = wx.SystemSettings_GetMetric(wx.SYS_BORDER_Y) button_size = button.GetSize() if button_size[0] > 150: button_size[0] = 150 button_size[1] -= border_size*2 self.button = button label_panel.SetMinSize(button_size) label_panel.SetSize(button_size) item_sizer.Add(label_panel, 0, wx.ALIGN_CENTER) item_sizer.AddSpacer(2) item_sizer.Add(button, 0, wx.EXPAND) return item_sizer
def create_textctrl(**kwargs): panel = kwargs.get('panel') value = kwargs.get('value') key = kwargs.get('key') bind = kwargs.get('bind') item_sizer = wx.BoxSizer(wx.HORIZONTAL) item_name = MODULE_KEY.join(key) item_box = wx.TextCtrl(panel, id=id_renew(item_name, update=True), value=unicode(value)) item_box.Bind(wx.EVT_TEXT, bind) item_text = wx.StaticText(panel, label=translate_key(item_name)) item_sizer.Add(item_text, 0, wx.ALIGN_CENTER) item_sizer.Add(item_box) return {'item': item_sizer, 'text_size': item_text.GetSize()[0], 'text_ctrl': item_text}
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 create_inside_panel(self): self.dvc = dv.DataViewCtrl(self.panel, style=wx.BORDER_THEME | dv.DV_VERT_RULES | dv.DV_MULTIPLE | dv.DV_ROW_LINES) dv_col = self.dvc.AppendTextColumn("Seq", 0, width=45, align=wx.ALIGN_CENTER) dv_col.SetMinWidth(45) dv_col = self.dvc.AppendTextColumn("Well Name", 1, width=85) dv_col.SetMinWidth(55) dv_col = self.dvc.AppendTextColumn("Start", 2, width=85) dv_col.SetMinWidth(55) dv_col = self.dvc.AppendTextColumn("End", 3, width=85) dv_col.SetMinWidth(55) dv_col = self.dvc.AppendTextColumn("Unit", 4, width=85) dv_col.SetMinWidth(55) dv_col = self.dvc.AppendToggleColumn("Import", 5, width=90, mode=dv.DATAVIEW_CELL_ACTIVATABLE) dv_col.SetMinWidth(90) #dv_col = self.dvc.AppendTextColumn("LAS File Name", 6, width=100) #dv_col.SetMinWidth(100) #dv_col = self.dvc.AppendTextColumn("Progress", 6, width=85) dv_col = self.dvc.AppendProgressColumn ("Progress", 6, width=85)#, mode=dv.DATAVIEW_CELL_INERT) dv_col.SetMinWidth(80) for dv_col in self.dvc.Columns: dv_col.Renderer.Alignment = wx.ALIGN_CENTER dv_col.SetAlignment(wx.ALIGN_CENTER) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.dvc, 1, wx.EXPAND|wx.ALL, border=10) sizer.Add(self.getPanelBottomButtons(), 0, wx.EXPAND|wx.BOTTOM|wx.TOP) self.panel.SetSizer(sizer) self.panel.Layout()