def __init__(self, *args, **kw): # ensure the parent's __init__ is called super(HelloFrame, self).__init__(*args, **kw) # create a panel in the frame pnl = wx.Panel(self) # put some text with a larger bold font on it st = wx.StaticText(pnl, label="Hello World!") font = st.GetFont() font.PointSize += 10 font = font.Bold() st.SetFont(font) fc = wx.FileCtrl(pnl) # and create a sizer to manage the layout of child widgets sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(st, wx.SizerFlags().Border(wx.TOP | wx.LEFT, 25)) sizer.Add(fc) pnl.SetSizer(sizer) # create a menu bar self.makeMenuBar() # and a status bar self.CreateStatusBar() self.SetStatusText("Welcome to wxPython!")
def test_filectrl5(self): fc = wx.FileCtrl(self.frame, defaultDirectory=os.path.dirname(__file__), defaultFilename=os.path.basename(__file__), style=wx.FC_OPEN | wx.FC_MULTIPLE) self.assertEqual(fc.GetFilenames(), [os.path.basename(__file__)]) self.assertEqual(fc.GetPaths(), [__file__]) self.assertEqual(fc.Filenames, [os.path.basename(__file__)]) self.assertEqual(fc.Paths, [__file__])
def test_filectrl4(self): fc = wx.FileCtrl(self.frame, defaultDirectory=os.path.dirname(__file__), defaultFilename=os.path.basename(__file__), style=wx.FC_OPEN) self.assertEqual(fc.GetFilename(), os.path.basename(__file__)) self.assertEqual(fc.GetPath(), __file__) self.assertEqual(fc.Filename, os.path.basename(__file__)) self.assertEqual(fc.Path, __file__)
def CreateBrowsePanel(self, main_sizer): sizer = wx.BoxSizer(wx.VERTICAL) panel = wx.Panel(self, -1) self.filectrl = wx.FileCtrl(panel, wx.ID_ANY, '.') load_button_panel = wx.Panel(panel, -1) btn_load_file = wx.Button(load_button_panel, -1, "Load File") sizer.Add(self.filectrl, 9, wx.EXPAND) sizer.Add(load_button_panel, 1, wx.EXPAND) panel.SetSizer(sizer) main_sizer.Add(panel, 2, wx.EXPAND) self.filectrl.Bind(wx.EVT_FILECTRL_FILEACTIVATED, self.LoadFile) btn_load_file.Bind(wx.EVT_BUTTON, self.LoadFile)
def initCtrls(self): self.panel = wx.Panel(self, -1) self.plog = wx.Panel(self, -1) self.pbutton = wx.Panel(self, -1) self.pctrls = wx.Panel(self.panel, -1) wc = IMPORT_DIALOG_WILDCARD self.fctrl = wx.FileCtrl(self.panel, -1, wildCard=wc) self.grid = ui.DataGrid(self.panel, (10, 1)) self.grid.SetRowLabelSize(0) self.grid.SetColLabelSize(0) # Controles conf. self._dlm = wx.StaticText(self.pctrls, -1, u"Delimiter", size=(-1, 25)) self.dlm = wx.TextCtrl(self.pctrls, -1, u",", size=(-1, 25)) self.dlm.SetFont(self.VALUE_FONT) self._skiprows = wx.StaticText(self.pctrls, -1, u"Start reading from row...", size=(-1, 25)) self.skiprows = wx.SpinCtrl(self.pctrls, -1, min=1, max=100) self.preview = wx.Button(self.pctrls, -1, u"Preview") # Set labels for label in [self._dlm, self._skiprows]: label.SetFont(self.LABEL_FONT) label.SetForegroundColour("#556655") # Log self.log = LogCtrl(self.plog) # Botones self.okbutton = wx.Button(self.pbutton, wx.ID_OK, size=(100, 25)) self.cancelbutton = wx.Button(self.pbutton, wx.ID_CANCEL, size=(100, 25), style=wx.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.OnPreview, self.preview)
def test_filectrl1(self): fc = wx.FileCtrl(self.frame)
def test_filectrl2(self): fc = wx.FileCtrl() fc.Create(self.frame)
def create_file_ctrl(self): self.fc = wx.FileCtrl(self) self.fc.SetMinSize(wx.Size(900, 600)) self.Bind(wx.EVT_FILECTRL_FILEACTIVATED, self.on_file_activated) self.Bind(wx.EVT_FILECTRL_SELECTIONCHANGED, self.on_selection_changed) return self.fc
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(FRAME_WIDTH, FRAME_HEIGHT),style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER) self.plotData = None self.legend = False self.legend_cur_loc = legend_positions[0] self.labels = [] self.names = [] main_sizer = wx.BoxSizer(wx.HORIZONTAL) left_sizer = wx.BoxSizer(wx.VERTICAL) middle_sizer = wx.BoxSizer(wx.VERTICAL) control_sizer = wx.BoxSizer(wx.HORIZONTAL) right_sizer = wx.BoxSizer(wx.VERTICAL) self.sample_selector_sizer = wx.BoxSizer(wx.VERTICAL) select_button_sizer = wx.BoxSizer(wx.HORIZONTAL) self.checkboxes = [] filectrl_panel = wx.Panel(self, -1) canvas_panel = wx.Panel(self, -1) sample_panel = wx.Panel(self,-1) right_panel = wx.Panel(self,-1) select_button_panel = wx.Panel(right_panel,-1) self.samples_select_panel = wx.ScrolledWindow(right_panel, -1) self.samples_select_panel.SetScrollbars(20,20,50,50) button_panel = wx.Panel(canvas_panel,-1) self.filectrl = wx.FileCtrl(filectrl_panel,wx.ID_ANY,'.') load_button_panel = wx.Panel(filectrl_panel,-1) self.canvas = CanvasPanel(canvas_panel) self.btn_load_file = wx.Button(load_button_panel,-1,"Load File") self.btn_save_plot = wx.Button(button_panel,-1,"Save Image") self.btn_save_csv = wx.Button(button_panel,-1,"Save CSV") self.legend_chk = wx.CheckBox(button_panel,-1,"Legend") self.btn_edit_label = wx.Button(button_panel,-1,"Edit Labels") self.legend_pos_text = wx.StaticText(button_panel,-1,"Location: ",style=wx.ALIGN_RIGHT) self.legend_pos = wx.Choice(button_panel,-1,choices=legend_positions) self.legend_pos.SetSelection(0) #-- Sample Select Panel --# self.btn_select_all = wx.Button(select_button_panel,-1,"Select All") self.btn_select_none = wx.Button(select_button_panel,-1,"Select None") test_btn1 = wx.CheckBox(self.samples_select_panel,-1,'Test Button') test_btn2 = wx.CheckBox(self.samples_select_panel,-1,'Test Button2') self.doBinds() left_sizer.Add(self.filectrl,9,wx.EXPAND) left_sizer.Add(load_button_panel,1,wx.EXPAND) main_sizer.Add(filectrl_panel, 2, wx.EXPAND) main_sizer.Add(canvas_panel, 3, wx.EXPAND | wx.ALL) main_sizer.Add(right_panel,1,wx.EXPAND) middle_sizer.Add(self.canvas,6,wx.EXPAND) middle_sizer.Add(button_panel,1,wx.EXPAND) control_sizer.Add(self.legend_chk,1) control_sizer.Add(self.btn_edit_label,1) control_sizer.Add(self.legend_pos_text,1,wx.ALIGN_RIGHT) control_sizer.Add(self.legend_pos,1,wx.ALIGN_LEFT) control_sizer.Add(self.btn_save_plot,1) control_sizer.Add(self.btn_save_csv,1) right_sizer.Add(select_button_panel,0,wx.EXPAND) right_sizer.Add(self.samples_select_panel,1,wx.EXPAND) select_button_sizer.Add(self.btn_select_all,0) select_button_sizer.Add(self.btn_select_none,0) self.sample_selector_sizer.Add(test_btn1,0) self.sample_selector_sizer.Add(test_btn2,0) button_panel.SetSizer(control_sizer) filectrl_panel.SetSizer(left_sizer) canvas_panel.SetSizer(middle_sizer) right_panel.SetSizer(right_sizer) select_button_panel.SetSizer(select_button_sizer) self.samples_select_panel.SetSizer(self.sample_selector_sizer) self.SetSizer(main_sizer) self.Centre()
def __init__(self, ground_frame): wx.Frame.__init__(self, None, wx.ID_ANY, "Boxygene Settings", size=(500, 800)) self.panel = wx.Panel(self) self.sizer = wx.BoxSizer(wx.VERTICAL) self.ground_frame = ground_frame #Grid Settings self.gs = gs = wx.GridSizer(rows=8, cols=2, hgap=5, vgap=5) #Color Pickers self.colour_picker_stop = wx.ColourPickerCtrl(self.panel) col_stop = wx.Colour() col_stop.Set(settings.config['DEFAULT']['color_stop']) self.colour_picker_stop.SetColour(col_stop) self.colour_picker_run = wx.ColourPickerCtrl(self.panel) col_run = wx.Colour() col_run.Set(settings.config['DEFAULT']['color_run']) self.colour_picker_run.SetColour(col_run) self.colour_picker_pause = wx.ColourPickerCtrl(self.panel) col_pause = wx.Colour() col_pause.Set(settings.config['DEFAULT']['color_pause']) self.colour_picker_pause.SetColour(col_pause) self.colour_picker_almostdone = wx.ColourPickerCtrl(self.panel) col_almost_done = wx.Colour() col_almost_done.Set(settings.config['DEFAULT']['color_almost_end']) self.colour_picker_almostdone.SetColour(col_almost_done) #Number of rounds self.number_of_rounds_SpinCtrl = wx.SpinCtrl(self.panel, min=1, max=50) self.number_of_rounds_SpinCtrl.SetValue( int(settings.config['DEFAULT']['number_of_rounds'])) #Time round in seconds self.time_rounds_second_SpinCtrl = wx.SpinCtrl(self.panel, min=30, max=600) self.time_rounds_second_SpinCtrl.SetValue( int(settings.config['DEFAULT']['timer_in_seconds'])) #Pause between rounds in seconds self.time_between_rounds_second_SpinCtrl = wx.SpinCtrl(self.panel, min=1, max=600) self.time_between_rounds_second_SpinCtrl.SetValue( int(settings.config['DEFAULT']['pause_each_round_in_seconds'])) #Notification round almost done in seconds self.time_notification_alost_done_rounds_second_SpinCtrl = wx.SpinCtrl( self.panel, min=1, max=60) self.time_notification_alost_done_rounds_second_SpinCtrl.SetValue( int(settings.config['DEFAULT'] ['notification_before_end_of_ring_in_seconds'])) #Logo self.logo = wx.FileCtrl(self.panel, size=(500, 300)) self.logo.SetPath(settings.config['DEFAULT']['logo']) # Adding properties to grid self.gs.AddMany([ (wx.StaticText(self.panel, -1, "Number of rounds"), wx.EXPAND), (self.number_of_rounds_SpinCtrl, wx.EXPAND), (wx.StaticText(self.panel, -1, "Time of the round in seconds"), wx.EXPAND), (self.time_rounds_second_SpinCtrl, wx.EXPAND), (wx.StaticText(self.panel, -1, "Time between rounds in seconds"), wx.EXPAND), (self.time_between_rounds_second_SpinCtrl, wx.EXPAND), (wx.StaticText(self.panel, -1, "Notification end of round in seconds"), wx.EXPAND), (self.time_notification_alost_done_rounds_second_SpinCtrl, wx.EXPAND), (wx.StaticText(self.panel, -1, "Stop Color"), wx.EXPAND), (self.colour_picker_stop, wx.EXPAND), (wx.StaticText(self.panel, -1, "Run Color"), wx.EXPAND), (self.colour_picker_run, wx.EXPAND), (wx.StaticText(self.panel, -1, "Pause Color"), wx.EXPAND), (self.colour_picker_pause, wx.EXPAND), (wx.StaticText(self.panel, -1, "Almost Done Color"), wx.EXPAND), (self.colour_picker_almostdone, wx.EXPAND), ]) self.sizer.Add(self.gs, 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(wx.StaticText(self.panel, -1, "Logo"), 0, wx.ALL | wx.EXPAND, 5) self.sizer.Add(self.logo, 0, wx.ALL | wx.EXPAND, 25) #Save Button self.saveBtn = wx.Button(self.panel, wx.ID_ANY, "Save") self.Bind(wx.EVT_BUTTON, self.save_settings, self.saveBtn) self.sizer.Add(self.saveBtn, 0, wx.ALL | wx.EXPAND, 5) #Main panel self.panel.SetSizer(self.sizer)