def __init__(self, parent=None, title='Inspecting Python Modules Processes'): super().__init__(parent=parent, title=title) panel = wx.Panel(self) # Building basic widgets self.entxl = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER) self.entxl.Bind(wx.EVT_TEXT_ENTER, self.OnEnter) self.insptree = wx.TreeCtrl(panel, style=wx.TR_DEFAULT_STYLE | wx.TR_HAS_BUTTONS) self.insptree.Bind(wx.EVT_TREE_KEY_DOWN, self.OnSpace) self.outxl = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY) # Underlying BoxSizer vsizer = VBoxSizer() vsizer.Add(self.entxl, 0, wx.EXPAND) vsizer.Add(self.insptree, 2, wx.EXPAND) vsizer.Add(self.outxl, 1, wx.EXPAND) panel.SetSizer(vsizer)
def __init__(self, parent, title="Add a Row to the Table"): super().__init__(parent, title=title) vsizer = VBoxSizer() self.panel = self.GetParent() self.tabletitle = self.panel.tablecombo.GetString( self.panel.tablecombo.GetCurrentSelection()) metadata = MetaData() metadata.reflect(self.panel.engine) self.columntitles = list(metadata.tables[self.tabletitle].c.keys()) self.entxtlist = [] for title in self.columntitles[1:]: hsizer = wx.BoxSizer() stxt = wx.StaticText(self, label=title) entxt = wx.TextCtrl(self) self.entxtlist.append(entxt) hsizer.Add(stxt) hsizer.Add(entxt) vsizer.Add(hsizer) fhsizer = wx.BoxSizer() addbtn = wx.Button(self, label="Add the Data", id=wx.ID_OK) addbtn.Bind(wx.EVT_BUTTON, self.OnAdd) cancelbtn = wx.Button(self, label="Cancel") cancelbtn.Bind(wx.EVT_BUTTON, self.OnCancel) fhsizer.Add(addbtn) fhsizer.Add(cancelbtn) vsizer.Add(fhsizer) self.SetSizer(vsizer)
def __init__(self, parent=None, title='Programs Launcher'): super().__init__(parent, title=title) panel = wx.Panel(self) self.buttons = { 'Inspecting Python Modules': 'inspectmodules.py', "Books DB Editor": "booksdbeditor.py", "Program Output": "programoutput.py", "IoInteraction": "iointeraction.py" } buttonslist = [] for name in self.buttons: button = wx.Button(panel, label=name) button.Bind(wx.EVT_BUTTON, self.OnButton) buttonslist.append(button) vsizer = VBoxSizer() for button in buttonslist: vsizer.Add(button, wx.EXPAND) panel.SetSizer(vsizer)
def __init__(self, parent): self.engine = None if not os.path.exists("books.db"): self.CreateDB("books.db") else: self.engine = create_engine("sqlite:///books.db") self.session = sqlafuns.getsqlsess(self.engine) super().__init__(parent) vsizer = VBoxSizer() hsizer1 = wx.BoxSizer() combolab = wx.StaticText(self, label="Pick a table:") self.tablenames = [BookTable.__tablename__, SeriesTable.__tablename__] self.tablecombo = wx.Choice(self, choices=self.tablenames) self.tablecombo.SetSelection(0) self.tablecombo.Bind(wx.EVT_CHOICE, self.OnChoice) self.current_table = self.tablecombo.GetStringSelection() hsizer1.Add(combolab) hsizer1.Add(self.tablecombo) vsizer.Add(hsizer1, 0, wx.CENTER) self.olvtable = ObjectListView(self, style=wx.LC_REPORT) vsizer.Add(self.olvtable, 1, wx.EXPAND) hsizer2 = wx.BoxSizer() addbtn = wx.Button(self, label="Add a row") addbtn.Bind(wx.EVT_BUTTON, self.OnAdd) hsizer2.Add(addbtn) editbtn = wx.Button(self, label="Edit a row") editbtn.Bind(wx.EVT_BUTTON, self.OnEdit) hsizer2.Add(editbtn) delbtn = wx.Button(self, label="Delete a row") delbtn.Bind(wx.EVT_BUTTON, self.OnDelete) hsizer2.Add(delbtn) vsizer.Add(hsizer2, 0, wx.CENTER) self.SetSizer(vsizer) self.AddCols("book")
def __init__(self, title="Program Output"): super().__init__(None, title=title) menubar = wx.MenuBar() actionmenu = wx.Menu() chdirmenuitem = actionmenu.Append(wx.ID_ANY, 'Change Current Dir') menubar.Append(actionmenu, '&Action') self.Bind(wx.EVT_MENU, self.OnChange, chdirmenuitem) self.SetMenuBar(menubar) panel = wx.Panel(self) self.entxt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER) self.entxt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter) self.outxt = wx.TextCtrl(panel, style=wx.TE_MULTILINE| wx.TE_READONLY| wx.TE_BESTWRAP) sizer = VBoxSizer() sizer.Add(self.entxt, 0, wx.EXPAND) sizer.Add(self.outxt, 1, wx.EXPAND) panel.SetSizer(sizer)
def __init__(self, parent, rowobj=None, title="Edit a Row in the Table"): super().__init__(parent, title=title) self.panel = self.GetParent() self.engine = self.panel.engine self.rowtoedit = list( self.panel.session.query(BookTable).filter_by( book_id=rowobj.book_id)) self.tabletitle = self.panel.tablecombo.GetString( self.panel.tablecombo.GetCurrentSelection()) metadata = MetaData() metadata.reflect(self.panel.engine) self.columntitles = list(metadata.tables[self.tabletitle].c.keys()) vsizer = VBoxSizer() hsizer1 = wx.BoxSizer() stxt = wx.StaticText(self, label="Name:") self.nameentxt = wx.TextCtrl(self, value=str(rowobj.name)) hsizer1.Add(stxt) hsizer1.Add(self.nameentxt) vsizer.Add(hsizer1) hsizer2 = wx.BoxSizer() stxt = wx.StaticText(self, label="Books Total:") self.bookstotalentxt = wx.TextCtrl(self, value=str(rowobj.bookstotal)) hsizer2.Add(stxt) hsizer2.Add(self.bookstotalentxt) vsizer.Add(hsizer2) fhsizer = wx.BoxSizer() editbtn = wx.Button(self, label="Edit the Data", id=wx.ID_OK) editbtn.Bind(wx.EVT_BUTTON, self.OnEdit) cancelbtn = wx.Button(self, label="Cancel") cancelbtn.Bind(wx.EVT_BUTTON, self.OnCancel) fhsizer.Add(editbtn) fhsizer.Add(cancelbtn) vsizer.Add(fhsizer) self.SetSizer(vsizer)