Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import wx
- import wx.grid
- class SceRen:
- pass
- class ScRenWindow(wx.Frame):
- dirname = ""
- version = 0.1
- def __init__(self, parent, title):
- self.sc_ren = SceRen("g:\\doesntexist\\", False, False)
- wx.Frame.__init__(self, parent, title=title)
- panel = wx.Panel(self)
- vSizer = wx.BoxSizer(wx.VERTICAL)
- grid = wx.GridBagSizer(hgap=5, vgap=5)
- label = wx.StaticText(panel, label="Select Folder")
- grid.Add(label, pos=(0,0))
- textField = wx.TextCtrl(panel, size=(300, 23))
- self.fieldOne = textField
- grid.Add(textField, pos=(1,0))
- btn = wx.Button(panel, wx.ID_FIND, "Find")
- self.Bind(wx.EVT_BUTTON, self.findFolder, btn)
- grid.Add(btn, pos=(2,0))
- grid.Add((1, 20), pos=(3,0))
- label2 = wx.StaticText(panel, label="Files")
- grid.Add(label2, pos=(4,0))
- # FileGrid
- fileF = wx.grid.Grid(panel)
- #fileF.SetMinSize(minSize=(400,200))
- fileF.CreateGrid(1,3)
- fileF.SetColLabelSize(0)
- fileF.SetRowLabelSize(0)
- fileF.SetCellValue(0, 0, "Old")
- fileF.SetCellValue(0, 1, "New")
- fileF.SetCellValue(0, 2, "Update?")
- fileF.SetReadOnly(0,0)
- fileF.SetReadOnly(0,1)
- fileF.SetReadOnly(0,2)
- fileF.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.selectClick)
- #wx.EVT_LEFT_DOWN(fileF, self.selectClick)
- #wx.EVT_KEY_DOWN(fileF, self.selectClick)
- self.fileField = fileF
- grid.Add(fileF, pos=(5,0))
- # FileGrid end
- runBtn = wx.Button(panel, wx.ID_APPLY, "Apply")
- self.Bind(wx.EVT_BUTTON, self.applyScRen, runBtn)
- grid.Add(runBtn, pos=(6,0))
- errlbl = wx.StaticText(panel, label="No Error")
- grid.Add(errlbl, pos=(6,1))
- grid.Add((1, 40), pos=(7,0))
- # MENUBAR not used yet
- filemenu = wx.Menu()
- menuOpen = filemenu.Append(wx.ID_OPEN, "&Open"," Open a file")
- self.Bind(wx.EVT_MENU, self.findFolder, menuOpen)
- menuBar = wx.MenuBar()
- menuBar.Append(filemenu,"&File")
- self.SetMenuBar(menuBar)
- #panel.CreateStatusBar()
- vSizer.Add(grid, 0, wx.ALL, 5)
- panel.SetSizerAndFit(grid)
- self.CreateStatusBar()
- self.SetInitialSize()
- self.Show(True)
- def findFolder(self, e):
- dlg = wx.DirDialog(self, "Select Folder", ".", wx.DEFAULT_DIALOG_STYLE)
- if dlg.ShowModal() == wx.ID_OK:
- self.dirname = dlg.GetPath()
- dlg.Destroy()
- self.fieldOne.SetLabel(self.dirname)
- self.populateGrid()
- return True;
- def populateGrid(self):
- pass
- def applyScRen(self, e):
- pass
- def selectClick(self, e):
- if (e.GetRow() > 0 and e.GetCol() == 2):
- current = self.fileField.GetCellValue(e.GetRow(),e.GetCol()) == "y"
- current = "n" if current else "y"
- self.fileField.SetCellValue(e.GetRow(),e.GetCol(),current)
- app = wx.App(False)
- frame = ScRenWindow(None, "Scren")
- app.MainLoop()
Add Comment
Please, Sign In to add comment