コード例 #1
0
ファイル: consoles.py プロジェクト: aguzubiaga/sugar-jamedit
 def __init__(self):
         gtk.HBox.__init__(self)
         self.toolbar = VTray()
         
         copy = ToolButton("edit-copy")
         copy.set_tooltip('Copy')
         copy.connect("clicked", self.__copy_cb)
         copy.show()
         self.toolbar.add_item(copy, -1)
         paste = ToolButton("edit-paste")
         paste.set_tooltip("Paste")
         paste.connect("clicked", self.__paste_cb)
         paste.show()
         self.toolbar.add_item(paste, -1)
         
         fgcolor = ColorToolButton()
         fgcolor.get_child()._title = "Font Color"
         self.toolbar.add_item(fgcolor, -1)
         fgcolor.connect('notify::color', self._fgcolor_cb)
         fgcolor.show_all()
         bgcolor = ColorToolButton()
         bgcolor.get_child()._title = "Background Color"
         bgcolor.connect('notify::color', self._bgcolor_cb)
         self.toolbar.add_item(bgcolor, -1)
         bgcolor.show_all()
         
         self.console = Console()
         self.console.set_bgcolor(gtk.gdk.color_parse("#FFFFFF"))
         self.console.set_fgcolor(gtk.gdk.color_parse("#000000"))
         bgcolor.set_color(gtk.gdk.color_parse("#FFFFFF"))
         fgcolor.set_color(gtk.gdk.color_parse("#000000"))
         self.console.show()
         
         font = ToolButton("format-text")
         font.set_tooltip("Console Font")
         fontselection = gtk.FontSelection()
         fontselection.get_family_list().get_selection().connect("changed", self.update_font, fontselection)
         fontselection.get_face_list().get_selection().connect("changed", self.update_font, fontselection)
         fontselection.get_size_entry().connect("changed", self.update_font, fontselection)
         fontselection.get_size_entry().connect("activate", self.update_font, fontselection)
         fontselection.show()
         font.props.palette.set_content(fontselection)
         fontselection.set_font_name("Monospace Regular 10")
         font.show()
         self.toolbar.add_item(font, -1)
         
         reset = ToolButton("view-refresh")
         reset.set_tooltip("Reset Console")
         reset.connect("clicked", self.reset)
         reset.show()
         self.toolbar.add_item(reset, -1)
         self.toolbar.show()
         self.pack_start(self.toolbar, False, True, 0)
         
         self.console.run_command("python")
         self.pack_start(self.console)