diff options
author | Marc Maurer <uwog@uwog.net> | 2007-11-05 13:47:39 (GMT) |
---|---|---|
committer | Marc Maurer <uwog@uwog.net> | 2007-11-05 13:47:39 (GMT) |
commit | 21a84883305859c99b6cc1bfe64dcf4377da6ba9 (patch) | |
tree | 170faeb07b1cf3f5835df5f70a654fa1de75f679 /AbiWordActivity.py | |
parent | 3ecb7b51ce27a4c36e2c105a1040b1eb0abddd0a (diff) |
Remove tons of hacks to go with the new AbiWidget version (uwog)
Diffstat (limited to 'AbiWordActivity.py')
-rw-r--r-- | AbiWordActivity.py | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/AbiWordActivity.py b/AbiWordActivity.py index 1120a35..d508811 100644 --- a/AbiWordActivity.py +++ b/AbiWordActivity.py @@ -45,8 +45,6 @@ class AbiWordActivity (Activity): # abiword uses the current directory for all its file dialogs os.chdir(os.path.expanduser('~')) - self._file_opened = False - # create our main abiword canvas self.abiword_canvas = Canvas() self.abiword_canvas.connect('text-selected', self._selection_cb) @@ -89,33 +87,26 @@ class AbiWordActivity (Activity): toolbox.set_current_toolbar(toolbar.TOOLBAR_TEXT) self.set_canvas(self.abiword_canvas) + self.abiword_canvas.connect_after('map-event', self._map_event_cb) self.abiword_canvas.show() - self.abiword_canvas.connect_after('map', self._map_cb) - - def _map_cb(self, activity): - logger.debug('_map_cb') + def _map_event_cb(self, event, activity): + logger.debug('_map_event_cb') - # always make sure at least 1 document is loaded (bad bad widget design) - if not self._file_opened: - logger.debug("Loading empty doc") - self.abiword_canvas.load_file('', ''); - # set custom keybindings for Write logger.debug("Loading keybindings") keybindings_file = os.path.join( get_bundle_path(), "keybindings.xml" ) self.abiword_canvas.invoke_cmd('com.abisource.abiword.loadbindings.fromURI', keybindings_file, 0, 0) - # set the initial zoom to page width; note: always do this AFTER a document - # has been opened - self.abiword_canvas.zoom_width() - # no ugly borders please self.abiword_canvas.set_property("shadow-type", gtk.SHADOW_NONE) - # WORKAROUND: toggle the margin, as the widget doesn't calculate it properly on load - self.abiword_canvas.set_show_margin(False) + + # we only do per-word selections (when using the mouse) + self.abiword_canvas.set_word_selections(True) + + # we want a nice border so we can select paragraphs easily self.abiword_canvas.set_show_margin(True) - + # activity sharing self.participants = {} pservice = presenceservice.get_instance() @@ -310,7 +301,6 @@ class AbiWordActivity (Activity): self.abiword_canvas.load_file('file://' + file_path, 'text/plain') else: self.abiword_canvas.load_file('file://' + file_path, '') # we pass no mime/file type, let libabiword autodetect it, so we can handle multiple file formats - self._file_opened = True def write_file(self, file_path): logging.debug('AbiWordActivity.write_file') |