← Back to team overview

gtg team mailing list archive

[Merge] lp:~izidor/gtg/title into lp:gtg

 

Izidor Matušov has proposed merging lp:~izidor/gtg/title into lp:gtg.

Requested reviews:
  Gtg developers (gtg)
Related bugs:
  Bug #826898 in Getting Things GNOME!: "Differentiate between development and stable GTG"
  https://bugs.launchpad.net/gtg/+bug/826898

For more details, see:
https://code.launchpad.net/~izidor/gtg/title/+merge/109153

Added option -t to set the title of windows (You can put whatever you want instead of "Getting Things GNOME!" in the titlebar). It is useful when you have opened multiple instances of GTG and want to differentiate between them.

Use case from real life. I do final debug of a new feature. I import my real life data to test and run it. In that moment I have two identical instances of GTG running. If I want to add a new task to my real GTG (oops, found a bug), it is impossible to distinguish between them.

./scripts/debug.sh sets title to "Dev GTG: <name of the dir>" or "Dev GTG: <name of dir> (<name of -s dataset> dataset)". If I am in ~/projects/gtg/new-feature and run ./scripts/debug.sh -s bryce, the title is "Dev GTG: new-feature (bryce dataset)"

I think it is a nifty feature to have.
-- 
https://code.launchpad.net/~izidor/gtg/title/+merge/109153
Your team Gtg developers is requested to review the proposed merge of lp:~izidor/gtg/title into lp:gtg.
=== modified file 'CHANGELOG'
--- CHANGELOG	2012-06-07 11:37:15 +0000
+++ CHANGELOG	2012-06-07 14:07:23 +0000
@@ -24,6 +24,7 @@
     * New tag editor
     * Fix bugs #1003872 and #1002067: Correct titles to Preferences and Synchronization Services Dialogs, by Alan Gomes
     * Improved Export plugin, export to PDF works now, by Izidor Matušov
+    * Added -t option to distinguish between multiple instances of GTG
 
 2012-02-13 Getting Things GNOME! 0.2.9
     * Big refractorization of code, now using liblarch

=== modified file 'gtg'
--- gtg	2012-06-02 11:02:53 +0000
+++ gtg	2012-06-07 14:07:23 +0000
@@ -57,10 +57,15 @@
     parser.add_option('-l', '--local-liblarch', action='store_true',
       dest='local_liblarch', default=False,
       help="Use local liblarch located in ../liblarch if it is posible")
+    parser.add_option('-t', '--title', action='store',
+      help="Use special title for windows' title")
     parser.add_option('-v', '--version', action='store_true',
       dest='print_version', help="Print GTG's version number", default=False)
     (options, args) = parser.parse_args()
 
+    if options.title is not None:
+        info.NAME = options.title
+
     if options.print_version:
         print "GTG (Getting Things Gnome!)", info.VERSION
         print

=== modified file 'scripts/debug.sh'
--- scripts/debug.sh	2012-04-07 15:05:21 +0000
+++ scripts/debug.sh	2012-06-07 14:07:23 +0000
@@ -7,9 +7,10 @@
 fi
 
 args="--no-crash-handler"
-set="default"
+dataset="default"
 norun=0
 profile=0
+title=""
 
 # Create execution-time data directory if needed
 mkdir -p tmp
@@ -25,29 +26,34 @@
         ;;
     n)   norun=1;;
     p)   profile=1;;
-    s)   set="$OPTARG";;
-    [?]) echo >&2 "Usage: $0 [-s dataset] [-b] [-d] [-l] [-n] [-p]"
+    s)   dataset="$OPTARG";;
+    t)   title="$OPTARG";;
+    [?]) echo >&2 "Usage: $0 [-s dataset] [-t title] [-b] [-d] [-l] [-n] [-p]"
          exit 1;;
     esac
 done
 
 # Copy dataset
-if [  $set != "default" ]
-then
-    if [ ! -d "./tmp/$set" ]
+if [  $dataset != "default" -a ! -d "./tmp/$dataset" ]
+then
+    echo "Copying $dataset dataset to ./tmp/"
+    cp -r test/data/$dataset tmp/
+fi
+
+echo "Setting XDG vars to use $dataset dataset."
+export XDG_DATA_HOME="./tmp/$dataset/xdg/data"
+export XDG_CACHE_HOME="./tmp/$dataset/xdg/cache"
+export XDG_CONFIG_HOME="./tmp/$dataset/xdg/config"
+
+# Title has to be passed to GTG directly, not through $args
+# title could be more word, and only the first word would be taken
+if [ "$title" = "" ]
+then
+    title="Dev GTG: $(basename `pwd`)"
+    if [ "$dataset" != "default" ]
     then
-        echo "Copying $set dataset to ./tmp/"
-        cp -r test/data/$set tmp/
+        title="$title ($dataset dataset)"
     fi
-    echo "Setting XDG vars to use $set dataset."
-    export XDG_DATA_HOME="./tmp/$set/xdg/data"
-    export XDG_CACHE_HOME="./tmp/$set/xdg/cache"
-    export XDG_CONFIG_HOME="./tmp/$set/xdg/config"
-else
-    echo "Setting XDG vars to use default dataset."
-    export XDG_DATA_HOME="./tmp/default/xdg/data"
-    export XDG_CACHE_HOME="./tmp/default/xdg/cache"
-    export XDG_CONFIG_HOME="./tmp/default/xdg/config"
 fi
 
 if [ $norun -eq 0 ]; then
@@ -64,10 +70,10 @@
     fi
 
     if [ $profile -eq 1 ]; then
-	python -m cProfile -o gtg.prof ./gtg $args
-    python ./scripts/profile_interpret.sh
+        python -m cProfile -o gtg.prof ./gtg $args -t "$title"
+        python ./scripts/profile_interpret.sh
     else
-	./gtg $args
+	./gtg $args -t "$title"
     fi
 fi