Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Notebook.py
diff options
context:
space:
mode:
Diffstat (limited to 'Notebook.py')
-rw-r--r--Notebook.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/Notebook.py b/Notebook.py
index 16eebe5..23b0be3 100644
--- a/Notebook.py
+++ b/Notebook.py
@@ -185,6 +185,19 @@ class SourceNotebook(AddNotebook):
text_view = tab[0]
return text_view
+ def _purify_file(self, label):
+ import unicodedata
+
+ if not label.endswith(".py"):
+ label = label + ".py"
+
+ label = label.replace(" ", "_")
+ if isinstance(label, unicode):
+ label = \
+ unicodedata.normalize('NFKD', label).encode('ascii', 'ignore')
+
+ return label
+
def get_all_data(self):
# Returns all the names of files and the buffer contents too.
names = []
@@ -196,13 +209,19 @@ class SourceNotebook(AddNotebook):
include_hidden_chars=True)
contents.append(text)
- label = self.get_tab_label(child).get_text()
- if not label.endswith(".py"):
- label = label + ".py"
+ label = self._purify_file(self.get_tab_label(child).get_text())
+
names.append(label)
return (names, contents)
+ def get_current_file_name(self):
+ child = self.get_nth_page(self.get_current_page())
+ label = self.get_tab_label(child).get_text()
+ label = self._purify_file(label)
+
+ return label
+
def child_exited_cb(self, *args):
"""Called whenever a child exits. If there's a handler, runadd it."""
h, self.activity._child_exited_handler = \