Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/labyrinthactivity.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2008-11-16 17:14:37 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2008-11-16 17:14:37 (GMT)
commit3bc98abc173c63e1e7383611e76bce324b974f0a (patch)
treef6d5c6474cdbb18f20d2aeb32299d41e3ca4834d /labyrinthactivity.py
parent53a2f7b5f3cff33ed497c4c5b209920f07c689e8 (diff)
Conform to pygtk coding conventions
Diffstat (limited to 'labyrinthactivity.py')
-rw-r--r--labyrinthactivity.py86
1 files changed, 43 insertions, 43 deletions
diff --git a/labyrinthactivity.py b/labyrinthactivity.py
index d802893..ee03030 100644
--- a/labyrinthactivity.py
+++ b/labyrinthactivity.py
@@ -27,42 +27,42 @@ class LabyrinthActivity(activity.Activity):
self.set_toolbox(toolbox)
toolbox.show()
- self._edit_toolbar = activity.EditToolbar()
- toolbox.add_toolbar(_('Edit'), self._edit_toolbar)
- self._edit_toolbar.undo.child.connect('clicked', self.__undo_cb)
- self._edit_toolbar.redo.child.connect('clicked', self.__redo_cb)
- self._edit_toolbar.show()
+ edit_toolbar = activity.EditToolbar()
+ toolbox.add_toolbar(_('Edit'), edit_toolbar)
+ edit_toolbar.undo.child.connect('clicked', self.__undo_cb)
+ edit_toolbar.redo.child.connect('clicked', self.__redo_cb)
+ edit_toolbar.show()
- self.undo = UndoManager.UndoManager (self,
- self._edit_toolbar.undo.child,
- self._edit_toolbar.redo.child)
- self.undo.block ()
+ self._undo = UndoManager.UndoManager (self,
+ edit_toolbar.undo.child,
+ edit_toolbar.redo.child)
+ self._undo.block ()
- self.save_file = None
- self.mode = MMapArea.MODE_EDITING
+ self._save_file = None
+ self._mode = MMapArea.MODE_EDITING
- self.MainArea = MMapArea.MMapArea (self.undo)
- self.MainArea.connect ("doc_save", self.doc_save_cb)
- self.MainArea.connect ("set_focus", self.main_area_focus_cb)
- self.MainArea.connect ("button-press-event", self.main_area_focus_cb)
- self.set_canvas(self.MainArea)
- self.MainArea.show()
+ self._main_area = MMapArea.MMapArea (self._undo)
+ self._main_area.connect ("doc_save", self.__doc_save_cb)
+ self._main_area.connect ("set_focus", self.__main_area_focus_cb)
+ self._main_area.connect ("button-press-event", self.__main_area_focus_cb)
+ self.set_canvas(self._main_area)
+ self._main_area.show()
- self.tree_model = gtk.TreeStore(gobject.TYPE_STRING)
- self.MainArea.initialize_model(self.tree_model)
+ tree_model = gtk.TreeStore(gobject.TYPE_STRING)
+ self._main_area.initialize_model(tree_model)
- self.set_focus_child (self.MainArea)
+ self.set_focus_child (self._main_area)
- self.undo.unblock()
+ self._undo.unblock()
def __undo_cb(self, button):
- self.undo.undo_action(None)
+ self._undo.undo_action(None)
def __redo_cb(self, button):
- self.undo.redo_action(None)
+ self._undo.redo_action(None)
- def main_area_focus_cb (self, arg, event, extended = False):
- self.MainArea.grab_focus ()
+ def __main_area_focus_cb (self, arg, event, extended = False):
+ self._main_area.grab_focus ()
def read_file(self, file_path):
tar_file = tarfile.open(file_path)
@@ -74,57 +74,57 @@ class LabyrinthActivity(activity.Activity):
doc = dom.parse (f)
top_element = doc.documentElement
self.set_title(top_element.getAttribute ("title"))
- self.mode = int (top_element.getAttribute ("mode"))
+ self._mode = int (top_element.getAttribute ("mode"))
- self.MainArea.set_mode (self.mode)
- self.MainArea.load_thyself (top_element, doc)
+ self._main_area.set_mode (self._mode)
+ self._main_area.load_thyself (top_element, doc)
if top_element.hasAttribute("scale_factor"):
- self.MainArea.scale_fac = float (top_element.getAttribute ("scale_factor"))
+ self._main_area.scale_fac = float (top_element.getAttribute ("scale_factor"))
if top_element.hasAttribute("translation"):
tmp = top_element.getAttribute("translation")
(x,y) = utils.parse_coords(tmp)
- self.MainArea.translation = [x,y]
+ self._main_area.translation = [x,y]
def write_file(self, file_path):
logging.debug('write_file')
- self.MainArea.save_thyself ()
+ self._main_area.save_thyself ()
- if self.save_file is None:
+ if self._save_file is None:
# FIXME: Create an empty file because the Activity superclass
# always requires one
- fd, self.save_file = tempfile.mkstemp(suffix='.map')
+ fd, self._save_file = tempfile.mkstemp(suffix='.map')
del fd
tf = tarfile.open (file_path, "w")
- tf.add (self.save_file, os.path.split(self.save_file)[1])
- for t in self.MainArea.thoughts:
+ tf.add (self._save_file, os.path.split(self._save_file)[1])
+ for t in self._main_area.thoughts:
if isinstance(t, ImageThought.ImageThought):
tf.add (t.filename, 'images/' + os.path.split(t.filename)[1])
tf.close()
- os.unlink(self.save_file)
+ os.unlink(self._save_file)
- def doc_save_cb (self, widget, doc, top_element):
+ def __doc_save_cb (self, widget, doc, top_element):
logging.debug('doc_save_cb')
save_string = self.serialize_to_xml(doc, top_element)
- fd, self.save_file = tempfile.mkstemp(suffix='.map')
+ fd, self._save_file = tempfile.mkstemp(suffix='.map')
del fd
- self.save_map(self.save_file, save_string)
- #self.emit ('file_saved', self.save_file, self)
+ self.save_map(self._save_file, save_string)
+ #self.emit ('file_saved', self._save_file, self)
def serialize_to_xml(self, doc, top_element):
top_element.setAttribute ("title", self.props.title)
- top_element.setAttribute ("mode", str(self.mode))
+ top_element.setAttribute ("mode", str(self._mode))
top_element.setAttribute ("size", str((400, 400)))
top_element.setAttribute ("position", str((0, 0)))
top_element.setAttribute ("maximised", str(True))
top_element.setAttribute ("view_type", str(0))
top_element.setAttribute ("pane_position", str(500))
- top_element.setAttribute ("scale_factor", str(self.MainArea.scale_fac))
- top_element.setAttribute ("translation", str(self.MainArea.translation))
+ top_element.setAttribute ("scale_factor", str(self._main_area.scale_fac))
+ top_element.setAttribute ("translation", str(self._main_area.translation))
string = doc.toxml ()
return string.encode ("utf-8" )