def __init__(self): wx.Frame.__init__(self, None, title="ExcelDiffer", size=(960, 640)) self.Center() self.firstFileButton = filebrowse.FileBrowseButton(self, -1, labelText="第一个Excel文件", buttonText="选择") self.secondFileButton = filebrowse.FileBrowseButton(self, -1, labelText="第二个Excel文件", buttonText="选择") fileButtonSizer = wx.BoxSizer(wx.VERTICAL) fileButtonSizer.Add(self.firstFileButton, 0, wx.EXPAND) fileButtonSizer.Add(self.secondFileButton, 0, wx.EXPAND) self.diffButton = wx.Button(self, -1, "开始比对") fileSelectSizer = wx.BoxSizer(wx.HORIZONTAL) fileSelectSizer.Add(fileButtonSizer, 9, wx.EXPAND) fileSelectSizer.Add(self.diffButton, 1, wx.EXPAND) self.typeNB = wx.Notebook(self, -1) frameSizer = wx.BoxSizer(wx.VERTICAL) frameSizer.Add(fileSelectSizer, 1, wx.ALIGN_CENTER) frameSizer.Add(self.typeNB, 9, wx.EXPAND) self.SetSizer(frameSizer) self.Bind(wx.EVT_BUTTON, self.Diff, self.diffButton) self.Show()
def initialize(self): tfsbsz = leginon.gui.wx.TargetFinder.ScrolledSettings.initialize(self) if self.show_basic: return tfsbsz else: sb = wx.StaticBox(self, -1, 'Matlab Module') sbsz = wx.StaticBoxSizer(sb, wx.VERTICAL) #leginon.gui.wx.Settings.Dialog.initialize(self) # self.widgets['test image'] = filebrowse.FileBrowseButton(self, # labelText='Test Image:', fileMask='*.mrc') self.widgets['module path'] = filebrowse.FileBrowseButton( self, labelText='Matlab File:', fileMask='*.m') sz = wx.GridBagSizer(5, 5) # sz.Add(self.widgets['test image'], (0, 0), (1, 1), # wx.ALIGN_CENTER_VERTICAL) sz.Add(self.widgets['module path'], (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL) self.widgets['parametergui path'] = filebrowse.FileBrowseButton( self, labelText='Matlab GUI File:', fileMask='*.m') sz.Add(self.widgets['parametergui path'], (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL) paramguibut = wx.Button(self, -1, 'Run parametrization GUI') self.Bind(wx.EVT_BUTTON, self.onRunParamGUI, paramguibut) sz.Add(paramguibut, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL) sbsz.Add(sz, 1, wx.EXPAND | wx.ALL, 5) return tfsbsz + [sbsz]
def make_fb(self): # get current working directory self.dirnm = os.getcwd() self.cc2 = filebrowse.FileBrowseButton( self, -1, size=(50, -1), labelText='NDVI:', startDirectory=self.dirnm, fileMode=wx.OPEN, changeCallback=self.fbbCallback2, ) self.cc3 = filebrowse.FileBrowseButton( self, -1, size=(50, -1), labelText='Band7:', startDirectory=self.dirnm, fileMode=wx.OPEN, changeCallback=self.fbbCallback3) self.cc6 = filebrowse.FileBrowseButton( self, -1, size=(50, -1), labelText='OUT File: ', startDirectory=self.dirnm, fileMask='*.tif', fileMode=wx.SAVE, changeCallback=self.fbbCallback6)
def __init__(self, parent): wiz.WizardPageSimple.__init__(self, parent) border = 4 vbs = wx.BoxSizer(wx.VERTICAL) vbs.Add(wx.StaticText( self, label= _('Specify the Excel File containing TT Start Times in HH:MM:SS format.' )), flag=wx.ALL, border=border) vbs.Add(wx.StaticText( self, label=_('Each race must be in a separate sheet.')), flag=wx.ALL, border=border) vbs.Add(wx.StaticText( self, label= _('This is the Stopwatch Time usually beginning at 00:01:00, with 30 to 60 second gaps - not the clock time.' )), flag=wx.ALL, border=border) fileMask = [ 'Excel Worksheets (*.xlsx;*.xlsm;*.xls)|*.xlsx;*.xlsm;*.xls', ] self.fbb = filebrowse.FileBrowseButton(self, size=(450, -1), labelText='Excel Workbook:', fileMode=wx.OPEN, fileMask='|'.join(fileMask)) vbs.Add(self.fbb, flag=wx.ALL, border=border) self.SetSizer(vbs)
def __init__(self, parent, plugin, default_filename=None): self.plugin = plugin title = "Load scan" wx.adv.WizardPageSimple.__init__(self, parent) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) titleText = wx.StaticText(self, -1, title) titleText.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) self.sizer.Add(titleText, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.sizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 5) self.filebrowser = filebrowse.FileBrowseButton( self, -1, startDirectory='.', size=(450, -1), changeCallback=self.filebrowser_callback, fileMode=wx.FD_OPEN) self.filebrowser.textControl.Disable() self.sizer.Add(self.filebrowser, 0, wx.EXPAND | wx.ALL, 10) chooserText = wx.StaticText(self, -1, "Select the scans to load") self.sizer.Add(chooserText, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.scanchooser = wx.CheckListBox(self, -1) self.sizer.Add(self.scanchooser, 1, wx.EXPAND | wx.ALL, 2) self.Bind(wx.adv.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging) self.scanchooser.Bind(wx.EVT_CHECKLISTBOX, self.OnScanSelected) self.SetControlEnable(wx.ID_FORWARD, False) # Load the defualt spec file - if exists if default_filename: self.filebrowser.SetValue(default_filename) self.load_file(default_filename)
def __init__(self, parent, entity_list=[]): wx.Dialog.__init__(self, parent, -1, "Export selected entities", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.TAB_TRAVERSAL | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX) self.entity_list = entity_list self.button_select_all = wx.Button(self, -1, "Select All") self.button_clear_all = wx.Button(self, -1, "Clear All") self.checklist_entity = wx.CheckListBox(self, -1) default_path = guisettings.Repository.getsettingvalue( guisettings.ID_DefaultEntityExportPath) self.button_browse_file = filebrowse.FileBrowseButton( self, -1, size=(400, -1), labelText="Save to ", buttonText="Browse", startDirectory=default_path, initialValue=default_path + "\entities.n2", fileMask="*.n2") self.button_ok = wx.Button(self, -1, "&OK") self.button_cancel = wx.Button(self, -1, "&Cancel") self.set_properties() self.do_layout() self.bind_events()
def ImportData(self): global colList, n1, n2 colList = [] n1 = 1 n2 = 0 imbmpreset = wx.Bitmap(os.path.normpath(os.getcwd() + "\\reset.jpg")) self.impresetb = buttons.GenBitmapButton(self.panelB, -1, imbmpreset, pos=(630, 10), style=wx.BORDER_NONE) self.Bind(wx.EVT_BUTTON, self.resetImportData, self.impresetb) global fontim fontim = wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD) wx.StaticText(self.panelB, -1, "Import Sheets ", (20, 20)).SetFont(self.font) self.fbbimp = filebrowse.FileBrowseButton( self.panelB, -1, size=(470, -1), pos=(70, 95), changeCallback=self.ImpfbbCallback) self.fbbimp.SetLabel("Select File") self.ImpCreateEditb() self.ImpCreateDoneb()
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=-1, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX) # Bandeau titre = _(u"Transférer des tables") intro = _(u"Cette fonctionnalité permet de transférer le contenu des tables du fichier de données chargé vers un fichier de données local.") self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Configuration.png") self.SetTitle(titre) self.label_destination = wx.StaticText(self, -1, _(u"Fichier de destination :")) wildcard = _(u"Fichiers Noethys (*.dat)|*.dat|All files (*.*)|*.*") self.ctrl_destination = filebrowse.FileBrowseButton(self, -1, labelText=u"", buttonText=_(u"Sélectionner"), toolTip=_(u"Cliquez ici pour sélectionner un fichier de données"), dialogTitle=_(u"Sélectionner un fichier"), fileMask=wildcard) self.label_destination_copy = wx.StaticText(self, -1, _(u"Tables à transférer :")) DB = GestionDB.DB() listeTablesTemp = DB.GetListeTables() DB.Close() listeTables = [] for x in listeTablesTemp : listeTables.append(x[0]) self.ctrl_tables = wx.CheckListBox(self, -1, (-1, -1), wx.DefaultSize, listeTables) self.bouton_aide = CTRL_Bouton_image.CTRL(self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_ok = CTRL_Bouton_image.CTRL(self, texte=_(u"Ok"), cheminImage="Images/32x32/Valider.png") self.bouton_annuler = CTRL_Bouton_image.CTRL(self, texte=_(u"Annuler"), cheminImage="Images/32x32/Annuler.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonOk, self.bouton_ok) self.Bind(wx.EVT_BUTTON, self.OnBoutonAnnuler, self.bouton_annuler)
def __init__(self, parent, giface): ImportDialog.__init__(self, parent, giface=giface, itype='dxf', title=_("Import DXF layers")) self.list.SetValidator( LayersListValidator(condition='vector', callback=self._nameValidationFailed)) self._giface = giface self.dsnInput = filebrowse.FileBrowseButton( parent=self.panel, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE, labelText='', dialogTitle=_('Choose DXF file to import'), buttonText=_('Browse'), startDirectory=os.getcwd(), fileMode=0, changeCallback=self.OnSetDsn, fileMask="DXF File (*.dxf)|*.dxf") self.add.SetLabel(_("Add imported layers into layer tree")) self.add.SetValue( UserSettings.Get(group='cmd', key='addNewLayer', subkey='enabled')) self.doLayout()
def __init__(self, config, parent): """Create a configuration component based on the given ConfigParser. Arguments: config -- A ConfigParser object. parent -- This component's parent component. """ wx.Panel.__init__(self, parent, size=CONFIG_PANEL_SIZE) self.config = config sizer = wx.BoxSizer(wx.VERTICAL) dict_file = config.get(conf.DICTIONARY_CONFIG_SECTION, conf.DICTIONARY_FILE_OPTION) dict_file = os.path.join(conf.CONFIG_DIR, dict_file) dict_dir = os.path.split(dict_file)[0] self.file_browser = filebrowse.FileBrowseButton( self, labelText=DICT_FILE_LABEL, fileMask='*' + conf.JSON_EXTENSION, fileMode=wx.OPEN, dialogTitle=DICT_FILE_DIALOG_TITLE, initialValue=dict_file, startDirectory=dict_dir, ) sizer.Add(self.file_browser, border=UI_BORDER, flag=wx.ALL | wx.EXPAND) self.SetSizer(sizer)
def box_file_sys_access(self, panel): box = wx.StaticBox(panel, -1, 'File system access') sizerBox = wx.StaticBoxSizer(box, wx.VERTICAL) sizerFile = wx.GridBagSizer() self.gridCount = 0 self.rFile = wx.TextCtrl(panel, -1, size=SIZE) self.rFile.SetToolTip( wx.ToolTip('Read a file from the back-end DBMS file system')) self.set_label(sizerFile, panel, 'file-read', self.rFile) self.wFile = fbrows.FileBrowseButton(panel, -1) self.wFile.SetLabel('file-write') self.wFile.SetToolTip( wx.ToolTip('Write a local file on the back-end DBMS file system')) self.dFile = wx.TextCtrl(panel, -1, size=SIZE) self.dFile.SetToolTip( wx.ToolTip('Back-end DBMS absolute filepath to write to')) self.set_label(sizerFile, panel, 'file-dest', self.dFile) sizerBox.Add(self.wFile, 0, wx.EXPAND) sizerBox.Add(sizerFile, 0, wx.EXPAND) return sizerBox
def __init__(self, *args, **kwargs): wx.Dialog.__init__(self, *args, **kwargs) self.SetSize((550, 500)) self.fbb = filebrowse.FileBrowseButton(self, -1, (0, 0), size=(450, -1), labelText="File", changeCallback=self.fbbCallback) wx.StaticText(self, -1, "Port mapping", (20, 40)) self.gd_portmap = PortMapGrid(self, -1, (0, 60), (220, 300)) wx.StaticText(self, -1, "Chart Type", (260, 40)) self.cmb_charttype = wx.ComboBox(self, -1, "Grid dB-Mag", (260, 60), (160, -1), ["Grid dB-Mag", "Grid Angle"], wx.CB_DROPDOWN | wx.CB_READONLY) wx.StaticText(self, -1, "Curves", (260, 90)) self.clb_splist = wx.CheckListBox(self, -1, (260, 110), (160, 250)) posy = 110 self.btn_spfilter = [] for b in ["CC", "CD", "DC", "DD"]: btn = buttons.GenToggleButton(self, -1, "All %s's" % b, (440, posy)) posy += 30 self.btn_spfilter.append(btn) btn.Bind(wx.EVT_BUTTON, self.OnSPFilter) wx.Button(self, wx.ID_OK, "OK", (100, 400)) wx.Button(self, wx.ID_CANCEL, "Cancel", (200, 400))
def __init__(self, parent, log): wx.Panel.__init__(self, parent) self.log = log self.dbb = filebrowse.DirBrowseButton(self, -1, size=(450, -1), buttonText=u'瀏覽', labelText=u'圖片檔案位置:', changeCallback=self.dbbCallback) self.dbb1 = filebrowse.FileBrowseButton( self, -1, size=(450, -1), buttonText=u'瀏覽', labelText=u'DBF檔案位置:', changeCallback=self.dbbCallback) b = wx.Button(self, 40, u'RUN', (500, 28), style=wx.NO_BORDER) self.Bind(wx.EVT_BUTTON, self.OnClick, b) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.dbb, 0, wx.ALL, 5) sizer.Add(self.dbb1, 0, wx.ALL, 5) box = wx.BoxSizer() box.Add(sizer, 0, wx.ALL, 20) b.SetInitialSize() self.SetSizer(box)
def __init__(self, parent): wiz.WizardPageSimple.__init__(self, parent) border = 4 vbs = wx.BoxSizer(wx.VERTICAL) vbs.Add(wx.StaticText( self, label= _('Specify the Excel File containing additional rider information.' )), flag=wx.ALL, border=border) vbs.Add(wx.StaticText( self, label=_('Each race must be in a separate sheet.')), flag=wx.ALL, border=border) vbs.Add(wx.StaticText(self, label=_('See documentation for examples.')), flag=wx.ALL, border=border) fileMask = [ 'Excel Worksheets (*.xlsx;*.xlsm;*.xls)|*.xlsx;*.xlsm;*.xls', ] self.fbb = filebrowse.FileBrowseButton(self, size=(450, -1), labelText=_('Excel Workbook:'), fileMode=wx.OPEN, fileMask='|'.join(fileMask)) vbs.Add(self.fbb, flag=wx.ALL, border=border) self.SetSizer(vbs)
def __init__(self, parent): wx.adv.WizardPageSimple.__init__(self, parent) border = 4 vbs = wx.BoxSizer(wx.VERTICAL) vbs.Add(wx.StaticText( self, wx.ID_ANY, _('Specify the Excel File containing the Results info.')), flag=wx.ALL, border=border) vbs.Add(wx.StaticText(self, wx.ID_ANY, _('Each result must be in a separate sheet.')), flag=wx.ALL, border=border) fileMask = [ 'Excel Worksheets (*.xlsx;*.xlsm;*.xls)|*.xlsx;*.xlsm;*.xls', ] self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), labelText='Excel Workbook:', fileMode=wx.FD_OPEN, fileMask='|'.join(fileMask)) vbs.Add(self.fbb, flag=wx.ALL, border=border) self.SetSizer(vbs)
def __init__(self, *args, **kwds): self.parent = kwds["parent"] # begin wxGlade: PyDbgDialog.__init__ kwds["style"] = wx.DEFAULT_DIALOG_STYLE wx.Dialog.__init__(self, *args, **kwds) self.retrieve_list = wx.Button(self, -1, "Retrieve List") self.process_list = _PAIMEIpeek.ProcessListCtrl.ProcessListCtrl( self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER, top=self.parent) self.load_target = filebrowse.FileBrowseButton( self, -1, labelText="", fileMask="*.exe", fileMode=wx.OPEN, toolTip="Specify the target executable to load") self.attach_or_load = wx.Button(self, -1, "Attach / Load") self.cancel = wx.Button(self, wx.ID_CANCEL) self.__set_properties() self.__do_layout() # end wxGlade # event bindings. self.Bind(wx.EVT_BUTTON, self.process_list.on_retrieve_list, self.retrieve_list) self.Bind(wx.EVT_BUTTON, self.on_attach_or_load, self.attach_or_load) self.process_list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.process_list.on_select)
def __init__(self, parent, ID, log): wx.Panel.__init__(self, parent, ID) self.log = log self.fbb = filebrowse.FileBrowseButton(self, -1, size=(450, -1), changeCallback=self.fbbCallback) self.fbbh = filebrowse.FileBrowseButtonWithHistory( self, -1, size=(450, -1), changeCallback=self.fbbhCallback) self.dbb = filebrowse.DirBrowseButton(self, -1, size=(450, -1), changeCallback=self.dbbCallback) self.fbbh.callCallback = False self.fbbh.SetHistory( ['You', 'can', 'put', 'some', 'filenames', 'here'], 4) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.fbb, 0, wx.ALL, 5) sizer.Add(self.fbbh, 0, wx.ALL, 5) sizer.Add(self.dbb, 0, wx.ALL, 5) box = wx.BoxSizer() box.Add(sizer, 0, wx.ALL, 20) self.SetSizer(box)
def _checkArg(self, name): """Create an option in WX :param str name: the name of command to parse """ sizer = wx.BoxSizer(wx.HORIZONTAL) # check what is the module if name == 'modis_convert.py' or name == 'modis_parse.py' or \ name == 'modis_quality.py': ltext = 'File HDF [%s]' % STREQUIRED self.htext = 'Select HDF file' self.typecont = 'file' elif name == 'modis_download.py' or \ name == 'modis_download_from_list.py': ltext = 'Destination Folder [%s]' % STREQUIRED self.htext = 'Select directory where save MODIS files' self.typecont = 'dir' elif name == 'modis_mosaic.py': ltext = 'File containig HDF list [%s]' % STREQUIRED self.htext = 'Select file containig a list of MODIS file' self.typecont = 'file' elif name == 'modis_multiparse.py': ltext = 'List of HDF file [%s]' % STREQUIRED self.htext = 'List of MODIS files' self.typecont = 'mfile' else: ltext = 'Test' self.htext = 'Test' label = wx.StaticText(self, -1, ltext) label.SetHelpText(self.htext) sizer.Add(item=label, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTRE_VERTICAL | wx.ALL, border=5) if self.typecont == 'dir': self.arg_ctrl = filebrowse.DirBrowseButton( self, id=wx.ID_ANY, labelText='', dialogTitle=self.htext, buttonText='Browse', startDirectory=os.getcwd(), changeCallback=self.onText, size=TEXTCTRL_SIZE) elif self.typecont in ['file', 'mfile']: self.arg_ctrl = filebrowse.FileBrowseButton( self, id=wx.ID_ANY, fileMask='*', labelText='', dialogTitle=self.htext, buttonText='Browse', startDirectory=os.getcwd(), fileMode=wx.OPEN, changeCallback=self.onText, size=TEXTCTRL_SIZE) sizer.Add(item=self.arg_ctrl, flag=wx.ALIGN_RIGHT | wx.ALL, border=5) return sizer
def add_file_browse_field(parent, editable=True, **kwargs): kw = get_file_browse_default_args() kw.update(kwargs) kw.update(mode=wx.FD_OPEN if kw['mode'] == 'open' else wx.FD_SAVE) fbb = filebrowse.FileBrowseButton(parent, **fill_keywords(kw)) fbb.textControl.SetEditable(editable) return fbb
def make_fb(self): # get current working directory self.dirnm = os.getcwd() self.cc0 = filebrowse.FileBrowseButton( self, -1, size=(50, -1), labelText='.met File:', startDirectory = self.dirnm, fileMask='*.met', fileMode=wx.OPEN, changeCallback = self.fbbCallback0, ) self.cc1 = filebrowse.FileBrowseButton( self, -1, size=(50, -1), labelText='out File: ', startDirectory = self.dirnm, fileMask='*.tif', fileMode=wx.SAVE, changeCallback = self.fbbCallback1 )
def initPanel(self): gbs = wx.GridBagSizer(5, 5) hint = "Modifiez une couleur en cliquant dessus" gbs.Add(wx.StaticText(self.panel, wx.ID_ANY, hint), (0, 0), (1, 6), wx.ALIGN_CENTER | wx.ALL, 5) for i, color in enumerate(EditColorFrame.Colors): if i < 8: y = i + 1 x = 0 else: y = i - 8 + 1 x = 4 gbs.Add(wx.StaticText(self.panel, wx.ID_ANY, color + " :"), (y, x), flag=wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, border=5) r, g, b, a = self.colors[color].Get() data = [r, g, b] data = array.array('B', data) img = wx.Image(1, 1, data).Rescale(20, 20) n_id = wx.NewId() bmp = wx.StaticBitmap(self.panel, n_id, img.ConvertToBitmap(), name=color) gbs.Add(bmp, (y, x + 1), flag=wx.EXPAND) bmp.Bind(wx.EVT_LEFT_DOWN, self.onEditColor, id=n_id) gbs.SetEmptyCellSize((1, 1)) gbs.Add( wx.StaticLine(self.panel, -1, size=(200, 1), style=wx.LI_HORIZONTAL), (9, 0), (1, 6), wx.ALIGN_CENTER | wx.EXPAND | wx.LEFT | wx.RIGHT, 10) self.fb = fb.FileBrowseButton(self.panel, wx.ID_ANY, labelText="Charger depuis un fichier :", buttonText="Parcourir", toolTip="", dialogTitle="Choisissez un fichier", changeCallback=self.onChooseFile) gbs.Add(self.fb, (10, 0), (1, 6), wx.EXPAND, 5) gbs.Add( wx.Button(self.panel, ID_APPLY_COLORSCHEME, "Appliquer les modifications"), (11, 0), (1, 3), wx.EXPAND, 5) gbs.Add(wx.Button(self.panel, ID_SAVE_COLORSCHEME, "Enregistrer"), (11, 3), (1, 3), wx.EXPAND, 5) self.panel.SetSizer(gbs) boxsizer = wx.BoxSizer() boxsizer.Add(self.panel) self.SetSizer(boxsizer) self.Fit() # events binding self.Bind(wx.EVT_CLOSE, self.onClose) self.Bind(wx.EVT_BUTTON, self.onSaveColors, id=ID_SAVE_COLORSCHEME) self.Bind(wx.EVT_BUTTON, self.onApplyColors, id=ID_APPLY_COLORSCHEME) self.Bind(EVT_RESET_PANEL, self.onResetPanel)
def add_file_browse_history_field(parent, editable=True, history=None, file_list=[], **kwargs): kw = get_file_browse_default_args() kw.update(name='fileBrowseButtonWithHistory', history=history) kw.update(kwargs) kw.update(mode=wx.FD_OPEN if kw['mode'] == 'open' else wx.FD_SAVE) fbbh = filebrowse.FileBrowseButton(parent, **fill_keywords(kw)) fbbh.textControl.SetEditable(editable) return fbbh
def __init__(self, parent): super(self.__class__, self).__init__(parent) inFile = filebrowse.FileBrowseButton(self, -1, changeCallback=self.OnInFile) outFile = filebrowse.FileBrowseButton(self, -1, changeCallback=self.OnOutFile) submit = wx.Button(self, label='Convert') self.Bind(wx.EVT_BUTTON, self.OnClick, submit) #Sizer vSizer = wx.BoxSizer(wx.VERTICAL) vSizer.Add(inFile, 1, wx.GROW) vSizer.Add(outFile, 1, wx.GROW) vSizer.Add(submit, 1, wx.GROW)
def __init__(self, panel, name, fit, hideable=False, fieldsActivation=None): wx.BoxSizer.__init__(self, wx.VERTICAL) self.name = name self.fit = fit self.hideable = hideable self.fieldsActivation = fieldsActivation self.config = get_param_config() self.initDir = self.config.getLoadDir() self.sizerHFile = wx.BoxSizer(wx.HORIZONTAL) self.sizerHSRS = wx.BoxSizer(wx.HORIZONTAL) if hideable == True: self.checkBox = wx.CheckBox(panel, -1, name) self.checkBox.SetFont(blockFont) self.checkBox.Bind(wx.EVT_CHECKBOX, self.checked) self.Add(self.checkBox) self.uploadLabel = wx.StaticText(panel, label=('Upload %s' % name), size=fbbTitleSize) self.sizerHFile.Add(self.uploadLabel, flag=wx.ALIGN_CENTER_VERTICAL) self.filePath = fbb.FileBrowseButton(panel, labelText="", initialValue="", size=fbbSize, startDirectory=self.initDir, fileMask="*.shp", fileMode=wx.OPEN) self.filePath.textControl.Bind(wx.EVT_TEXT, self.getEPSG) self.sizerHFile.Add(self.filePath) self.Add(self.sizerHFile) self.uploadSRSLabel = wx.StaticText(panel, label=('%s SRS' % name), size=labelSize) self.sizerHSRS.Add(self.uploadSRSLabel, flag=wx.ALIGN_CENTER_VERTICAL) self.fileSRS = wx.ComboBox(panel, style=wx.CB_DROPDOWN, size=labelSize) self.fileSRS.Bind(wx.EVT_TEXT, self.autoCompleteSRS) self.sizerHSRS.Add(self.fileSRS, flag=wx.ALIGN_CENTER_VERTICAL) self.img = wx.Image(clearImgPath, wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.bitmap = wx.StaticBitmap(panel, -1, self.img) self.bitmap.Bind(wx.EVT_LEFT_UP, self.clearValue) self.sizerHSRS.Add(self.bitmap, flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=2 * margin) self.Add(self.sizerHSRS) self.show()
def __init__(self, parent, title, filebrowsesettings): myWizardPage.__init__(self, parent, title) self.fbbh = filebrowse.FileBrowseButton(self, -1, size=(480, -1), buttonText=_('Browse') + ' ...', **filebrowsesettings) self.sizer.Add(self.fbbh, 0, wx.ALL, 5) self.SetSizer(self.sizer)
def __init__(self, parent, id, configParser, configStringTextNodeVar, _size): """ """ # Call superclass constructors ConfigControl.__init__(self, parent, configParser, configStringTextNodeVar) wx.BoxSizer.__init__(self, wx.HORIZONTAL) # Controls if self.configVar.setting.choose == 'file': file = self.configVar.getVal() #path = file[:file.rfind(os.path.sep)] #file = file[file.rfind(os.path.sep):] self.ctrl = filebrowse.FileBrowseButton( self.parent, -1, size=_size, labelText='', buttonText='Browse', toolTip=self.configVar.setting.description, startDirectory=file, initialValue=file, changeCallback=self.callback) self.ctrl.textControl.Bind(wx.EVT_KILL_FOCUS, self.callback) elif self.configVar.setting.choose == 'path': self.ctrl = filebrowse.DirBrowseButton( self.parent, -1, size=_size, labelText='', toolTip=self.configVar.setting.description, startDirectory=os.path.join(os.getcwd(), self.configVar.getVal()), changeCallback=self.callback) self.ctrl.textControl.Bind(wx.EVT_KILL_FOCUS, self.callback) self.ctrl.SetValue( os.path.join(os.getcwd(), self.configVar.getVal()), 0) else: self.ctrl = wx.TextCtrl(self.parent, id, self.configVar.getVal(), size=_size) self.ctrl.Bind(wx.EVT_KILL_FOCUS, self.callback) textLabel = wx.StaticText(self.parent, -1, self.configVar.setting.displayName) # Tooltip textLabel.SetToolTip(wx.ToolTip(self.configVar.setting.description)) self.ctrl.SetToolTip(wx.ToolTip(self.configVar.setting.description)) # Add controll to the sizer self.Add(textLabel, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTRE_VERTICAL) self.Add(self.ctrl, 1, wx.EXPAND | wx.ALL, 5) # Binding self.ctrl.Bind(wx.EVT_KEY_DOWN, self.onOK)
def get_visual(self, parent): import wx.lib.filebrowsebutton as filebrowse self.fbb = filebrowse.FileBrowseButton( parent, labelText=_('DB file:'), buttonText=_('Open'), dialogTitle=_("Open main database file"), fileMask=_("NIST*AIDS-83 database format|pdf2.dat"), fileMode=wx.OPEN, size=wx.Size(300, -1), initialValue=self.data["main_file"]) return self.fbb
def create_file(self, key, label, choices=None): sizer = self.GetSizer() hbox = wx.BoxSizer(wx.HORIZONTAL) entry = filebrowse.FileBrowseButton( self, -1, size=(450, -1), labelText=label, changeCallback=self.on_path_changed) hbox.Add(entry, 0, wx.LEFT, self.border) sizer.Add(hbox, 0, wx.ALL | wx.EXPAND, 0) return entry
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, style=wx.DEFAULT_DIALOG_STYLE) self.parent = parent # Bandeau titre = _(u"Import/Export de traductions au format texte") intro = _(u"Sélectionnez une langue dans la liste puis exportez ou importez les textes au format TXT.") self.SetTitle(titre) self.ctrl_bandeau = CTRL_Bandeau.Bandeau(self, titre=titre, texte=intro, hauteurHtml=30, nomImage="Images/32x32/Traduction.png") # Langue self.box_langue_staticbox = wx.StaticBox(self, -1, _(u"Langue")) self.ctrl_langues = CTRL_Langue(self) # Exporter self.box_exporter_staticbox = wx.StaticBox(self, -1, _(u"Exporter")) self.check_nontraduits = wx.CheckBox(self, -1, _(u"Inclure uniquement les textes non traduits")) self.check_nontraduits.SetValue(True) self.bouton_exporter = CTRL_Bouton_image.CTRL(self, texte=_(u"Exporter"), cheminImage="Images/32x32/Fleche_haut.png") self.bouton_exporter.SetMinSize((400, -1)) # Importer self.box_importer_staticbox = wx.StaticBox(self, -1, _(u"Importer")) wildcard = _(u"Fichiers texte|*.txt|Tous les fichiers (*.*)|*.*") sp = wx.StandardPaths.Get() cheminDefaut = sp.GetDocumentsDir() self.ctrl_fichier_importer_original = filebrowse.FileBrowseButton(self, -1, labelText=_(u"Fichier des textes originaux :"), buttonText=_(u"Sélectionner"), toolTip=_(u"Cliquez ici pour sélectionner un fichier"), dialogTitle=_(u"Sélectionner un fichier"), fileMask=wildcard, startDirectory=cheminDefaut) self.ctrl_fichier_importer_traduction = filebrowse.FileBrowseButton(self, -1, labelText=_(u"Fichier des textes traduits :"), buttonText=_(u"Sélectionner"), toolTip=_(u"Cliquez ici pour sélectionner un fichier"), dialogTitle=_(u"Sélectionner un fichier"), fileMask=wildcard, startDirectory=cheminDefaut) self.bouton_importer = CTRL_Bouton_image.CTRL(self, texte=_(u"Importer"), cheminImage="Images/32x32/Fleche_bas.png") self.bouton_aide = CTRL_Bouton_image.CTRL(self, texte=_(u"Aide"), cheminImage="Images/32x32/Aide.png") self.bouton_fermer = CTRL_Bouton_image.CTRL(self, texte=_(u"Fermer"), cheminImage="Images/32x32/Fermer.png") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnBoutonExporter, self.bouton_exporter) self.Bind(wx.EVT_BUTTON, self.OnBoutonImporter, self.bouton_importer) self.Bind(wx.EVT_BUTTON, self.OnBoutonAide, self.bouton_aide) self.Bind(wx.EVT_BUTTON, self.OnBoutonFermer, self.bouton_fermer)
def __init__(self, usb_device, file_name, title="Set Title!", size=(200, 200)): wx.Dialog.__init__(self, None, -1, title, size=(500, 300)) self.SetBackgroundColour("lightgray") # self.ports = get_possible_ports() # if (usb_device not in self.ports): # if (len(self.ports) > 0): # usb_device = self.ports[0] # else: # usb_device = "" usb_device = "" self.usb_ctrl = wx.ComboBox(self, -1, value=usb_device, choices=self.ports, size=(150,-1)) self.grid = wx.GridBagSizer(5,5) self.usb_prompt = wx.StaticText(self, -1, "USB Device:") self.progress_prompt = wx.StaticText(self, -1, "Download progress:") #self.usb_ctrl = wx.TextCtrl(self, -1, value=usb_device, size=(200,-1)) self.gauge = wx.Gauge(self, -1, range=100) self.start = wx.Button(self, -1, "Start Download") self.cancel = wx.Button(self, -1, "Cancel Download") self.help_text = wx.StaticText(self, -1, "") self.file_browse = fbb.FileBrowseButton(self, -1, labelText="Intel Hex File:", dialogTitle="Find an Intel Hex File", fileMode=wx.OPEN, fileMask="Hex files (*.hex)|*.hex|All files (*.*)|*.*") self.file_browse.SetBackgroundColour("lightgray") self.grid.Add(self.file_browse, (1,1), span=(1,3), flag=wx.EXPAND) self.grid.Add(self.usb_prompt, (2,1), flag=wx.ALIGN_RIGHT|wx.ALIGN_CENTRE_VERTICAL) self.grid.Add(self.usb_ctrl, (2,2), flag=wx.ALIGN_LEFT|wx.ALIGN_CENTRE_VERTICAL) self.grid.Add(self.progress_prompt, (4,1), span=(1,2), flag=wx.EXPAND) self.grid.Add(self.gauge, (5,1), span=(1,3), flag=wx.EXPAND) self.grid.Add(self.help_text, (6,1), span=(2,2), flag=wx.EXPAND) self.grid.AddGrowableRow(7) self.grid.Add(self.cancel, (8,2), flag=wx.ALIGN_RIGHT | wx.BOTTOM) self.grid.Add(self.start, (8,3), flag=wx.ALIGN_LEFT | wx.BOTTOM) self.grid.Add((1,1), (9,2)) self.SetSizer(self.grid) self.Layout() self.start.SetDefault() self.Bind(wx.EVT_BUTTON, self.on_start, self.start) self.Bind(wx.EVT_BUTTON, self.on_cancel, self.cancel)