Author Topic: Lets create a PCLinuxOS webkit browser (python)  (Read 28291 times)

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15847
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #240 on: April 10, 2011, 04:12:57 AM »
Neal, Taco.22

I think we're ok as long as we leave the original license in the code.  It states that we can modify it and redistribute it and that we should note our changes. We're ok.

That's what I thought.

Quote
We could own the ToolBar class because we've almost completely rewritten it.
A customizable toolbar similar to FF is in order, but that's way too much work.

At this point, a stable, working toolbar is more important than a customizable toolbar, I believe. Adding on the ability to customize the toolbar could be looked into at a later time.
 
Quote
Moving tools around is as simple as relocating them in the list.  So anyone can customize it to suit themselves.

Config files could be simple text files written to and read from by us.  There is also a ready made class that manages all that if we want to import it.  It's a lot of work either way.

I have started some work on creating config files. I do not know whether they will function as wanted yet, as they are not ready for testing at this time. 

Quote
Epiphany isn't quite done, but it blows us away in features.  We can't download or view PDF or handle cookies, popups, google ads, and lots of other geeky stuff.  We can't even set the font size.  We just don't have the brainiacs to figure all that out. 

We have determination. We have resources like community encouragement and support. A braniac might figure it all out quickly, but I think we can get it figured out well enough.

Quote
It takes a lot of people to develop big apps. We have to realize our limits here.  We'll be doing good to come up with a basic HTML viewer and get rid of all the little bugs and glitches. 

I think we have already passed "a basic HTML viewer." We have a toolbar with functioning buttons and tabbed browsing added.
It would be nice to have more coders helping out, but we can do this. :)

Quote
For people learning Python, a project like this is the best thing that could happen.  I hope it stays fun and helps everyone get some hands-on experience. 
I love puzzles and this one has a lot to offer.   ;D

Lots to learn. :) Lots to have fun with. :)


Offline Taco.22

  • Sr. Member
  • ****
  • Posts: 481
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #241 on: April 10, 2011, 06:33:13 AM »
Quote
I think we're ok as long as we leave the original license in the code.  It states that we can modify it and redistribute it and that we should note our changes. We're ok.
At the very least we should be able to add our changes to the initial code and be credited for it.  That way the new, improved version of this script is out there for others to play with.  Who knows what may happen.  Certainly this script has not been taken as far as we taken it because we would have found it!  So the potential is there for some other brainiac to stumble across it and add his/her bit.  You know, the bit we needed! ;D

Quote
For people learning Python, a project like this is the best thing that could happen.  I hope it stays fun and helps everyone get some hands-on experience. 
I love puzzles and this one has a lot to offer.   ;D
I've got to say that this project has opened a large can of worms for me.  I've always wanted to get into a bit of coding but couldn't seem to find the right opening.  Be careful of what you wish for!!  That ski ramp ain't looking any smaller, so I guess it's "hang on and enjoy the ride". ;D     
Linux Registered User # 529407


Online scoundrel

  • Administrator
  • Hero Member
  • *****
  • Posts: 4532
  • Philosophy= Bigger Hammer
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #242 on: April 10, 2011, 06:38:06 AM »
zoom is not working right.. gradientz are smaller and zooms only the midle of browser .. earlier zoom worked better though without retaining zoom ..

couldn't find if the URl handler had been worked on or not.. but still needing to do the whole addy for other sites ..

like how clicking on search pops the google page ..
Please Donate Today..Or I Will Make You Wish You Had

Offline Hootiegibbon

  • Hero Member
  • *****
  • Posts: 4151
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #243 on: April 10, 2011, 08:25:08 AM »
Quote
Neal, Taco.22

I think we're ok as long as we leave the original license in the code.  It states that we can modify it and redistribute it and that we should note our changes. We're ok.


The code this is based on is GPL2 so we are ok to redistribute etc so long as we acknowledge it, we can consider our code a fork of this so....
Quote
We could own the ToolBar class because we've almost completely rewritten it.
A customizable toolbar similar to FF is in order, but that's way too much work.
  
Moving tools around is as simple as relocating them in the list.  So anyone can customize it to suit themselves.

Config files could be simple text files written to and read from by us.  There is also a ready made class that manages all that if we want to import it.  It's a lot of work either way.  

Epiphany isn't quite done, but it blows us away in features.  We can't download or view PDF or handle cookies, popups, google ads, and lots of other geeky stuff.  We can't even set the font size.  We just don't have the brainiacs to figure all that out.  



Where possible I would like to pass out certain functions to external apps for processing , existing apps that do their job well and for minimal headroom. examples are using surfraw for bookmarking and for searching (we could get a box that passes out sr options right and default that to scroogle?) , wget or similar for downloading  (we can do a zenity wrapper for a gui if we absolutely need one) , I think that of a task can be done by another app that does it well and it is light lets do so as it lets the browser do what it should  - Browse.

I would be all for having 'extensions' that work this way or with any web browser interface for example we could put a http front end to msmtp and have an email client appear within the browser but actually be another app doing its thing while its needed... we could even have access to a text editor within the browser window
Quote
It takes a lot of people to develop big apps. We have to realize our limits here.  We'll be doing good to come up with a basic HTML viewer and get rid of all the little bugs and glitches.  

Yes it does and I think so too - again that's part of my - pass it out where possible doctrine..
Quote
For people learning Python, a project like this is the best thing that could happen.  I hope it stays fun and helps everyone get some hands-on experience.  
I love puzzles and this one has a lot to offer.   ;D


The cookies thing can be done via webkit (when I get more time i will read up on the how to activate these functions) - this is how most of the modial browsers work.

One question I have is where to sit this :

Code: [Select]
def on_active(self, widget, data=None):
        '''When the user enters an address in the bar, we check to make
           sure they added the http://, if not we add it for them.  Once
           the url is correct, we just ask webkit to open that site.'''
        url = self.url_bar.get_text()
        try:
            url.index("://")
        except:
            url = "http://"+url
        self.url_bar.set_text(url)
        self.web_view.open(url)



to stop having to add the http://

Jase
« Last Edit: April 11, 2011, 09:46:28 PM by old-polack »


I am Hootiegibbon, undisputed champion fo the typo

My .dotfiles

Offline Sproggy

  • Hero Member
  • *****
  • Posts: 1484
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #244 on: April 10, 2011, 08:55:25 AM »
i have been digging around the net and found a script

#!/usr/bin/env python
import Cookie
import datetime
import random
expiration = datetime.datetime.now() + datetime.timedelta(days=30)
cookie = Cookie.SimpleCookie()
cookie["session"] = random.randint(1000000000)
cookie["session"]["domain"] = ".jayconrod.com"
cookie["session"]["path"] = "/"
cookie["session"]["expires"] = \
expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST")
print "Content-type: text/plain"
print cookie.output()
print
print "Cookie set with: " + cookie.output()

dunno if it is helpful or not

Kori

Offline Sproggy

  • Hero Member
  • *****
  • Posts: 1484
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #245 on: April 10, 2011, 09:12:46 AM »
heres another i have found
Code: [Select]
from Common import *

from MiscUtils.Funcs import positive_id

# If this is Python 2.2 or greater, import the standard Cookie module
# as CookieEngine. Otherwise, import WebUtils.Cookie as CookieEngine.
# This is because there is a nasty bug in the Cookie.py module
# included in Python 2.1 and earlier.

pyVer = getattr(sys, 'version_info', None)
if pyVer and pyVer[:2] >= (2, 2):
  # Get Python's Cookie module. We have to do some work since
  # it has the same name as we do. So we'll strip out anything
  # from the path that might cause us to import from the WebKit
  # directory, then import Cookie using that restricted path --
  # that ought to ensure that we're using Python's module.
  import imp
  path = []
  thisDir = os.path.abspath(os.path.dirname(__file__))
  for dir in sys.path:
    if not dir or dir == '.':
      continue
    if os.path.abspath(dir) == thisDir:
      continue
    path.append(dir)
  file, pathname, description = imp.find_module('Cookie', path)
  try:
    CookieEngine = imp.load_module('Cookie', file, pathname, description)
  finally:
    if file:
      file.close()
else:
  # For Python versions < 2.2, we are including a copy of the
  # standard Cookie.py module from Python 2.2, but modified to
  # work with Python 1.5.2 and up.
  from WebUtils import Cookie
  CookieEngine = Cookie
  del Cookie


class Cookie(Object):
  """Delicious cookies.

  Cookie is used to create cookies that have additional attributes
  beyond their value.

  Note that web browsers don't typically send any information with
  the cookie other than its value. Therefore `HTTPRequest.cookie`
  simply returns a value such as an integer or a string.

  When the server sends cookies back to the browser, it can send
  a cookie that simply has a value, or the cookie can be
  accompanied by various attributes (domain, path, max-age, ...)
  as described in `RFC 2109`_. Therefore, in HTTPResponse,
  `setCookie` can take either an instance of the Cookie class,
  as defined in this module, or a value.

  Note that Cookies values get pickled (see the `pickle` module),
  so you can set and get cookies that are integers, lists,
  dictionaries, etc.

  .. _`RFC 2109`: ftp://ftp.isi.edu/in-notes/rfc2109.txt

  """

  # Future
  #
  # * This class should provide error checking in the setFoo()
  #   methods. Or maybe our internal Cookie implementation
  #   already does that?
  # * This implementation is probably not as efficient as it
  #   should be, [a] it works and [b] the interface is stable.
  #   We can optimize later.[/b]


  ## Init ##

  def __init__(self, name, value):
    """Create a cookie.

    Properties other than `name` and `value` are set with methods.

    """

    self._cookies = CookieEngine.SimpleCookie()
    self._name = name
    self._value = value
    self._cookies[name] = value
    self._cookie = self._cookies[name]

  def __repr__(self):
    return ('%s(id=0x%x, name=%r, domain=%r, '
        'path=%r, value=%r, expires=%r, maxAge=%r)'
      % (self.__class__.__name__, positive_id(self),
        self.name(), self.domain(),
        self.path(), self.value(), self.expires(), self.maxAge()))


  ## Accessors ##

  def comment(self):
    return self._cookie['comment']

  def domain(self):
    return self._cookie['domain']

  def maxAge(self):
    return self._cookie['max-age']

  def expires(self):
    return self._cookie['expires']

  def name(self):
    return self._name

  def path(self):
    return self._cookie['path']

  def isSecure(self):
    return self._cookie['secure']

  def value(self):
    return self._value

  def version(self):
    return self._cookie['version']


  ## Setters ##

  def setComment(self, comment):
    self._cookie['comment'] = comment

  def setDomain(self, domain):
    self._cookie['domain'] = domain

  def setExpires(self, expires):
    self._cookie['expires'] = expires

  def setMaxAge(self, maxAge):
    self._cookie['max-age'] = maxAge

  def setPath(self, path):
    self._cookie['path'] = path

  def setSecure(self, secure=True):
    self._cookie['secure'] = secure

  def setValue(self, value):
    self._value = value
    self._cookies[self._name] = value

  def setVersion(self, version):
    self._cookie['version'] = version


  ## Misc ##

  def delete(self):
    """Delete a cookie.

    When sent, this should delete the cookie from the user's
    browser, by making it empty, expiring it in the past,
    and setting its max-age to 0. One of these will delete
    the cookie for any browser (which one actually works
    depends on the browser).

    """
    self._value = ''
    self._cookie['expires'] = "Mon, 01-Jan-1900 00:00:00 GMT"
    self._cookie['max-age'] = 0

  def headerValue(self):
    """Return header value.

    Returns a string with the value that should be used
    in the HTTP headers.

    """
    items = self._cookies.items()
    assert len(items) == 1
    return items[0][1].OutputString()

Kori
« Last Edit: April 10, 2011, 09:14:51 AM by Sproggy »

Offline Hootiegibbon

  • Hero Member
  • *****
  • Posts: 4151
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #246 on: April 10, 2011, 09:59:35 AM »

Excellent stuff Sproggy, I have been puzzling over this among other things (like the app-outsourcing concept)  

Folks , i am pretty sure that a .rc file is read by a single segment line of code that passes the arguments onto webkit, still looking at this.

Ongoto, good stuff with the current version , as mentioned the zoom is not quite right atm (seemed to be larger than normal fonts by default)

Everything else is good so far.

Jase
« Last Edit: April 11, 2011, 09:47:58 PM by old-polack »


I am Hootiegibbon, undisputed champion fo the typo

My .dotfiles

Offline Sproggy

  • Hero Member
  • *****
  • Posts: 1484
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #247 on: April 10, 2011, 10:28:19 AM »
ive updated the install rpm to the latest version from reply 237, i have also included the require of glib-networking to allow Hammer to use TSL/SSL Secure logins.


Download the latest version


http://dl.dropbox.com/u/5639762/pclinuxos-hammer-0.0.1.4-1Sproggy2011.i586.rpm

http://dl.dropbox.com/u/5639762/pclinuxos-hammer-0.0.1.4-1Sproggy2011.src.rpm


To install the rpm go to the folder in which you downloaded the rpm to, open terminal session in that folder

su to root

enter the following command to install the rpm and get the dependencies required

apt-get install pclinuxos-hammer-0.0.1.4-1Sproggy2011.i586.rpm


Kori

ongoto

  • Guest
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #248 on: April 10, 2011, 12:11:23 PM »
Way to go team.  Gettin' some of those geeky things worked out.   :)

I've noticed the things that scoundrel mentioned and a couple more.  I'm looking at getting zoom right and opening a link in a new window request is messed up. There's no handler for Back/Fwd button highlighting.  Also getting the window title and the entry bar to update correctly when you switch or close tabs is a little iffy.

Made an about dialog from stock.  Need to customize it to include credits and such.


Offline Sproggy

  • Hero Member
  • *****
  • Posts: 1484
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #249 on: April 10, 2011, 12:16:15 PM »
Way to go team.  Gettin' some of those geeky things worked out.   :)

I've noticed the things that scoundrel mentioned and a couple more.  I'm looking at getting zoom right and opening a link in a new window request is messed up. There's no handler for Back/Fwd button highlighting.  Also getting the window title and the entry bar to update correctly when you switch or close tabs is a little iffy.

Made an about dialog from stock.  Need to customize it to include credits and such.




i9 adjusted the zoom thing as is was set to DEFAULT_ZOOM = 1.3 ... i adjusted that to 1.0 ... i love the about dialog!!!

Kori

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3737
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #250 on: April 10, 2011, 01:53:44 PM »
Works here fine, but when i click on my site on a link, that should open a new tab, it's open a new window...

Online scoundrel

  • Administrator
  • Hero Member
  • *****
  • Posts: 4532
  • Philosophy= Bigger Hammer
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #251 on: April 10, 2011, 02:28:59 PM »
yep.. links are opening in a new page, about an inch wide and two high  ;D ;D  + taskbar reverts to bottom ..

watching video and scrolling makes video jump  ;D

browser does  not retain chosen size on restart .. and zoom is still buggy..

this is kori's rpm I am running.. latest ??
Please Donate Today..Or I Will Make You Wish You Had

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3737
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #252 on: April 10, 2011, 02:38:56 PM »
i use Kori's latest RPM, too  ;D
If i had boredom, i will add german language in the specfile  ;)

Offline Sproggy

  • Hero Member
  • *****
  • Posts: 1484
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #253 on: April 10, 2011, 02:54:59 PM »
i use Kori's latest RPM, too  ;D
If i had boredom, i will add german language in the specfile  ;)

lol well you could always send me it  :P :P :P :P

Offline daniel

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3737
  • God knows, i'm not an Angel!
    • Tipps und Tricks
Re: Lets create a PCLinuxOS webkit browser (python)
« Reply #254 on: April 10, 2011, 03:26:16 PM »
i use Kori's latest RPM, too  ;D
If i had boredom, i will add german language in the specfile  ;)

lol well you could always send me it  :P :P :P :P

You have a PM  ;)