V puvodnich scriptech ubrowser.py a gbrowser.py chybelo cacheovani, tak jsem ho tam ted pridal. Celej balik uz je prepsanej, kdo pouzil puvodni zde prilozim oba scripty s doplnenym cacheovanim. Ve slozce tmp automaticky vytvari profil s cache.
ubrowser.py
#!/usr/bin/python
import pygtk
pygtk.require('2.0')
import gtk
import gtkmozembed
import subprocess
class PyMoz:
def delete_event(self,widget,data=None):
print("Exit")
return False
def destroy(self,widget,data=None):
gtk.main_quit()
def button_clicked(self,widget,data):
data.go_back()
def button_clicked2(self,widget,data):
data.go_forward()
def term(self,widget,data):
subprocess.Popen("python terminal.py", shell=True)
def editor(self,widget,data):
subprocess.Popen("python editor.py", shell=True)
def google(self,widget,data):
subprocess.Popen("python gbrowser.py", shell=True)
def sbook(self,widget,data):
subprocess.Popen("python SCRIPTBOOK.py", shell=True)
def screen(self,widget,data):
subprocess.Popen("python screen.py", shell=True)
def __init__(self):
#init mozembed
gtkmozembed.set_profile_path("/tmp", "ubuntu_cz_browser_user")
self.moz = gtkmozembed.MozEmbed()
box = gtk.VBox(False,10)
win = gtk.Window()
win.add(box)
hbox = gtk.HBox(False,10)
button = gtk.Button("Back")
button.connect("clicked",self.button_clicked,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Forward")
button.connect("clicked",self.button_clicked2,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Close")
button.connect("clicked",self.destroy,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Terminal")
button.connect("clicked",self.term,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Editor")
button.connect("clicked",self.editor,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Google")
button.connect("clicked",self.google,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Scriptbook")
button.connect("clicked",self.sbook,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Screenshot")
button.connect("clicked",self.screen,self.moz)
hbox.pack_start(button)
button.show()
box.pack_start(hbox,False,False)
hbox.show()
box.pack_start(self.moz,True,True,0)
self.moz.show()
self.moz.load_url('http://forum.ubuntu.cz/index.php?action=login2&user=mujlogin&passwrd=mojeheslo')
self.moz.set_size_request(950,650)
title=self.moz.get_title()
win.set_title("Ubuntu CZ Browser")
win.show_all()
win.connect("delete_event",self.delete_event)
win.connect("destroy",self.destroy)
if __name__ == "__main__":
PyMoz()
gtk.main()
gbrowser.py
#!/usr/bin/python
import pygtk
pygtk.require('2.0')
import gtk
import gtkmozembed
class PyMoz:
def delete_event(self,widget,data=None):
print("Exit")
return False
def destroy(self,widget,data=None):
gtk.main_quit()
def button_clicked(self,widget,data):
data.go_back()
def button_clicked2(self,widget,data):
data.go_forward()
def __init__(self):
gtkmozembed.set_profile_path("/tmp", "google_browser_user")
self.moz = gtkmozembed.MozEmbed()
box = gtk.VBox(False,10)
win = gtk.Window()
win.add(box)
hbox = gtk.HBox(False,10)
button = gtk.Button("Back")
button.connect("clicked",self.button_clicked,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Forward")
button.connect("clicked",self.button_clicked2,self.moz)
hbox.pack_start(button)
button.show()
button = gtk.Button("Close")
button.connect("clicked",self.destroy,self.moz)
hbox.pack_start(button)
button.show()
box.pack_start(hbox,False,False)
hbox.show()
box.pack_start(self.moz,True,True,0)
self.moz.show()
self.moz.load_url('http://google.com')
self.moz.set_size_request(750,450)
title=self.moz.get_title()
win.set_title("Google Browser")
win.show_all()
win.connect("delete_event",self.delete_event)
win.connect("destroy",self.destroy)
if __name__ == "__main__":
PyMoz()
gtk.main()