Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2009-07-29 11:13:22 (GMT)
committer Simon Schampijer <simon@schampijer.de>2009-07-29 11:13:22 (GMT)
commit2b32947fbc8ef404a52c725527a8c3df3375567b (patch)
tree1a4c0d2a572147b772f92250019918ec76bb6cf0
parent335dd8ab5159ddc459bba882ea29ebb93233207d (diff)
Initial toolbar redesign
-rw-r--r--icons/edit-bar.svg203
-rw-r--r--webactivity.py44
-rw-r--r--webtoolbar.py29
3 files changed, 242 insertions, 34 deletions
diff --git a/icons/edit-bar.svg b/icons/edit-bar.svg
new file mode 100644
index 0000000..1e4a5b0
--- /dev/null
+++ b/icons/edit-bar.svg
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="48px"
+ height="48px"
+ id="svg4289"
+ sodipodi:version="0.32"
+ inkscape:version="0.46"
+ sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/actions"
+ sodipodi:docname="gtk-cut.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs4291">
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 24 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="48 : 24 : 1"
+ inkscape:persp3d-origin="24 : 16 : 1"
+ id="perspective37" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#000000"
+ bordercolor="#666"
+ borderopacity="1"
+ inkscape:pageopacity="0.64705882"
+ inkscape:pageshadow="2"
+ inkscape:zoom="8"
+ inkscape:cx="17.657576"
+ inkscape:cy="14.416513"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:grid-bbox="true"
+ inkscape:document-units="px"
+ showguides="true"
+ inkscape:guide-bbox="true"
+ inkscape:window-width="1278"
+ inkscape:window-height="719"
+ inkscape:window-x="0"
+ inkscape:window-y="16"
+ inkscape:showpageshadow="false"
+ showborder="false" />
+ <metadata
+ id="metadata4294">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:title>Edit Cut</dc:title>
+ <dc:date>2006-09-29</dc:date>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Lapo Calamandrei</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <dc:source />
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>cut</rdf:li>
+ <rdf:li>edit</rdf:li>
+ <rdf:li>scissors</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ <dc:contributor>
+ <cc:Agent>
+ <dc:title />
+ </cc:Agent>
+ </dc:contributor>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer">
+ <path
+ sodipodi:nodetypes="cccc"
+ id="path10844"
+ d="M 16.555074,10.843441 L 28.161165,30.33836 L 17.411662,8.98481 L 16.555074,10.843441 z"
+ style="opacity:0.59999999999999998;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00000011999999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 16.5,8.064024 C 16.5,8.064024 14.538778,10.327146 14.5,16.066276 C 14.461222,21.855914 26.545431,33.444908 26.545431,33.444908 L 28.428571,31.828292 L 16.5,8.064024 z"
+ id="path10784"
+ sodipodi:nodetypes="czccc" />
+ <path
+ style="opacity:0.40000000000000002;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00000024000000010px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 16.502378,10.48481 C 16.502378,10.48481 15.633959,12.149357 15.501208,16.168256 C 15.368457,20.222871 26.223776,32.250186 26.223776,32.250186 L 27.198114,31.720064 L 16.502378,10.48481 z"
+ id="path10848"
+ sodipodi:nodetypes="czccc" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path12233"
+ d="M 15.238158,12.57486 L 26.543378,31.183253 L 27.241997,30.611375 L 16.492494,9.257822 L 15.238158,12.57486 z"
+ style="opacity:0.59999999999999998;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="cscccsccsccsc"
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.06796968000000003;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 32.466015,41.450279 C 36.029605,41.39762 37.466015,38.777628 37.466015,35.484539 C 37.466015,32.397268 35.486282,29.855556 32.966015,29.549869 L 28.278515,29.518799 L 25.466015,32.222025 C 26.141566,33.524703 27.380092,34.638045 27.403515,35.639897 C 27.451281,37.733156 28.903534,41.502921 32.466015,41.450279 z M 32.497265,38.374794 C 30.43933,38.40989 29.388379,37.066573 29.412444,35.670968 L 29.483872,31.528518 L 32.809765,31.559589 C 34.265645,31.763384 35.403516,33.488454 35.403515,35.546682 C 35.403515,37.742125 34.55584,38.339687 32.497265,38.374794 z"
+ id="path10822" />
+ <path
+ style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00000011999999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 32.493806,7.500003 C 32.493806,7.500003 34.505536,10.060785 34.493806,15.47685 C 34.482077,20.892788 22.75142,33.052845 22.75142,33.052845 L 20.565235,31.188822 L 32.493806,7.500003 z"
+ id="path10786"
+ sodipodi:nodetypes="czccc" />
+ <path
+ style="opacity:0.40000000000000002;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.00000024000000010px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 32.549281,9.754224 C 32.549281,9.754224 33.4177,11.418771 33.550451,15.437671 C 33.683202,19.492285 22.827883,31.5196 22.827883,31.5196 L 21.853545,30.989478 L 32.549281,9.754224 z"
+ id="path10846"
+ sodipodi:nodetypes="czccc" />
+ <path
+ sodipodi:nodetypes="cscccsccsccsc"
+ style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.06797027999999994;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 16.533985,41.450273 C 12.970395,41.397612 11.533985,38.777615 11.533985,35.484522 C 11.533985,32.397247 13.513718,29.85553 16.033985,29.549845 L 20.721485,29.518773 L 23.533985,32.222003 C 22.858434,33.524684 21.619908,34.638028 21.596485,35.639881 C 21.548719,37.733144 20.096466,41.502915 16.533985,41.450273 z M 16.502735,38.418977 C 18.56067,38.454074 19.480414,37.066767 19.480414,35.670952 L 19.480414,31.569499 L 16.190235,31.600571 C 14.734355,31.804366 13.596485,33.488433 13.596485,35.546665 C 13.596485,37.742113 14.44416,38.38387 16.502735,38.418977 z"
+ id="path10805" />
+ <path
+ sodipodi:nodetypes="ccccc"
+ id="path10842"
+ d="M 33.751301,11.897787 L 22.446081,30.50618 L 21.747462,29.934302 L 32.496965,8.580749 L 33.751301,11.897787 z"
+ style="opacity:0.59999999999999998;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="cscccsc"
+ style="opacity:0.20000000000000001;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.06797004000000006;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 16.672328,40.450374 C 13.722856,40.406541 12.533985,38.225701 12.533985,35.484588 C 12.533985,32.914795 14.172548,30.799115 16.258494,30.544667 L 20.138192,30.518804 L 22.15351,32.456425 C 21.563128,33.384504 20.663039,34.092482 20.643652,34.926407 C 20.604118,36.668802 19.620883,40.494192 16.672328,40.450374 z"
+ id="path12235" />
+ <path
+ sodipodi:nodetypes="cscccsc"
+ style="opacity:0.20000000000000001;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1.06797004000000006;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 32.327672,40.450452 C 35.277144,40.406619 36.466015,38.225779 36.466015,35.484666 C 36.466015,32.914873 34.827452,30.799193 32.741506,30.544745 L 28.861808,30.518882 L 26.84649,32.456503 C 27.436872,33.384582 28.336961,34.09256 28.356348,34.926485 C 28.395882,36.66888 29.379117,40.49427 32.327672,40.450452 z"
+ id="path12237" />
+ <path
+ sodipodi:type="arc"
+ style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2797"
+ sodipodi:cx="31.28125"
+ sodipodi:cy="22.90625"
+ sodipodi:rx="1.21875"
+ sodipodi:ry="1.21875"
+ d="M 32.5,22.90625 A 1.21875,1.21875 0 1 1 30.0625,22.90625 A 1.21875,1.21875 0 1 1 32.5,22.90625 z"
+ transform="matrix(1,0,0,-1,-7,50.98481)" />
+ <path
+ style="opacity:0.15577889000000000;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ d="M 21.770407,27.689353 L 23.847533,23.711877 L 23.140426,22.386052 L 21.770407,27.689353 z"
+ id="path2799" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:0.64824123000000000;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path2801"
+ sodipodi:cx="37.498756"
+ sodipodi:cy="12.357399"
+ sodipodi:rx="0.59662133"
+ sodipodi:ry="0.59662133"
+ d="M 38.095378,12.357399 A 0.59662133,0.59662133 0 1 1 36.902135,12.357399 A 0.59662133,0.59662133 0 1 1 38.095378,12.357399 z"
+ transform="matrix(0.825663,0,0,-0.825663,-3.485189,41.69525)" />
+ <path
+ transform="matrix(0.825663,0,0,-0.825663,-16.45394,41.69525)"
+ d="M 38.095378,12.357399 A 0.59662133,0.59662133 0 1 1 36.902135,12.357399 A 0.59662133,0.59662133 0 1 1 38.095378,12.357399 z"
+ sodipodi:ry="0.59662133"
+ sodipodi:rx="0.59662133"
+ sodipodi:cy="12.357399"
+ sodipodi:cx="37.498756"
+ id="path2803"
+ style="opacity:0.64824123000000000;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ transform="matrix(1.637526,0,0,-1.637526,-37.49516,47.883579)"
+ d="M 38.095378,12.357399 A 0.59662133,0.59662133 0 1 1 36.902135,12.357399 A 0.59662133,0.59662133 0 1 1 38.095378,12.357399 z"
+ sodipodi:ry="0.59662133"
+ sodipodi:rx="0.59662133"
+ sodipodi:cy="12.357399"
+ sodipodi:cx="37.498756"
+ id="path2805"
+ style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ </g>
+</svg>
diff --git a/webactivity.py b/webactivity.py
index 7e3ac4f..3ab7c62 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -44,6 +44,7 @@ from sugar.graphics.tray import HTray
from sugar import profile
from sugar.graphics.alert import Alert
from sugar.graphics.icon import Icon
+from sugar.graphics.toolbar import Toolbar, ToolbarButton
from sugar import mime
PROFILE_VERSION = 1
@@ -153,8 +154,8 @@ def _set_accept_languages():
logging.debug('LANG set')
from browser import TabbedView
+from webtoolbar import PrimaryToolbar
from edittoolbar import EditToolbar
-from webtoolbar import WebToolbar
from viewtoolbar import ViewToolbar
import downloadmanager
import globalhistory
@@ -171,9 +172,6 @@ SERVICE = "org.laptop.WebActivity"
IFACE = SERVICE
PATH = "/org/laptop/WebActivity"
-_TOOLBAR_EDIT = 1
-_TOOLBAR_BROWSE = 2
-
_logger = logging.getLogger('web-activity')
class WebActivity(activity.Activity):
@@ -193,27 +191,28 @@ class WebActivity(activity.Activity):
branch = pref_service.getBranch("mozilla.widget.")
branch.setBoolPref("disable-native-theme", True)
- toolbox = activity.ActivityToolbox(self)
+ self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self)
self._edit_toolbar = EditToolbar(self)
- toolbox.add_toolbar(_('Edit'), self._edit_toolbar)
- self._edit_toolbar.show()
-
- self._web_toolbar = WebToolbar(self._tabbed_view)
- self._web_toolbar.connect('add-link', self._link_add_button_cb)
- toolbox.add_toolbar(_('Browse'), self._web_toolbar)
- self._web_toolbar.show()
-
+ self._edit_toolbar_button = ToolbarButton(
+ page=self._edit_toolbar,
+ icon_name='edit-bar')
+ self._primary_toolbar.top.insert(self._edit_toolbar_button,
+ self._primary_toolbar.top.get_n_items() - 1)
+
self._tray = HTray()
self.set_tray(self._tray, gtk.POS_BOTTOM)
self._tray.show()
self._view_toolbar = ViewToolbar(self)
- toolbox.add_toolbar(_('View'), self._view_toolbar)
- self._view_toolbar.show()
+ view_toolbar_button = ToolbarButton(
+ page=self._view_toolbar,
+ icon_name='camera')
+ self._primary_toolbar.top.insert(view_toolbar_button,
+ self._primary_toolbar.top.get_n_items() - 1)
- self.set_toolbox(toolbox)
- toolbox.show()
+ self._primary_toolbar.show_all()
+ self.set_toolbox(self._primary_toolbar)
self.set_canvas(self._tabbed_view)
self._tabbed_view.show()
@@ -222,9 +221,7 @@ class WebActivity(activity.Activity):
self.model.connect('add_link', self._add_link_model_cb)
self.connect('key-press-event', self._key_press_cb)
-
- self.toolbox.set_current_toolbar(_TOOLBAR_BROWSE)
-
+
if handle.uri:
self._tabbed_view.current_browser.load_uri(handle.uri)
elif not self._jobject.file_path:
@@ -431,13 +428,12 @@ class WebActivity(activity.Activity):
return True
elif gtk.gdk.keyval_name(event.keyval) == "f":
_logger.debug('keyboard: Find')
- self.toolbox.set_current_toolbar(_TOOLBAR_EDIT)
- self._edit_toolbar.search_entry.grab_focus()
+ self._edit_toolbar_button.expanded = True
+ self._edit_toolbar.search_entry.grab_focus()
return True
elif gtk.gdk.keyval_name(event.keyval) == "l":
_logger.debug('keyboard: Focus url entry')
- self.toolbox.set_current_toolbar(_TOOLBAR_BROWSE)
- self._web_toolbar.entry.grab_focus()
+ self._primary_toolbar.entry.grab_focus()
return True
elif gtk.gdk.keyval_name(event.keyval) == "minus":
_logger.debug('keyboard: Zoom out')
diff --git a/webtoolbar.py b/webtoolbar.py
index f942fa8..e87eb6f 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -27,6 +27,8 @@ from xpcom import components
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.menuitem import MenuItem
from sugar._sugarext import AddressEntry
+from sugar.graphics.toolbar import Toolbar
+from sugar.activity import activity
import filepicker
import places
@@ -212,8 +214,8 @@ class WebEntry(AddressEntry):
else:
self._search_popup()
-class WebToolbar(gtk.Toolbar):
- __gtype_name__ = 'WebToolbar'
+class PrimaryToolbar(Toolbar):
+ __gtype_name__ = 'PrimaryToolbar'
__gsignals__ = {
'add-link': (gobject.SIGNAL_RUN_FIRST,
@@ -221,30 +223,34 @@ class WebToolbar(gtk.Toolbar):
([]))
}
- def __init__(self, tabbed_view):
- gtk.Toolbar.__init__(self)
+ def __init__(self, tabbed_view, act):
+ Toolbar.__init__(self)
+
+ self._activity = act
self._tabbed_view = tabbed_view
self._loading = False
+ self.top.insert(activity.toolbar(self._activity), 0)
+
self._back = ToolButton('go-previous-paired')
self._back.set_tooltip(_('Back'))
self._back.props.sensitive = False
self._back.connect('clicked', self._go_back_cb)
- self.insert(self._back, -1)
+ self.top.insert(self._back, -1)
self._back.show()
-
+
self._forward = ToolButton('go-next-paired')
self._forward.set_tooltip(_('Forward'))
self._forward.props.sensitive = False
self._forward.connect('clicked', self._go_forward_cb)
- self.insert(self._forward, -1)
+ self.top.insert(self._forward, -1)
self._forward.show()
self._stop_and_reload = ToolButton('media-playback-stop')
self._stop_and_reload.connect('clicked', self._stop_and_reload_cb)
- self.insert(self._stop_and_reload, -1)
+ self.top.insert(self._stop_and_reload, -1)
self._stop_and_reload.show()
self.entry = WebEntry()
@@ -255,15 +261,18 @@ class WebToolbar(gtk.Toolbar):
entry_item.add(self.entry)
self.entry.show()
- self.insert(entry_item, -1)
+ self.top.insert(entry_item, -1)
entry_item.show()
self._link_add = ToolButton('emblem-favorite')
self._link_add.set_tooltip(_('Bookmark'))
self._link_add.connect('clicked', self._link_add_clicked_cb)
- self.insert(self._link_add, -1)
+ self.top.insert(self._link_add, -1)
self._link_add.show()
+ #self.top.insert(activity.expander(), -1)
+ self.top.insert(activity.stop_button(self._activity), -1)
+
self._progress_listener = None
self._history = None
self._browser = None