def DispatchToControl(self, evt): evt_id = evt.GetId() if evt_id == wx.ID_SAVE: self.tx.SaveFile(self.tx.GetFileName()) self.UpdatePageTitle() elif evt_id == wx.ID_FIND: if not isinstance(self.commandBar, SearchBar): cb = SearchBar( self.panLeft ) self.panLeft.GetSizer().Replace(self.commandBar, cb) self.commandBar.Destroy() self.commandBar = cb self.commandBar.Show() self.commandBar.ctrl.SetFocus() self.panLeft.Layout() self.Layout() elif evt_id == wx.ID_PREVIEW: if self.split.IsSplit(): self.LastCbWidth = self.split.GetSashPosition() self.split.Unsplit() else: self.split.SplitVertically( window1=self.panLeft, window2=self.panRight, sashPosition=self.LastCbWidth ) self.cbrowser.OnUpdateTree(force=True) self.Layout() self.GetParent().Update() elif evt_id == wx.ID_SAVEAS: pass elif evt_id == wx.ID_FORWARD: self.RunCode() else: self.tx.ControlDispatch(evt)
def __init__(self, db): Gtk.Window.__init__(self) self.db = db self.windowStack = None self.revealer = None self.headerBar = None self.searchBar = None self.imdbBox = None self.searchResults = None self.connect("key-press-event", self.key_pressed_cb) box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) # stackBox = Gtk.Box() self.windowStack = Gtk.Stack( interpolate_size=True, transition_type=Gtk.StackTransitionType.CROSSFADE) self.header = HeaderBar(self, self.db) self.header.connect('go-back', self.goBack_cb) self.header.connect("random-clicked", self.random_cb) self.header.connect("revealer-change", self.reveal_cb) self.header.connect('source-change', self.sourceChange_cb) self.set_titlebar(self.header) self.searchBar = SearchBar(db) self.searchBar.connect("search-ran", self.searchRan_cb) self.searchResults = SearchResults() self.searchResults.connect("row-activated", self.updateIMDB_cb) # self.windowStack.add_named(self.searchResults, "search-results") # stackBox.pack_start(self.searchResults, False, False, 0) self.windowStack.add_named( self.searchResults, "search-results" ) # what if I implement the infobox on a stack that also includes a start typing page like the search results has right now and a choose a search result to display detailed info page self.windowStack.set_visible_child_name("search-results") self.imdbBox = InfoPage(db, "Shrek") # stackBox.pack_end(self.imdbBox, True, True, 0) self.windowStack.add_named(self.imdbBox, "movie-info") # credentials = LogIn() # locationChooser.connect("location-chosen", self.updateWin) # self.windowStack.add_named(credentials, "credentials") box.add(self.searchBar) box.add(self.windowStack) self.add(box)
def __init__(self, master, *args, **kw): super().__init__(master, *args, **kw) # Configure Widget: self.grid_propagate(0) self.rowconfigure(1, weight=1) self.columnconfigure(0, weight=1) self.grid(sticky=tkSticky.fill) # Create Subwidgets: self.treeview = Treeview(self) self.searchbar = SearchBar(self) self.treeview.grid(row=1, sticky=tkSticky.fill) self.searchbar.grid(row=0, sticky=tkSticky.fill) # Bind additional keys between widgets: self.setBindings()