Advertisement
ak47suk1

webdeveloper

Sep 5th, 2010
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 44.21 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3.  
  4. import os
  5. import sys
  6. import pygtk
  7. pygtk.require('2.0')
  8. import gtk
  9. import subprocess
  10. import webkit
  11. import vte
  12. import time
  13. import string
  14.  
  15.  
  16. code = gtk.TextView()
  17. code2 = gtk.TextView()
  18.  
  19.  
  20.  
  21.  
  22. class NotebookExample:
  23.  
  24.     def checkForConfigDir(self):       
  25.         self.tmpPath = '/tmp/wdt'
  26.         if(not os.path.exists(self.tmpPath)):
  27.             os.makedirs(self.tmpPath)
  28.             print "Created dir: "+self.tmpPath
  29.  
  30.  
  31.     def quit(self):
  32.         gtk.main_quit()
  33.  
  34.     def on_close_clicked(self, widget):    
  35.         self.quit()
  36.  
  37.     def on_home_clicked(self, widget):
  38.         homedir = os.path.expanduser("~")      
  39.         os.system('xdg-open "%s"' % homedir)
  40.  
  41.     def on_comp_clicked(self, widget):     
  42.         os.system('xdg-open "%s"' % "computer:///")
  43.  
  44.     def on_filesystem_clicked(self, widget):   
  45.         os.system('xdg-open "%s"' % "/")
  46.  
  47.  
  48.  
  49.     def on_css_clicked(self, widget, event):
  50.         g_get_home_dir = os.path.expanduser("~")
  51.         dialog = gtk.FileChooserDialog(title = "Select Css file" ,
  52.             action=gtk.FILE_CHOOSER_ACTION_OPEN,
  53.             buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OK, gtk.RESPONSE_OK))
  54.         dialog.set_current_folder(g_get_home_dir);
  55.         filter = gtk.FileFilter()
  56.         filter.set_name("All css files")
  57.         filter.add_pattern("*.css")
  58.         dialog.add_filter(filter)
  59.         response = dialog.run()
  60.         if response == gtk.RESPONSE_OK:
  61.  
  62.                 namePath, ext = os.path.splitext(dialog.get_filename())
  63.                 nameP = string.split(namePath, '/')[-1]
  64.         subprocess.Popen(self.configpath+"css.py "+ dialog.get_filename()+"> /tmp/wdt/"+ nameP+"_minified.css", shell=True)
  65.                 time.sleep(2)
  66.                 filename2 = "/tmp/wdt/"+ nameP+"_minified.css"
  67.         textbuffer2 = code2.get_buffer()
  68.         file = open(filename2, "r")              
  69.             text2 = file.read()
  70.             textbuffer2.set_text(text2)
  71.             file.close()
  72.         elif response == gtk.RESPONSE_CANCEL:
  73.                print 'Closed, no files selected'
  74.         dialog.destroy()
  75.  
  76.     def on_cssmin_clicked(self, widget, event):
  77.  
  78.         filename = "/tmp/wdt/originalcode.css"
  79.         textbuffer = code.get_buffer()
  80.         text = textbuffer.get_text(textbuffer.get_start_iter() , textbuffer.get_end_iter())
  81.         file = open(filename, "w")
  82.         file.write(text)
  83.         file.close()
  84.         subprocess.Popen(self.configpath+"css.py /tmp/wdt/originalcode.css > /tmp/wdt/originalcode_minified.css", shell=True)
  85.                 time.sleep(2)
  86.                 filename2 = "/tmp/wdt/originalcode_minified.css"
  87.         textbuffer2 = code2.get_buffer()
  88.         file = open(filename2, "r")              
  89.             text2 = file.read()
  90.             textbuffer2.set_text(text2)
  91.  
  92.             file.close()
  93.  
  94.     def on_cssclear_clicked(self, widget, event):
  95.         textbuffer = code.get_buffer()
  96.         textbuffer.set_text("")
  97.         textbuffer2 = code2.get_buffer()
  98.             textbuffer2.set_text("")
  99.  
  100.  
  101.     def on_changed(self, widget):
  102.         g_get_home_dir = os.path.expanduser("~")
  103.         texty = widget.get_active_text()
  104.         dialog = gtk.FileChooserDialog(title = "Select Image" ,
  105.             action=gtk.FILE_CHOOSER_ACTION_OPEN,
  106.             buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OK, gtk.RESPONSE_OK))
  107.         dialog.set_current_folder(g_get_home_dir);
  108.         filter = gtk.FileFilter()
  109.         filter.set_name("Images")
  110.         filter.add_mime_type("image/png")
  111.         filter.add_mime_type("image/jpeg")
  112.         filter.add_mime_type("image/gif")
  113.         filter.add_pattern("*.png")
  114.         filter.add_pattern("*.jpg")
  115.         filter.add_pattern("*.gif")
  116.         dialog.add_filter(filter)
  117.         response = dialog.run()
  118.         if response == gtk.RESPONSE_OK:
  119.            iconPath, ext = os.path.splitext(dialog.get_filename())
  120.            if texty == "Create Square Style Button 32x32":
  121.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape square32", shell=True)
  122.                 time.sleep(2)
  123.                 subprocess.Popen("xdg-open " +iconPath+"-square32.png", shell=True)
  124.            elif texty == "Create Square Style Button 48x48":
  125.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape square48", shell=True)
  126.                 time.sleep(2)
  127.                 subprocess.Popen("xdg-open " +iconPath+"-square48.png", shell=True)
  128.            elif texty == "Create Square Style Button 64x64":
  129.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape square64", shell=True)
  130.                 time.sleep(2)
  131.                 subprocess.Popen("xdg-open " +iconPath+"-square64.png", shell=True)
  132.            elif texty == "Create Square Style Button 96x96":
  133.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape square96", shell=True)
  134.                 time.sleep(2)
  135.                 subprocess.Popen("xdg-open " +iconPath+"-square96.png", shell=True)
  136.            elif texty == "Create Square Style Button 128x128":
  137.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape square128", shell=True)
  138.                 time.sleep(2)
  139.                 subprocess.Popen("xdg-open " +iconPath+"-square128.png", shell=True)
  140.            elif texty == "Create Rounded Style Button 32x32":
  141.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape round32", shell=True)
  142.                 time.sleep(2)
  143.                 subprocess.Popen("xdg-open " +iconPath+"-round32.png", shell=True)
  144.            elif texty == "Create Rounded Style Button 48x48":
  145.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape round48", shell=True)
  146.                 time.sleep(2)
  147.                 subprocess.Popen("xdg-open " +iconPath+"-round48.png", shell=True)
  148.            elif texty == "Create Rounded Style Button 64x64":
  149.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape round64", shell=True)
  150.                 time.sleep(2)
  151.                 subprocess.Popen("xdg-open " +iconPath+"-round64.png", shell=True)
  152.            elif texty == "Create Rounded Style Button 96x96":
  153.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape round96", shell=True)
  154.                 time.sleep(2)
  155.                 subprocess.Popen("xdg-open " +iconPath+"-round96.png", shell=True)
  156.            elif texty == "Create Rounded Style Button 128x128":
  157.         subprocess.Popen(self.configpath+"coolbutton.py "+ dialog.get_filename()+" --shape round128", shell=True)
  158.                 time.sleep(2)
  159.                 subprocess.Popen("xdg-open " +iconPath+"-round128.png", shell=True)
  160.  
  161.         elif response == gtk.RESPONSE_CANCEL:
  162.                print 'Closed, no files selected'
  163.         dialog.destroy()
  164.  
  165.     def on_dir_changed(self, widget):
  166.         g_get_home_dir = os.path.expanduser("~")
  167.         texty = widget.get_active_text()
  168.         dialog = gtk.FileChooserDialog(title = "Select Folder" ,
  169.             action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
  170.             buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OK, gtk.RESPONSE_OK))
  171.         dialog.set_current_folder(g_get_home_dir);
  172.         response = dialog.run()
  173.         if response == gtk.RESPONSE_OK:
  174.            iconPath, ext = os.path.splitext(dialog.get_filename())
  175.            if texty == "Create Square Style Button 32x32":
  176.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s square32", shell=True)
  177.            elif texty == "Create Square Style Button 48x48":
  178.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s square48", shell=True)
  179.            elif texty == "Create Square Style Button 64x64":
  180.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s square64", shell=True)
  181.            elif texty == "Create Square Style Button 96x96":
  182.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s square96", shell=True)
  183.            elif texty == "Create Square Style Button 128x128":
  184.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s square128", shell=True)
  185.            elif texty == "Create Rounded Style Button 32x32":
  186.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s round32", shell=True)
  187.            elif texty == "Create Rounded Style Button 48x48":
  188.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s round48", shell=True)
  189.            elif texty == "Create Rounded Style Button 64x64":
  190.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s round64", shell=True)
  191.            elif texty == "Create Rounded Style Button 96x96":
  192.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s round96", shell=True)
  193.            elif texty == "Create Rounded Style Button 128x128":
  194.         subprocess.Popen(self.configpath+"masscoolbutton.py -d"+ dialog.get_filename()+" -s round128", shell=True)
  195.         elif response == gtk.RESPONSE_CANCEL:
  196.                print 'Closed, no files selected'
  197.         dialog.destroy()
  198.  
  199.  
  200.  
  201.  
  202.     def on_w3c_clicked(self, widget, data=None):
  203.         self.w3ceditor.open("http://validator.w3.org/#validate_by_uri+with_options")
  204.         self.w3c2editor.load_html_string("", "file:///")
  205.         self.w3c3editor.load_html_string("", "file:///")
  206.     def on_w3c2_clicked(self, widget, data=None):
  207.         self.w3c2editor.open("http://jigsaw.w3.org/css-validator/#validate_by_uri+with_options")
  208.         self.w3ceditor.load_html_string("", "file:///")
  209.         self.w3c3editor.load_html_string("", "file:///")
  210.     def on_w3c3_clicked(self, widget, data=None):
  211.         self.w3c3editor.open("http://validator.w3.org/feed/")
  212.         self.w3c2editor.load_html_string("", "file:///")
  213.         self.w3ceditor.load_html_string("", "file:///")
  214.  
  215.  
  216.  
  217.     def init_term(self):
  218.         os.chdir(os.getenv('HOME'))
  219.         self._vte.fork_command()
  220.         realpath = os.path.dirname(os.path.realpath( __file__ ))
  221.         os.chdir(realpath + '/..')
  222.  
  223.     def changed_cb(self, combobox):
  224.         model = combobox.get_model()
  225.         index = combobox.get_active()
  226.         if index > -1:
  227.             print model[index][0], 'selected'
  228.         return
  229.  
  230.  
  231.     def delete(self, widget, event=None):
  232.         gtk.main_quit()
  233.         return False
  234.  
  235.     def Renderer(self,horizontal, spacing):
  236.         frame = gtk.Frame()
  237.         bbox = gtk.HBox()
  238.         bbox.set_border_width(5)
  239.         frame.add(bbox)
  240.         bbox.set_spacing(spacing)
  241.         width = 620
  242.         height = 560
  243.         self.renderer = webkit.WebView()
  244.         self.renderer.set_size_request(width,height)
  245.         self.renderer.open(self.configpath+"_packer_.html")
  246.         bbox.add(self.renderer)
  247.  
  248.         return frame
  249.  
  250.     def BrowserRenderer(self,horizontal, spacing):
  251.         frame = gtk.Frame()
  252.         bbox = gtk.HBox()
  253.         bbox.set_border_width(10)
  254.         frame.add(bbox)
  255.         bbox.set_spacing(spacing)
  256.  
  257.         self._vte = vte.Terminal()
  258.         self._vte.set_emulation("xterm")
  259.         self._vte.set_allow_bold(True)
  260.         self._vte.set_scrollback_lines(1024)
  261.         self._vte.set_size_request(620,560)
  262.         self._vte.set_opacity(int(65535 * int(80) / 100))
  263.         bbox.add(self._vte)
  264.         self.init_term()
  265.         return frame
  266.  
  267.  
  268.     def EditorRenderer(self,horizontal, spacing):
  269.  
  270.         frame = gtk.Frame()
  271.         bbox = gtk.HBox()
  272.         bbox.set_border_width(10)
  273.         frame.add(bbox)
  274.         bbox.set_spacing(spacing)
  275.        
  276.         self.filename = None
  277.        
  278.         self.editor = webkit.WebView()
  279.         self.editor.set_editable(True)
  280.         self.editor.load_html_string("This is a test text", "file:///")
  281.  
  282.         scroll = gtk.ScrolledWindow()
  283.         scroll.add(self.editor)
  284.         scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  285.  
  286.         self.ui = self.generate_ui()
  287.         self.toolbar1 = self.ui.get_widget("/toolbar_main")
  288.         self.toolbar2 = self.ui.get_widget("/toolbar_format")
  289.  
  290.         self.layout = gtk.VBox()
  291.         self.layout.pack_start(self.toolbar1, False)
  292.         self.layout.pack_start(self.toolbar2, False)
  293.         self.layout.pack_start(scroll, True, True)
  294.  
  295.  
  296.         bbox.add(self.layout)
  297.  
  298.         return frame
  299.  
  300.  
  301.     def generate_ui(self):
  302.         ui_def = """
  303.        <ui>
  304.          <toolbar name="toolbar_main">
  305.            <toolitem action="new" />
  306.            <toolitem action="open" />
  307.            <toolitem action="save" />
  308.            <separator />
  309.            <toolitem action="undo" />
  310.            <toolitem action="redo" />
  311.          </toolbar>
  312.          <toolbar name="toolbar_format">
  313.            <toolitem action="bold" />
  314.            <toolitem action="italic" />
  315.            <toolitem action="underline" />
  316.            <toolitem action="strikethrough" />
  317.            <separator />
  318.            <toolitem action="font" />
  319.            <toolitem action="color" />
  320.            <separator />
  321.            <toolitem action="justifyleft" />
  322.            <toolitem action="justifyright" />
  323.            <toolitem action="justifycenter" />
  324.            <toolitem action="justifyfull" />
  325.            <separator />
  326.            <toolitem action="insertimage" />
  327.            <toolitem action="insertlink" />
  328.          </toolbar>
  329.        </ui>
  330.        """
  331.  
  332.         actions = gtk.ActionGroup("Actions")
  333.         actions.add_actions([
  334.  
  335.           ("new", gtk.STOCK_NEW, "_New", None, None, self.on_new),
  336.           ("open", gtk.STOCK_OPEN, "_Open", None, None, self.on_open),
  337.           ("save", gtk.STOCK_SAVE, "_Save", None, None, self.on_save),
  338.  
  339.           ("undo", gtk.STOCK_UNDO, "_Undo", None, None, self.on_action),
  340.           ("redo", gtk.STOCK_REDO, "_Redo", None, None, self.on_action),
  341.  
  342.           ("bold", gtk.STOCK_BOLD, "_Bold", "<ctrl>B", None, self.on_action),
  343.           ("italic", gtk.STOCK_ITALIC, "_Italic", "<ctrl>I", None, self.on_action),
  344.           ("underline", gtk.STOCK_UNDERLINE, "_Underline", "<ctrl>U", None, self.on_action),
  345.           ("strikethrough", gtk.STOCK_STRIKETHROUGH, "_Strike", "<ctrl>T", None, self.on_action),
  346.           ("font", gtk.STOCK_SELECT_FONT, "Select _Font", "<ctrl>F", None, self.on_select_font),
  347.           ("color", gtk.STOCK_SELECT_COLOR, "Select _Color", None, None, self.on_select_color),
  348.  
  349.           ("justifyleft", gtk.STOCK_JUSTIFY_LEFT, "Justify _Left", None, None, self.on_action),
  350.           ("justifyright", gtk.STOCK_JUSTIFY_RIGHT, "Justify _Right", None, None, self.on_action),
  351.           ("justifycenter", gtk.STOCK_JUSTIFY_CENTER, "Justify _Center", None, None, self.on_action),
  352.           ("justifyfull", gtk.STOCK_JUSTIFY_FILL, "Justify _Full", None, None, self.on_action),
  353.  
  354.           ("insertimage", "insert-image", "Insert _Image", None, None, self.on_insert_image),
  355.           ("insertlink", "insert-link", "Insert _Link", None, None, self.on_insert_link),
  356.         ])
  357.  
  358.         actions.get_action("insertimage").set_property("icon-name", "insert-image")
  359.         actions.get_action("insertlink").set_property("icon-name", "insert-link")
  360.  
  361.         ui = gtk.UIManager()
  362.         ui.insert_action_group(actions)
  363.         ui.add_ui_from_string(ui_def)
  364.         return ui
  365.  
  366.     def on_action(self, action):
  367.       self.editor.execute_script(
  368.         "document.execCommand('%s', false, false);" % action.get_name())
  369.  
  370.     def on_paste(self, action):
  371.       self.editor.paste_clipboard()
  372.  
  373.     def on_new(self, action):
  374.       self.editor.load_html_string("", "file:///")
  375.  
  376.     def on_select_font(self, action):
  377.       dialog = gtk.FontSelectionDialog("Select a font")
  378.       if dialog.run() == gtk.RESPONSE_OK:
  379.         fname, fsize = dialog.fontsel.get_family().get_name(), dialog.fontsel.get_size()
  380.         self.editor.execute_script("document.execCommand('fontname', null, '%s');" % fname)
  381.         self.editor.execute_script("document.execCommand('fontsize', null, '%s');" % fsize)
  382.       dialog.destroy()
  383.  
  384.     def on_select_color(self, action):
  385.       dialog = gtk.ColorSelectionDialog("Select Color")
  386.       if dialog.run() == gtk.RESPONSE_OK:
  387.         gc = str(dialog.colorsel.get_current_color())
  388.         color = "#" + "".join([gc[1:3], gc[5:7], gc[9:11]])
  389.         self.editor.execute_script("document.execCommand('forecolor', null, '%s');" % color)
  390.       dialog.destroy()
  391.  
  392.     def on_insert_link(self, action):
  393.       dialog = gtk.Dialog("Enter a URL:",
  394.                 buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK))
  395.  
  396.       entry = gtk.Entry()
  397.       dialog.vbox.pack_start(entry)
  398.       dialog.show_all()
  399.  
  400.       if dialog.run() == gtk.RESPONSE_OK:
  401.         self.editor.execute_script(
  402.           "document.execCommand('createLink', true, '%s');" % entry.get_text())
  403.       dialog.destroy()
  404.  
  405.     def on_insert_image(self, action):
  406.       dialog = gtk.FileChooserDialog(title = "Select Image" ,
  407.         action=gtk.FILE_CHOOSER_ACTION_OPEN,
  408.         buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OK, gtk.RESPONSE_OK))
  409.  
  410.       filter = gtk.FileFilter()
  411.       filter.set_name("Images")
  412.       filter.add_mime_type("image/png")
  413.       filter.add_mime_type("image/jpeg")
  414.       filter.add_mime_type("image/gif")
  415.       filter.add_pattern("*.png")
  416.       filter.add_pattern("*.jpg")
  417.       filter.add_pattern("*.gif")
  418.       filter.add_pattern("*.tif")
  419.       filter.add_pattern("*.xpm")
  420.       filter.add_pattern("*.ico")
  421.       filter.add_pattern("*.svg")
  422.       dialog.add_filter(filter)
  423.  
  424.       if dialog.run() == gtk.RESPONSE_OK:
  425.         fn = dialog.get_filename()
  426.         if os.path.exists(fn):
  427.           self.editor.execute_script(
  428.             "document.execCommand('insertImage', null, '%s');" % fn)
  429.       dialog.destroy()
  430.  
  431.     def on_open(self, action):
  432.       dialog = gtk.FileChooserDialog(title = "Select Html File" ,
  433.         action=gtk.FILE_CHOOSER_ACTION_OPEN,
  434.         buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_OK, gtk.RESPONSE_OK))
  435.  
  436.       if dialog.run() == gtk.RESPONSE_OK:
  437.         fn = dialog.get_filename()
  438.         if os.path.exists(fn):
  439.           self.filename = fn
  440.           with open(fn) as fd:
  441.             self.editor.load_html_string(fd.read(), "file:///")
  442.       dialog.destroy()
  443.  
  444.     def on_save(self, action):
  445.       if self.filename:
  446.         with open(self.filename) as fd: fd.write(self.get_html())
  447.       else:
  448.         dialog = gtk.FileChooserDialog(title = "Save File" ,
  449.         action=gtk.FILE_CHOOSER_ACTION_SAVE,
  450.         buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,gtk.STOCK_SAVE, gtk.RESPONSE_OK))
  451.  
  452.         if dialog.run() == gtk.RESPONSE_OK:
  453.           self.filename = dialog.get_filename()
  454.           with open(self.filename, "w+") as fd: fd.write(self.get_html())
  455.         dialog.destroy()
  456.  
  457.     def get_html(self):
  458.       self.editor.execute_script("document.title=document.documentElement.innerHTML;")
  459.       return self.editor.get_main_frame().get_title()
  460.  
  461.  
  462.  
  463.     def ColorPicker(self,horizontal, spacing):
  464.         frame = gtk.Frame()
  465.         bbox = gtk.HBox()
  466.         bbox.set_border_width(10)
  467.         frame.add(bbox)
  468.         bbox.set_spacing(spacing)
  469.         width = 620
  470.         height = 560
  471.         self.renderer = webkit.WebView()
  472.         self.renderer.set_size_request(width,height)
  473.         self.renderer.open(self.configpath+"view.html")
  474.         bbox.add(self.renderer)
  475.  
  476.         return frame
  477.  
  478.  
  479.     def CssGenerator(self,horizontal, spacing):
  480.         frame = gtk.Frame()
  481.         bbox = gtk.HBox()
  482.         bbox.set_border_width(10)
  483.         frame.add(bbox)
  484.         bbox.set_spacing(spacing)
  485.         width = 700
  486.         height = 560
  487.         self.cbrenderer = webkit.WebView()
  488.         self.cbrenderer.set_size_request(width,height)
  489.         self.cbrenderer.open(self.configpath+"ButtonGenerator.html")
  490.         bbox.add(self.cbrenderer)
  491.  
  492.         return frame
  493.  
  494.     def CoolGenerator(self,horizontal, spacing):
  495.         frame = gtk.Frame()
  496.         bbox = gtk.HBox()
  497.         bbox.set_border_width(10)
  498.         frame.add(bbox)
  499.         bbox.set_spacing(spacing)
  500.         width = 620
  501.         height = 490
  502.         self.crenderer = webkit.WebView()
  503.         self.crenderer.set_size_request(width,height)
  504.         self.crenderer.open(self.configpath+"coolbuttons.html")
  505.         bbox.add(self.crenderer)
  506.  
  507.         return frame
  508.  
  509.     def create_cbox3(self, horizontal, spacing):
  510.         frame = gtk.Frame("Simple image button generator")
  511.         bbox = gtk.HBox()
  512.         bbox.set_border_width(10)
  513.         frame.add(bbox)
  514.         bbox.set_spacing(spacing)
  515.  
  516.         self.qLabel = gtk.Label()
  517.         self.qLabel.set_markup("<span font_weight='bold' color='#000000'>Select style which you want to use</span>")
  518.  
  519.         bbox.add(self.qLabel)
  520.  
  521.         cb = gtk.combo_box_new_text()
  522.         cb.connect("changed", self.on_changed)
  523.  
  524.         cb.append_text('Create Square Style Button 32x32')
  525.         cb.append_text('Create Square Style Button 48x48')
  526.         cb.append_text('Create Square Style Button 64x64')
  527.         cb.append_text('Create Square Style Button 96x96')
  528.         cb.append_text('Create Square Style Button 128x128')
  529.         cb.append_text('Create Rounded Style Button 32x32')
  530.         cb.append_text('Create Rounded Style Button 48x48')
  531.         cb.append_text('Create Rounded Style Button 64x64')
  532.         cb.append_text('Create Rounded Style Button 96x96')
  533.         cb.append_text('Create Rounded Style Button 128x128')
  534.        
  535.         fixed = gtk.Fixed()
  536.         fixed.put(cb, 180, 0)
  537.         self.label = gtk.Label("-")
  538.         fixed.put(self.label, 190, 35)
  539.  
  540.         bbox.add(fixed)
  541.  
  542.         return frame
  543.  
  544.     def create_cbox4(self, horizontal, spacing):
  545.         frame = gtk.Frame("Mass image button generator (applied to all images in selected folder)")
  546.         bbox = gtk.HBox()
  547.         bbox.set_border_width(10)
  548.         frame.add(bbox)
  549.         bbox.set_spacing(spacing)
  550.  
  551.         self.qLabel = gtk.Label()
  552.         self.qLabel.set_markup("<span font_weight='bold' color='#000000'>Select style which you want to use</span>")
  553.  
  554.         bbox.add(self.qLabel)
  555.  
  556.         cb = gtk.combo_box_new_text()
  557.         cb.connect("changed", self.on_dir_changed)
  558.  
  559.         cb.append_text('Create Square Style Button 32x32')
  560.         cb.append_text('Create Square Style Button 48x48')
  561.         cb.append_text('Create Square Style Button 64x64')
  562.         cb.append_text('Create Square Style Button 96x96')
  563.         cb.append_text('Create Square Style Button 128x128')
  564.         cb.append_text('Create Rounded Style Button 32x32')
  565.         cb.append_text('Create Rounded Style Button 48x48')
  566.         cb.append_text('Create Rounded Style Button 64x64')
  567.         cb.append_text('Create Rounded Style Button 96x96')
  568.         cb.append_text('Create Rounded Style Button 128x128')
  569.        
  570.         fixed = gtk.Fixed()
  571.         fixed.put(cb, 180, 0)
  572.         self.label = gtk.Label("-")
  573.         fixed.put(self.label, 190, 35)
  574.  
  575.         bbox.add(fixed)
  576.  
  577.         return frame
  578.  
  579.  
  580.  
  581.     def AllButtons(self,horizontal, spacing, layout):
  582.  
  583.         frame = gtk.Frame()
  584.         bbox = gtk.HButtonBox()
  585.         bbox.set_border_width(3)
  586.         frame.add(bbox)
  587.         bbox.set_layout(layout)
  588.         bbox.set_spacing(spacing)
  589.  
  590.  
  591.  
  592.         icon = os.path.join(self.iconpath, "home.png")
  593.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon , 24, 24)
  594.         image = gtk.Image()
  595.         image.set_from_pixbuf(pixbuf)
  596.         image.show()
  597.     self.sethome_eventBox = gtk.ToolButton()
  598.         self.sethome_eventBox.set_icon_widget(image)
  599.     self.sethome_eventBox.connect("clicked", self.on_home_clicked)
  600.         bbox.add(self.sethome_eventBox)
  601.  
  602.  
  603.         icon = os.path.join(self.iconpath, "drive.png")
  604.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon , 24, 24)
  605.         image = gtk.Image()
  606.         image.set_from_pixbuf(pixbuf)
  607.         image.show()
  608.     self.setfile_eventBox = gtk.ToolButton()
  609.         self.setfile_eventBox.set_icon_widget(image)
  610.     self.setfile_eventBox.connect("clicked", self.on_filesystem_clicked)
  611.         bbox.add(self.setfile_eventBox)
  612.  
  613.  
  614.         icon = os.path.join(self.iconpath, "computer.png")
  615.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon , 24, 24)
  616.         image = gtk.Image()
  617.         image.set_from_pixbuf(pixbuf)
  618.         image.show()
  619.     self.setcomp_eventBox = gtk.ToolButton()
  620.         self.setcomp_eventBox.set_icon_widget(image)
  621.     self.setcomp_eventBox.connect("clicked", self.on_comp_clicked)
  622.         bbox.add(self.setcomp_eventBox)
  623.  
  624.  
  625.         icon = os.path.join(self.iconpath, "quit.png")
  626.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon , 24, 24)
  627.         image = gtk.Image()
  628.         image.set_from_pixbuf(pixbuf)
  629.         image.show()
  630.     self.setquit_eventBox = gtk.ToolButton()
  631.         self.setquit_eventBox.set_icon_widget(image)
  632.     self.setquit_eventBox.connect("clicked", self.on_close_clicked)
  633.         bbox.add(self.setquit_eventBox)
  634.  
  635.         return frame
  636.  
  637.     def CssButton(self,horizontal, spacing, layout):
  638.         frame = gtk.Frame()
  639.         bbox = gtk.HButtonBox()
  640.         bbox.set_border_width(10)
  641.         frame.add(bbox)
  642.         bbox.set_layout(layout)
  643.         bbox.set_spacing(spacing)
  644.     self.setpage_eventBox = gtk.Button()
  645.     self.setpage_eventBox.set_size_request(230,30)
  646.     self.setpageLabel = gtk.Label()
  647.     self.setpageLabel.set_markup("<span font_weight='bold' color='#000000'>Select CSS File and Minify</span>")
  648.     self.setpage_eventBox.connect("button-press-event", self.on_css_clicked)
  649.     self.setpage_eventBox.add(self.setpageLabel)
  650.         bbox.add(self.setpage_eventBox)
  651.  
  652.  
  653.     self.minpage_eventBox = gtk.Button()
  654.     self.minpage_eventBox.set_size_request(230,30)
  655.     self.minpageLabel = gtk.Label()
  656.     self.minpageLabel.set_markup("<span font_weight='bold' color='#000000'>Paste CSS to box and minify</span>")
  657.     self.minpage_eventBox.connect("button-press-event", self.on_cssmin_clicked)
  658.     self.minpage_eventBox.add(self.minpageLabel)
  659.         bbox.add(self.minpage_eventBox)
  660.  
  661.     self.clear_eventBox = gtk.Button()
  662.     self.clear_eventBox.set_size_request(60,30)
  663.     self.clearLabel = gtk.Label()
  664.     self.clearLabel.set_markup("<span font_weight='bold' color='#000000'>Clear</span>")
  665.     self.clear_eventBox.connect("button-press-event", self.on_cssclear_clicked)
  666.     self.clear_eventBox.add(self.clearLabel)
  667.         bbox.add(self.clear_eventBox)
  668.  
  669.         return frame
  670.  
  671.  
  672.     def w3cEntry(self,horizontal, spacing):
  673.  
  674.         frame = gtk.Frame()
  675.         bbox = gtk.HButtonBox()
  676.         bbox.set_border_width(10)
  677.         frame.add(bbox)
  678.         bbox.set_spacing(spacing)
  679.     self.w3cpage_eventBox = gtk.Button()
  680.     self.w3cpage_eventBox.set_size_request(500,30)
  681.     self.w3cpageLabel = gtk.Label()
  682.     self.w3cpageLabel.set_markup("<span font_weight='bold' color='#000000'>Start W3C Html Validator</span>")
  683.     self.w3cpage_eventBox.connect("button-press-event", self.on_w3c_clicked)
  684.     self.w3cpage_eventBox.add(self.w3cpageLabel)
  685.         bbox.add(self.w3cpage_eventBox)
  686.  
  687.  
  688.         return frame
  689.  
  690.     def w3c2Entry(self,horizontal, spacing):
  691.  
  692.         frame = gtk.Frame()
  693.         bbox = gtk.HButtonBox()
  694.         bbox.set_border_width(10)
  695.         frame.add(bbox)
  696.         bbox.set_spacing(spacing)
  697.     self.w3c2page_eventBox = gtk.Button()
  698.     self.w3c2page_eventBox.set_size_request(500,30)
  699.     self.w3c2pageLabel = gtk.Label()
  700.     self.w3c2pageLabel.set_markup("<span font_weight='bold' color='#000000'>Start W3C CSS Validator</span>")
  701.     self.w3c2page_eventBox.connect("button-press-event", self.on_w3c2_clicked)
  702.     self.w3c2page_eventBox.add(self.w3c2pageLabel)
  703.         bbox.add(self.w3c2page_eventBox)
  704.  
  705.  
  706.         return frame
  707.  
  708.     def w3c3Entry(self,horizontal, spacing):
  709.  
  710.         frame = gtk.Frame()
  711.         bbox = gtk.HButtonBox()
  712.         bbox.set_border_width(10)
  713.         frame.add(bbox)
  714.         bbox.set_spacing(spacing)
  715.     self.w3c3page_eventBox = gtk.Button()
  716.     self.w3c3page_eventBox.set_size_request(500,30)
  717.     self.w3c3pageLabel = gtk.Label()
  718.     self.w3c3pageLabel.set_markup("<span font_weight='bold' color='#000000'>Start W3C Feed Validator</span>")
  719.     self.w3c3page_eventBox.connect("button-press-event", self.on_w3c3_clicked)
  720.     self.w3c3page_eventBox.add(self.w3c3pageLabel)
  721.         bbox.add(self.w3c3page_eventBox)
  722.  
  723.  
  724.         return frame
  725.  
  726.  
  727.     def w3cInfo(self,horizontal, spacing):
  728.  
  729.         frame = gtk.Frame()
  730.         frame.set_size_request(800, 600)
  731.         bbox = gtk.HBox()
  732.         bbox.set_border_width(10)
  733.         frame.add(bbox)
  734.         bbox.set_spacing(spacing)
  735.        
  736.         self.filename = None
  737.        
  738.         self.w3ceditor = webkit.WebView()
  739.         self.w3ceditor.set_editable(True)
  740.         self.w3ceditor.load_html_string("", "file:///")
  741.  
  742.  
  743.         w3cscroll = gtk.ScrolledWindow()
  744.         w3cscroll.add(self.w3ceditor)
  745.         w3cscroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  746.  
  747.         self.w3clayout = gtk.VBox()
  748.         self.w3clayout.pack_start(w3cscroll, True, True)
  749.  
  750.  
  751.         bbox.add(self.w3clayout)
  752.  
  753.         return frame
  754.  
  755.     def w3c2Info(self,horizontal, spacing):
  756.  
  757.         frame = gtk.Frame()
  758.         frame.set_size_request(800, 600)
  759.         bbox = gtk.HBox()
  760.         bbox.set_border_width(10)
  761.         frame.add(bbox)
  762.         bbox.set_spacing(spacing)
  763.        
  764.         self.filename = None
  765.        
  766.         self.w3c2editor = webkit.WebView()
  767.         self.w3c2editor.set_editable(True)
  768.         self.w3c2editor.load_html_string("", "file:///")
  769.  
  770.         w3c2scroll = gtk.ScrolledWindow()
  771.         w3c2scroll.add(self.w3c2editor)
  772.         w3c2scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  773.  
  774.         self.w3c2layout = gtk.VBox()
  775.         self.w3c2layout.pack_start(w3c2scroll, True, True)
  776.  
  777.  
  778.         bbox.add(self.w3c2layout)
  779.  
  780.         return frame
  781.  
  782.     def w3c3Info(self,horizontal, spacing):
  783.  
  784.         frame = gtk.Frame()
  785.         frame.set_size_request(800, 600)
  786.         bbox = gtk.HBox()
  787.         bbox.set_border_width(10)
  788.         frame.add(bbox)
  789.         bbox.set_spacing(spacing)
  790.        
  791.         self.filename = None
  792.        
  793.         self.w3c3editor = webkit.WebView()
  794.         self.w3c3editor.set_editable(True)
  795.         self.w3c3editor.load_html_string("", "file:///")
  796.  
  797.         w3c3scroll = gtk.ScrolledWindow()
  798.         w3c3scroll.add(self.w3c3editor)
  799.         w3c3scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
  800.  
  801.         self.w3c3layout = gtk.VBox()
  802.         self.w3c3layout.pack_start(w3c3scroll, True, True)
  803.  
  804.  
  805.         bbox.add(self.w3c3layout)
  806.  
  807.         return frame
  808.  
  809.  
  810.     def CssInfo(self,horizontal, spacing):
  811.  
  812.         frame = gtk.Frame("Input Box")
  813.         frame.set_size_request(800, 290)
  814.         bbox = gtk.HBox()
  815.         bbox.set_border_width(10)
  816.         frame.add(bbox)
  817.         bbox.set_spacing(spacing)
  818.        
  819.  
  820.         code.set_editable(True)
  821.         scrolled_area2 = gtk.ScrolledWindow()
  822.         scrolled_area2.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
  823.         scrolled_area2.add_with_viewport(code)
  824.         scrolled_area2.set_size_request(500,290)
  825.  
  826.  
  827.         bbox.add(scrolled_area2)
  828.  
  829.         return frame
  830.  
  831.     def CssInfo2(self,horizontal, spacing):
  832.  
  833.         frame = gtk.Frame("Output Box")
  834.         frame.set_size_request(800, 290)
  835.         bbox = gtk.HBox()
  836.         bbox.set_border_width(10)
  837.         frame.add(bbox)
  838.         bbox.set_spacing(spacing)
  839.        
  840.  
  841.         code2.set_editable(False)
  842.         scrolled_area = gtk.ScrolledWindow()
  843.         scrolled_area.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
  844.         scrolled_area.add_with_viewport(code2)
  845.         scrolled_area.set_size_request(500,290)
  846.  
  847.  
  848.         bbox.add(scrolled_area)
  849.  
  850.         return frame
  851.  
  852.  
  853.     def About(self,horizontal, spacing):
  854.  
  855.         frame = gtk.Frame()
  856.         frame.set_size_request(800, 580)
  857.         bbox = gtk.HBox()
  858.         bbox.set_border_width(5)
  859.         frame.add(bbox)
  860.         bbox.set_spacing(spacing)
  861.         self.aboutLabel = gtk.Label()
  862.         self.aboutLabel.set_markup("<span font_weight='bold' color='#000000'>Web Developer Tools</span>\n\n"
  863.                              "Web Developer Tools is a suite of useful tools for web developers\n\n"
  864.                              "<span font_weight='bold' color='#000000'>Offline Tools:</span>\n\n"
  865.                              "Javascript Compressor\n"
  866.                              "Css Minifier\n"
  867.                              "RGB / HEX Color Picker\n"
  868.                              "Css Button Generator\n"
  869.                              "Cool Button Generator\n"
  870.                              "VTE Terminal\n"
  871.                              "Wysiwyg Editor\n\n"
  872.                              "<span font_weight='bold' color='#000000'>Online Tools:</span>\n\n"
  873.                              "W3C Html Validator\n"
  874.                              "W3C CSS Validator\n"
  875.                              "W3C Feed Validator\n\n\n"
  876.                              "For some of applications which has been included or modified we thanks to various people\n\n"
  877.                              "<span font_weight='bold' color='#000000'>Credits goes to:</span>\n"
  878.                              "<a href='http://dean.edwards.name/'>Dean Edwards for Javascript Compressor</a>\n"
  879.                              "<a href='http://stackoverflow.com/users/27388/borgar'>Borgar Porsteinsson for Css Minifier</a>\n"
  880.                              "<a href='http://arstechnica.com/author/ryan-paul/'>Ryan Paul for Wysiwyg Editor</a>\n"
  881.                              "<a href='http://nadiana.com/pil-tutorial-how-create-button-generator'>Nadia Alramli fro Cool Button Generator</a>\n\n"
  882.                              "<span font_weight='bold' color='#000000'>License</span>\n\n"
  883.                              "<a href='http://www.gnu.org/licenses/gpl-2.0.html'>Distributed under GPL 2</a>\n\n"
  884.                              "<span font_weight='bold' color='#000000'>Author</span>\n\n"
  885.                              "(c) 2010 <a href='mailto:thebestdeal1@gmail.com'>Peter  Kmet </a>\n\n" )
  886.  
  887.         bbox.add(self.aboutLabel)
  888.  
  889.         return frame
  890.  
  891.  
  892.  
  893.     def __init__(self):
  894.         self.checkForConfigDir()
  895.         self.configpath = "/usr/share/wdt/"
  896.         self.iconpath = self.configpath+"icons/"
  897.         window = gtk.Window(gtk.WINDOW_TOPLEVEL)
  898.         window.set_position(gtk.WIN_POS_CENTER)
  899.         window.set_title("Web Developer Tools")
  900.         window.set_icon_from_file(os.path.join(self.iconpath, "wdt.png"))
  901.         window.connect("delete_event", self.delete)
  902.         window.set_border_width(1)
  903.         window.set_size_request(1280,700)
  904.  
  905.         table = gtk.Table(3,6,False)
  906.         window.add(table)
  907.  
  908.         notebook = gtk.Notebook()
  909.         notebook.set_tab_pos(gtk.POS_LEFT)
  910.         table.attach(notebook, 0,6,0,1)
  911.         notebook.show()
  912.         self.show_tabs = True
  913.         self.show_border = True
  914.  
  915.  
  916.         frame = gtk.Frame("CSS Button Generator")
  917.  
  918.         frame.set_border_width(10)
  919.         frame.set_size_request(800, 600)
  920.         vbox = gtk.VBox(False, 0)
  921.         vbox.set_border_width(10)
  922.         frame.add(vbox)
  923.         vbox.pack_start(self.CssGenerator(True, 5),True, True, 10)
  924.  
  925.         tab_box = gtk.HBox(False, 5)
  926.         tab_label = gtk.Label("CSS Button Generator")
  927.         tab_label.set_size_request(170, 25)
  928.         tab_icon = gtk.Image()
  929.         icon_path = os.path.join(self.iconpath, "cssbutton.png")
  930.  
  931.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  932.         tab_icon.set_from_pixbuf(pixbuf)
  933.  
  934.         tab_box.pack_start(tab_icon, False)
  935.         tab_box.pack_start(tab_label, False)
  936.  
  937.         tab_box.show_all()
  938.         notebook.append_page(frame, tab_box)
  939.  
  940.  
  941.  
  942.         frame = gtk.Frame("Dean Edwards Packer")
  943.  
  944.         frame.set_border_width(10)
  945.         frame.set_size_request(800, 600)
  946.         vbox = gtk.VBox(False, 0)
  947.         vbox.set_border_width(10)
  948.         frame.add(vbox)
  949.         vbox.pack_start(self.Renderer(True, 5),True, True, 10)
  950.  
  951.         tab_box = gtk.HBox(False, 5)
  952.         tab_label = gtk.Label("Javascript Compressor")
  953.         tab_label.set_size_request(170, 25)
  954.         tab_icon = gtk.Image()
  955.         icon_path = os.path.join(self.iconpath, "javascript.png")
  956.  
  957.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  958.         tab_icon.set_from_pixbuf(pixbuf)
  959.  
  960.         tab_box.pack_start(tab_icon, False)
  961.         tab_box.pack_start(tab_label, False)
  962.  
  963.         tab_box.show_all()
  964.         notebook.append_page(frame, tab_box)
  965.  
  966.         frame = gtk.Frame("CSS Minifier")
  967.  
  968.         frame.set_border_width(10)
  969.         frame.set_size_request(800, 600)
  970.         vbox = gtk.VBox(False, 0)
  971.         vbox.set_border_width(10)
  972.         frame.add(vbox)
  973.         vbox.pack_start(self.CssButton(True, 20, gtk.BUTTONBOX_SPREAD),True, True, 10)
  974.         vbox.pack_start(self.CssInfo(True, 5),True, True, 10)
  975.         vbox.pack_start(self.CssInfo2(True, 5),True, True, 10)
  976.         tab_box = gtk.HBox(False, 5)
  977.         tab_label = gtk.Label("---- Css Minifier ----")
  978.         tab_label.set_size_request(170, 25)
  979.         tab_icon = gtk.Image()
  980.         icon_path = os.path.join(self.iconpath, "css-icon.png")
  981.  
  982.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  983.         tab_icon.set_from_pixbuf(pixbuf)
  984.  
  985.         tab_box.pack_start(tab_icon, False)
  986.         tab_box.pack_start(tab_label, False)
  987.  
  988.         tab_box.show_all()
  989.         notebook.append_page(frame, tab_box)
  990.  
  991.         frame = gtk.Frame("RGB / HEX Color Picker")
  992.  
  993.         frame.set_border_width(10)
  994.         frame.set_size_request(800, 600)
  995.         vbox = gtk.VBox(False, 0)
  996.         vbox.set_border_width(10)
  997.         frame.add(vbox)
  998.         vbox.pack_start(self.ColorPicker(True, 5),True, True, 10)
  999.  
  1000.         tab_box = gtk.HBox(False, 5)
  1001.         tab_label = gtk.Label("RGB / HEX Color Picker")
  1002.         tab_label.set_size_request(170, 25)
  1003.         tab_icon = gtk.Image()
  1004.         icon_path = os.path.join(self.iconpath, "colorchart.png")
  1005.  
  1006.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1007.         tab_icon.set_from_pixbuf(pixbuf)
  1008.  
  1009.         tab_box.pack_start(tab_icon, False)
  1010.         tab_box.pack_start(tab_label, False)
  1011.  
  1012.         tab_box.show_all()
  1013.         notebook.append_page(frame, tab_box)
  1014.  
  1015.         frame = gtk.Frame("Cool Button Generator")
  1016.  
  1017.         frame.set_border_width(10)
  1018.         frame.set_size_request(800, 600)
  1019.         vbox = gtk.VBox(False, 0)
  1020.         vbox.set_border_width(10)
  1021.         frame.add(vbox)
  1022.         vbox.pack_start(self.create_cbox3(True, 5),True, True, 10)
  1023.         vbox.pack_start(self.CoolGenerator(True, 5),True, True, 10)
  1024.         vbox.pack_start(self.create_cbox4(True, 5),True, True, 10)
  1025.  
  1026.         tab_box = gtk.HBox(False, 5)
  1027.         tab_label = gtk.Label("Cool Button Generator")
  1028.         tab_label.set_size_request(170, 25)
  1029.         tab_icon = gtk.Image()
  1030.         icon_path = os.path.join(self.iconpath, "coolbutton.png")
  1031.  
  1032.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1033.         tab_icon.set_from_pixbuf(pixbuf)
  1034.  
  1035.         tab_box.pack_start(tab_icon, False)
  1036.         tab_box.pack_start(tab_label, False)
  1037.  
  1038.         tab_box.show_all()
  1039.         notebook.append_page(frame, tab_box)
  1040.      
  1041.         frame = gtk.Frame("VTE Terminal")
  1042.  
  1043.         frame.set_border_width(10)
  1044.         frame.set_size_request(800, 600)
  1045.         vbox = gtk.VBox(False, 0)
  1046.         vbox.set_border_width(10)
  1047.         frame.add(vbox)
  1048.         vbox.pack_start(self.BrowserRenderer(True, 5),True, True, 10)
  1049.  
  1050.         tab_box = gtk.HBox(False, 5)
  1051.         tab_label = gtk.Label("---- VTE Terminal ----")
  1052.         tab_label.set_size_request(170, 25)
  1053.         tab_icon = gtk.Image()
  1054.         icon_path = os.path.join(self.iconpath, "terminal.png")
  1055.  
  1056.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1057.         tab_icon.set_from_pixbuf(pixbuf)
  1058.  
  1059.         tab_box.pack_start(tab_icon, False)
  1060.         tab_box.pack_start(tab_label, False)
  1061.  
  1062.         tab_box.show_all()
  1063.         notebook.append_page(frame, tab_box)
  1064.  
  1065.         frame = gtk.Frame("Wysiwyg Html 5 Editor")
  1066.  
  1067.         frame.set_border_width(10)
  1068.         frame.set_size_request(800, 600)
  1069.         vbox = gtk.VBox(False, 0)
  1070.         vbox.set_border_width(10)
  1071.         frame.add(vbox)
  1072.         vbox.pack_start(self.EditorRenderer(True, 5),True, True, 10)
  1073.  
  1074.         tab_box = gtk.HBox(False, 5)
  1075.         tab_label = gtk.Label("Wysiwyg Html5 Editor")
  1076.         tab_label.set_size_request(170, 25)
  1077.         tab_icon = gtk.Image()
  1078.         icon_path = os.path.join(self.iconpath, "editor.png")
  1079.  
  1080.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1081.         tab_icon.set_from_pixbuf(pixbuf)
  1082.  
  1083.         tab_box.pack_start(tab_icon, False)
  1084.         tab_box.pack_start(tab_label, False)
  1085.  
  1086.         tab_box.show_all()
  1087.         notebook.append_page(frame, tab_box)
  1088.  
  1089.  
  1090.         frame = gtk.Frame("W3C Html Validator")
  1091.  
  1092.         frame.set_border_width(10)
  1093.         frame.set_size_request(800, 600)
  1094.         vbox = gtk.VBox(False, 0)
  1095.         vbox.set_border_width(10)
  1096.         frame.add(vbox)
  1097.         vbox.pack_start(self.w3cEntry(True, 5),True, True, 10)
  1098.         vbox.pack_start(self.w3cInfo(True, 5),True, True, 10)
  1099.         tab_box = gtk.HBox(False, 5)
  1100.         tab_label = gtk.Label("W3C Html Validator")
  1101.         tab_label.set_size_request(170, 25)
  1102.         tab_icon = gtk.Image()
  1103.         icon_path = os.path.join(self.iconpath, "w3c_home.png")
  1104.  
  1105.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1106.         tab_icon.set_from_pixbuf(pixbuf)
  1107.  
  1108.         tab_box.pack_start(tab_icon, False)
  1109.         tab_box.pack_start(tab_label, False)
  1110.  
  1111.         tab_box.show_all()
  1112.         notebook.append_page(frame, tab_box)
  1113.  
  1114.         frame = gtk.Frame("W3C CSS Validator")
  1115.  
  1116.         frame.set_border_width(10)
  1117.         frame.set_size_request(800, 600)
  1118.         vbox = gtk.VBox(False, 0)
  1119.         vbox.set_border_width(10)
  1120.         frame.add(vbox)
  1121.         vbox.pack_start(self.w3c2Entry(True, 5),True, True, 10)
  1122.         vbox.pack_start(self.w3c2Info(True, 5),True, True, 10)
  1123.         tab_box = gtk.HBox(False, 5)
  1124.         tab_label = gtk.Label("W3C CSS Validator")
  1125.         tab_label.set_size_request(170, 25)
  1126.         tab_icon = gtk.Image()
  1127.         icon_path = os.path.join(self.iconpath, "w3c_home.png")
  1128.  
  1129.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1130.         tab_icon.set_from_pixbuf(pixbuf)
  1131.  
  1132.         tab_box.pack_start(tab_icon, False)
  1133.         tab_box.pack_start(tab_label, False)
  1134.  
  1135.         tab_box.show_all()
  1136.         notebook.append_page(frame, tab_box)
  1137.  
  1138.         frame = gtk.Frame("W3C Feed Validator")
  1139.  
  1140.         frame.set_border_width(10)
  1141.         frame.set_size_request(800, 600)
  1142.         vbox = gtk.VBox(False, 0)
  1143.         vbox.set_border_width(10)
  1144.         frame.add(vbox)
  1145.         vbox.pack_start(self.w3c3Entry(True, 5),True, True, 10)
  1146.         vbox.pack_start(self.w3c3Info(True, 5),True, True, 10)
  1147.         tab_box = gtk.HBox(False, 5)
  1148.         tab_label = gtk.Label("W3C Feed Validator")
  1149.         tab_label.set_size_request(170, 25)
  1150.         tab_icon = gtk.Image()
  1151.         icon_path = os.path.join(self.iconpath, "w3c_home.png")
  1152.  
  1153.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1154.         tab_icon.set_from_pixbuf(pixbuf)
  1155.  
  1156.         tab_box.pack_start(tab_icon, False)
  1157.         tab_box.pack_start(tab_label, False)
  1158.  
  1159.         tab_box.show_all()
  1160.         notebook.append_page(frame, tab_box)
  1161.  
  1162.  
  1163.         frame = gtk.Frame("About & Credits")
  1164.  
  1165.         frame.set_border_width(10)
  1166.         frame.set_size_request(800, 600)
  1167.         vbox = gtk.VBox(False, 0)
  1168.         vbox.set_border_width(10)
  1169.         frame.add(vbox)
  1170.         vbox.pack_start(self.About(True, 5),True, True, 10)
  1171.  
  1172.         tab_box = gtk.HBox(False, 5)
  1173.         tab_label = gtk.Label("--- About & Credits ---")
  1174.         tab_label.set_size_request(170, 25)
  1175.         tab_icon = gtk.Image()
  1176.         icon_path = os.path.join(self.iconpath, "about.png")
  1177.  
  1178.         pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(icon_path, 24, 24)
  1179.         tab_icon.set_from_pixbuf(pixbuf)
  1180.  
  1181.         tab_box.pack_start(tab_icon, False)
  1182.         tab_box.pack_start(tab_label, False)
  1183.  
  1184.         tab_box.show_all()
  1185.         notebook.append_page(frame, tab_box)  
  1186.  
  1187.  
  1188.         vbox = gtk.VBox(False, 0)
  1189.         vbox.pack_start(self.AllButtons(True, 5, gtk.BUTTONBOX_END),True, True, 10)
  1190.         table.attach(vbox, 2,6,1,2)
  1191.  
  1192.  
  1193.  
  1194.         table.show_all()
  1195.         window.show_all()
  1196.  
  1197. def setProcessName(processName):
  1198.     if sys.platform == 'linux2':
  1199.         try:
  1200.         import ctypes
  1201.         libc = ctypes.CDLL('libc.so.6')
  1202.         libc.prctl(15, processName, 0, 0, 0)
  1203.         except:
  1204.         try:
  1205.              import dl
  1206.              libc = dl.open('/lib/libc.so.6')
  1207.              libc.call('prctl', 15, (processName+'\0'), 0, 0, 0)
  1208.         except:
  1209.             pass
  1210.  
  1211. setProcessName('Web-Devel-Tools')
  1212.  
  1213.  
  1214.  
  1215. if __name__ == "__main__":
  1216.     NotebookExample()
  1217.     gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement