class Help(object): def __init__(self, console): self.index = 0 self.array = help_strings self.console = console self.tip = None def next(self): if self.index < len(self.array) - 1: self.index += 1 def previous(self): if self.index > 0: self.index -= 1 def current(self): string = self.array[self.index] data = HIGTooltipData(string) hbb = gtk.HBox(2, False) btn = MiniButton(stock=gtk.STOCK_CLOSE) btn.connect('clicked', self.__on_close) hbb.pack_start(btn, False, False, 0) btn = MiniButton(stock=gtk.STOCK_GO_BACK) btn.connect('clicked', self.__on_back) if self.index == 0: btn.set_sensitive(False) hbb.pack_start(btn, False, False, 0) btn = MiniButton(stock=gtk.STOCK_GO_FORWARD) btn.connect('clicked', self.__on_forward) if self.index == len(self.array) - 1: btn.set_sensitive(False) hbb.pack_start(btn, False, False, 0) hbb.show_all() align = gtk.Alignment(1.0, 0.5) align.add(hbb) align.show_all() data.append_widget(align) return data def __on_back(self, widget): self.previous() self.__on_close(widget) self.show_help() def __on_forward(self, widget): self.next() self.__on_close(widget) self.show_help() def __on_close(self, widget): if self.tip: self.tip.close_and_destroy() def show_help(self): self.__on_close(None) self.tip = HIGTooltip() x, y = self.console.window.get_origin() self.tip.show_at(self.console, self.current(), x, y)
def show_help(self): self.__on_close(None) self.tip = HIGTooltip() x, y = self.console.window.get_origin() self.tip.show_at(self.console, self.current(), x, y)