maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   Tear 0.3 - Simple WebKit browser, now with Dashboard (https://talk.maemo.org/showthread.php?t=26475)

Benson 2009-02-23 21:17

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Quote:

Originally Posted by BrentDC (Post 266291)
Code:

def shorten_text(self, variable_holding_text):
    if len(variable_holding_text) > 15:
        new_variable = variable_holding_text[0:15] + " ..."
    return new_variable

Extremely easy! :D

Or:
Code:

def shorten_text(self, variable_holding_text):
    if len(variable_holding_text) > 18:
        new_variable = variable_holding_text[0:15] + " ..."
    return new_variable

After all, if you can hold 15 chars with " ..." you can hold at least 17, and usually 18, chars without.

bongo 2009-02-23 21:17

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Quote:

Originally Posted by Bundyo (Post 266610)
Yes, xbel support is planned.

That's good news.

Could you please implement a temporary solution to delete/edit bookmarks?

Bundyo 2009-02-23 21:33

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
I've already did add removing bookmarks using the star when there is bookmark already. I have some things yet to do before the next release though.

BrentDC 2009-02-23 21:37

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Quote:

Originally Posted by Benson (Post 266619)
Or:
Code:

def shorten_text(self, variable_holding_text):
    if len(variable_holding_text) > 18:
        new_variable = variable_holding_text[0:15] + " ..."
    return new_variable

After all, if you can hold 15 chars with " ..." you can hold at least 17, and usually 18, chars without.

True, True. This is really something that should be changeable in the settings (which should be a Control Panel applet. K, TrueJournals? :D).

I have a programming rule: if I find myself putting an arbitrary hard-coded value into my program, chances are it should be user-configurable.

So, shorten_text version 2:

Code:

def shorten_text(self, variable_holding_text):
    settings = self.get_settings() # a function to get all user settings. This should be a list.
    if len(variable_holding_text) > settings['title_length']:
        end_length = settings['title_length'] - 3
        new_variable = variable_holding_text[0:end_length] + " ..."
    return new_variable


I think that'll work. Never tested using a variable as a slice index, though... (translated, it'll cause you plugin to silently fail like all problems with Python hildon-desktop plugins do).

Bundyo 2009-02-23 21:47

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Btw, these changes to the Tear bookmarks remove the need for VBox and look good on the dark Echo background (also add left alignment):

Code:

      for row in self.c:
            menuitem = gtk.ImageMenuItem()
            label = gtk.Label("")
            label.set_markup("<span color='#7090BA'><b>"+self.html_escape(str(row[1]))+"</b></span>\n<span foreground='#FFF'>%s</span>" % row[2])
            label.set_alignment(0, 0)
            menuitem.add(label)
            self.menu.append(menuitem)
            menuitem.connect('activate',self.open_url,row[2])

      #menu_item = gtk.SeparatorMenuItem()
      #self.menu.append(menu_item)

Right now i'm directly using white for the bookmark url, but if we can get the theme fg color will be best. I tried with

Code:

fgcolor = menu_item.get_child().get_style().text[0]
and with
Code:

scheme = gtk.Object(gtk.Settings().get_default()).get("gtk-color-scheme")
But I'm not very good with Python and even less with Hildon Desktop and wasn't able to see the error messages which I was getting to check what I'm receiving. Maybe someone else can take it from here?

bongo 2009-02-23 22:38

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Quote:

Originally Posted by Bundyo (Post 266624)
I've already did add removing bookmarks using the star when there is bookmark already. I have some things yet to do before the next release though.

Doesn't work for me. I use 0.3pre4 ...

Bundyo 2009-02-23 22:39

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Its not released :)

BrentDC 2009-02-23 22:45

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Quote:

Originally Posted by Bundyo (Post 266631)
Btw, these changes to the Tear bookmarks remove the need for VBox and look good on the dark Echo background (also add left alignment):

Code:

      for row in self.c:
            menuitem = gtk.ImageMenuItem()
            label = gtk.Label("")
            label.set_markup("<span color='#7090BA'><b>"+self.html_escape(str(row[1]))+"</b></span>\n<span foreground='#FFF'>%s</span>" % row[2])
            label.set_alignment(0, 0)
            menuitem.add(label)
            self.menu.append(menuitem)
            menuitem.connect('activate',self.open_url,row[2])

      #menu_item = gtk.SeparatorMenuItem()
      #self.menu.append(menu_item)

Right now i'm directly using white for the bookmark url, but if we can get the theme fg color will be best. I tried with

Code:

fgcolor = menu_item.get_child().get_style().text[0]
and with
Code:

scheme = gtk.Object(gtk.Settings().get_default()).get("gtk-color-scheme")
But I'm not very good with Python and even less with Hildon Desktop and wasn't able to see the error messages which I was getting to check what I'm receiving. Maybe someone else can take it from here?

Python hildon-desktop applets/plugins always silently fail. At least on the device (I hear you can get the debug text on scratchbox...if I can ever get it installed).

I'll take a look at it later and see if I can figure out how to do it. :)

bongo 2009-02-23 22:56

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Quote:

Originally Posted by Bundyo (Post 266643)
Its not released :)

Might be the reason ... :cool:

I had an other thought about the bookmark manager: what about mer? The microb manager won't be there so maybe we need a new one.

Bundyo 2009-02-23 23:00

Re: Tear 0.3 - Simple WebKit browser, now with Dashboard
 
Yeah, you're right, ask me for a project join if you have an urge to do it :)


All times are GMT. The time now is 06:59.

vBulletin® Version 3.8.8