[hamster-applet] for the copy/paste parse out tags.
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] for the copy/paste parse out tags.
- Date: Fri, 22 Jan 2010 01:05:30 +0000 (UTC)
commit 994aa8f62f03f5c829c9ecb1e81629efe2c8a8f5
Author: Toms Bauģis <toms baugis gmail com>
Date: Fri Jan 22 01:04:28 2010 +0000
for the copy/paste parse out tags.
hamster/stuff.py | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/hamster/stuff.py b/hamster/stuff.py
index 842febb..3d2f704 100644
--- a/hamster/stuff.py
+++ b/hamster/stuff.py
@@ -1,6 +1,6 @@
# - coding: utf-8 -
-# Copyright (C) 2008 Toms Bauģis <toms.baugis at gmail.com>
+# Copyright (C) 2008-2010 Toms Bauģis <toms.baugis at gmail.com>
# This file is part of Project Hamster.
@@ -264,6 +264,22 @@ def parse_activity_input(text):
text, res.description = text.split(",", 1)
res.description = res.description.strip()
+ # more of a hidden feature for copy and paste purposes
+ # tags are marked with hash sign and parsed only at the end of description
+ words = res.description.split(" ")
+ tags = []
+ for word in reversed(words):
+ if word.startswith("#"):
+ tags.append(word.strip("#,")) #avoid commas
+ else:
+ break
+
+ if tags:
+ res.tags = tags
+ res.description = " ".join(res.description.split(" ")[:-len(tags)])
+
+
+
if text.find("@") > 0:
text, res.category_name = text.split("@", 1)
res.category_name = res.category_name.strip()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]