def __init__(self, *args, **kwargs): super(BrowserTab, self).__init__(*args, **kwargs) go_button = gtk.Button("go to...") go_button.connect("clicked", self._load_url) self.url_bar = gtk.Entry() self.url_bar.connect("activate", self._load_url) self.webview = webkit.WebView() settings = webkit.WebSettings() #settings.set_property('user-agent', 'Mozilla/5.0 (X11; Linux x86_64) Applewebkit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36') settings.set_property('enable_default_context_menu', False) self.webview.set_settings(settings) #self.webview.props.settings.props.enable_default_context_menu = False self.show() self.go_back = gtk.Button("Back") self.go_back.connect("clicked", lambda x: self.webview.go_back()) self.go_forward = gtk.Button("Forward") self.go_forward.connect("clicked", lambda x: self.webview.go_forward()) scrolled_window = gtk.ScrolledWindow() scrolled_window.add(self.webview) find_box = gtk.HBox() close_button = gtk.Button("X") close_button.connect("clicked", lambda x: find_box.hide()) self.find_entry = gtk.Entry() self.find_entry.connect("activate", lambda x: self.webview.search_text(self.find_entry.get_text(), False, True, True)) prev_button = gtk.Button("<") next_button = gtk.Button(">") prev_button.connect("clicked", lambda x: self.webview.search_text(self.find_entry.get_text(), False, False, True)) next_button.connect("clicked", lambda x: self.webview.search_text(self.find_entry.get_text(), False, True, True)) find_box.pack_start(self.find_entry, False, False, 0) find_box.pack_start(prev_button, False, False, 0) find_box.pack_start(next_button, False, False, 0) find_box.pack_start(close_button, False, False, 0) self.find_box = find_box url_box = gtk.HBox() url_box.pack_start(self.go_back, False, False, 0) url_box.pack_start(self.go_forward, False, False, 0) url_box.pack_start(self.url_bar, True, True, 0) url_box.pack_start(go_button, False, False, 0) self.pack_start(url_box, False, False, 0) self.pack_start(scrolled_window, True, True, 0) self.pack_start(find_box, False, False, 0) #url_box.show_all() scrolled_window.show_all()
def __init__(self, url, font_size=14, font_default="VLGothic", font_serif="VLGothic", font_sans_serif="VLGothic", font_monospace="VLGothic", size=None): import gtk import webkit gtk.gdk.threads_init() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.move(0, 0) if not size: size = (gtk.gdk.screen_width(), gtk.gdk.screen_height()) window.resize(*size) webview = webkit.WebView() # webkit settings settings = webkit.WebSettings() settings.set_property("serif-font-family", font_serif) settings.set_property("sans-serif-font-family", font_sans_serif) settings.set_property("monospace-font-family", font_monospace) settings.set_property("default-font-family", font_default) settings.set_property("default-font-size", font_size) webview.set_settings(settings) window.add(webview) webview.connect("load-finished", self._loaded) webview.open(url) window.show_all() gtk.main() gtk.gdk.threads_leave() pass
def __init__(self): webkit.WebView.__init__(self) self.web_settings = webkit.WebSettings() self.set_settings(self.web_settings) self.web_settings.set_property("enable-plugins", False) self.gc = gconf.client_get_default() self.connect("navigation-requested", self.on_click_link) self.connect("populate-popup", self.on_popup) self.template = None
def process_request(self, request, spider): if not request.meta.has_key('no_webkit') and type(request) is not FormRequest: webview = webkit.WebView() #set browser settings settings = webkit.WebSettings() settings.set_property('user-agent','Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10') webview.set_settings(settings) webview.connect('load-finished', lambda v,f: gtk.main_quit()) webview.load_uri(request.url) gtk.main() js = jswebkit.JSContext(webview.get_main_frame().get_global_context()) renderedBody = str(js.EvaluateScript('document.documentElement.innerHTML')) return HtmlResponse(request.url, body=renderedBody)
def __init__(self, builder): webkit.WebView.__init__(self) # webkit-gtk is very old, and has javascript bugs settings = webkit.WebSettings() settings.props.enable_scripts = False self.set_settings(settings) self.hometrack = None self.set_maintains_back_forward_list(True) builder.connect_signals(self) event.add_callback(self.on_playback_start, 'playback_track_start')
def __init__(self, parent): gtk.Window.__init__(self) self.mainwin = parent self.set_title(_('Secure Authentication')) self.set_default_size(800, 450) self.set_transient_for(parent) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.connect('delete-event', self.quit) self.settings = webkit.WebSettings() self.view = webkit.WebView() self.view.set_settings(self.settings) scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scroll.set_shadow_type(gtk.SHADOW_IN) scroll.add(self.view) self.label = gtk.Label() self.label.set_use_markup(True) self.label.set_alignment(0, 0) #self.label.set_line_wrap(True) self.label.set_markup( _('Autorize Turpial and copy the given number \ (<b>PIN</b>) in the text box below:')) #self.label.set_justify(gtk.JUSTIFY_FILL) lblbox = gtk.HBox(False, 2) lblbox.pack_start(self.label, True, True, 2) self.pin = gtk.Entry() cancel = gtk.Button(stock=gtk.STOCK_CANCEL) accept = gtk.Button(stock=gtk.STOCK_OK) hbox = gtk.HBox(False, 0) hbox.pack_start(self.pin, True, True, 2) hbox.pack_start(cancel, False, False, 2) hbox.pack_start(accept, False, False, 2) vbox = gtk.VBox(False, 5) vbox.pack_start(scroll, True, True, 0) vbox.pack_start(lblbox, False, False, 2) vbox.pack_start(hbox, False, False, 2) cancel.connect('clicked', self.quit) accept.connect('clicked', self.__accept) self.add(vbox)
def __init__(self, mainwin, label='', menu='normal'): gtk.VBox.__init__(self, False) self.last = None # Last tweets updated self.mainwin = mainwin style_path = os.path.join(os.path.dirname(__file__), '..', '..', 'data', 'themes', 'default', 'style.css') template_path = os.path.join(os.path.dirname(__file__), '..', '..', 'data', 'themes', 'default', 'tweet_template.html') #self.header = '<link href="%s" rel="stylesheet" type="text/css">' % style_path #self.header = '' f = open(style_path, 'r') self.css_template = f.read() f.close() self.header = '<style type="text/css"> %s </style>' % self.css_template self.page = self.header f = open(template_path, 'r') self.tweet_template = f.read() f.close() self.list = webkit.WebView() self.settings = webkit.WebSettings() self.list.set_settings(self.settings) self.label = gtk.Label(label) self.caption = label self.lblerror = gtk.Label() self.lblerror.set_use_markup(True) self.waiting = CairoWaiting(self.mainwin) align = gtk.Alignment(xalign=1, yalign=0.5) align.add(self.waiting) bottombox = gtk.HBox(False) bottombox.pack_start(self.lblerror, False, False, 2) bottombox.pack_start(align, True, True, 2) scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) scroll.set_shadow_type(gtk.SHADOW_IN) scroll.add(self.list) self.pack_start(scroll, True, True) self.pack_start(bottombox, False, False)
def print_body(url, thumsize, thumfile, font): gtk.gdk.threads_init() window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.move(0, 0) window.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height()) webview = webkit.WebView() # webkit settings settings = webkit.WebSettings() settings.set_property("serif-font-family", font) settings.set_property("sans-serif-font-family", font) settings.set_property("monospace-font-family", font) settings.set_property("default-font-family", font) settings.set_property("default-font-size", 14) webview.set_settings(settings) window.add(webview) webview.connect("load-finished", loaded_handler(thumsize, thumfile)) webview.open(url) window.show_all() gtk.main() pass
def __init__(self): program = gnome.init('blogtk', '2.0') self.glade = gtk.glade.XML(os.path.join(SHARED_FILES, 'glade', 'blogtk2.glade')) self.winMain = self.glade.get_widget('winMain') self.tvBlogs = self.glade.get_widget('tvBlogs') self.tvPosts = self.glade.get_widget('tvPosts') self.appbar = self.glade.get_widget('appbarMain') self.swPreview = self.glade.get_widget('swPreview') self.dlgAbout = self.glade.get_widget('dlgAbout') # Create preview self.html_Preview = webkit.WebView() # We want to lock down our preview to prevent scripting and plugins # from doing anything. self.webkit_settings = webkit.WebSettings() self.webkit_settings.set_property("enable-plugins", False) self.webkit_settings.set_property("enable-scripts", False) self.html_Preview.set_settings(self.webkit_settings) self.setWelcome() self.winMain.show() # Main Window events self.winMain.connect('delete_event', self.delete_event) self.winMain.connect('destroy', self.destroy) dic = { 'on_tbtnRefresh_clicked' : self.refreshPosts, 'on_tvPosts_row_activated' : self.sendPostToEditor, 'gtk_main_quit' : self.destroy, 'on_tbtnHome_clicked' : self.goToBlogHome, 'on_tbtnEdit_clicked' : self.sendPostToEditor, 'on_mniEditPost_activate' : self.sendPostToEditor, 'on_tbtnNew_clicked' : self.createNewPost, 'on_mniNewPost_activate' : self.createNewPost, 'on_tvBlogs_row_activated' : self.createNewPost, 'on_tbtnDelete_clicked' : self.deletePost, 'on_mniDeletePost_activate' : self.deletePost, 'on_tbtnAccounts_clicked' : self.initAccounts, 'on_mniPrefs_activate' : self.initAccounts, 'on_mniOffline_activate' : self.goOffline, 'on_mniDisplayAbout_activate' : self.displayAbout, 'on_mniMainQuit_activate' : self.closeMainWin, 'on_dlgAbout_close' : self.windowHider } self.glade.signal_autoconnect(dic) self.tbtnRefresh = self.glade.get_widget('tbtnRefresh') self.mniOffline = self.glade.get_widget('mniOffline') # This needs to be replaced with a variable self.homeDir = os.path.expanduser('~') self.configDir = self.homeDir + "/.BloGTK" self.firstrun = firstrun.BloGTKFirstRun(self) self.firstrun.checkConfigStatus() # For offline support, we need a flag to note whether we should go offline or not. self.isOffline = False # We need a change flag here to prevent the app from closing # if the editor has unsaved changes. self.changeFlag = False # Create our accelerator group self.accelGroup = gtk.AccelGroup() self.winMain.add_accel_group(self.accelGroup) self.addAccelerators()
def __init__(self): # Create window self.much_window = gtk.Window() self.much_window.connect('destroy', lambda w: gtk.main_quit()) self.much_window.set_default_size(900, 700) # Create navigation bar self.so_navigation = gtk.HBox() self.many_back = gtk.ToolButton(gtk.STOCK_GO_BACK) self.such_forward = gtk.ToolButton(gtk.STOCK_GO_FORWARD) self.very_refresh = gtk.ToolButton(gtk.STOCK_REFRESH) self.newwindow=gtk.ToolButton(gtk.STOCK_NEW) self.test_tor_connect = gtk.ToolButton(gtk.STOCK_CONNECT) self.test_tor_disconnect=gtk.ToolButton(gtk.STOCK_DISCONNECT) self.log=gtk.ToolButton(gtk.STOCK_DIALOG_AUTHENTICATION) self.wow_address_bar = gtk.Entry() self.file=gtk.ToolButton(gtk.STOCK_FILE) self.video=gtk.ToolButton(gtk.STOCK_MEDIA_RECORD) self.many_back.connect('clicked', self.go_back) self.such_forward.connect('clicked', self.go_forward) self.very_refresh.connect('clicked', self.refresh_page) self.newwindow.connect("clicked",self.newwind) self.wow_address_bar.connect('activate', self.load_page) self.test_tor_connect.connect('clicked',self.torstart) self.test_tor_disconnect.connect("clicked",self.torstop) self.log.connect("clicked",self.lodlog) self.file.connect("clicked",self.loadfile) self.video.connect("clicked",self.loadvideo) self.so_navigation.pack_start(self.many_back, False) self.so_navigation.pack_start(self.such_forward, False) self.so_navigation.pack_start(self.very_refresh, False) self.so_navigation.pack_start(self.newwindow,False) self.so_navigation.pack_start(self.test_tor_connect, False) self.so_navigation.pack_start(self.test_tor_disconnect,False) self.so_navigation.pack_start(self.file,False) self.so_navigation.pack_start(self.video,False) self.so_navigation.pack_start(self.wow_address_bar) self.so_navigation.pack_start(self.log,False) # Create view for webpage self.very_view = gtk.ScrolledWindow() self.such_webview = webkit.WebView() self.such_webview.open('http://google.com') self.such_webview.connect('title-changed', self.change_title) self.such_webview.connect('load-committed', self.change_url) self.such_webview.connect('download-requested', self.download_requested) self.such_webview.connect('mime-type-policy-decision-requested', self.policy_decision_requested) self.very_view.add(self.such_webview) #Settings self.settings=webkit.WebSettings() self.settings.set_property('enable-scripts', True) self.such_webview.set_settings(self.settings); # Add everything and initialize self.wow_container = gtk.VBox() self.wow_container.pack_start(self.so_navigation, False) self.wow_container.pack_start(self.very_view) if os.path.exists("temp"): shutil.rmtree("temp") os.mkdir("temp") self.much_window.add(self.wow_container) self.much_window.show_all() gtk.main()
def __init__(self, parent): gtk.Window.__init__(self) self.mainwin = parent self.set_title(_('Secure Authentication')) ### self.set_default_size(800, 450) self.set_transient_for(parent) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.connect('delete-event', self.quit) self.settings = webkit.WebSettings() self.settings.enable_java_applet = False #self.settings.enable_plugins = False self.settings.enable_page_cache = True self.settings.enable_offline_web_application_cache = False self.settings.enable_html5_local_storage = False self.settings.enable_html5_database = False self.settings.enable_default_context_menu = False self.view = webkit.WebView() self.view.set_settings(self.settings) self.view.connect('load-started', self.__started) self.view.connect('load-finished', self.__finished) scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scroll.set_shadow_type(gtk.SHADOW_IN) scroll.add(self.view) self.label = gtk.Label() self.label.set_use_markup(True) self.label.set_alignment(0, 0) self.label.set_markup( _('Autorize Turpial, copy the <b>PIN</b> in the \ text box below and click OK:')) self.waiting_label = gtk.Label() self.waiting_label.set_use_markup(True) self.waiting = CairoWaiting(parent) waiting_box = gtk.Alignment(xalign=1.0) waiting_box.add(self.waiting_label) lblbox = gtk.HBox(False, 2) lblbox.pack_start(self.label, True, True, 2) lblbox.pack_start(waiting_box, True, True, 2) lblbox.pack_start(self.waiting, False, False, 2) self.pin = gtk.Entry() cancel = gtk.Button(stock=gtk.STOCK_CANCEL) accept = gtk.Button(stock=gtk.STOCK_OK) hbox = gtk.HBox(False, 0) hbox.pack_start(self.pin, True, True, 2) hbox.pack_start(cancel, False, False, 2) hbox.pack_start(accept, False, False, 2) vbox = gtk.VBox(False, 5) vbox.pack_start(scroll, True, True, 0) vbox.pack_start(lblbox, False, False, 2) vbox.pack_start(hbox, False, False, 2) cancel.connect('clicked', self.quit) accept.connect('clicked', self.__accept) self.add(vbox)
def __init__(self): #La ventana self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_position(gtk.WIN_POS_CENTER) self.window.set_title("Generador de CED") self.window.maximize() self.window.set_resizable(False) self.window.set_icon_from_file(ruta + 'iconos/iconoApp.png') color = gtk.gdk.color_parse('#ffffff') self.window.modify_bg(gtk.STATE_NORMAL, color) self.window.connect("delete_event", self.salir) self.window.connect("destroy", self.destroy) #contenedor tabla = gtk.Table(100, 100, False) #El Menu menu = gtk.MenuBar() menuArchivo = gtk.Menu() menuEditar = gtk.Menu() menuProyecto = gtk.Menu() menuA = gtk.MenuItem("Archivo") menuE = gtk.MenuItem("Editar") menuP = gtk.MenuItem("Proyecto") menuH = gtk.MenuItem("Herramientas") menuL = gtk.MenuItem("Aplicacion") menuY = gtk.MenuItem("Ayuda") #El menu archivo menuA.set_submenu(menuArchivo) self.nue = gtk.MenuItem("Nuevo Proyecto") self.abr = gtk.MenuItem("Abrir Proyecto") self.gua = gtk.MenuItem("Guardar Proyecto") self.gua.set_sensitive(False) self.guc = gtk.MenuItem("Guardar Proyecto Como...") self.guc.set_sensitive(False) self.cer = gtk.MenuItem("Cerrar Proyecto") self.cer.set_sensitive(False) self.sep = gtk.SeparatorMenuItem() self.sal = gtk.MenuItem("Salir") menuArchivo.append(self.nue) menuArchivo.append(self.abr) menuArchivo.append(self.gua) menuArchivo.append(self.guc) menuArchivo.append(self.cer) menuArchivo.append(self.sep) menuArchivo.append(self.sal) #el menu edicion menuE.set_submenu(menuEditar) self.inHoja = gtk.MenuItem("Insertar Hoja") self.inImagen = gtk.MenuItem("Insertar Imagen") self.inSonido = gtk.MenuItem("Insertar Sonido") self.inVideo = gtk.MenuItem("Insertar Video") self.inArchivo = gtk.MenuItem("Insertar Archivo") self.sepEd1 = gtk.SeparatorMenuItem() self.cop = gtk.MenuItem("Copiar Objeto") self.peg = gtk.MenuItem("Pegar Objeto") self.elm = gtk.MenuItem("Eliminar Objeto") menuEditar.append(self.inHoja) menuEditar.append(self.inImagen) menuEditar.append(self.inSonido) menuEditar.append(self.inVideo) menuEditar.append(self.inArchivo) menuEditar.append(self.sepEd1) menuEditar.append(self.cop) menuEditar.append(self.peg) menuEditar.append(self.elm) #el Menu proyecto menuP.set_submenu(menuProyecto) self.eje = gtk.MenuItem("Ejecutar") self.verHtml = gtk.MenuItem("Ver Codigo Fuente") menuProyecto.append(self.eje) menuProyecto.append(self.verHtml) menu.append(menuA) menu.append(menuE) menu.append(menuP) menu.append(menuH) menu.append(menuL) menu.append(menuY) #La barra de herramientas self.barra = gtk.Toolbar() self.barra.set_orientation(gtk.ORIENTATION_HORIZONTAL) self.barra.set_style(gtk.TOOLBAR_ICONS) self.barra.set_border_width(5) self.barra.set_tooltips(True) tooltips = gtk.Tooltips() #Botones estandar #icono=gtk.image_new_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size('iconos/proyecto.png', 25, 25)) icoNue = gtk.Image() icoNue.set_from_file(ruta + 'iconos/proyecto.png') self.barraNue = gtk.ToolButton(icoNue) self.barraNue.set_tooltip(tooltips, "Nuevo Proyecto") icoAbr = gtk.Image() icoAbr.set_from_file(ruta + 'iconos/abrir.png') self.barraAbr = gtk.ToolButton(icoAbr) self.barraAbr.set_tooltip(tooltips, "Abrir Proyecto") icoGua = gtk.Image() icoGua.set_from_file(ruta + 'iconos/guardar.png') self.barraGua = gtk.ToolButton(icoGua) self.barraGua.set_tooltip(tooltips, "Guardar Proyecto") self.barraGua.set_sensitive(False) icoGuc = gtk.Image() icoGuc.set_from_file(ruta + 'iconos/guardarc.png') self.barraGuc = gtk.ToolButton(icoGuc) self.barraGuc.set_tooltip(tooltips, "Guardar Proyecto Como") self.barraGuc.set_sensitive(False) self.sep = gtk.SeparatorToolItem() icoSal = gtk.Image() icoSal.set_from_file(ruta + 'iconos/salir.png') self.quittb = gtk.ToolButton(icoSal) #botones de recursos self.sep2 = gtk.SeparatorToolItem() icoHoj = gtk.Image() icoHoj.set_from_file(ruta + 'iconos/hoja.png') self.barraHojaNueva = gtk.ToolButton(icoHoj) self.barraHojaNueva.set_tooltip(tooltips, "Insertar Nueva Hoja") self.barraHojaNueva.set_sensitive(False) icoImg = gtk.Image() icoImg.set_from_file(ruta + 'iconos/imagen.png') self.barraImagenNuevo = gtk.ToolButton(icoImg) self.barraImagenNuevo.set_tooltip(tooltips, "Insertar Nueva Imagen") self.barraImagenNuevo.set_sensitive(False) icoSon = gtk.Image() icoSon.set_from_file(ruta + 'iconos/sonido.png') self.barraSonidoNuevo = gtk.ToolButton(icoSon) self.barraSonidoNuevo.set_tooltip(tooltips, "Insertar Nuevo Sonido") self.barraSonidoNuevo.set_sensitive(False) icoVid = gtk.Image() icoVid.set_from_file(ruta + 'iconos/video.png') self.barraVideoNuevo = gtk.ToolButton(icoVid) self.barraVideoNuevo.set_tooltip(tooltips, "Insertar Nuevo Video") self.barraVideoNuevo.set_sensitive(False) icoArc = gtk.Image() icoArc.set_from_file(ruta + 'iconos/archivo.png') self.barraArchivoNuevo = gtk.ToolButton(icoArc) self.barraArchivoNuevo.set_tooltip(tooltips, "Insertar Nuevo Archivo") self.barraArchivoNuevo.set_sensitive(False) #botones de objetos self.sep3 = gtk.SeparatorToolItem() icoRec = gtk.Image() icoRec.set_from_file(ruta + 'iconos/cuadrado.png') self.barraRectangulo = gtk.ToolButton(icoRec) self.barraRectangulo.set_tooltip(tooltips, "Insertar rectangulo") self.barraRectangulo.set_sensitive(False) icoCir = gtk.Image() icoCir.set_from_file(ruta + 'iconos/circulo.png') self.barraCirculo = gtk.ToolButton(icoCir) self.barraCirculo.set_tooltip(tooltips, "Insertar circulo") self.barraCirculo.set_sensitive(False) icoTri = gtk.Image() icoTri.set_from_file(ruta + 'iconos/triangulo.png') self.barraTriangulo = gtk.ToolButton(icoTri) self.barraTriangulo.set_tooltip(tooltips, "Insertar triangulo") self.barraTriangulo.set_sensitive(False) icoLin = gtk.Image() icoLin.set_from_file(ruta + 'iconos/linea.png') self.barraLinea = gtk.ToolButton(icoLin) self.barraLinea.set_tooltip(tooltips, "Insertar Linea") self.barraLinea.set_sensitive(False) icoimg = gtk.Image() icoimg.set_from_file(ruta + 'iconos/imagen.png') self.barraImagen = gtk.ToolButton(icoimg) self.barraImagen.set_tooltip(tooltips, "Insertar Imagen a la Hoja") self.barraImagen.set_sensitive(False) icotex = gtk.Image() icotex.set_from_file(ruta + 'iconos/texto.png') self.barraTexto = gtk.ToolButton(icotex) self.barraTexto.set_tooltip(tooltips, "Insertar texto") self.barraTexto.set_sensitive(False) #botones de formularios self.sep4 = gtk.SeparatorToolItem() icoBot = gtk.Image() icoBot.set_from_file(ruta + 'iconos/boton.png') self.barraBoton = gtk.ToolButton(icoBot) self.barraBoton.set_tooltip(tooltips, "Insertar Boton") self.barraBoton.set_sensitive(False) icoTex = gtk.Image() icoTex.set_from_file(ruta + 'iconos/cajaTexto.png') self.barraCajaTexto = gtk.ToolButton(icoTex) self.barraCajaTexto.set_tooltip(tooltips, "Insertar caja de texto") self.barraCajaTexto.set_sensitive(False) icoLis = gtk.Image() icoLis.set_from_file(ruta + 'iconos/lista.png') self.barraLista = gtk.ToolButton(icoLis) self.barraLista.set_tooltip(tooltips, "Insertar Lista Desplegable") self.barraLista.set_sensitive(False) icoChk = gtk.Image() icoChk.set_from_file(ruta + 'iconos/check.png') self.barraCheck = gtk.ToolButton(icoChk) self.barraCheck.set_tooltip(tooltips, "Insertar CheckBox") self.barraCheck.set_sensitive(False) icoArea = gtk.Image() icoArea.set_from_file(ruta + 'iconos/editor.png') self.barraArea = gtk.ToolButton(icoArea) self.barraArea.set_tooltip(tooltips, "Insertar Editor de Texto") self.barraArea.set_sensitive(False) icoSnd = gtk.Image() icoSnd.set_from_file(ruta + 'iconos/corneta.png') self.barraSon = gtk.ToolButton(icoSnd) self.barraSon.set_tooltip(tooltips, "Insertar Sonido a la Hoja") self.barraSon.set_sensitive(False) icoCla = gtk.Image() icoCla.set_from_file(ruta + 'iconos/clap.png') self.barraCla = gtk.ToolButton(icoCla) self.barraCla.set_tooltip(tooltips, "Insertar Video a la Hoja") self.barraCla.set_sensitive(False) icoScr = gtk.Image() icoScr.set_from_file(ruta + 'iconos/escritos.png') self.barraScr = gtk.ToolButton(icoScr) self.barraScr.set_tooltip(tooltips, "Insertar Codigo Escrito a la Hoja") self.barraScr.set_sensitive(False) #Insertamos los botones estandar a la barra self.barra.insert(self.barraNue, 0) self.barra.insert(self.barraAbr, 1) self.barra.insert(self.barraGua, 2) self.barra.insert(self.barraGuc, 3) self.barra.insert(self.sep, 4) self.barra.insert(self.quittb, 5) #Insertamos los botones recuros a la barra self.barra.insert(self.sep2, 6) self.barra.insert(self.barraHojaNueva, 7) self.barra.insert(self.barraImagenNuevo, 8) self.barra.insert(self.barraSonidoNuevo, 9) self.barra.insert(self.barraVideoNuevo, 10) self.barra.insert(self.barraArchivoNuevo, 11) #Insertamos los botones objetos a la barra self.barra.insert(self.sep3, 12) self.barra.insert(self.barraRectangulo, 13) self.barra.insert(self.barraCirculo, 14) self.barra.insert(self.barraTriangulo, 15) self.barra.insert(self.barraLinea, 16) self.barra.insert(self.barraImagen, 17) self.barra.insert(self.barraTexto, 18) #insertamos los botones de Controles de Formularios self.barra.insert(self.sep4, 19) self.barra.insert(self.barraBoton, 20) self.barra.insert(self.barraCajaTexto, 21) self.barra.insert(self.barraLista, 22) self.barra.insert(self.barraCheck, 23) self.barra.insert(self.barraArea, 24) self.barra.insert(self.barraSon, 25) self.barra.insert(self.barraCla, 26) self.barra.insert(self.barraScr, 27) #La zona de Trabajo #NAvegador de Proyecto self.treeview = gtk.TreeView() # Crear la columna para la lista self.columna = gtk.TreeViewColumn('Proyecto') self.celdaIcono = gtk.CellRendererPixbuf() self.cell = gtk.CellRendererText() self.columna.pack_start(self.celdaIcono, False) self.columna.pack_start(self.cell, False) self.columna.set_attributes(self.celdaIcono, stock_id=1) self.columna.set_attributes(self.cell, text=0) self.treeview.append_column(self.columna) self.treeview.set_enable_tree_lines(True) self.selFila = self.treeview.get_selection() #Vista de las propiedades de los objetos self.panelPropiedades = gtk.TreeView() rendererText = gtk.CellRendererText() column = gtk.TreeViewColumn("Propiedad", rendererText, text=0) column.set_sort_column_id(0) self.panelPropiedades.append_column(column) self.cajaEditable = gtk.CellRendererCombo() self.cajaEditable.set_fixed_size(5, -1) self.cajaEditable.set_property("editable", True) self.cajaEditable.set_property("text-column", 0) self.cajaEditable.set_property("has-entry", True) column = gtk.TreeViewColumn("Valor", self.cajaEditable, text=1) column.add_attribute(self.cajaEditable, "model", 2) self.panelPropiedades.append_column(column) self.panelPropiedades.set_grid_lines(True) #Zona de Previsualizacion self.lienzo = webkit.WebView() self.lienzo.set_view_source_mode(False) propLienzo = webkit.WebSettings() propLienzo.set_property("enable-plugins", False) self.lienzo.set_settings(propLienzo) #propLienzo.set_property("title","Titulo 1") #self.lienzo.set_settings(propLienzo) # Barras de desplazamiento para el contenedor scroll = gtk.ScrolledWindow() scroll2 = gtk.ScrolledWindow() scroll3 = gtk.ScrolledWindow() #self.scroll3.set_policy(gtk.POLICY_NEVER,gtk.POLICY_AUTOMATIC) #barra estado self.statusbar = gtk.Statusbar() #Agregamos al Contenedor scroll.add(self.treeview) scroll2.add(self.lienzo) scroll3.add(self.panelPropiedades) tabla.attach(menu, 0, 100, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.SHRINK, 0, 0) tabla.attach(self.barra, 0, 100, 1, 2, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.SHRINK, 0, 0) tabla.attach(scroll, 0, 20, 2, 50, gtk.FILL, gtk.FILL | gtk.EXPAND, 0, 0) tabla.attach(scroll3, 0, 20, 50, 98, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 0) tabla.attach(scroll2, 20, 100, 2, 98, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 0, 0) tabla.attach(self.statusbar, 0, 100, 98, 100, gtk.FILL | gtk.EXPAND, gtk.FILL, 0, 0) #ACtrivamos las funciones de los menu self.sal.connect("activate", self.salir, 2) #activamos las funciones de los botones de la barra self.quittb.connect("clicked", self.salir, 2) #mostramos la ventana self.window.add(tabla) self.window.show_all()
try: proxy = os.environ['HTTPS_PROXY'] or os.environ['HTTP_PROXY'] except: proxy = None pass if proxy: proxy_handler = urllib2.ProxyHandler({"https": proxy}) opener = urllib2.build_opener(proxy_handler) urllib2.install_opener(opener) font_size = 14 font_default = 'Ricty' font_serif = 'Ricty' font_sans_serif = 'Ricty' font_monospace = 'Ricty' settings = webkit.WebSettings() settings.set_property('serif-font-family', font_serif) settings.set_property('sans-serif-font-family', font_sans_serif) settings.set_property('monospace-font-family', font_monospace) settings.set_property('default-font-family', font_default) settings.set_property('default-font-size', font_size) if proxy: try: import ctypes if platform.system() == 'Windows': libgobject = ctypes.CDLL('libgobject-2.0-0.dll') libsoup = ctypes.CDLL('libsoup-2.4-1.dll') libwebkit = ctypes.CDLL('libwebkit-1.0-2.dll') else: libgobject = ctypes.CDLL('libgobject-2.0.so.0') libsoup = ctypes.CDLL('libsoup-2.4.so.1')
def init_gui(self): self.vbox = gtk.VBox() self.frame = gtk.Frame() self.label = gtk.Label(_('Nothing Playing')) self.frame.set_shadow_type(gtk.SHADOW_IN) self.frame.set_label_align(0.0, 0.0) self.frame.set_label_widget(self.label) self.label.set_use_markup(True) self.label.set_padding(0, 4) #----- set up top 5 tree view -----# self.top_five_list = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) self.top_five_view = gtk.TreeView(self.top_five_list) self.top_five_tvc1 = gtk.TreeViewColumn() self.top_five_tvc2 = gtk.TreeViewColumn() self.top_five_view.append_column(self.top_five_tvc1) self.top_five_view.append_column(self.top_five_tvc2) self.crt = gtk.CellRendererText() self.top_five_tvc1.pack_start(self.crt, True) self.top_five_tvc2.pack_start(self.crt, True) self.top_five_tvc1.add_attribute(self.crt, 'text', 0) self.top_five_tvc2.add_attribute(self.crt, 'text', 1) self.top_five_view.set_headers_visible(False) self.frame.add(self.top_five_view) #---- set up webkit pane -----# self.webview = webkit.WebView() self.webview.connect("navigation-requested", self.navigation_request_cb) self.scroll = gtk.ScrolledWindow() self.scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) self.scroll.set_shadow_type(gtk.SHADOW_IN) self.scroll.add(self.webview) # set up webkit settings to match gtk font settings self.websettings = webkit.WebSettings() self.webview.set_settings(self.websettings) self.apply_font_settings() self.webview.connect("style-set", self.style_set_cb) #----- set up button group -----# self.vbox2 = gtk.VBox() self.buttons = gtk.HBox() #---- pack everything into side pane ----# self.vbox.pack_start(self.frame, expand=False) self.vbox2.pack_start(self.buttons, expand=False) self.vbox2.pack_start(self.scroll, expand=True) self.vbox.pack_start(self.vbox2, expand=True) self.vbox.show_all() self.vbox.set_size_request(200, -1) self.shell.add_widget(self.vbox, rb.SHELL_UI_LOCATION_RIGHT_SIDEBAR, expand=True)