foiegras r64 - in trunk: . src/foiegras/windows
- From: denisw svn gnome org
- To: svn-commits-list gnome org
- Subject: foiegras r64 - in trunk: . src/foiegras/windows
- Date: Mon, 10 Mar 2008 13:24:20 +0000 (GMT)
Author: denisw
Date: Mon Mar 10 13:24:19 2008
New Revision: 64
URL: http://svn.gnome.org/viewvc/foiegras?rev=64&view=rev
Log:
2008-03-10 Denis Washington <denisw svn gnome org>
* src/foiegras/buffer/main.py:
Implement side pane showing/hiding, and add doc comments to the
cut(), copy() and paste() methods.
Modified:
trunk/ChangeLog
trunk/src/foiegras/windows/main.py
Modified: trunk/src/foiegras/windows/main.py
==============================================================================
--- trunk/src/foiegras/windows/main.py (original)
+++ trunk/src/foiegras/windows/main.py Mon Mar 10 13:24:19 2008
@@ -168,7 +168,7 @@
]
self._toggle_actions = self._annotation_actions + [
- ('SidePaneAction', None, _("_Side Pane"), "F9", _(""), self.dummy_action),
+ ('SidePaneAction', None, _("_Side Pane"), "F9", _(""), self.toggle_side_pane),
]
self._actiongroup = gtk.ActionGroup('menubar')
@@ -178,6 +178,7 @@
self.uimanager.insert_action_group(self._actiongroup, 0)
+
# Further UIManager stuff
self.ui = {}
self.ui['menubar'] = self.uimanager.add_ui_from_file(self._app.get_datadir() + os.sep + 'menubar.ui')
@@ -288,22 +289,27 @@
self._app.set_document(self._document)
self._document.get_buffer().connect("notify::cursor-position", self._cursor_position_changed)
- hhbox = gtk.HBox()
- hhbox.pack_start(inline_label, True, True)
- close_button = gtk.Button("")
- close_button.set_image(gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU))
- close_button.set_relief(gtk.RELIEF_NONE)
- hhbox.pack_start(close_button, False, False)
- vvbox = gtk.VBox()
- vvbox.pack_start(hhbox, False, False)
- vport = gtk.Viewport()
- vport.set_shadow_type(gtk.SHADOW_IN)
- vport.add(self._toolbar_inline)
- vvbox.pack_start(vport, True, True)
-
+ # Set up side pane
+ self._side_pane = gtk.VBox()
+ self._side_pane.set_no_show_all(True)
+ side_pane_title_hbox = gtk.HBox()
+ side_pane_title_hbox.pack_start(inline_label, True, True)
+ side_pane_close_button = gtk.Button("")
+ side_pane_close_button.set_image(gtk.image_new_from_stock(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU))
+ side_pane_close_button.set_relief(gtk.RELIEF_NONE)
+ side_pane_close_button.connect("clicked", self._side_pane_close_button_clicked)
+ side_pane_title_hbox.pack_start(side_pane_close_button, False, False)
+ self._side_pane.pack_start(side_pane_title_hbox, False, False)
+ side_pane_vport = gtk.Viewport()
+ side_pane_vport.set_shadow_type(gtk.SHADOW_IN)
+ side_pane_vport.add(self._toolbar_inline)
+ self._side_pane.pack_start(side_pane_vport, True, True)
+ side_pane_title_hbox.show_all()
+ side_pane_vport.show_all()
+
# Add the document and the notebook to the window
self._hpaned.pack1(self._document, True, True)
- self._hpaned.pack2(vvbox, False, False)
+ self._hpaned.pack2(self._side_pane, False, False)
# To be able to show the star on changes
self._document.get_buffer().connect('changed', self._buffer_changed)
@@ -320,6 +326,10 @@
self._conf.get_preference('window_height', 'int', 400))
self._hpaned.set_position(self._conf.get_preference('hpaned_position', 'int', 400))
+ # Restore side pane visibility
+ show_side_pane = self._conf.get_preference('show_side_pane', 'bool', True)
+ self._actiongroup.get_action("SidePaneAction").set_active(show_side_pane)
+
def _buffer_changed(self, buffer):
"""
@@ -410,6 +420,13 @@
self._document._buffer.apply_block_tag(tag)
+ def _side_pane_close_button_clicked(self, widget):
+ """
+ Close the side pane.
+ """
+ self._actiongroup.get_action("SidePaneAction").set_active(False)
+
+
def about(self, action):
"""
About action handler.
@@ -732,14 +749,26 @@
def cut(self, action):
+ """
+ Cut the selected text.
+ """
self._document._buffer.cut_clipboard(gtk.Clipboard(), True)
+
def copy(self, action):
+ """
+ Copy the selected text.
+ """
self._document._buffer.copy_clipboard(gtk.Clipboard())
+
def paste(self, action):
+ """
+ Paste the clipboard.
+ """
self._document._buffer.paste_clipboard(gtk.Clipboard(), None, True)
+
def show_preferences(self, action):
"""
Show the Preferences dialog.
@@ -748,6 +777,20 @@
pref.show()
+ def toggle_side_pane(self, action):
+ """
+ Show or hide the side pane.
+ """
+ show = action.get_active()
+
+ if action.get_active() == True:
+ self._side_pane.show()
+ else:
+ self._side_pane.hide()
+
+ self._conf.set_preference('show_side_pane', 'bool', show)
+
+
def apply_block_tag(self, action):
"""
Applies a block tag to the current selection.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]